]> git.lizzy.rs Git - rust.git/blob - src/test/ui/macros/issue-88206.rs
Merge commit 'f51aade56f93175dde89177a92e3669ebd8e7592' into clippyup
[rust.git] / src / test / ui / macros / issue-88206.rs
1 // compile-flags: -Z deduplicate-diagnostics=yes
2
3 #![warn(unused_imports)]
4
5 use std::str::*;
6 //~^ NOTE `from_utf8` is imported here, but it is a function
7 //~| NOTE `from_utf8_mut` is imported here, but it is a function
8 //~| NOTE `from_utf8_unchecked` is imported here, but it is a function
9
10 mod hey {
11     pub trait Serialize {}
12     pub trait Deserialize {}
13
14     pub struct X(i32);
15 }
16
17 use hey::{Serialize, Deserialize, X};
18 //~^ NOTE `Serialize` is imported here, but it is only a trait, without a derive macro
19 //~| NOTE `Deserialize` is imported here, but it is a trait
20 //~| NOTE `X` is imported here, but it is a struct
21
22 #[derive(Serialize)]
23 //~^ ERROR cannot find derive macro `Serialize`
24 struct A;
25
26 #[derive(from_utf8_mut)]
27 //~^ ERROR cannot find derive macro `from_utf8_mut`
28 struct B;
29
30 #[derive(println)]
31 //~^ ERROR cannot find derive macro `println`
32 //~| NOTE `println` is in scope, but it is a function-like macro
33 struct C;
34
35 #[Deserialize]
36 //~^ ERROR cannot find attribute `Deserialize`
37 struct D;
38
39 #[from_utf8_unchecked]
40 //~^ ERROR cannot find attribute `from_utf8_unchecked`
41 struct E;
42
43 #[println]
44 //~^ ERROR cannot find attribute `println`
45 //~| NOTE `println` is in scope, but it is a function-like macro
46 struct F;
47
48 fn main() {
49     from_utf8!();
50     //~^ ERROR cannot find macro `from_utf8`
51
52     Box!();
53     //~^ ERROR cannot find macro `Box`
54     //~| NOTE `Box` is in scope, but it is a struct
55
56     Copy!();
57     //~^ ERROR cannot find macro `Copy`
58     //~| NOTE `Copy` is in scope, but it is a derive macro
59
60     test!();
61     //~^ ERROR cannot find macro `test`
62     //~| NOTE `test` is in scope, but it is an attribute
63
64     X!();
65     //~^ ERROR cannot find macro `X`
66 }