-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.Category: This is a bug.P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
This is very low priority.
I tried this code:
#![feature(c_variadic)]
unsafe extern "C" fn thats_not_a_pattern(mut ap: ...) -> u32 {
let mut lol = |...| ();
unsafe { ap.arg::<u32>() }
}
I expected it to go off on me for trying to put varargs in a closure.
Instead, I got this:
Compiling playground v0.0.1 (/playground)
error: unexpected `...`
--> src/lib.rs:4:20
|
4 | let mut lol = |...| ();
| ^^^ not a valid pattern
|
help: for a rest pattern, use `..` instead of `...`
|
4 - let mut lol = |...| ();
4 + let mut lol = |..| ();
|
error: `..` patterns are not allowed here
--> src/lib.rs:4:20
|
4 | let mut lol = |...| ();
| ^^^
|
= note: only allowed in tuple, tuple struct, and slice patterns
error[E0282]: type annotations needed
--> src/lib.rs:4:20
|
4 | let mut lol = |...| ();
| ^^^
|
help: consider giving this closure parameter an explicit type
|
4 | let mut lol = |...: /* Type */| ();
| ++++++++++++
Note that one error message directly conflicts with another!
Weird!
Then I tried this:
unsafe extern "C" fn closures_cannot_varargs(mut ap: ...) -> u32 {
let mut lol = |mut ap: ...| unsafe { ap.arg::<u32>() };
lol(unsafe { ap.arg::<u32>() })
}
And I got this:
error[E0743]: C-variadic type
...
may not be nested inside another type
so uh, lol
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.Category: This is a bug.P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.