about summary refs log tree commit diff
path: root/tests/ui/resolve
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/resolve')
-rw-r--r--tests/ui/resolve/cannot-find-value-in-scope-22811.rs2
-rw-r--r--tests/ui/resolve/cannot-find-value-in-scope-22811.stderr9
-rw-r--r--tests/ui/resolve/multiple_definitions_attribute_merging.rs2
-rw-r--r--tests/ui/resolve/pointer-type-impls-14254.rs94
-rw-r--r--tests/ui/resolve/proc_macro_generated_packed.rs2
-rw-r--r--tests/ui/resolve/reference-clone-nonclone-11820.rs15
-rw-r--r--tests/ui/resolve/unresolved-module-error-33293.rs7
-rw-r--r--tests/ui/resolve/unresolved-module-error-33293.stderr11
-rw-r--r--tests/ui/resolve/use-shadowing-14082.rs21
9 files changed, 161 insertions, 2 deletions
diff --git a/tests/ui/resolve/cannot-find-value-in-scope-22811.rs b/tests/ui/resolve/cannot-find-value-in-scope-22811.rs
new file mode 100644
index 00000000000..fc07ae5e60e
--- /dev/null
+++ b/tests/ui/resolve/cannot-find-value-in-scope-22811.rs
@@ -0,0 +1,2 @@
+// https://github.com/rust-lang/rust/issues/22811
+fn main() { println!("{}", foobar); } //~ ERROR cannot find value `foobar` in this scope
diff --git a/tests/ui/resolve/cannot-find-value-in-scope-22811.stderr b/tests/ui/resolve/cannot-find-value-in-scope-22811.stderr
new file mode 100644
index 00000000000..529fd7e8f49
--- /dev/null
+++ b/tests/ui/resolve/cannot-find-value-in-scope-22811.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `foobar` in this scope
+  --> $DIR/cannot-find-value-in-scope-22811.rs:2:28
+   |
+LL | fn main() { println!("{}", foobar); }
+   |                            ^^^^^^ not found in this scope
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/resolve/multiple_definitions_attribute_merging.rs b/tests/ui/resolve/multiple_definitions_attribute_merging.rs
index 155abafdd9d..519b989fbe8 100644
--- a/tests/ui/resolve/multiple_definitions_attribute_merging.rs
+++ b/tests/ui/resolve/multiple_definitions_attribute_merging.rs
@@ -5,7 +5,7 @@
 //@known-bug: #120873
 //@ failure-status: 101
 //@ normalize-stderr: "note: .*\n\n" -> ""
-//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> ""
+//@ normalize-stderr: "thread 'rustc'.*panicked.*\n" -> ""
 //@ normalize-stderr: "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
 //@ rustc-env:RUST_BACKTRACE=0
 
