Skip to content

E0121 overlapping spans / bad placeholder #118048

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

// check-pass: this used to be a stack overflow because of recursion in `usefulness.rs`

macro_rules! long_tuple_arg {
    ([$($t:tt)*]#$($h:tt)*) => {
        long_tuple_arg!{[$($t)*$($t)*]$($h)*}
    };
    ([$([$t:tt $y:tt])*]) => {
        pub fn _f(($($t,)*): ($($t,)*)) {}
    }
}

long_tuple_arg!{[[_ u8]]#}

fn main() {}

Minimal

macro_rules! foo {
    ($ty:ty) => {
        fn foo(_: $ty, _: $ty) {}
    }
}

foo!(_);

fn main() {}

Meta

rustc --version --verbose:

33688d24673db07df084483cbcf0b6bc569ea33a

Error output

error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
  --> 5A2D2B75C2BF81E687B5271EF31D0BB4F73D27EFD91EEA26ABC563EAC0B84418.rs:12:19
   |
12 | long_tuple_arg!{[[_ u8]]#}
   |                   ^
   |                   |
   |                   not allowed in type signatures
   |                   not allowed in type signatures
   |
help: use type parameters instead
   |
8  ~         pub fn _f<T>(($($t,)*): ($($t,)*)) {}
9  |     }
10 | }
11 |
12 ~ long_tuple_arg!{[[TT u8]]#}
   |

error: aborting due to previous error

For more information about this error, try `rustc --explain E0121`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-debug-assertionsThis issue requires a build of rustc or tooling with debug-assertions in some way

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions