Skip to content

Use of deprecated item not propagated to macro expansion #20327

Closed
@laumann

Description

@laumann

When the spawn function was deprecated in favour of std::thread::Thread::spawn, the following program will produce a warning

fn main() {
    spawn(move|| ());
}

Output:

<anon>:11:5: 11:10 warning: use of deprecated item: use std::thread::Thread::spawn and detach instead, #[warn(deprecated)] on by default
<anon>:11     spawn(move|| ());
              ^~~~~

But if the same call is wrapped in a macro the warning is not emitted, as follows:

#![feature(macro_rules)]
// Short-hand macro for spawn(move|| expr)
macro_rules! go( ($e:expr) => (spawn(move|| $e)) );

fn main() {
    go!{ () };
}

Here it is on the playpen

Not sure if this is a bug or not, or if the warning should be emitted, but I would have expected the same warning when the macro is "unwrapped".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions