-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #125135 - chenyukang:yukang-fix-116502, r=compiler-er…
…rors Fix the dedup error because of spans from suggestion Fixes #116502 I believe this kind of issue is supposed resolved by #118057, but the `==` in `span` respect syntax context, here we should only care that they point to the same bytes of source text, so should use `source_equal`.
- Loading branch information
Showing
3 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |