Fix the dedup error because of spans from suggestion · rust-lang/rust@75895f5 (original) (raw)
File tree
3 files changed
lines changed
- compiler/rustc_errors/src
3 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -896,7 +896,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { | ||
896 | 896 | style: SuggestionStyle, |
897 | 897 | ) -> &mut Self { |
898 | 898 | suggestion.sort_unstable(); |
899 | - suggestion.dedup(); | |
899 | + suggestion.dedup_by(|(s1, m1), (s2, m2) | |
900 | 900 | |
901 | 901 | let parts = suggestion |
902 | 902 | .into_iter() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
1 | +#![allow(dead_code)] | |
2 | +#![allow(unused_variables)] | |
3 | + | |
4 | +fn bug() { | |
5 | +macro_rules! m { | |
6 | +() => { | |
7 | + _ //~ ERROR the placeholder `_` is not allowed within types on item signatures for structs | |
8 | +}; | |
9 | +} | |
10 | +struct S<T = m!()>(m!(), T) | |
11 | +where | |
12 | +T: Trait<m!()>; | |
13 | +} | |
14 | +trait Trait<T> {} | |
15 | + | |
16 | +fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
1 | +error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs | |
2 | + --> $DIR/macro-span-issue-116502.rs:7:13 | |
3 | + | | |
4 | +LL | _ | |
5 | + | ^ | |
6 | + | | |
7 | + | not allowed in type signatures | |
8 | + | not allowed in type signatures | |
9 | + | not allowed in type signatures | |
10 | +... | |
11 | +LL | struct S<T = m!()>(m!(), T) | |
12 | + | ---- ---- in this macro invocation | |
13 | + | | |
14 | + | in this macro invocation | |
15 | +LL | where | |
16 | +LL | T: Trait<m!()>; | |
17 | + | ---- in this macro invocation | |
18 | + | | |
19 | + = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) | |
20 | +help: use type parameters instead | |
21 | + | | |
22 | +LL ~ U | |
23 | +LL | }; | |
24 | +LL | } | |
25 | +LL ~ struct S(m!(), T) | |
26 | + | | |
27 | + | |
28 | +error: aborting due to 1 previous error | |
29 | + | |
30 | +For more information about this error, try `rustc --explain E0121`. |