--- /dev/null
+// 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()
+}
--- /dev/null
+// 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() {}
--- /dev/null
+#![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() {}
--- /dev/null
+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`.
--- /dev/null
+// 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!());
+}
--- /dev/null
+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
+
| ^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
- = help: add #![feature(custom_attribute)] to the crate attributes to enable
+ = help: add `#![feature(custom_attribute)]` to the crate attributes to enable
error: can't use a procedural macro from the same crate that defines it
--> $DIR/macro-namespace-reserved-2.rs:39:3