diff options
| author | bors <bors@rust-lang.org> | 2019-07-19 00:24:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-07-19 00:24:39 +0000 |
| commit | fe499a7b34dcb1fc054dd637ea561a19a268d2de (patch) | |
| tree | b4dbe1763cb8a971531e046b3a708e78dc2f6c26 /src/test/ui/feature-gates | |
| parent | a3369981deff35f1c8d9a29e99358593959bd06e (diff) | |
| parent | 1b4fbfca4181c6779b75a4a1dc6c8fd538d6edcc (diff) | |
| download | rust-fe499a7b34dcb1fc054dd637ea561a19a268d2de.tar.gz rust-fe499a7b34dcb1fc054dd637ea561a19a268d2de.zip | |
Auto merge of #62684 - petrochenkov:scopevisit, r=davidtwco
resolve: Improve candidate search for unresolved macro suggestions Use same scope visiting machinery for both collecting suggestion candidates and actually resolving the names. The PR is better read in per-commit fashion with whitespace changes ignored (the first commit in particular moves some code around). This should be the last pre-requisite for https://github.com/rust-lang/rust/pull/62086. r? @davidtwco
Diffstat (limited to 'src/test/ui/feature-gates')
4 files changed, 43 insertions, 91 deletions
diff --git a/src/test/ui/feature-gates/feature-gate-custom_attribute.rs b/src/test/ui/feature-gates/feature-gate-custom_attribute.rs index f31c9d5afc4..d34936b42a6 100644 --- a/src/test/ui/feature-gates/feature-gate-custom_attribute.rs +++ b/src/test/ui/feature-gates/feature-gate-custom_attribute.rs @@ -1,23 +1,18 @@ // Check that literals in attributes parse just fine. +#[fake_attr] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr(100)] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr(1, 2, 3)] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr("hello")] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr(name = "hello")] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR cannot find attribute macro `fake_attr` in th +#[fake_attr(key = "hello", val = 10)] //~ ERROR cannot find attribute macro `fake_attr` in this scop +#[fake_attr(key("hello"), val(10))] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr(enabled = true, disabled = false)] //~ ERROR cannot find attribute macro `fake_attr` in +#[fake_attr(true)] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr(pi = 3.14159)] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr(b"hi")] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_doc(r"doc")] //~ ERROR cannot find attribute macro `fake_doc` in this scope +struct Q {} -#![allow(dead_code)] -#![allow(unused_variables)] - -#[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_doc(r"doc")] //~ ERROR attribute `fake_doc` is currently unknown -struct Q { } - - -fn main() { } +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr b/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr index 12175feadd6..efdc2d1cd31 100644 --- a/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr +++ b/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr @@ -1,120 +1,80 @@ -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:7:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:3:3 | LL | #[fake_attr] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:8:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:4:3 | LL | #[fake_attr(100)] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:9:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:5:3 | LL | #[fake_attr(1, 2, 3)] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:10:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:6:3 | LL | #[fake_attr("hello")] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:11:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:7:3 | LL | #[fake_attr(name = "hello")] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:12:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:8:3 | LL | #[fake_attr(1, "hi", key = 12, true, false)] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:13:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:9:3 | LL | #[fake_attr(key = "hello", val = 10)] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:14:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:10:3 | LL | #[fake_attr(key("hello"), val(10))] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:15:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:11:3 | LL | #[fake_attr(enabled = true, disabled = false)] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:16:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:12:3 | LL | #[fake_attr(true)] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:17:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:13:3 | LL | #[fake_attr(pi = 3.14159)] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:18:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:14:3 | LL | #[fake_attr(b"hi")] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_doc` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:19:3 +error: cannot find attribute macro `fake_doc` in this scope + --> $DIR/feature-gate-custom_attribute.rs:15:3 | LL | #[fake_doc(r"doc")] | ^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable error: aborting due to 13 previous errors -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs b/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs index 9ce2fb58ab0..13983726c78 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs +++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs @@ -19,5 +19,5 @@ fn g() {} //~^ ERROR used by the test suite #[rustc_unknown] //~^ ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler -//~| ERROR attribute `rustc_unknown` is currently unknown +//~| ERROR cannot find attribute macro `rustc_unknown` in this scope fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr b/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr index 7c5aa5381e8..23cf936ee83 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr +++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr @@ -37,14 +37,11 @@ LL | #[rustc_unknown] = note: for more information, see https://github.com/rust-lang/rust/issues/29642 = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable -error[E0658]: The attribute `rustc_unknown` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `rustc_unknown` in this scope --> $DIR/feature-gate-rustc-attrs.rs:20:3 | LL | #[rustc_unknown] | ^^^^^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable error[E0658]: used by the test suite --> $DIR/feature-gate-rustc-attrs.rs:18:1 |
