resolve: Prohibit use of imported non-macro attributes
This commit is contained in:
parent
e1d1487fc4
commit
bf1e70cd1f
5 changed files with 42 additions and 6 deletions
9
src/test/ui/rust-2018/uniform-paths/prelude-fail-2.rs
Normal file
9
src/test/ui/rust-2018/uniform-paths/prelude-fail-2.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// edition:2018
|
||||
|
||||
#![feature(uniform_paths)]
|
||||
|
||||
// Built-in attribute
|
||||
use inline as imported_inline;
|
||||
|
||||
#[imported_inline] //~ ERROR cannot use a built-in attribute through an import
|
||||
fn main() {}
|
||||
14
src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr
Normal file
14
src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
error: cannot use a built-in attribute through an import
|
||||
--> $DIR/prelude-fail-2.rs:8:3
|
||||
|
|
||||
LL | #[imported_inline] //~ ERROR cannot use a built-in attribute through an import
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the built-in attribute imported here
|
||||
--> $DIR/prelude-fail-2.rs:6:5
|
||||
|
|
||||
LL | use inline as imported_inline;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -6,9 +6,6 @@
|
|||
// Macro imported with `#[macro_use] extern crate`
|
||||
use vec as imported_vec;
|
||||
|
||||
// Built-in attribute
|
||||
use inline as imported_inline;
|
||||
|
||||
// Tool module
|
||||
use rustfmt as imported_rustfmt;
|
||||
|
||||
|
|
@ -20,7 +17,6 @@ use u8 as imported_u8;
|
|||
|
||||
type A = imported_u8;
|
||||
|
||||
#[imported_inline]
|
||||
#[imported_rustfmt::skip]
|
||||
fn main() {
|
||||
imported_vec![0];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue