Repository navigation
let_underscore_drop: weird "+" in output? #113894
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.D-diagnostic-infraDiagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.T-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
Code
#![allow(unused_must_use)]
use std::thread;
macro_rules! expr { ($e: expr) => { $e } }
macro_rules! spawn {
($($code: tt)*) => {
expr!(thread::spawn(move|| {$($code)*}).join())
}
}
pub fn main() {
spawn! {
println!("expr");
};
let _ = spawn! {
println!("expr");
};
}Current output
warning: non-binding let on a type that implements `Drop`
--> 2B8C38DE2265366FC40C9872C2EB2C8B37BDA99B72B47C43B03BF5A58936ABCC.rs:16:5
|
16 | / let _ = spawn! {
17 | | println!("expr");
18 | | };
| |______^
|
= note: requested on the command line with `-W let-underscore-drop`
help: consider binding to an unused variable to avoid immediately dropping the value
|
16 | let _unused = spawn! {
| ~~~~~~~
help: consider immediately dropping the value
|
8 | expr!(drop())
| ~~~~~ +
warning: 1 warning emittedThis free-standing "+" looks very weird, not sure what this is supposed to point at?
Maybe the macros messed something up here?
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.D-diagnostic-infraDiagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.T-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.
Activity
clubby789 commentedon Jul 21, 2023
While reducing this
ICEs with
Filing that here as I suspect it's part of the same issue
EDIT: The issue here is that the span associated with the
drop(suggestion is from the start oflocal.span(which covers the wholelet _ = ...line) up until the start ofinit.span, which is the span of$codeinside the macro definition.chenyukang commentedon May 15, 2024
The ice dispear now: