-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolve: Future proof resolutions for potentially built-in attributes
- Loading branch information
1 parent
634d886
commit 3ef8754
Showing
7 changed files
with
239 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// compile-flags:--test | ||
|
||
#![feature(decl_macro, test)] | ||
|
||
extern crate test; | ||
|
||
macro test() {} | ||
|
||
#[test] //~ ERROR `test` is ambiguous | ||
fn test() {} | ||
|
||
macro bench() {} | ||
|
||
#[bench] //~ ERROR `bench` is ambiguous | ||
fn bench(b: &mut test::Bencher) {} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
error[E0659]: `test` is ambiguous | ||
--> $DIR/ambiguous-builtin-attrs-test.rs:9:3 | ||
| | ||
LL | #[test] //~ ERROR `test` is ambiguous | ||
| ^^^^ | ||
| | ||
note: `test` could refer to the name defined here | ||
--> $DIR/ambiguous-builtin-attrs-test.rs:7:1 | ||
| | ||
LL | macro test() {} | ||
| ^^^^^^^^^^^^^^^ | ||
note: `test` could also refer to the name defined here | ||
--> $DIR/ambiguous-builtin-attrs-test.rs:9:3 | ||
| | ||
LL | #[test] //~ ERROR `test` is ambiguous | ||
| ^^^^ | ||
|
||
error[E0659]: `bench` is ambiguous | ||
--> $DIR/ambiguous-builtin-attrs-test.rs:14:3 | ||
| | ||
LL | #[bench] //~ ERROR `bench` is ambiguous | ||
| ^^^^^ | ||
| | ||
note: `bench` could refer to the name defined here | ||
--> $DIR/ambiguous-builtin-attrs-test.rs:12:1 | ||
| | ||
LL | macro bench() {} | ||
| ^^^^^^^^^^^^^^^^ | ||
note: `bench` could also refer to the name defined here | ||
--> $DIR/ambiguous-builtin-attrs-test.rs:14:3 | ||
| | ||
LL | #[bench] //~ ERROR `bench` is ambiguous | ||
| ^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0659`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#![feature(decl_macro)] | ||
|
||
macro repr() {} | ||
|
||
#[repr(C)] //~ ERROR `repr` is ambiguous | ||
struct S; | ||
#[cfg_attr(all(), repr(C))] //~ ERROR `repr` is ambiguous | ||
struct SCond; | ||
|
||
macro cfg() {} | ||
|
||
#[cfg(all())] //~ ERROR `cfg` is ambiguous | ||
struct A; | ||
#[cfg(any())] // ERROR FIXME | ||
struct A; | ||
|
||
macro cfg_attr() {} | ||
|
||
#[cfg_attr(all(), cold)] // ERROR FIXME | ||
fn g() {} | ||
#[cfg_attr(any(), cold)] // ERROR FIXME | ||
fn h() {} | ||
|
||
macro derive() {} | ||
|
||
#[derive(Clone)] // ERROR FIXME | ||
struct B; | ||
|
||
macro test() {} | ||
|
||
#[test] // ERROR FIXME | ||
fn test() {} | ||
|
||
macro bench() {} | ||
|
||
#[bench] // ERROR FIXME | ||
fn bench() {} | ||
|
||
macro_rules! inline { () => () } | ||
|
||
#[inline] //~ ERROR `inline` is ambiguous | ||
fn f() {} | ||
#[cfg_attr(all(), inline)] //~ ERROR `inline` is ambiguous | ||
fn f_cond() {} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
error[E0659]: `repr` is ambiguous | ||
--> $DIR/ambiguous-builtin-attrs.rs:5:3 | ||
| | ||
LL | #[repr(C)] //~ ERROR `repr` is ambiguous | ||
| ^^^^ | ||
| | ||
note: `repr` could refer to the name defined here | ||
--> $DIR/ambiguous-builtin-attrs.rs:3:1 | ||
| | ||
LL | macro repr() {} | ||
| ^^^^^^^^^^^^^^^ | ||
note: `repr` could also refer to the name defined here | ||
--> $DIR/ambiguous-builtin-attrs.rs:5:3 | ||
| | ||
LL | #[repr(C)] //~ ERROR `repr` is ambiguous | ||
| ^^^^ | ||
|
||
error[E0659]: `repr` is ambiguous | ||
--> $DIR/ambiguous-builtin-attrs.rs:7:19 | ||
| | ||
LL | #[cfg_attr(all(), repr(C))] //~ ERROR `repr` is ambiguous | ||
| ^^^^ | ||
| | ||
note: `repr` could refer to the name defined here | ||
--> $DIR/ambiguous-builtin-attrs.rs:3:1 | ||
| | ||
LL | macro repr() {} | ||
| ^^^^^^^^^^^^^^^ | ||
note: `repr` could also refer to the name defined here | ||
--> $DIR/ambiguous-builtin-attrs.rs:7:19 | ||
| | ||
LL | #[cfg_attr(all(), repr(C))] //~ ERROR `repr` is ambiguous | ||
| ^^^^ | ||
|
||
error[E0659]: `cfg` is ambiguous | ||
--> $DIR/ambiguous-builtin-attrs.rs:12:3 | ||
| | ||
LL | #[cfg(all())] //~ ERROR `cfg` is ambiguous | ||
| ^^^ | ||
| | ||
note: `cfg` could refer to the name defined here | ||
--> $DIR/ambiguous-builtin-attrs.rs:10:1 | ||
| | ||
LL | macro cfg() {} | ||
| ^^^^^^^^^^^^^^ | ||
note: `cfg` could also refer to the name defined here | ||
--> $DIR/ambiguous-builtin-attrs.rs:12:3 | ||
| | ||
LL | #[cfg(all())] //~ ERROR `cfg` is ambiguous | ||
| ^^^ | ||
|
||
error[E0659]: `inline` is ambiguous | ||
--> $DIR/ambiguous-builtin-attrs.rs:41:3 | ||
| | ||
LL | #[inline] //~ ERROR `inline` is ambiguous | ||
| ^^^^^^ | ||
| | ||
note: `inline` could refer to the name defined here | ||
--> $DIR/ambiguous-builtin-attrs.rs:39:1 | ||
| | ||
LL | macro_rules! inline { () => () } | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: `inline` could also refer to the name defined here | ||
--> $DIR/ambiguous-builtin-attrs.rs:41:3 | ||
| | ||
LL | #[inline] //~ ERROR `inline` is ambiguous | ||
| ^^^^^^ | ||
|
||
error[E0659]: `inline` is ambiguous | ||
--> $DIR/ambiguous-builtin-attrs.rs:43:19 | ||
| | ||
LL | #[cfg_attr(all(), inline)] //~ ERROR `inline` is ambiguous | ||
| ^^^^^^ | ||
| | ||
note: `inline` could refer to the name defined here | ||
--> $DIR/ambiguous-builtin-attrs.rs:39:1 | ||
| | ||
LL | macro_rules! inline { () => () } | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: `inline` could also refer to the name defined here | ||
--> $DIR/ambiguous-builtin-attrs.rs:43:19 | ||
| | ||
LL | #[cfg_attr(all(), inline)] //~ ERROR `inline` is ambiguous | ||
| ^^^^^^ | ||
|
||
error: aborting due to 5 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0659`. |