| Age | Commit message (Collapse) | Author | Lines |
|
r=davidtwco"
This reverts commit 57dad1d75e562ff73051c1c43b07eaf65c7dbd74, reversing
changes made to 36316df9fe6c3e246153fe6e78967643cf08c148.
|
|
(cherry picked from commit 6e67eaa311c8e2992ccc64cf6a9e8f311a02a5d4)
|
|
r=compiler-errors"
This reverts commit f939d1ff4820844595d0f50f94038869f1445d08, reversing
changes made to 183c706305d8c4e0ccb0967932381baf7e0c3611.
(cherry picked from commit 56c135c9253563f92755b0a9cd54ec67f7c17fc7)
|
|
(cherry picked from commit f60f2e8cb07d21b7d5b0fa7f96dacd2e806b98e4)
|
|
(cherry picked from commit 2bb25d3f4ac8796a50f45409f3ef461ce83295f3)
|
|
(cherry picked from commit 0ca1a94b2bd58d19a1bd492300abd5bffe5263fb)
|
|
in the `invalid_reference_casting` lint, when trying to lint on
bigger memory layout casts.
(cherry picked from commit cd6a0c8c77575056f95d79ae1f5c460794e1388f)
|
|
reverts the behavior changes of #119820 to give some
additional time to `sqlx` as it is affected by this change.
|
|
resolvability
(cherry picked from commit fa829feb2f7a3fee5890f3acf57b66029b123d18)
|
|
As discussed at <https://github.com/rust-lang/rust/pull/122106>, use the
crate encoding to represent new primitives.
(cherry picked from commit 809b84edba988408071630b1e89a8c06be07aeed)
|
|
(cherry picked from commit 23015b9ff4a7f829c2e0c884bdc0bcdb3c6d86f7)
|
|
(cherry picked from commit 2e4c90c3f7c11c745a5d787809ad36c49970a25b)
|
|
(cherry picked from commit 7dbdbaaa8e4ce77f9b2f1428c82f7166fe6f02fb)
|
|
Fix #124651.
(cherry picked from commit 4847f2249f03b249956d2daa90a12f4ee66543a8)
|
|
(cherry picked from commit 21c688af86a52cf5d44c69c274179e7410e01a49)
|
|
This is a workaround for #122758, but it's not clear why 1.79 requires a
more extensive amount of no_inline than the previous release. Seems like
there's something relatively subtle happening here.
|
|
|
|
doc: Make the `mod.rs` in the comment point to the correct location
The origin `mod.rs` had moved to `rustc_hir_analysis::check`, but the annotation doesn't point to it.
See [the origin PR](https://github.com/rust-lang/rust/pull/61857/files#diff-b65997b61ccd8d8e08238c925d631207671aca506e93ce7c5cfa0bec134c0a8e).
|
|
Do not ICE on invalid consts when walking mono-reachable blocks
The `bug!` here was written under the logic of "this condition is impossible, right?" except that of course, if the compiler is given code that results in an compile error, then the situation is possible.
So now we just direct errors into the already-existing path for when we can't do a mono-time optimization.
|
|
Fix ICE on invalid const param types
Fixes ICE #123863 which occurs because the const param has a type which is not a `bool`, `char` or an integral type.
The ICEing code path begins here in `typeck_with_fallback`: https://github.com/rust-lang/rust/blob/cb3752d20e0f5d24348062211102a08d46fbecff/compiler/rustc_hir_typeck/src/lib.rs#L167
The `fallback` invokes the `type_of` query and that eventually ends up calling `ct_infer` from the lowering code over here:
https://github.com/rust-lang/rust/blob/cb3752d20e0f5d24348062211102a08d46fbecff/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs#L561 and `ct_infer` ICEs at this location: https://github.com/rust-lang/rust/blob/cb3752d20e0f5d24348062211102a08d46fbecff/compiler/rustc_hir_analysis/src/collect.rs#L392
To fix the ICE it I'm triggering a `span_delayed_bug` before we hit `ct_infer` if the type of the const param is not one of the supported types
### Edit
On `@lcnr's` suggestion I've changed the approach to not let `ReStatic` region hit the `bug!` in `ct_infer` instead of triggering a `span_delayed_bug`.
|
|
Fix substitution parts having a shifted underline in some cases
If two suggestions parts are side by side, the underline's offset:
(WIP PR as an example, not yet pushed)
```
error: expected a pattern, found an expression
--> ./main.rs:4:9
|
4 | 1 + 2 => 3
| ^^^^^ arbitrary expressions are not allowed in patterns
|
help: check the value in an arm guard
|
4 | n if n == 1 + 2 => 3
| ~ +++++++++++++
```
The emitter didn't take into account that the string had shrunk/grown if two substitution parts were side-by-side (surprisingly, there was only one case in the ui testsuite.)
```
help: check the value in an arm guard
|
4 | n if n == 1 + 2 => 3
| ~ +++++++++++++
```
``@rustbot`` label +A-suggestion-diagnostics
|
|
|
|
ast: Generalize item kind visiting
And avoid duplicating logic for visiting `Item`s with different kinds (regular, associated, foreign).
The diff is better viewed with whitespace ignored.
|
|
|
|
|
|
`rustc_builtin_macros` cleanups
Some improvements I found while looking over this code.
r? ``@fee1-dead``
|
|
resolve: Remove two cases of misleading macro call visiting
Macro calls are ephemeral, they should not add anything to the definition tree, even if their AST could contains something with identity.
Thankfully, macro call AST cannot contain anything like that, so these walks are just noops.
In majority of other places in def_collector / build_reduced_graph they are already not visited.
(Also, a minor match reformatting is included.)
|
|
`obligations_for_self_ty`: use `ProofTreeVisitor` for nested goals
As always, dealing with proof trees continues to be a hacked together mess. After this PR and #124380 the only remaining blocker for core is https://github.com/rust-lang/trait-system-refactor-initiative/issues/90. There is also a `ProofTreeVisitor` issue causing an ICE when compiling `alloc` which I will handle in a separate PR. This issue likely affects coherence diagnostics more generally.
The core idea is to extend the proof tree visitor to support visiting nested candidates without using a `probe`. We then simply recurse into nested candidates if they are the only potentially applicable candidate for a given goal and check whether the self type matches the expected one.
For that to work, we need to improve `CanonicalState` to also handle unconstrained inference variables created inside of the trait solver. This is done by extending the `var_values` of `CanoncalState` with each fresh inference variables. Furthermore, we also store the state of all inference variables at the end of each probe. When recursing into `InspectCandidates` we then unify the values of all these states.
r? `@compiler-errors`
|
|
|
|
debuginfo: Stabilize `-Z debug-macros`, `-Z collapse-macro-debuginfo` and `#[collapse_debuginfo]`
`-Z debug-macros` is "stabilized" by enabling it by default and removing.
`-Z collapse-macro-debuginfo` is stabilized as `-C collapse-macro-debuginfo`.
It now supports all typical boolean values (`parse_opt_bool`) in addition to just yes/no.
Default value of `collapse_debuginfo` was changed from `false` to `external` (i.e. collapsed if external, not collapsed if local) - https://github.com/rust-lang/rust/issues/100758#issuecomment-1935815625 describes some debugging scenarios that motivate this default as reasonable.
`#[collapse_debuginfo]` attribute without a value is no longer supported to avoid guessing the default.
Stabilization report: https://github.com/rust-lang/rust/pull/120845#issuecomment-1939145242
Closes https://github.com/rust-lang/rust/issues/100758
Closes https://github.com/rust-lang/rust/issues/41743
Closes https://github.com/rust-lang/rust/issues/39153
|
|
Renamed `DerivedObligation` to `WellFormedDeriveObligation`
It's used when computing `WellFormed` obligations, so let's give it a less ambiguous name.
|
|
r=lcnr
Remove special-casing for `SimplifiedType` for next solver
It's unnecessary due to the way that we fully normalize the self type before assembly begins.
r? lcnr
|
|
These functions are only used in `rustc_builtin_macros`, so it makes
sense for them to live there. This allows them to be changed from `pub`
to `pub(crate)`.
|
|
Making this a proper struct, and giving its fields names, makes things
easier to understand.
|
|
|
|
Rollup of 3 pull requests
Successful merges:
- #124313 (Detect borrow error involving sub-slices and suggest `split_at_mut`)
- #124374 (Don't ICE when `codegen_select_candidate` returns ambiguity in new solver)
- #124380 (`Range` iteration specialization: remove trivial bounds)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
|
|
|
|
And avoid duplicating logic for visiting `Item`s with different kinds (regular, associated, foreign).
|
|
uses a `ProofTreeVisitor` to look into nested
goals when looking at the pending obligations
during hir typeck. Used by closure signature
inference, coercion, and for async functions.
|
|
`#[collapse_debuginfo]`
`-Z debug-macros` is "stabilized" by enabling it by default and removing.
`-Z collapse-macro-debuginfo` is stabilized as `-C collapse-macro-debuginfo`.
It now supports all typical boolean values (`parse_opt_bool`) in addition to just yes/no.
Default value of `collapse_debuginfo` was changed from `false` to `external` (i.e. collapsed if external, not collapsed if local).
`#[collapse_debuginfo]` attribute without a value is no longer supported to avoid guessing the default.
|
|
Don't ICE when `codegen_select_candidate` returns ambiguity in new solver
Because we merge identical candidates, we may have >1 impl candidate to in `codegen_select_error` but *not* have a trait error.
r? lcnr
|
|
Detect borrow error involving sub-slices and suggest `split_at_mut`
```
error[E0499]: cannot borrow `foo` as mutable more than once at a time
--> $DIR/suggest-split-at-mut.rs:13:18
|
LL | let a = &mut foo[..2];
| --- first mutable borrow occurs here
LL | let b = &mut foo[2..];
| ^^^ second mutable borrow occurs here
LL | a[0] = 5;
| ---- first borrow later used here
|
= help: use `.split_at_mut(position)` or similar method to obtain two mutable non-overlapping sub-slices
```
Address most of #58792.
For follow up work, we should emit a structured suggestion for cases where we can identify the exact `let (a, b) = foo.split_at_mut(2);` call that is needed.
|
|
|
|
|
|
Rollup of 2 pull requests
Successful merges:
- #124287 (Improved code with clippy)
- #124326 (tests: remove few ignore-stage2)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Improved code with clippy
I haven't used the bootstrapped compiler, but I think I have made some improvements using clippy. I have already made the following changes to the compiler:
Replaced `self.first().is_digit(10)` with `self.first().is_ascii_digit()` on lines 633, 664, and 680 of compiler/rust_lexer/src/lib.rs.
Removed unnecessary cast on line 262 of compiler/rustc_lexer/src/unescape.rs
Replaced ok_or_else with ok_or on line 303 of compiler/rustc_lexer/src/unescape.rs
Replaced `!std::env::var("RUSTC_BOOTSTRAP").is_ok()` with `std::env::var("RUSTC_BOOTSTRAP").is_err()` on line 4 of compiler/rustc_macros/build.rs
Removed needless borrow for generic argument `env`on line 53 of compiler/rust_llvm/build.rs
|
|
|
|
|
|
Emit suggestion when encountering
```rust
let a = &mut foo[0];
let b = &foo[1];
a.use_mut();
```
|