summaryrefslogtreecommitdiffstats
path: root/tests/ui/resolve
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/resolve')
-rw-r--r--tests/ui/resolve/auxiliary/issue-112831-aux.rs13
-rw-r--r--tests/ui/resolve/export-fully-qualified-2018.rs13
-rw-r--r--tests/ui/resolve/export-fully-qualified-2018.stderr14
-rw-r--r--tests/ui/resolve/export-fully-qualified.rs2
-rw-r--r--tests/ui/resolve/export-fully-qualified.stderr7
-rw-r--r--tests/ui/resolve/extern-prelude.rs2
-rw-r--r--tests/ui/resolve/hidden_glob_reexports.rs52
-rw-r--r--tests/ui/resolve/hidden_glob_reexports.stderr54
-rw-r--r--tests/ui/resolve/issue-105069.stderr4
-rw-r--r--tests/ui/resolve/issue-109153.rs14
-rw-r--r--tests/ui/resolve/issue-109153.stderr23
-rw-r--r--tests/ui/resolve/issue-112472-multi-generics-suggestion.fixed31
-rw-r--r--tests/ui/resolve/issue-112472-multi-generics-suggestion.rs31
-rw-r--r--tests/ui/resolve/issue-112472-multi-generics-suggestion.stderr25
-rw-r--r--tests/ui/resolve/issue-112831.rs20
-rw-r--r--tests/ui/resolve/privacy-enum-ctor.stderr8
-rw-r--r--tests/ui/resolve/resolve-pseudo-shadowing.rs2
-rw-r--r--tests/ui/resolve/resolve-self-in-impl.stderr30
18 files changed, 324 insertions, 21 deletions
diff --git a/tests/ui/resolve/auxiliary/issue-112831-aux.rs b/tests/ui/resolve/auxiliary/issue-112831-aux.rs
new file mode 100644
index 000000000..df436fb99
--- /dev/null
+++ b/tests/ui/resolve/auxiliary/issue-112831-aux.rs
@@ -0,0 +1,13 @@
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+struct Zeroable;
+
+#[proc_macro_derive(Zeroable)]
+pub fn derive_zeroable(_: proc_macro::TokenStream) -> proc_macro::TokenStream {
+ proc_macro::TokenStream::default()
+}
diff --git a/tests/ui/resolve/export-fully-qualified-2018.rs b/tests/ui/resolve/export-fully-qualified-2018.rs
new file mode 100644
index 000000000..afd48acb6
--- /dev/null
+++ b/tests/ui/resolve/export-fully-qualified-2018.rs
@@ -0,0 +1,13 @@
+// edition:2018
+
+// In this test baz isn't resolved when called as foo.baz even though
+// it's called from inside foo. This is somewhat surprising and may
+// want to change eventually.
+
+mod foo {
+ pub fn bar() { foo::baz(); } //~ ERROR failed to resolve: use of undeclared crate or module `foo`
+
+ fn baz() { }
+}
+
+fn main() { }
diff --git a/tests/ui/resolve/export-fully-qualified-2018.stderr b/tests/ui/resolve/export-fully-qualified-2018.stderr
new file mode 100644
index 000000000..366ffd9bb
--- /dev/null
+++ b/tests/ui/resolve/export-fully-qualified-2018.stderr
@@ -0,0 +1,14 @@
+error[E0433]: failed to resolve: use of undeclared crate or module `foo`
+ --> $DIR/export-fully-qualified-2018.rs:8:20
+ |
+LL | pub fn bar() { foo::baz(); }
+ | ^^^ use of undeclared crate or module `foo`
+ |
+help: consider importing this module
+ |
+LL + use crate::foo;
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/tests/ui/resolve/export-fully-qualified.rs b/tests/ui/resolve/export-fully-qualified.rs
index 4e73a2c54..9d4daf4cd 100644
--- a/tests/ui/resolve/export-fully-qualified.rs
+++ b/tests/ui/resolve/export-fully-qualified.rs
@@ -1,3 +1,5 @@
+// edition:2015
+
// In this test baz isn't resolved when called as foo.baz even though
// it's called from inside foo. This is somewhat surprising and may
// want to change eventually.
diff --git a/tests/ui/resolve/export-fully-qualified.stderr b/tests/ui/resolve/export-fully-qualified.stderr
index 7ee352e12..0cd516ee1 100644
--- a/tests/ui/resolve/export-fully-qualified.stderr
+++ b/tests/ui/resolve/export-fully-qualified.stderr
@@ -1,8 +1,13 @@
error[E0433]: failed to resolve: use of undeclared crate or module `foo`
- --> $DIR/export-fully-qualified.rs:6:20
+ --> $DIR/export-fully-qualified.rs:8:20
|
LL | pub fn bar() { foo::baz(); }
| ^^^ use of undeclared crate or module `foo`
+ |
+help: consider importing this module
+ |
+LL + use foo;
+ |
error: aborting due to previous error
diff --git a/tests/ui/resolve/extern-prelude.rs b/tests/ui/resolve/extern-prelude.rs
index 50fed6034..b5f1d5d35 100644
--- a/tests/ui/resolve/extern-prelude.rs
+++ b/tests/ui/resolve/extern-prelude.rs
@@ -25,7 +25,7 @@ fn shadow_mod() {
fn shadow_prelude() {
// Extern prelude shadows standard library prelude
- let x = Vec::new(0f32, ()); // OK
+ let x: () = Vec::new(0f32, ()); // OK
}
fn main() {}
diff --git a/tests/ui/resolve/hidden_glob_reexports.rs b/tests/ui/resolve/hidden_glob_reexports.rs
new file mode 100644
index 000000000..102b56562
--- /dev/null
+++ b/tests/ui/resolve/hidden_glob_reexports.rs
@@ -0,0 +1,52 @@
+// check-pass
+
+pub mod upstream_a {
+ mod inner {
+ pub struct Foo {}
+ pub struct Bar {}
+ }
+
+ struct Foo;
+ //~^ WARN private item shadows public glob re-export
+
+ pub use self::inner::*;
+}
+
+pub mod upstream_b {
+ mod inner {
+ pub struct Foo {}
+ pub struct Qux {}
+ }
+
+ mod other {
+ pub struct Foo;
+ }
+
+ pub use self::inner::*;
+
+ use self::other::Foo;
+ //~^ WARN private item shadows public glob re-export
+}
+
+pub mod upstream_c {
+ mod no_def_id {
+ #![allow(non_camel_case_types)]
+ pub struct u8;
+ pub struct World;
+ }
+
+ pub use self::no_def_id::*;
+
+ use std::primitive::u8;
+ //~^ WARN private item shadows public glob re-export
+}
+
+// Downstream crate
+// mod downstream {
+// fn proof() {
+// let _ = crate::upstream_a::Foo;
+// let _ = crate::upstream_b::Foo;
+// }
+// }
+
+pub fn main() {}
diff --git a/tests/ui/resolve/hidden_glob_reexports.stderr b/tests/ui/resolve/hidden_glob_reexports.stderr
new file mode 100644
index 000000000..11fa94d6f
--- /dev/null
+++ b/tests/ui/resolve/hidden_glob_reexports.stderr
@@ -0,0 +1,54 @@
+warning: private item shadows public glob re-export
+ --> $DIR/hidden_glob_reexports.rs:9:5
+ |
+LL | struct Foo;
+ | ^^^^^^^^^^^
+ |
+note: the name `Foo` in the type namespace is supposed to be publicly re-exported here
+ --> $DIR/hidden_glob_reexports.rs:12:13
+ |
+LL | pub use self::inner::*;
+ | ^^^^^^^^^^^^^^
+note: but the private item here shadows it
+ --> $DIR/hidden_glob_reexports.rs:9:5
+ |
+LL | struct Foo;
+ | ^^^^^^^^^^^
+ = note: `#[warn(hidden_glob_reexports)]` on by default
+
+warning: private item shadows public glob re-export
+ --> $DIR/hidden_glob_reexports.rs:27:9
+ |
+LL | use self::other::Foo;
+ | ^^^^^^^^^^^^^^^^
+ |
+note: the name `Foo` in the type namespace is supposed to be publicly re-exported here
+ --> $DIR/hidden_glob_reexports.rs:25:13
+ |
+LL | pub use self::inner::*;
+ | ^^^^^^^^^^^^^^
+note: but the private item here shadows it
+ --> $DIR/hidden_glob_reexports.rs:27:9
+ |
+LL | use self::other::Foo;
+ | ^^^^^^^^^^^^^^^^
+
+warning: private item shadows public glob re-export
+ --> $DIR/hidden_glob_reexports.rs:40:9
+ |
+LL | use std::primitive::u8;
+ | ^^^^^^^^^^^^^^^^^^
+ |
+note: the name `u8` in the type namespace is supposed to be publicly re-exported here
+ --> $DIR/hidden_glob_reexports.rs:38:13
+ |
+LL | pub use self::no_def_id::*;
+ | ^^^^^^^^^^^^^^^^^^
+note: but the private item here shadows it
+ --> $DIR/hidden_glob_reexports.rs:40:9
+ |
+LL | use std::primitive::u8;
+ | ^^^^^^^^^^^^^^^^^^
+
+warning: 3 warnings emitted
+
diff --git a/tests/ui/resolve/issue-105069.stderr b/tests/ui/resolve/issue-105069.stderr
index 1e6c9c6e2..a049cac83 100644
--- a/tests/ui/resolve/issue-105069.stderr
+++ b/tests/ui/resolve/issue-105069.stderr
@@ -4,17 +4,19 @@ error[E0659]: `V` is ambiguous
LL | use V;
| ^ ambiguous name
|
- = note: ambiguous because of multiple potential import sources
+ = note: ambiguous because of multiple glob imports of a name in the same module
note: `V` could refer to the variant imported here
--> $DIR/issue-105069.rs:1:5
|
LL | use self::A::*;
| ^^^^^^^^^^
+ = help: consider adding an explicit import of `V` to disambiguate
note: `V` could also refer to the variant imported here
--> $DIR/issue-105069.rs:3:5
|
LL | use self::B::*;
| ^^^^^^^^^^
+ = help: consider adding an explicit import of `V` to disambiguate
error: aborting due to previous error
diff --git a/tests/ui/resolve/issue-109153.rs b/tests/ui/resolve/issue-109153.rs
new file mode 100644
index 000000000..bff6c9112
--- /dev/null
+++ b/tests/ui/resolve/issue-109153.rs
@@ -0,0 +1,14 @@
+use foo::*;
+
+mod foo {
+ pub mod bar {
+ pub mod bar {
+ pub mod bar {}
+ }
+ }
+}
+
+use bar::bar; //~ ERROR `bar` is ambiguous
+use bar::*;
+
+fn main() { }
diff --git a/tests/ui/resolve/issue-109153.stderr b/tests/ui/resolve/issue-109153.stderr
new file mode 100644
index 000000000..1a345d2a3
--- /dev/null
+++ b/tests/ui/resolve/issue-109153.stderr
@@ -0,0 +1,23 @@
+error[E0659]: `bar` is ambiguous
+ --> $DIR/issue-109153.rs:11:5
+ |
+LL | use bar::bar;
+ | ^^^ ambiguous name
+ |
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `bar` could refer to the module imported here
+ --> $DIR/issue-109153.rs:1:5
+ |
+LL | use foo::*;
+ | ^^^^^^
+ = help: consider adding an explicit import of `bar` to disambiguate
+note: `bar` could also refer to the module imported here
+ --> $DIR/issue-109153.rs:12:5
+ |
+LL | use bar::*;
+ | ^^^^^^
+ = help: consider adding an explicit import of `bar` to disambiguate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/resolve/issue-112472-multi-generics-suggestion.fixed b/tests/ui/resolve/issue-112472-multi-generics-suggestion.fixed
new file mode 100644
index 000000000..892697493
--- /dev/null
+++ b/tests/ui/resolve/issue-112472-multi-generics-suggestion.fixed
@@ -0,0 +1,31 @@
+// run-rustfix
+
+use std::fmt::Debug;
+use std::marker::PhantomData;
+use std::convert::{self, TryFrom};
+
+#[allow(unused)]
+struct Codec<EncodeLine, DecodeLine> {
+ phantom_decode: PhantomData<DecodeLine>,
+ phantom_encode: PhantomData<EncodeLine>,
+}
+
+pub enum ParseError {}
+
+impl<EncodeLine, DecodeLine> Codec<EncodeLine, DecodeLine> where
+ DecodeLine: Debug + convert::TryFrom<String>,
+ DecodeLine: convert::TryFrom<String, Error = ParseError>,
+ //~^ ERROR expected trait, found enum `ParseError`
+ //~| HELP constrain the associated type to `ParseError`
+{
+}
+
+impl<EncodeLine, DecodeLine> Codec<EncodeLine, DecodeLine> where
+ DecodeLine: Debug + TryFrom<String>,
+ DecodeLine: TryFrom<String, Error = ParseError>,
+ //~^ ERROR expected trait, found enum `ParseError`
+ //~| HELP constrain the associated type to `ParseError`
+{
+}
+
+fn main() {}
diff --git a/tests/ui/resolve/issue-112472-multi-generics-suggestion.rs b/tests/ui/resolve/issue-112472-multi-generics-suggestion.rs
new file mode 100644
index 000000000..2b2f5f1ad
--- /dev/null
+++ b/tests/ui/resolve/issue-112472-multi-generics-suggestion.rs
@@ -0,0 +1,31 @@
+// run-rustfix
+
+use std::fmt::Debug;
+use std::marker::PhantomData;
+use std::convert::{self, TryFrom};
+
+#[allow(unused)]
+struct Codec<EncodeLine, DecodeLine> {
+ phantom_decode: PhantomData<DecodeLine>,
+ phantom_encode: PhantomData<EncodeLine>,
+}
+
+pub enum ParseError {}
+
+impl<EncodeLine, DecodeLine> Codec<EncodeLine, DecodeLine> where
+ DecodeLine: Debug + convert::TryFrom<String>,
+ <DecodeLine as convert::TryFrom<String>>::Error: ParseError,
+ //~^ ERROR expected trait, found enum `ParseError`
+ //~| HELP constrain the associated type to `ParseError`
+{
+}
+
+impl<EncodeLine, DecodeLine> Codec<EncodeLine, DecodeLine> where
+ DecodeLine: Debug + TryFrom<String>,
+ <DecodeLine as TryFrom<String>>::Error: ParseError,
+ //~^ ERROR expected trait, found enum `ParseError`
+ //~| HELP constrain the associated type to `ParseError`
+{
+}
+
+fn main() {}
diff --git a/tests/ui/resolve/issue-112472-multi-generics-suggestion.stderr b/tests/ui/resolve/issue-112472-multi-generics-suggestion.stderr
new file mode 100644
index 000000000..f463e2dad
--- /dev/null
+++ b/tests/ui/resolve/issue-112472-multi-generics-suggestion.stderr
@@ -0,0 +1,25 @@
+error[E0404]: expected trait, found enum `ParseError`
+ --> $DIR/issue-112472-multi-generics-suggestion.rs:17:54
+ |
+LL | <DecodeLine as convert::TryFrom<String>>::Error: ParseError,
+ | ^^^^^^^^^^ not a trait
+ |
+help: constrain the associated type to `ParseError`
+ |
+LL | DecodeLine: convert::TryFrom<String, Error = ParseError>,
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error[E0404]: expected trait, found enum `ParseError`
+ --> $DIR/issue-112472-multi-generics-suggestion.rs:25:45
+ |
+LL | <DecodeLine as TryFrom<String>>::Error: ParseError,
+ | ^^^^^^^^^^ not a trait
+ |
+help: constrain the associated type to `ParseError`
+ |
+LL | DecodeLine: TryFrom<String, Error = ParseError>,
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0404`.
diff --git a/tests/ui/resolve/issue-112831.rs b/tests/ui/resolve/issue-112831.rs
new file mode 100644
index 000000000..ffd83ea8b
--- /dev/null
+++ b/tests/ui/resolve/issue-112831.rs
@@ -0,0 +1,20 @@
+// check-pass
+// aux-build:issue-112831-aux.rs
+
+mod zeroable {
+ pub trait Zeroable {}
+}
+
+use zeroable::*;
+
+mod pod {
+ use super::*;
+ pub trait Pod: Zeroable {}
+}
+
+use pod::*;
+
+extern crate issue_112831_aux;
+use issue_112831_aux::Zeroable;
+
+fn main() {}
diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr
index 0bb090905..b10eded01 100644
--- a/tests/ui/resolve/privacy-enum-ctor.stderr
+++ b/tests/ui/resolve/privacy-enum-ctor.stderr
@@ -228,7 +228,9 @@ error[E0603]: enum `Z` is private
--> $DIR/privacy-enum-ctor.rs:61:22
|
LL | let _: Z = m::n::Z::Fn;
- | ^ private enum
+ | ^ -- tuple variant `Fn` is not publicly re-exported
+ | |
+ | private enum
|
note: the enum `Z` is defined here
--> $DIR/privacy-enum-ctor.rs:11:9
@@ -252,7 +254,9 @@ error[E0603]: enum `Z` is private
--> $DIR/privacy-enum-ctor.rs:68:22
|
LL | let _: Z = m::n::Z::Unit {};
- | ^ private enum
+ | ^ ---- variant `Unit` is not publicly re-exported
+ | |
+ | private enum
|
note: the enum `Z` is defined here
--> $DIR/privacy-enum-ctor.rs:11:9
diff --git a/tests/ui/resolve/resolve-pseudo-shadowing.rs b/tests/ui/resolve/resolve-pseudo-shadowing.rs
index 85c684ca0..0ee0d0efa 100644
--- a/tests/ui/resolve/resolve-pseudo-shadowing.rs
+++ b/tests/ui/resolve/resolve-pseudo-shadowing.rs
@@ -3,7 +3,7 @@
fn check<Clone>(_c: Clone) {
fn check2() {
- let _ = <() as std::clone::Clone>::clone(&());
+ let () = <() as std::clone::Clone>::clone(&());
}
check2();
}
diff --git a/tests/ui/resolve/resolve-self-in-impl.stderr b/tests/ui/resolve/resolve-self-in-impl.stderr
index b3042d413..9f9ed6889 100644
--- a/tests/ui/resolve/resolve-self-in-impl.stderr
+++ b/tests/ui/resolve/resolve-self-in-impl.stderr
@@ -1,40 +1,40 @@
error: `Self` is not valid in the self type of an impl block
- --> $DIR/resolve-self-in-impl.rs:16:6
+ --> $DIR/resolve-self-in-impl.rs:14:13
|
-LL | impl Self {}
- | ^^^^
+LL | impl Tr for Self {}
+ | ^^^^
|
= note: replace `Self` with a different type
error: `Self` is not valid in the self type of an impl block
- --> $DIR/resolve-self-in-impl.rs:17:8
+ --> $DIR/resolve-self-in-impl.rs:15:15
|
-LL | impl S<Self> {}
- | ^^^^
+LL | impl Tr for S<Self> {}
+ | ^^^^
|
= note: replace `Self` with a different type
error: `Self` is not valid in the self type of an impl block
- --> $DIR/resolve-self-in-impl.rs:18:7
+ --> $DIR/resolve-self-in-impl.rs:16:6
|
-LL | impl (Self, Self) {}
- | ^^^^ ^^^^
+LL | impl Self {}
+ | ^^^^
|
= note: replace `Self` with a different type
error: `Self` is not valid in the self type of an impl block
- --> $DIR/resolve-self-in-impl.rs:14:13
+ --> $DIR/resolve-self-in-impl.rs:17:8
|
-LL | impl Tr for Self {}
- | ^^^^
+LL | impl S<Self> {}
+ | ^^^^
|
= note: replace `Self` with a different type
error: `Self` is not valid in the self type of an impl block
- --> $DIR/resolve-self-in-impl.rs:15:15
+ --> $DIR/resolve-self-in-impl.rs:18:7
|
-LL | impl Tr for S<Self> {}
- | ^^^^
+LL | impl (Self, Self) {}
+ | ^^^^ ^^^^
|
= note: replace `Self` with a different type