Closed
Description
#[derive(Debug)]
pub struct X;
impl Add for X {} // trigger unused import
fn main() {}
After #44215, this gives the following error message:
error[E0405]: cannot find trait `Add` in this scope
--> x.rs:4:6
|
4 | impl Add for X {} // trigger unused import
| ^^^ not found in this scope
|
help: possible candidate is found in another module, you can import it into scope
|
2 | use std::ops::Add; // <--- LINE 2 HERE
|
error: cannot continue compilation due to previous error
This suggests placing the use
-statement at line 2, which is between the #[derive]
and the pub struct X;
line, while we want to place the use
statement before the #[derive]
.
cc @oli-obk