resolve: Implement prelude search for macro paths
resolve/expansion: Implement tool attributes
This commit is contained in:
parent
c63bb1d6a7
commit
c3e54217e8
42 changed files with 683 additions and 143 deletions
|
|
@ -8,9 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(tool_attributes)]
|
||||
#![feature(use_extern_macros, proc_macro_path_invoc)]
|
||||
|
||||
#![foo::bar] //~ ERROR an unknown tool name found in scoped attribute: `foo::bar`. [E0694]
|
||||
|
||||
#[foo::bar] //~ ERROR an unknown tool name found in scoped attribute: `foo::bar`. [E0694]
|
||||
#[foo::bar] //~ ERROR failed to resolve. Use of undeclared type or module `foo`
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// aux-build:issue-42708.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![feature(decl_macro, use_extern_macros, proc_macro_path_invoc)]
|
||||
#![feature(decl_macro, proc_macro_path_invoc)]
|
||||
#![allow(unused)]
|
||||
|
||||
extern crate issue_42708;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// aux-build:issue-50061.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![feature(use_extern_macros, proc_macro_path_invoc, decl_macro)]
|
||||
#![feature(proc_macro_path_invoc, decl_macro)]
|
||||
|
||||
extern crate issue_50061;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// aux-build:parent-source-spans.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![feature(use_extern_macros, decl_macro, proc_macro_non_items)]
|
||||
#![feature(decl_macro, proc_macro_non_items)]
|
||||
|
||||
extern crate parent_source_spans;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,3 +12,8 @@
|
|||
macro_rules! mac {
|
||||
($ident:ident) => { let $ident = 42; }
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! inline {
|
||||
() => ()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0658]: macro invocations in `extern {}` blocks are experimental. (see issue #49476)
|
||||
error[E0658]: macro and proc-macro invocations in `extern {}` blocks are experimental. (see issue #49476)
|
||||
--> $DIR/feature-gate-macros_in_extern.rs:29:5
|
||||
|
|
||||
LL | returns_isize!(rust_get_test_int);
|
||||
|
|
@ -6,7 +6,7 @@ LL | returns_isize!(rust_get_test_int);
|
|||
|
|
||||
= help: add #![feature(macros_in_extern)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: macro invocations in `extern {}` blocks are experimental. (see issue #49476)
|
||||
error[E0658]: macro and proc-macro invocations in `extern {}` blocks are experimental. (see issue #49476)
|
||||
--> $DIR/feature-gate-macros_in_extern.rs:31:5
|
||||
|
|
||||
LL | takes_u32_returns_u32!(rust_dbg_extern_identity_u32);
|
||||
|
|
@ -14,7 +14,7 @@ LL | takes_u32_returns_u32!(rust_dbg_extern_identity_u32);
|
|||
|
|
||||
= help: add #![feature(macros_in_extern)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: macro invocations in `extern {}` blocks are experimental. (see issue #49476)
|
||||
error[E0658]: macro and proc-macro invocations in `extern {}` blocks are experimental. (see issue #49476)
|
||||
--> $DIR/feature-gate-macros_in_extern.rs:33:5
|
||||
|
|
||||
LL | emits_nothing!();
|
||||
|
|
|
|||
|
|
@ -8,8 +8,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(use_extern_macros)]
|
||||
|
||||
fn main() {
|
||||
#[rustfmt::skip] //~ ERROR scoped attribute `rustfmt::skip` is experimental
|
||||
#[rustfmt::skip] //~ ERROR tool attributes are unstable
|
||||
let x = 3
|
||||
;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
error[E0658]: scoped attribute `rustfmt::skip` is experimental (see issue #44690)
|
||||
--> $DIR/feature-gate-tool_attributes.rs:12:5
|
||||
error[E0658]: tool attributes are unstable (see issue #44690)
|
||||
--> $DIR/feature-gate-tool_attributes.rs:14:5
|
||||
|
|
||||
LL | #[rustfmt::skip] //~ ERROR scoped attribute `rustfmt::skip` is experimental
|
||||
LL | #[rustfmt::skip] //~ ERROR tool attributes are unstable
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(tool_attributes)] to the crate attributes to enable
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
print!(test!());
|
||||
print!(testo!());
|
||||
//~^ ERROR: format argument must be a string literal
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
error: format argument must be a string literal
|
||||
--> $DIR/issue-11692-1.rs:12:12
|
||||
|
|
||||
LL | print!(test!());
|
||||
| ^^^^^^^
|
||||
LL | print!(testo!());
|
||||
| ^^^^^^^^
|
||||
help: you might be missing a string literal to format with
|
||||
|
|
||||
LL | print!("{}", test!());
|
||||
LL | print!("{}", testo!());
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@
|
|||
|
||||
fn main() {
|
||||
concat!(test!());
|
||||
//~^ ERROR cannot find macro `test!` in this scope
|
||||
//~^ ERROR expected a macro, found non-macro attribute
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: cannot find macro `test!` in this scope
|
||||
error: expected a macro, found non-macro attribute
|
||||
--> $DIR/issue-11692-2.rs:12:13
|
||||
|
|
||||
LL | concat!(test!());
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// compile-pass
|
||||
|
||||
#![feature(use_extern_macros, decl_macro)]
|
||||
#![feature(decl_macro)]
|
||||
|
||||
mod type_ns {
|
||||
pub type A = u8;
|
||||
|
|
|
|||
|
|
@ -8,11 +8,13 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// Make sure that 'custom_attributes' feature does not allow scoped attributes.
|
||||
#![feature(use_extern_macros, extern_prelude)]
|
||||
|
||||
#![feature(custom_attributes)]
|
||||
mod m {
|
||||
fn check() {
|
||||
Vec::clone!(); //~ ERROR failed to resolve. Not a module `Vec`
|
||||
u8::clone!(); //~ ERROR failed to resolve. Not a module `u8`
|
||||
}
|
||||
}
|
||||
|
||||
#[foo::bar]
|
||||
//~^ ERROR scoped attribute `foo::bar` is experimental (see issue #44690) [E0658]
|
||||
//~^^ ERROR an unknown tool name found in scoped attribute: `foo::bar`. [E0694]
|
||||
fn main() {}
|
||||
15
src/test/ui/macro-path-prelude-fail-1.stderr
Normal file
15
src/test/ui/macro-path-prelude-fail-1.stderr
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
error[E0433]: failed to resolve. Not a module `Vec`
|
||||
--> $DIR/macro-path-prelude-fail-1.rs:15:9
|
||||
|
|
||||
LL | Vec::clone!(); //~ ERROR failed to resolve. Not a module `Vec`
|
||||
| ^^^ Not a module `Vec`
|
||||
|
||||
error[E0433]: failed to resolve. Not a module `u8`
|
||||
--> $DIR/macro-path-prelude-fail-1.rs:16:9
|
||||
|
|
||||
LL | u8::clone!(); //~ ERROR failed to resolve. Not a module `u8`
|
||||
| ^^ Not a module `u8`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0433`.
|
||||
19
src/test/ui/macro-path-prelude-fail-2.rs
Normal file
19
src/test/ui/macro-path-prelude-fail-2.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(use_extern_macros)]
|
||||
|
||||
mod m {
|
||||
fn check() {
|
||||
Result::Ok!(); //~ ERROR fail to resolve non-ident macro path
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
8
src/test/ui/macro-path-prelude-fail-2.stderr
Normal file
8
src/test/ui/macro-path-prelude-fail-2.stderr
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
error: fail to resolve non-ident macro path
|
||||
--> $DIR/macro-path-prelude-fail-2.rs:15:9
|
||||
|
|
||||
LL | Result::Ok!(); //~ ERROR fail to resolve non-ident macro path
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
18
src/test/ui/macro-path-prelude-fail-3.rs
Normal file
18
src/test/ui/macro-path-prelude-fail-3.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(use_extern_macros)]
|
||||
|
||||
#[derive(inline)] //~ ERROR expected a macro, found non-macro attribute
|
||||
struct S;
|
||||
|
||||
fn main() {
|
||||
inline!(); //~ ERROR expected a macro, found non-macro attribute
|
||||
}
|
||||
14
src/test/ui/macro-path-prelude-fail-3.stderr
Normal file
14
src/test/ui/macro-path-prelude-fail-3.stderr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
error: expected a macro, found non-macro attribute
|
||||
--> $DIR/macro-path-prelude-fail-3.rs:13:10
|
||||
|
|
||||
LL | #[derive(inline)] //~ ERROR expected a macro, found non-macro attribute
|
||||
| ^^^^^^
|
||||
|
||||
error: expected a macro, found non-macro attribute
|
||||
--> $DIR/macro-path-prelude-fail-3.rs:17:5
|
||||
|
|
||||
LL | inline!(); //~ ERROR expected a macro, found non-macro attribute
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
@ -8,8 +8,14 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
#[rustfmt::skip] //~ ERROR scoped attribute `rustfmt::skip` is experimental
|
||||
let x =
|
||||
3;
|
||||
// compile-pass
|
||||
|
||||
#![feature(use_extern_macros, extern_prelude)]
|
||||
|
||||
mod m {
|
||||
fn check() {
|
||||
std::panic!(); // OK
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
41
src/test/ui/macro-path-prelude-shadowing.rs
Normal file
41
src/test/ui/macro-path-prelude-shadowing.rs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// aux-build:macro-in-other-crate.rs
|
||||
|
||||
#![feature(decl_macro, extern_prelude)]
|
||||
|
||||
macro_rules! add_macro_expanded_things_to_macro_prelude {() => {
|
||||
#[macro_use]
|
||||
extern crate macro_in_other_crate;
|
||||
}}
|
||||
|
||||
add_macro_expanded_things_to_macro_prelude!();
|
||||
|
||||
mod m1 {
|
||||
fn check() {
|
||||
inline!(); //~ ERROR `inline` is ambiguous
|
||||
}
|
||||
}
|
||||
|
||||
mod m2 {
|
||||
pub mod std {
|
||||
pub macro panic() {}
|
||||
}
|
||||
}
|
||||
|
||||
mod m3 {
|
||||
use m2::*; // glob-import user-defined `std`
|
||||
fn check() {
|
||||
std::panic!(); //~ ERROR `std` is ambiguous
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
42
src/test/ui/macro-path-prelude-shadowing.stderr
Normal file
42
src/test/ui/macro-path-prelude-shadowing.stderr
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
error[E0659]: `inline` is ambiguous
|
||||
--> $DIR/macro-path-prelude-shadowing.rs:24:9
|
||||
|
|
||||
LL | inline!(); //~ ERROR `inline` is ambiguous
|
||||
| ^^^^^^
|
||||
|
|
||||
note: `inline` could refer to the name imported here
|
||||
--> $DIR/macro-path-prelude-shadowing.rs:16:5
|
||||
|
|
||||
LL | #[macro_use]
|
||||
| ^^^^^^^^^^^^
|
||||
...
|
||||
LL | add_macro_expanded_things_to_macro_prelude!();
|
||||
| ---------------------------------------------- in this macro invocation
|
||||
note: `inline` could also refer to the name defined here
|
||||
--> $DIR/macro-path-prelude-shadowing.rs:24:9
|
||||
|
|
||||
LL | inline!(); //~ ERROR `inline` is ambiguous
|
||||
| ^^^^^^
|
||||
= note: macro-expanded macro imports do not shadow
|
||||
|
||||
error[E0659]: `std` is ambiguous
|
||||
--> $DIR/macro-path-prelude-shadowing.rs:37:9
|
||||
|
|
||||
LL | std::panic!(); //~ ERROR `std` is ambiguous
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
note: `std` could refer to the name imported here
|
||||
--> $DIR/macro-path-prelude-shadowing.rs:35:9
|
||||
|
|
||||
LL | use m2::*; // glob-import user-defined `std`
|
||||
| ^^^^^
|
||||
note: `std` could also refer to the name defined here
|
||||
--> $DIR/macro-path-prelude-shadowing.rs:37:9
|
||||
|
|
||||
LL | std::panic!(); //~ ERROR `std` is ambiguous
|
||||
| ^^^
|
||||
= note: consider adding an explicit import of `std` to disambiguate
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0659`.
|
||||
15
src/test/ui/tool-attributes-disabled-1.rs
Normal file
15
src/test/ui/tool-attributes-disabled-1.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// If macro modularization (`use_extern_macros`) is not enabled,
|
||||
// then tool attributes are treated as custom attributes.
|
||||
|
||||
#[rustfmt::bar] //~ ERROR The attribute `rustfmt::bar` is currently unknown to the compiler
|
||||
fn main() {}
|
||||
11
src/test/ui/tool-attributes-disabled-1.stderr
Normal file
11
src/test/ui/tool-attributes-disabled-1.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0658]: The attribute `rustfmt::bar` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
|
||||
--> $DIR/tool-attributes-disabled-1.rs:14:1
|
||||
|
|
||||
LL | #[rustfmt::bar] //~ ERROR The attribute `rustfmt::bar` is currently unknown to the compiler
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(custom_attribute)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
19
src/test/ui/tool-attributes-disabled-2.rs
Normal file
19
src/test/ui/tool-attributes-disabled-2.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// If macro modularization (`use_extern_macros`) is not enabled,
|
||||
// then tool attributes are treated as custom attributes.
|
||||
|
||||
// compile-pass
|
||||
|
||||
#![feature(custom_attribute)]
|
||||
|
||||
#[rustfmt::bar]
|
||||
fn main() {}
|
||||
28
src/test/ui/tool-attributes-misplaced-1.rs
Normal file
28
src/test/ui/tool-attributes-misplaced-1.rs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(tool_attributes)]
|
||||
|
||||
type A = rustfmt; //~ ERROR expected type, found tool module `rustfmt`
|
||||
type B = rustfmt::skip; //~ ERROR expected type, found non-macro attribute `rustfmt::skip`
|
||||
|
||||
#[derive(rustfmt)] //~ ERROR cannot find derive macro `rustfmt` in this scope
|
||||
struct S;
|
||||
|
||||
#[rustfmt] //~ ERROR cannot find attribute macro `rustfmt` in this scope
|
||||
fn check() {}
|
||||
|
||||
#[rustfmt::skip] // OK
|
||||
fn main() {
|
||||
rustfmt; //~ ERROR expected value, found tool module `rustfmt`
|
||||
rustfmt!(); //~ ERROR cannot find macro `rustfmt!` in this scope
|
||||
|
||||
rustfmt::skip; //~ ERROR expected value, found non-macro attribute `rustfmt::skip`
|
||||
}
|
||||
46
src/test/ui/tool-attributes-misplaced-1.stderr
Normal file
46
src/test/ui/tool-attributes-misplaced-1.stderr
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
error: cannot find derive macro `rustfmt` in this scope
|
||||
--> $DIR/tool-attributes-misplaced-1.rs:16:10
|
||||
|
|
||||
LL | #[derive(rustfmt)] //~ ERROR cannot find derive macro `rustfmt` in this scope
|
||||
| ^^^^^^^
|
||||
|
||||
error: cannot find attribute macro `rustfmt` in this scope
|
||||
--> $DIR/tool-attributes-misplaced-1.rs:19:3
|
||||
|
|
||||
LL | #[rustfmt] //~ ERROR cannot find attribute macro `rustfmt` in this scope
|
||||
| ^^^^^^^
|
||||
|
||||
error: cannot find macro `rustfmt!` in this scope
|
||||
--> $DIR/tool-attributes-misplaced-1.rs:25:5
|
||||
|
|
||||
LL | rustfmt!(); //~ ERROR cannot find macro `rustfmt!` in this scope
|
||||
| ^^^^^^^
|
||||
|
||||
error[E0573]: expected type, found tool module `rustfmt`
|
||||
--> $DIR/tool-attributes-misplaced-1.rs:13:10
|
||||
|
|
||||
LL | type A = rustfmt; //~ ERROR expected type, found tool module `rustfmt`
|
||||
| ^^^^^^^ not a type
|
||||
|
||||
error[E0573]: expected type, found non-macro attribute `rustfmt::skip`
|
||||
--> $DIR/tool-attributes-misplaced-1.rs:14:10
|
||||
|
|
||||
LL | type B = rustfmt::skip; //~ ERROR expected type, found non-macro attribute `rustfmt::skip`
|
||||
| ^^^^^^^^^^^^^ not a type
|
||||
|
||||
error[E0423]: expected value, found tool module `rustfmt`
|
||||
--> $DIR/tool-attributes-misplaced-1.rs:24:5
|
||||
|
|
||||
LL | rustfmt; //~ ERROR expected value, found tool module `rustfmt`
|
||||
| ^^^^^^^ not a value
|
||||
|
||||
error[E0423]: expected value, found non-macro attribute `rustfmt::skip`
|
||||
--> $DIR/tool-attributes-misplaced-1.rs:27:5
|
||||
|
|
||||
LL | rustfmt::skip; //~ ERROR expected value, found non-macro attribute `rustfmt::skip`
|
||||
| ^^^^^^^^^^^^^ not a value
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
Some errors occurred: E0423, E0573.
|
||||
For more information about an error, try `rustc --explain E0423`.
|
||||
18
src/test/ui/tool-attributes-misplaced-2.rs
Normal file
18
src/test/ui/tool-attributes-misplaced-2.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(tool_attributes)]
|
||||
|
||||
#[derive(rustfmt::skip)] //~ ERROR expected a macro, found non-macro attribute
|
||||
struct S;
|
||||
|
||||
fn main() {
|
||||
rustfmt::skip!(); //~ ERROR expected a macro, found non-macro attribute
|
||||
}
|
||||
14
src/test/ui/tool-attributes-misplaced-2.stderr
Normal file
14
src/test/ui/tool-attributes-misplaced-2.stderr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
error: expected a macro, found non-macro attribute
|
||||
--> $DIR/tool-attributes-misplaced-2.rs:13:10
|
||||
|
|
||||
LL | #[derive(rustfmt::skip)] //~ ERROR expected a macro, found non-macro attribute
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: expected a macro, found non-macro attribute
|
||||
--> $DIR/tool-attributes-misplaced-2.rs:17:5
|
||||
|
|
||||
LL | rustfmt::skip!(); //~ ERROR expected a macro, found non-macro attribute
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
16
src/test/ui/tool-attributes-shadowing.rs
Normal file
16
src/test/ui/tool-attributes-shadowing.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(tool_attributes, proc_macro_path_invoc)]
|
||||
|
||||
mod rustfmt {}
|
||||
|
||||
#[rustfmt::skip] //~ ERROR failed to resolve. Could not find `skip` in `rustfmt`
|
||||
fn main() {}
|
||||
9
src/test/ui/tool-attributes-shadowing.stderr
Normal file
9
src/test/ui/tool-attributes-shadowing.stderr
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
error[E0433]: failed to resolve. Could not find `skip` in `rustfmt`
|
||||
--> $DIR/tool-attributes-shadowing.rs:15:12
|
||||
|
|
||||
LL | #[rustfmt::skip] //~ ERROR failed to resolve. Could not find `skip` in `rustfmt`
|
||||
| ^^^^ Could not find `skip` in `rustfmt`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0433`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue