Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a710e1f
account for `c_enum_min_bits` in `multiple-reprs` UI test
japaric Jan 20, 2025
b691e9f
Correct comment for FreeBSD and DragonFly BSD in unix/thread
no1wudi Jan 25, 2025
8c24c0a
Remove the common prelude module
ehuss Feb 11, 2025
51b105d
ignore vendor directory in `git status`
jyn514 Feb 13, 2025
1a3efd2
Use `slice::fill` in `io::Repeat` implementation
DaniPopes Feb 13, 2025
2f27236
alloc boxed: docs: use MaybeUninit::write instead of as_mut_ptr
jedbrown Feb 13, 2025
fb3a363
Emit MIR for each bit with on `dont_reset_cast_kind_without_updating_…
pvdrz Feb 14, 2025
46c7236
Move drop elaboration infrastructure.
nnethercote Feb 14, 2025
28b75a3
Move `MirPatch` from `rustc_middle` to `rustc_mir_transform`.
nnethercote Feb 14, 2025
b480a92
Use underline suggestions for purely 'additive' replacements
compiler-errors Feb 13, 2025
f6406df
Consider add-prefix replacements too
compiler-errors Feb 13, 2025
6d71251
Trim suggestion parts to the subset that is purely additive
compiler-errors Feb 13, 2025
4b13dfd
Rollup merge of #135778 - ferrocene:ja-gh135777, r=workingjubilee
matthiaskrgr Feb 14, 2025
678ff2a
Rollup merge of #136052 - no1wudi:fix, r=workingjubilee
matthiaskrgr Feb 14, 2025
c21a76f
Rollup merge of #136886 - ehuss:remove-prelude-common, r=jhpratt
matthiaskrgr Feb 14, 2025
2980f75
Rollup merge of #136956 - jyn514:ignore-vendor, r=Noratrieb
matthiaskrgr Feb 14, 2025
49fb61c
Rollup merge of #136958 - compiler-errors:additive-replacmeent, r=est…
matthiaskrgr Feb 14, 2025
b5fce2a
Rollup merge of #136967 - DaniPopes:io-repeat-fill, r=joboet
matthiaskrgr Feb 14, 2025
145e35a
Rollup merge of #136976 - jedbrown:jed/doc-boxed-deferred-init, r=tgr…
matthiaskrgr Feb 14, 2025
8bf77a4
Rollup merge of #137007 - pvdrz:fix-aarch64-alloc-layout, r=compiler-…
matthiaskrgr Feb 14, 2025
bd094fb
Rollup merge of #137008 - nnethercote:mv-code-into-rustc_mir_transfor…
matthiaskrgr Feb 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Consider add-prefix replacements too
  • Loading branch information
compiler-errors authored and workingjubilee committed Feb 14, 2025
commit f6406dfd4efceb6f713e503aecda587304135ed9
7 changes: 4 additions & 3 deletions compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,10 @@ impl SubstitutionPart {
/// it with "abx" is, since the "c" character is lost.
pub fn is_destructive_replacement(&self, sm: &SourceMap) -> bool {
self.is_replacement(sm)
&& !sm
.span_to_snippet(self.span)
.is_ok_and(|snippet| self.snippet.trim_start().starts_with(snippet.trim_start()))
&& !sm.span_to_snippet(self.span).is_ok_and(|snippet| {
self.snippet.trim_start().starts_with(snippet.trim_start())
|| self.snippet.trim_end().ends_with(snippet.trim_end())
})
}

fn replaces_meaningful_content(&self, sm: &SourceMap) -> bool {
Expand Down
5 changes: 2 additions & 3 deletions tests/ui/closures/2229_closure_analysis/issue-118144.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ LL | V(x) = func_arg;
|
help: consider dereferencing to access the inner value using the Deref trait
|
LL - V(x) = func_arg;
LL + V(x) = &*func_arg;
|
LL | V(x) = &*func_arg;
| ~~~~~~~~~~

error: aborting due to 1 previous error

Expand Down
5 changes: 2 additions & 3 deletions tests/ui/empty/empty-struct-braces-expr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ LL | let xe3 = XE::Empty3;
|
help: there is a variant with a similar name
|
LL - let xe3 = XE::Empty3;
LL + let xe3 = XE::XEmpty3;
|
LL | let xe3 = XE::XEmpty3;
| ~~~~~~~

error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope
--> $DIR/empty-struct-braces-expr.rs:26:19
Expand Down
5 changes: 2 additions & 3 deletions tests/ui/env-macro/error-recovery-issue-55897.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ LL | use env;
|
help: consider importing this module instead
|
LL - use env;
LL + use std::env;
|
LL | use std::env;
| ~~~~~~~~

error: aborting due to 4 previous errors

Expand Down
15 changes: 6 additions & 9 deletions tests/ui/error-codes/E0027.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ LL | Dog { age: x } => {}
|
help: include the missing field in the pattern
|
LL - Dog { age: x } => {}
LL + Dog { age: x, name } => {}
|
LL | Dog { age: x, name } => {}
| ~~~~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
|
LL - Dog { age: x } => {}
LL + Dog { age: x, name: _ } => {}
|
LL | Dog { age: x, name: _ } => {}
| ~~~~~~~~~~~
help: or always ignore missing fields here
|
LL - Dog { age: x } => {}
LL + Dog { age: x, .. } => {}
|
LL | Dog { age: x, .. } => {}
| ~~~~~~

error[E0027]: pattern does not mention field `age`
--> $DIR/E0027.rs:15:9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,8 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {}
found signature `extern "rust-call" fn(Foo, ()) -> ()`
help: change the self-receiver type to match the trait
|
LL - extern "rust-call" fn call(self, args: ()) -> () {}
LL + extern "rust-call" fn call(&self, args: ()) -> () {}
|
LL | extern "rust-call" fn call(&self, args: ()) -> () {}
| ~~~~~

error[E0183]: manual implementations of `FnOnce` are experimental
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing);
|
help: a similar path exists
|
LL - println!("Hello, {}!", crate::bar::do_the_thing);
LL + println!("Hello, {}!", crate::foo::bar::do_the_thing);
|
LL | println!("Hello, {}!", crate::foo::bar::do_the_thing);
| ~~~~~~~~
help: consider importing this module
|
LL + use foo::bar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing);
|
help: a similar path exists
|
LL - println!("Hello, {}!", crate::bar::do_the_thing);
LL + println!("Hello, {}!", crate::foo::bar::do_the_thing);
|
LL | println!("Hello, {}!", crate::foo::bar::do_the_thing);
| ~~~~~~~~
help: consider importing this module
|
LL + use foo::bar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ LL | T::A(a) | T::B(a) => a,
found enum `T`
help: consider dereferencing the boxed value
|
LL - let y = match x {
LL + let y = match *x {
|
LL | let y = match *x {
| ~~

error[E0308]: mismatched types
--> $DIR/issue-57741.rs:20:19
Expand All @@ -26,9 +25,8 @@ LL | T::A(a) | T::B(a) => a,
found enum `T`
help: consider dereferencing the boxed value
|
LL - let y = match x {
LL + let y = match *x {
|
LL | let y = match *x {
| ~~

error[E0308]: mismatched types
--> $DIR/issue-57741.rs:27:9
Expand All @@ -42,9 +40,8 @@ LL | S::A { a } | S::B { b: a } => a,
found enum `S`
help: consider dereferencing the boxed value
|
LL - let y = match x {
LL + let y = match *x {
|
LL | let y = match *x {
| ~~

error[E0308]: mismatched types
--> $DIR/issue-57741.rs:27:22
Expand All @@ -58,9 +55,8 @@ LL | S::A { a } | S::B { b: a } => a,
found enum `S`
help: consider dereferencing the boxed value
|
LL - let y = match x {
LL + let y = match *x {
|
LL | let y = match *x {
| ~~

error: aborting due to 4 previous errors

Expand Down
10 changes: 4 additions & 6 deletions tests/ui/let-else/let-else-deref-coercion.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ LL | let Bar::Present(z) = self else {
|
help: consider dereferencing to access the inner value using the Deref trait
|
LL - let Bar::Present(z) = self else {
LL + let Bar::Present(z) = &**self else {
|
LL | let Bar::Present(z) = &**self else {
| ~~~~~~~

error[E0308]: mismatched types
--> $DIR/let-else-deref-coercion.rs:68:13
Expand All @@ -22,9 +21,8 @@ LL | let Bar(z) = x;
|
help: consider dereferencing to access the inner value using the Deref trait
|
LL - let Bar(z) = x;
LL + let Bar(z) = &**x;
|
LL | let Bar(z) = &**x;
| ~~~~

error: aborting due to 2 previous errors

Expand Down
5 changes: 2 additions & 3 deletions tests/ui/lexer/lex-bad-char-literals-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ LL | "\●"
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
|
LL - "\●"
LL + r"\●"
|
LL | r"\●"
| ~~~~~

error: aborting due to 4 previous errors

5 changes: 2 additions & 3 deletions tests/ui/lifetimes/borrowck-let-suggestion.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ LL | x.use_mut();
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider consuming the `Vec<i32>` when turning it into an `Iterator`
|
LL - let mut x = vec![1].iter();
LL + let mut x = vec![1].into_iter();
|
LL | let mut x = vec![1].into_iter();
| ~~~~~~~~~
help: consider using a `let` binding to create a longer lived value
|
LL ~ let binding = vec![1];
Expand Down
5 changes: 2 additions & 3 deletions tests/ui/lint/lint-strict-provenance-lossy-casts.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ LL | let addr_32bit = &x as *const u8 as u32;
= help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_provenance()` instead
help: use `.addr()` to obtain the address of a pointer
|
LL - let addr_32bit = &x as *const u8 as u32;
LL + let addr_32bit = (&x as *const u8).addr() as u32;
|
LL | let addr_32bit = (&x as *const u8).addr() as u32;
| + ~~~~~~~~~~~~~~~

error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `usize`
--> $DIR/lint-strict-provenance-lossy-casts.rs:14:20
Expand Down
20 changes: 8 additions & 12 deletions tests/ui/match/issue-56685.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ LL | #![deny(unused_variables)]
| ^^^^^^^^^^^^^^^^
help: if this is intentional, prefix it with an underscore
|
LL - E::A(x) | E::B(x) => {}
LL + E::A(_x) | E::B(_x) => {}
|
LL | E::A(_x) | E::B(_x) => {}
| ~~ ~~

error: unused variable: `x`
--> $DIR/issue-56685.rs:25:14
Expand All @@ -23,9 +22,8 @@ LL | F::A(x, y) | F::B(x, y) => { y },
|
help: if this is intentional, prefix it with an underscore
|
LL - F::A(x, y) | F::B(x, y) => { y },
LL + F::A(_x, y) | F::B(_x, y) => { y },
|
LL | F::A(_x, y) | F::B(_x, y) => { y },
| ~~ ~~

error: unused variable: `a`
--> $DIR/issue-56685.rs:27:14
Expand All @@ -47,9 +45,8 @@ LL | let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) {
|
help: if this is intentional, prefix it with an underscore
|
LL - let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) {
LL + let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) {
|
LL | let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) {
| ~~ ~~

error: unused variable: `x`
--> $DIR/issue-56685.rs:39:20
Expand All @@ -59,9 +56,8 @@ LL | while let F::A(x, y) | F::B(x, y) = F::A(1, 2) {
|
help: if this is intentional, prefix it with an underscore
|
LL - while let F::A(x, y) | F::B(x, y) = F::A(1, 2) {
LL + while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) {
|
LL | while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) {
| ~~ ~~

error: aborting due to 6 previous errors

5 changes: 2 additions & 3 deletions tests/ui/mismatched_types/issue-112036.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ LL | fn drop(self) {}
found signature `fn(Foo)`
help: change the self-receiver type to match the trait
|
LL - fn drop(self) {}
LL + fn drop(&mut self) {}
|
LL | fn drop(&mut self) {}
| ~~~~~~~~~

error: aborting due to 1 previous error

Expand Down
20 changes: 8 additions & 12 deletions tests/ui/namespace/namespace-mix.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ LL | check(m1::S);
= note: can't use a type alias as a constructor
help: a tuple struct with a similar name exists
|
LL - check(m1::S);
LL + check(m1::TS);
|
LL | check(m1::TS);
| ~~
help: consider importing one of these constants instead
|
LL + use m2::S;
Expand All @@ -39,9 +38,8 @@ LL | pub struct TS();
= note: can't use a type alias as a constructor
help: a tuple struct with a similar name exists
|
LL - check(xm1::S);
LL + check(xm1::TS);
|
LL | check(xm1::TS);
| ~~
help: consider importing one of these constants instead
|
LL + use m2::S;
Expand All @@ -66,9 +64,8 @@ LL | check(m7::V);
= note: can't use a type alias as a constructor
help: a tuple variant with a similar name exists
|
LL - check(m7::V);
LL + check(m7::TV);
|
LL | check(m7::TV);
| ~~
help: consider importing one of these constants instead
|
LL + use m8::V;
Expand All @@ -95,9 +92,8 @@ LL | TV(),
= note: can't use a type alias as a constructor
help: a tuple variant with a similar name exists
|
LL - check(xm7::V);
LL + check(xm7::TV);
|
LL | check(xm7::TV);
| ~~
help: consider importing one of these constants instead
|
LL + use m8::V;
Expand Down
5 changes: 2 additions & 3 deletions tests/ui/object-pointer-types.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ LL | x.owned();
|
help: there is a method `to_owned` with a similar name
|
LL - x.owned();
LL + x.to_owned();
|
LL | x.to_owned();
| ~~~~~~~~

error[E0599]: no method named `owned` found for mutable reference `&mut dyn Foo` in the current scope
--> $DIR/object-pointer-types.rs:17:7
Expand Down
5 changes: 2 additions & 3 deletions tests/ui/parser/bad-char-literals.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ LL | ''';
|
help: escape the character
|
LL - ''';
LL + '\'';
|
LL | '\'';
| ~~

error: character constant must be escaped: `\n`
--> $DIR/bad-char-literals.rs:10:6
Expand Down
5 changes: 2 additions & 3 deletions tests/ui/parser/bad-escape-suggest-raw-string.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ LL | let bad = "ab\[c";
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
|
LL - let bad = "ab\[c";
LL + let bad = r"ab\[c";
|
LL | let bad = r"ab\[c";
| ~~~~~~~~

error: aborting due to 1 previous error

5 changes: 2 additions & 3 deletions tests/ui/parser/byte-literals.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ LL | b''';
|
help: escape the character
|
LL - b''';
LL + b'\'';
|
LL | b'\'';
| ~~

error: non-ASCII character in byte literal
--> $DIR/byte-literals.rs:10:7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ LL | mut n = 0;
|
help: missing keyword
|
LL - mut n = 0;
LL + let mut n = 0;
|
LL | let mut n = 0;
| ~~~~~~~

error: invalid variable declaration
--> $DIR/issue-65257-invalid-var-decl-recovery.rs:16:5
Expand All @@ -66,9 +65,8 @@ LL | mut var;
|
help: missing keyword
|
LL - mut var;
LL + let mut var;
|
LL | let mut var;
| ~~~~~~~

error[E0308]: mismatched types
--> $DIR/issue-65257-invalid-var-decl-recovery.rs:20:33
Expand Down
Loading