diff --git a/tests/ui/resolve/pointer-type-impls-14254.rs b/tests/ui/resolve/pointer-type-impls-14254.rs
new file mode 100644
index 00000000000..ea8fb6aa167
--- /dev/null
+++ b/tests/ui/resolve/pointer-type-impls-14254.rs
@@ -0,0 +1,94 @@
+//! Regression test for https://github.com/rust-lang/rust/issues/14254
+
+//@ check-pass
+
+trait Foo: Sized {
+    fn bar(&self);
+    fn baz(&self) { }
+    fn bah(_: Option<Self>) { }
+}
+
+struct BarTy {
+    x : isize,
+    y : f64,
+}
+
+impl BarTy {
+    fn a() {}
+    fn b(&self) {}
+}
+
+// If these fail, it's necessary to update rustc_resolve and the cfail tests.
+impl Foo for *const BarTy {
+    fn bar(&self) {
+        self.baz();
+        BarTy::a();
+        Foo::bah(None::<*const BarTy>);
+    }
+}
+
+// If these fail, it's necessary to update rustc_resolve and the cfail tests.
+impl<'a> Foo for &'a BarTy {
+    fn bar(&self) {
+        self.baz();
+        self.x;
+        self.y;
+        BarTy::a();
+        Foo::bah(None::<&BarTy>);
+        self.b();
+    }
+}
+
+// If these fail, it's necessary to update rustc_resolve and the cfail tests.
+impl<'a> Foo for &'a mut BarTy {
+    fn bar(&self) {
+        self.baz();
+        self.x;
+        self.y;
+        BarTy::a();
+        Foo::bah(None::<&mut BarTy>);
+        self.b();
+    }
+}
+
+// If these fail, it's necessary to update rustc_resolve and the cfail tests.
+impl Foo for Box<BarTy> {
+    fn bar(&self) {
+        self.baz();
+        Foo::bah(None::<Box<BarTy>>);
+    }
+}
+
+// If these fail, it's necessary to update rustc_resolve and the cfail tests.
+impl Foo for *const isize {
+    fn bar(&self) {
+        self.baz();
+        Foo::bah(None::<*const isize>);
+    }
+}
+
+// If these fail, it's necessary to update rustc_resolve and the cfail tests.
+impl<'a> Foo for &'a isize {
+    fn bar(&self) {
+        self.baz();
+        Foo::bah(None::<&isize>);
+    }
+}
+
+// If these fail, it's necessary to update rustc_resolve and the cfail tests.
+impl<'a> Foo for &'a mut isize {
+    fn bar(&self) {
+        self.baz();
+        Foo::bah(None::<&mut isize>);
+    }
+}
+
+// If these fail, it's necessary to update rustc_resolve and the cfail tests.
+impl Foo for Box<isize> {
+    fn bar(&self) {
+        self.baz();
+        Foo::bah(None::<Box<isize>>);
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/resolve/proc_macro_generated_packed.rs b/tests/ui/resolve/proc_macro_generated_packed.rs
index 0cba3c1616d..41236c732bb 100644
--- a/tests/ui/resolve/proc_macro_generated_packed.rs
+++ b/tests/ui/resolve/proc_macro_generated_packed.rs
@@ -5,7 +5,7 @@
 //@known-bug: #120873
 //@ failure-status: 101
 //@ normalize-stderr: "note: .*\n\n" -> ""
-//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> ""
+//@ normalize-stderr: "thread 'rustc'.*panicked.*\n" -> ""
 //@ normalize-stderr: "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
 //@ rustc-env:RUST_BACKTRACE=0
 
diff --git a/tests/ui/resolve/reference-clone-nonclone-11820.rs b/tests/ui/resolve/reference-clone-nonclone-11820.rs
new file mode 100644
index 00000000000..74dad96da94
--- /dev/null
+++ b/tests/ui/resolve/reference-clone-nonclone-11820.rs
@@ -0,0 +1,15 @@
+//! Regression test for https://github.com/rust-lang/rust/issues/11820
+
+//@ run-pass
+
+#![allow(noop_method_call)]
+
+struct NoClone;
+
+fn main() {
+  let rnc = &NoClone;
+  let rsnc = &Some(NoClone);
+
+  let _: &NoClone = rnc.clone();
+  let _: &Option<NoClone> = rsnc.clone();
+}
diff --git a/tests/ui/resolve/unresolved-module-error-33293.rs b/tests/ui/resolve/unresolved-module-error-33293.rs
new file mode 100644
index 00000000000..354f9914d44
--- /dev/null
+++ b/tests/ui/resolve/unresolved-module-error-33293.rs
@@ -0,0 +1,7 @@
+// https://github.com/rust-lang/rust/issues/33293
+fn main() {
+    match 0 {
+        aaa::bbb(_) => ()
+        //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `aaa`
+    };
+}
diff --git a/tests/ui/resolve/unresolved-module-error-33293.stderr b/tests/ui/resolve/unresolved-module-error-33293.stderr
new file mode 100644
index 00000000000..28528148387
--- /dev/null
+++ b/tests/ui/resolve/unresolved-module-error-33293.stderr
@@ -0,0 +1,11 @@
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `aaa`
+  --> $DIR/unresolved-module-error-33293.rs:4:9
+   |
+LL |         aaa::bbb(_) => ()
+   |         ^^^ use of unresolved module or unlinked crate `aaa`
+   |
+   = help: you might be missing a crate named `aaa`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/tests/ui/resolve/use-shadowing-14082.rs b/tests/ui/resolve/use-shadowing-14082.rs
new file mode 100644
index 00000000000..9d7df5ed1c6
--- /dev/null
+++ b/tests/ui/resolve/use-shadowing-14082.rs
@@ -0,0 +1,21 @@
+//! Regression test for https://github.com/rust-lang/rust/issues/14082
+
+//@ check-pass
+
+#![allow(unused_imports, dead_code)]
+
+use foo::Foo;
+
+mod foo {
+    pub use m::Foo; // this should shadow d::Foo
+}
+
+mod m {
+    pub struct Foo;
+}
+
+mod d {
+    pub struct Foo;
+}
+
+fn main() {}