summaryrefslogtreecommitdiffstats
path: root/tests/ui/hygiene
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:24 +0000
commit023939b627b7dc93b01471f7d41fb8553ddb4ffa (patch)
tree60fc59477c605c72b0a1051409062ddecc43f877 /tests/ui/hygiene
parentAdding debian version 1.72.1+dfsg1-1. (diff)
downloadrustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.tar.xz
rustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/hygiene')
-rw-r--r--tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs29
-rw-r--r--tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr53
-rw-r--r--tests/ui/hygiene/extern-prelude-from-opaque-fail.rs1
-rw-r--r--tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr20
-rw-r--r--tests/ui/hygiene/fields-numeric-borrowck.stderr2
-rw-r--r--tests/ui/hygiene/panic-location.run.stderr3
6 files changed, 102 insertions, 6 deletions
diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs
new file mode 100644
index 000000000..40c5eacee
--- /dev/null
+++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs
@@ -0,0 +1,29 @@
+// edition:2018
+#![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 crate 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 crate or module `my_core`
+}
+
+fn main() {}
diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr
new file mode 100644
index 000000000..7ed15e89c
--- /dev/null
+++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr
@@ -0,0 +1,53 @@
+error[E0432]: unresolved import `my_core`
+ --> $DIR/extern-prelude-from-opaque-fail-2018.rs:21:9
+ |
+LL | use my_core;
+ | ^^^^^^^ no external crate `my_core`
+
+error[E0432]: unresolved import `my_core`
+ --> $DIR/extern-prelude-from-opaque-fail-2018.rs:8:13
+ |
+LL | use my_core;
+ | ^^^^^^^ no external crate `my_core`
+...
+LL | a!();
+ | ---- in this macro invocation
+ |
+ = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
+ --> $DIR/extern-prelude-from-opaque-fail-2018.rs:12:18
+ |
+LL | fn f() { my_core::mem::drop(0); }
+ | ^^^^^^^ use of undeclared crate or module `my_core`
+...
+LL | a!();
+ | ---- in this macro invocation
+ |
+ = help: consider importing one of these items:
+ std::mem
+ core::mem
+ = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
+ --> $DIR/extern-prelude-from-opaque-fail-2018.rs:25:14
+ |
+LL | fn f() { my_core::mem::drop(0); }
+ | ^^^^^^^ use of undeclared crate or module `my_core`
+ |
+help: consider importing one of these items
+ |
+LL + use core::mem;
+ |
+LL + use std::mem;
+ |
+help: if you import `mem`, refer to it directly
+ |
+LL - fn f() { my_core::mem::drop(0); }
+LL + fn f() { mem::drop(0); }
+ |
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0432, E0433.
+For more information about an error, try `rustc --explain E0432`.
diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs b/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs
index 571017df4..f3fa2ddda 100644
--- a/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs
+++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs
@@ -1,3 +1,4 @@
+// edition:2015
#![feature(decl_macro)]
macro a() {
diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr b/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr
index f1f4caee3..13b2827ef 100644
--- a/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr
+++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr
@@ -1,11 +1,11 @@
error[E0432]: unresolved import `my_core`
- --> $DIR/extern-prelude-from-opaque-fail.rs:20:9
+ --> $DIR/extern-prelude-from-opaque-fail.rs:21:9
|
LL | use my_core;
| ^^^^^^^ no `my_core` in the root
error[E0432]: unresolved import `my_core`
- --> $DIR/extern-prelude-from-opaque-fail.rs:7:13
+ --> $DIR/extern-prelude-from-opaque-fail.rs:8:13
|
LL | use my_core;
| ^^^^^^^ no `my_core` in the root
@@ -16,7 +16,7 @@ LL | a!();
= note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
- --> $DIR/extern-prelude-from-opaque-fail.rs:11:18
+ --> $DIR/extern-prelude-from-opaque-fail.rs:12:18
|
LL | fn f() { my_core::mem::drop(0); }
| ^^^^^^^ use of undeclared crate or module `my_core`
@@ -24,13 +24,25 @@ LL | fn f() { my_core::mem::drop(0); }
LL | a!();
| ---- in this macro invocation
|
+ = help: consider importing this module:
+ my_core::mem
= note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
- --> $DIR/extern-prelude-from-opaque-fail.rs:24:14
+ --> $DIR/extern-prelude-from-opaque-fail.rs:25:14
|
LL | fn f() { my_core::mem::drop(0); }
| ^^^^^^^ use of undeclared crate or module `my_core`
+ |
+help: consider importing this module
+ |
+LL + use my_core::mem;
+ |
+help: if you import `mem`, refer to it directly
+ |
+LL - fn f() { my_core::mem::drop(0); }
+LL + fn f() { mem::drop(0); }
+ |
error: aborting due to 4 previous errors
diff --git a/tests/ui/hygiene/fields-numeric-borrowck.stderr b/tests/ui/hygiene/fields-numeric-borrowck.stderr
index bc13aa62f..fb90825c0 100644
--- a/tests/ui/hygiene/fields-numeric-borrowck.stderr
+++ b/tests/ui/hygiene/fields-numeric-borrowck.stderr
@@ -7,7 +7,7 @@ LL | let S { 0: ref mut borrow2 } = s;
| ^^^^^^^^^^^^^^^ second mutable borrow occurs here
...
LL | borrow1.use_mut();
- | ----------------- first borrow later used here
+ | ------- first borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/hygiene/panic-location.run.stderr b/tests/ui/hygiene/panic-location.run.stderr
index a7252a400..5ed0d9fcf 100644
--- a/tests/ui/hygiene/panic-location.run.stderr
+++ b/tests/ui/hygiene/panic-location.run.stderr
@@ -1,2 +1,3 @@
-thread 'main' panicked at 'capacity overflow', library/alloc/src/raw_vec.rs:524:5
+thread 'main' panicked at library/alloc/src/raw_vec.rs:534:5:
+capacity overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace