Commit Graph

22474 Commits

Author SHA1 Message Date
bors
01b7a6a9ea Auto merge of #108689 - compiler-errors:normalization-error-smaller, r=lcnr
Remove `NormalizationError::ConstantKind`

No longer in use by `TryNormalizeAfterErasingRegionsFolder` (as of #102355 / e8150fa60c it seems). It's making `LayoutError`, etc. kinda large -- that was noticed by `@zoxc.`
2023-03-04 09:03:23 +00:00
bors
70adb4e5b4 Auto merge of #108709 - matthiaskrgr:rollup-j2tjbyx, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #104549 (add -Zexport-executable-symbols to unstable book)
 - #108292 (Label opaque type for 'captures lifetime' error message)
 - #108540 (Add `Atomic*::from_ptr`)
 - #108634 (Add link to component dashboard)
 - #108647 (Remove dead pgo.sh file)
 - #108678 (Use `Option::as_slice` where applicable)
 - #108681 (Improve comments in `needs_process_obligation`.)
 - #108688 (Match unmatched backticks in library/)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-03 22:45:58 +00:00
Matthias Krüger
37bd50eddd
Rollup merge of #108681 - nnethercote:needs_process_obligation-comments, r=lqd
Improve comments in `needs_process_obligation`.

And a couple of other places.

r? `@lqd`
2023-03-03 20:45:02 +01:00
Matthias Krüger
efc79bc654
Rollup merge of #108678 - llogiq:use-option-as-slice, r=Nilstrieb
Use `Option::as_slice` where applicable

After #105871 introduced `Option::as_slice`, this PR uses it within the compiler. I found it interesting that all cases where `as_slice` could be used were done with different code before; so it seems the new API also has the benefit of being "the obvious solution" where before there was a mix of options, none clearly better than the rest.
2023-03-03 20:45:02 +01:00
Matthias Krüger
188ed14ca3
Rollup merge of #108292 - compiler-errors:opaque-captures-where, r=oli-obk
Label opaque type for 'captures lifetime' error message

Providing more information may help make this somewhat opaque (lol) error message a bit clearer.
2023-03-03 20:45:00 +01:00
Matthias Krüger
01fc5a7653
Rollup merge of #108694 - est31:backticks_matchmaking_comments, r=Nilstrieb
Match unmatched backticks in compiler/ comments

r? ``@Nilstrieb`` as per [advice](https://github.com/rust-lang/rust/pull/108685#issuecomment-1453018499)
2023-03-03 20:06:30 +01:00
Matthias Krüger
846424d15f
Rollup merge of #108685 - est31:backticks_matchmaking, r=petrochenkov
Match unmatched backticks in compiler/

Found with GNU grep:
```
grep -rEn '^(([^`]*`){2})*[^`]*`[^`]*$' compiler/ | rg -v '\s*[//]?.{1,2}```'
```
2023-03-03 20:06:29 +01:00
Matthias Krüger
db4b3dd608
Rollup merge of #108667 - compiler-errors:issue-108664, r=estebank
Fix another ICE in `point_at_expr_source_of_inferred_type`

Types coming from method probes must only be investigated *structurally*, since they often contain escaping infer variables from generalization and autoderef. We already have a hack in this PR that erases variables from types, so just use that.

Fixes #108664

The note attached to this error is pretty bad:

```
here the type of `primes` is inferred to be `[_]`
```

But that's unrelated to the PR.

---

Side-note: This is a pretty easy to trigger beta regression, so I've nominated it. Alternatively, I'm slightly inclined to remove this code altogether until it can be reformulated to be more accurate and less ICEy.
2023-03-03 20:06:28 +01:00
Matthias Krüger
1fab0fc4a2
Rollup merge of #108599 - nikic:drop-init, r=cuviper
Remove legacy PM leftovers

This drops two leftovers of legacy PM usage:
 * We don't need to initialize passes anymore.
 * The pass listing was still using legacy PM passes. Replace it with the corresponding new PM listing.
2023-03-03 20:06:27 +01:00
Matthias Krüger
44e794f8ab
Rollup merge of #108553 - compiler-errors:non-lt-late-bound-in-anon-ct, r=petrochenkov
Deny capturing late-bound non-lifetime param in anon const

Introduce a new AnonConstBoundary so we can detect when we capture a late-bound non-lifetime param with `non_lifetime_binders` enabled.

In the future, we could technically do something like introduce an early-bound parameter on the anon const, and stick the late-bound param in its substs (kinda like how we turn late-bound lifetimes in opaques into early-bound ones). But for now, just deny it so we don't ICE.

Fixes #108191
2023-03-03 20:06:27 +01:00
Matthias Krüger
4f49352e92
Rollup merge of #107981 - lcnr:canonicalization-uwu, r=compiler-errors
new solver: implement canonicalization and region constraints

see the corresponding rustc-dev-guide chapter: https://rustc-dev-guide.rust-lang.org/solve/canonicalization.html

r? ``@compiler-errors``
2023-03-03 20:06:26 +01:00
lcnr
a15abea931 canonicalization 2023-03-03 12:45:03 +01:00
est31
c54f061228 Don't put integers into backticks during formatting 2023-03-03 08:39:37 +01:00
est31
5a02105fff Rustdoc-ify LiteralKind note 2023-03-03 08:39:36 +01:00
est31
ef658907a5 Match end user facing unmatched backticks in compiler/ 2023-03-03 08:39:36 +01:00
est31
6df5ae4fb0 Match unmatched backticks in comments in compiler/ 2023-03-03 08:39:00 +01:00
est31
ff2c609d66 Match unmatched backticks in compiler/ that are part of rustdoc 2023-03-03 08:39:00 +01:00
Michael Goulet
bdacc8bdd9 Migrate diagnostic 2023-03-03 05:02:34 +00:00
Michael Goulet
4b23a224ab Label opaque type for 'captures lifetime' error message 2023-03-03 05:02:34 +00:00
Michael Goulet
a43b554259 Remove NormalizationError::ConstantKind 2023-03-03 02:25:31 +00:00
Nicholas Nethercote
3bcea5f979 Improve comments in needs_process_obligation.
And a couple of other places.
2023-03-03 09:59:33 +11:00
Matthias Krüger
e85df8d0fe
Rollup merge of #108672 - spastorino:new-rpitit-impl-side, r=compiler-errors
Feed queries on impl side for RPITITs when using lower_impl_trait_in_trait_to_assoc_ty

I've added a test for traits that were already working and what I think is probably the last bit of infrastructure work needed.
In following PRs I'm going to start adding things TDD style, tests and code that make it work.

r? `@compiler-errors`
2023-03-02 23:05:31 +01:00
Matthias Krüger
7c4e9dd63d
Rollup merge of #108624 - Nilstrieb:move-it-up, r=WaffleLapkin
Make `ExprKind` the first field in `thir::Expr`

This makes its `Debug` impl print it first which is useful, as it's the most important part when looking at an expr.
2023-03-02 23:05:30 +01:00
Matthias Krüger
13640e337a
Rollup merge of #108573 - kornelski:runtimeenvs, r=WaffleLapkin
Explain compile-time vs run-time difference in env!() error message

This PR is clarifying error message of `env!()` based on this user question: https://users.rust-lang.org/t/environment-variable-out-dir-is-undefined/90067

It makes it clear that `env!()` is for env variables defined at compile-time. There's special-case help text for common Cargo build script variables.

I've also rearranged the code to avoid allocating error message on the happy path when the env var is defined.
2023-03-02 23:05:29 +01:00
Matthias Krüger
564715a5b7
Rollup merge of #108557 - Nathan-Fenner:nathanf/adjust-error-span-fix-Some, r=WaffleLapkin
Point error span at Some constructor argument when trait resolution fails

This is a follow up to #108254 and #106477 which extends error span refinement to handle a case which I mistakenly believed was handled in #106477. The goal is to refine the error span depicted below:

```rs
trait Fancy {}
impl <T> Fancy for Option<T> where T: Iterator {}

fn want_fancy<F>(f: F) where F: Fancy {}

fn example() {
    want_fancy(Some(5));
//  (BEFORE)   ^^^^^^^ `{integer}` is not an iterator
//  (AFTER)         ^  `{integer}` is not an iterator
}
```

I had used a (slightly more complex) example as an illustrative example in #108254 , but hadn't actually turned it into a test, because I had (incorrectly) believed at the time it was covered by existing behavior. It turns out that `Some` is slightly "special" in that it resolves differently from the other `enum` constructors I had tried, and therefore this test was actually broken.

I've now updated the tests to include this example, and fixed the code to correctly resolve the `Some` constructor so that the span of the error is reduced.
2023-03-02 23:05:28 +01:00
Matthias Krüger
f75f440bbf
Rollup merge of #108022 - CraftSpider:align-bytes, r=oli-obk
Support allocations with non-Box<[u8]> bytes

This is prep work for allowing miri to support passing pointers to C code, which will require `Allocation`s to be correctly aligned. Currently, it just makes `Allocation` generic and plumbs the necessary changes through the right places.

The follow-up to this will be adding a type in the miri interpreter which correctly aligns the bytes, using that for the Miri engine, then allowing Miri to pass pointers into these allocations to C calls.

Based off of #100467, credit to ```@emarteca``` for the code
2023-03-02 23:05:27 +01:00
Andre Bogus
03334503b3 Use Option::as_slice where applicable 2023-03-02 22:36:37 +01:00
Santiago Pastorino
fa6bf2afdb
Feed queries on impl side for RPITITs when using lower_impl_trait_in_trait_to_assoc_ty 2023-03-02 16:48:49 -03:00
Michael Goulet
4b01a1a07a Fix another ICE in point_at_expr_source_of_inferred_type 2023-03-02 18:27:06 +00:00
Nilstrieb
e3d397a5f6 Make ExprKind the first field in thir::Expr
This makes its `Debug` impl print it first which is useful, as it's the
most important part when looking at an expr.
2023-03-02 18:21:44 +00:00
bors
13471d3b20 Auto merge of #108654 - LeSeulArtichaut:revert-99767, r=compiler-errors
Revert stabilization of `#![feature(target_feature_11)]`

This reverts #99767 due to the presence of bugs #108645 and #108646.

cc `@joshtriplett`
cc tracking issue #69098
r? `@ghost`
2023-03-02 17:38:31 +00:00
Léo Lanteri Thauvin
bfe5189904 Revert "Stabilize #![feature(target_feature_11)]"
This reverts commit b379d216ee.
2023-03-02 13:41:17 +01:00
Matthias Krüger
832987bb1e
Rollup merge of #108609 - clubby789:e0599-highlight, r=estebank
Highlight whole expression for E0599

Fixes #108603

This adds a secondary label to highlight the whole expression leading to the error. It also prevents empty labels being recognised as 'unexpected' by compiletest - otherwise, tests with NOTE annotations would pick up empty labels.

`@rustbot` label +A-diagnostics
2023-03-02 07:24:02 +01:00
Matthias Krüger
91dafebc91
Rollup merge of #108575 - compiler-errors:erase, r=estebank
Erase **all** regions when probing for associated types on ambiguity in astconv

Fixes #108562
2023-03-02 07:24:01 +01:00
Matthias Krüger
c9c9283c6a
Rollup merge of #108516 - clubby789:rustc-box-restrict, r=compiler-errors
Restrict `#[rustc_box]` to `Box::new` calls

Currently, `#[rustc_box]` can be applied to any call expression with a single argument. This PR only allows it to be applied to calls to `Box::new`
2023-03-02 07:24:00 +01:00
clubby789
d845769557 Restrict #[rustc_box] to Box::new calls 2023-03-02 02:42:19 +00:00
Rune Tynan
f26b0a2948
Format 2023-03-01 20:27:03 -05:00
bors
f77bfb7336 Auto merge of #108620 - Dylan-DPC:rollup-o5c4evy, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #108143 (rustdoc: search by macro when query ends with `!`)
 - #108394 (Make `x doc --open` work on every book)
 - #108427 (Recover from for-else and while-else)
 - #108462 (Fix `VecDeque::append` capacity overflow for ZSTs)
 - #108568 (Make associated_item_def_ids for traits use an unstable option to also return associated types for RPITITs)
 - #108604 (Add regression test for #107280)
 - #108605 (Add regression test for #105821)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-01 18:51:29 +00:00
Dylan DPC
9d132f77ae
Rollup merge of #108568 - spastorino:new-rpitit-flag, r=compiler-errors
Make associated_item_def_ids for traits use an unstable option to also return associated types for RPITITs

r? `@compiler-errors`
2023-03-01 23:40:21 +05:30
Santiago Pastorino
73e2fe0494
Properly implement should_encode_fn_impl_trait_in_trait using new unstable option 2023-03-01 14:13:41 -03:00
clubby789
6c2a952b56 Highlight whole expression for E0599 2023-03-01 16:57:11 +00:00
Santiago Pastorino
811a1cabda
Make associated_item_def_ids for traits use an unstable option to also return associated types for RPITITs 2023-03-01 12:56:39 -03:00
Santiago Pastorino
be72beca68
Fix typo in docs 2023-03-01 12:56:39 -03:00
Santiago Pastorino
e74f50ecc2
Add unstable option new_rpitit to be used for new RPITIT lowering system 2023-03-01 12:56:39 -03:00
Santiago Pastorino
5295de1694
Add opt_rpitit_info query 2023-03-01 12:56:38 -03:00
bors
609496eecf Auto merge of #108446 - Zoxc:named-allocs, r=oli-obk
Name LLVM anonymous constants by a hash of their contents

This makes the names stable between different versions of a crate unlike the `AllocId` naming, making LLVM IR comparisons with `llvm-diff` more practical.
2023-03-01 15:36:15 +00:00
y21
0758c05c97 recover from for-else and while-else 2023-03-01 13:26:59 +01:00
Nikita Popov
655a810b66 Print NewPM passes
-C passes=list was printing passes for the legacy pass manager.
Use PassBuilder::printPassNames() to print NewPM passes instead.
2023-03-01 09:26:00 +01:00
Nikita Popov
45f694dbba Remove pass initialization code
This is no longer necessary with the new pass manager.
2023-03-01 09:24:13 +01:00
bors
bcb610da7f Auto merge of #108587 - matthiaskrgr:rollup-rw6po59, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #108376 (compiler/rustc_session: fix sysroot detection logic)
 - #108400 (add llvm cgu instructions stats to perf)
 - #108496 (fix #108495, postfix decrement and prefix decrement has no warning)
 - #108505 (Further unify validity intrinsics)
 - #108520 (Small cleanup to `one_bound_for_assoc_type`)
 - #108560 (Some `infer/mod.rs` cleanups)
 - #108563 (Make mailmap more correct)
 - #108564 (Fix `x clean` with specific paths)
 - #108571 (Add contains_key to SortedIndexMultiMap)
 - #108578 (Update Fuchsia platform team members)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-01 06:23:19 +00:00