Fix the dedup error because of spans from suggestion
This commit is contained in:
parent
8387315ab3
commit
75895f59b0
3 changed files with 47 additions and 1 deletions
|
@ -896,7 +896,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
|
||||||
style: SuggestionStyle,
|
style: SuggestionStyle,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
suggestion.sort_unstable();
|
suggestion.sort_unstable();
|
||||||
suggestion.dedup();
|
suggestion.dedup_by(|(s1, m1), (s2, m2)| s1.source_equal(*s2) && m1 == m2);
|
||||||
|
|
||||||
let parts = suggestion
|
let parts = suggestion
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
16
tests/ui/macros/macro-span-issue-116502.rs
Normal file
16
tests/ui/macros/macro-span-issue-116502.rs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#![allow(dead_code)]
|
||||||
|
#![allow(unused_variables)]
|
||||||
|
|
||||||
|
fn bug() {
|
||||||
|
macro_rules! m {
|
||||||
|
() => {
|
||||||
|
_ //~ ERROR the placeholder `_` is not allowed within types on item signatures for structs
|
||||||
|
};
|
||||||
|
}
|
||||||
|
struct S<T = m!()>(m!(), T)
|
||||||
|
where
|
||||||
|
T: Trait<m!()>;
|
||||||
|
}
|
||||||
|
trait Trait<T> {}
|
||||||
|
|
||||||
|
fn main() {}
|
30
tests/ui/macros/macro-span-issue-116502.stderr
Normal file
30
tests/ui/macros/macro-span-issue-116502.stderr
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
|
||||||
|
--> $DIR/macro-span-issue-116502.rs:7:13
|
||||||
|
|
|
||||||
|
LL | _
|
||||||
|
| ^
|
||||||
|
| |
|
||||||
|
| not allowed in type signatures
|
||||||
|
| not allowed in type signatures
|
||||||
|
| not allowed in type signatures
|
||||||
|
...
|
||||||
|
LL | struct S<T = m!()>(m!(), T)
|
||||||
|
| ---- ---- in this macro invocation
|
||||||
|
| |
|
||||||
|
| in this macro invocation
|
||||||
|
LL | where
|
||||||
|
LL | T: Trait<m!()>;
|
||||||
|
| ---- in this macro invocation
|
||||||
|
|
|
||||||
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: use type parameters instead
|
||||||
|
|
|
||||||
|
LL ~ U
|
||||||
|
LL | };
|
||||||
|
LL | }
|
||||||
|
LL ~ struct S<U>(m!(), T)
|
||||||
|
|
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0121`.
|
Loading…
Add table
Add a link
Reference in a new issue