-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test for the issue resolved by removing `resolve_macro_path` Add a test making sure that extern prelude entries introduced from an opaque macro are not visible anywhere, even it that macro Fix test output after rebase
- Loading branch information
1 parent
7b74d72
commit e86e5cb
Showing
7 changed files
with
128 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// force-host | ||
// no-prefer-dynamic | ||
|
||
#![crate_type = "proc-macro"] | ||
|
||
extern crate proc_macro; | ||
use proc_macro::*; | ||
|
||
#[proc_macro_derive(NoMarker)] | ||
pub fn f(input: TokenStream) -> TokenStream { | ||
if input.to_string().contains("rustc_copy_clone_marker") { | ||
panic!("found `#[rustc_copy_clone_marker]`"); | ||
} | ||
TokenStream::new() | ||
} |
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,16 @@ | ||
// Test that `#[rustc_copy_clone_marker]` is not injected when a user-defined derive shadows | ||
// a built-in derive in non-trivial scope (e.g. in a nested module). | ||
|
||
// check-pass | ||
// aux-build:derive-marker-tricky.rs | ||
|
||
extern crate derive_marker_tricky; | ||
|
||
mod m { | ||
use derive_marker_tricky::NoMarker as Copy; | ||
|
||
#[derive(Copy)] | ||
struct S; | ||
} | ||
|
||
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,28 @@ | ||
#![feature(decl_macro)] | ||
|
||
macro a() { | ||
extern crate core as my_core; | ||
mod v { | ||
// Early resolution. | ||
use my_core; //~ ERROR unresolved import `my_core` | ||
} | ||
mod u { | ||
// Late resolution. | ||
fn f() { my_core::mem::drop(0); } | ||
//~^ ERROR failed to resolve: use of undeclared type or module `my_core` | ||
} | ||
} | ||
|
||
a!(); | ||
|
||
mod v { | ||
// Early resolution. | ||
use my_core; //~ ERROR unresolved import `my_core` | ||
} | ||
mod u { | ||
// Late resolution. | ||
fn f() { my_core::mem::drop(0); } | ||
//~^ ERROR failed to resolve: use of undeclared type or module `my_core` | ||
} | ||
|
||
fn main() {} |
37 changes: 37 additions & 0 deletions
37
src/test/ui/hygiene/extern-prelude-from-opaque-fail.stderr
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[E0432]: unresolved import `my_core` | ||
--> $DIR/extern-prelude-from-opaque-fail.rs:20:9 | ||
| | ||
LL | use my_core; | ||
| ^^^^^^^ | ||
| | | ||
| no `my_core` in the root | ||
| help: a similar name exists in the module: `my_core` | ||
|
||
error[E0432]: unresolved import `my_core` | ||
--> $DIR/extern-prelude-from-opaque-fail.rs:7:13 | ||
| | ||
LL | use my_core; | ||
| ^^^^^^^ no `my_core` in the root | ||
... | ||
LL | a!(); | ||
| ----- in this macro invocation | ||
|
||
error[E0433]: failed to resolve: use of undeclared type or module `my_core` | ||
--> $DIR/extern-prelude-from-opaque-fail.rs:11:18 | ||
| | ||
LL | fn f() { my_core::mem::drop(0); } | ||
| ^^^^^^^ use of undeclared type or module `my_core` | ||
... | ||
LL | a!(); | ||
| ----- in this macro invocation | ||
|
||
error[E0433]: failed to resolve: use of undeclared type or module `my_core` | ||
--> $DIR/extern-prelude-from-opaque-fail.rs:24:14 | ||
| | ||
LL | fn f() { my_core::mem::drop(0); } | ||
| ^^^^^^^ use of undeclared type or module `my_core` | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
Some errors have detailed explanations: E0432, E0433. | ||
For more information about an error, try `rustc --explain E0432`. |
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,14 @@ | ||
// Regression test for the issue #44692 | ||
|
||
macro_rules! hang { () => { | ||
{ //~ ERROR format argument must be a string literal | ||
#[derive(Clone)] | ||
struct S; | ||
|
||
"" | ||
} | ||
}} | ||
|
||
fn main() { | ||
format_args!(hang!()); | ||
} |
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 @@ | ||
error: format argument must be a string literal | ||
--> $DIR/derive-in-eager-expansion-hang.rs:4:5 | ||
| | ||
LL | / { | ||
LL | | #[derive(Clone)] | ||
LL | | struct S; | ||
LL | | | ||
LL | | "" | ||
LL | | } | ||
| |_____^ | ||
help: you might be missing a string literal to format with | ||
| | ||
LL | format_args!("{}", hang!()); | ||
| ^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
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