about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Wood <david@davidtw.co>2020-08-04 10:47:07 +0100
committerDavid Wood <david@davidtw.co>2020-08-16 15:42:22 +0100
commit734441c1ae5f0766842d37db68f606a1bca49836 (patch)
tree226c93e31b0cd303792c5c1de487d409161a2bcf
parent764dc3dc2f8a2a421fa9d9c6144ad75310a26b99 (diff)
downloadrust-734441c1ae5f0766842d37db68f606a1bca49836.tar.gz
rust-734441c1ae5f0766842d37db68f606a1bca49836.zip
tests: add test for #61019's current behaviour
This commit adds a test for #61019 where a extern crate is imported as
`std` which results in name resolution to fail due to the uses of `std`
types introduced from lowering.

Signed-off-by: David Wood <david@davidtw.co>
-rw-r--r--src/test/ui/hygiene/hir-res-hygiene.rs41
-rw-r--r--src/test/ui/hygiene/hir-res-hygiene.stderr49
2 files changed, 90 insertions, 0 deletions
diff --git a/src/test/ui/hygiene/hir-res-hygiene.rs b/src/test/ui/hygiene/hir-res-hygiene.rs
new file mode 100644
index 00000000000..e5af1000dd5
--- /dev/null
+++ b/src/test/ui/hygiene/hir-res-hygiene.rs
@@ -0,0 +1,41 @@
+//~ ERROR failed to resolve: could not find `future` in `std` [E0433]
+//~^ ERROR failed to resolve: could not find `pin` in `std` [E0433]
+//~^^ ERROR failed to resolve: could not find `future` in `std` [E0433]
+//~^^^ ERROR failed to resolve: could not find `future` in `std` [E0433]
+//~^^^^ ERROR failed to resolve: could not find `task` in `std` [E0433]
+//~^^^^^ ERROR failed to resolve: could not find `task` in `std` [E0433]
+//~^^^^^^ ERROR failed to resolve: could not find `future` in `std` [E0433]
+//~^^^^^^^ ERROR failed to resolve: could not find `future` in `std` [E0433]
+//~^^^^^^^^ ERROR failed to resolve: could not find `ops` in `std` [E0433]
+//~^^^^^^^^^ ERROR failed to resolve: could not find `option` in `std` [E0433]
+//~^^^^^^^^^^ ERROR failed to resolve: could not find `option` in `std` [E0433]
+//~^^^^^^^^^^^ ERROR failed to resolve: could not find `iter` in `std` [E0433]
+//~^^^^^^^^^^^^ ERROR failed to resolve: could not find `iter` in `std` [E0433]
+//~^^^^^^^^^^^^^ ERROR failed to resolve: could not find `ops` in `std` [E0433]
+//~^^^^^^^^^^^^^^ ERROR failed to resolve: could not find `option` in `std` [E0433]
+//~^^^^^^^^^^^^^^^ ERROR failed to resolve: could not find `option` in `std` [E0433]
+//~^^^^^^^^^^^^^^^^ ERROR failed to resolve: could not find `iter` in `std` [E0433]
+//~^^^^^^^^^^^^^^^^^ ERROR failed to resolve: could not find `iter` in `std` [E0433]
+//~^^^^^^^^^^^^^^^^^^ ERROR failed to resolve: could not find `ops` in `std` [E0433]
+//~^^^^^^^^^^^^^^^^^^^ ERROR failed to resolve: could not find `result` in `std` [E0433]
+//~^^^^^^^^^^^^^^^^^^^^ ERROR failed to resolve: could not find `convert` in `std` [E0433]
+//~^^^^^^^^^^^^^^^^^^^^^ ERROR failed to resolve: could not find `ops` in `std` [E0433]
+//~^^^^^^^^^^^^^^^^^^^^^^ ERROR failed to resolve: could not find `result` in `std` [E0433]
+
+// edition:2018
+// aux-build:not-libstd.rs
+
+// Check that paths created in HIR are not affected by in scope names.
+
+extern crate not_libstd as std;
+
+async fn the_future() {
+    async {}.await;
+}
+
+fn main() -> Result<(), ()> {
+    for i in 0..10 {}
+    for j in 0..=10 {}
+    Ok(())?;
+    Ok(())
+}
diff --git a/src/test/ui/hygiene/hir-res-hygiene.stderr b/src/test/ui/hygiene/hir-res-hygiene.stderr
new file mode 100644
index 00000000000..73a1bd5c626
--- /dev/null
+++ b/src/test/ui/hygiene/hir-res-hygiene.stderr
@@ -0,0 +1,49 @@
+error[E0433]: failed to resolve: could not find `future` in `std`
+
+error[E0433]: failed to resolve: could not find `pin` in `std`
+
+error[E0433]: failed to resolve: could not find `future` in `std`
+
+error[E0433]: failed to resolve: could not find `future` in `std`
+
+error[E0433]: failed to resolve: could not find `task` in `std`
+
+error[E0433]: failed to resolve: could not find `task` in `std`
+
+error[E0433]: failed to resolve: could not find `future` in `std`
+
+error[E0433]: failed to resolve: could not find `future` in `std`
+
+error[E0433]: failed to resolve: could not find `ops` in `std`
+
+error[E0433]: failed to resolve: could not find `option` in `std`
+
+error[E0433]: failed to resolve: could not find `option` in `std`
+
+error[E0433]: failed to resolve: could not find `iter` in `std`
+
+error[E0433]: failed to resolve: could not find `iter` in `std`
+
+error[E0433]: failed to resolve: could not find `ops` in `std`
+
+error[E0433]: failed to resolve: could not find `option` in `std`
+
+error[E0433]: failed to resolve: could not find `option` in `std`
+
+error[E0433]: failed to resolve: could not find `iter` in `std`
+
+error[E0433]: failed to resolve: could not find `iter` in `std`
+
+error[E0433]: failed to resolve: could not find `ops` in `std`
+
+error[E0433]: failed to resolve: could not find `result` in `std`
+
+error[E0433]: failed to resolve: could not find `convert` in `std`
+
+error[E0433]: failed to resolve: could not find `ops` in `std`
+
+error[E0433]: failed to resolve: could not find `result` in `std`
+
+error: aborting due to 23 previous errors
+
+For more information about this error, try `rustc --explain E0433`.