summaryrefslogtreecommitdiffstats
path: root/tests/ui/resolve
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/resolve/fn-new-doesnt-exist.rs5
-rw-r--r--tests/ui/resolve/fn-new-doesnt-exist.stderr14
-rw-r--r--tests/ui/resolve/issue-116164.rs19
-rw-r--r--tests/ui/resolve/issue-116164.stderr14
-rw-r--r--tests/ui/resolve/issue-55673.fixed21
-rw-r--r--tests/ui/resolve/issue-55673.rs9
-rw-r--r--tests/ui/resolve/issue-55673.stderr24
-rw-r--r--tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs2
-rw-r--r--tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr31
-rw-r--r--tests/ui/resolve/issue-82865.stderr7
-rw-r--r--tests/ui/resolve/resolve-inconsistent-names.stderr42
11 files changed, 134 insertions, 54 deletions
diff --git a/tests/ui/resolve/fn-new-doesnt-exist.rs b/tests/ui/resolve/fn-new-doesnt-exist.rs
new file mode 100644
index 000000000..4f6290808
--- /dev/null
+++ b/tests/ui/resolve/fn-new-doesnt-exist.rs
@@ -0,0 +1,5 @@
+use std::net::TcpStream;
+
+fn main() {
+ let stream = TcpStream::new(); //~ ERROR no function or associated item named `new` found
+}
diff --git a/tests/ui/resolve/fn-new-doesnt-exist.stderr b/tests/ui/resolve/fn-new-doesnt-exist.stderr
new file mode 100644
index 000000000..39adc0fde
--- /dev/null
+++ b/tests/ui/resolve/fn-new-doesnt-exist.stderr
@@ -0,0 +1,14 @@
+error[E0599]: no function or associated item named `new` found for struct `TcpStream` in the current scope
+ --> $DIR/fn-new-doesnt-exist.rs:4:28
+ |
+LL | let stream = TcpStream::new();
+ | ^^^ function or associated item not found in `TcpStream`
+ |
+note: if you're trying to build a new `TcpStream` consider using one of the following associated functions:
+ TcpStream::connect
+ TcpStream::connect_timeout
+ --> $SRC_DIR/std/src/net/tcp.rs:LL:COL
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/resolve/issue-116164.rs b/tests/ui/resolve/issue-116164.rs
new file mode 100644
index 000000000..d30c8f514
--- /dev/null
+++ b/tests/ui/resolve/issue-116164.rs
@@ -0,0 +1,19 @@
+#![allow(unused_imports)]
+
+mod inner {
+ pub enum Example {
+ ExOne,
+ }
+}
+
+mod reexports {
+ pub use crate::inner::Example as _;
+}
+
+use crate::reexports::*;
+//~^ SUGGESTION: use inner::Example::ExOne
+
+fn main() {
+ ExOne;
+ //~^ ERROR: cannot find value `ExOne` in this scope
+}
diff --git a/tests/ui/resolve/issue-116164.stderr b/tests/ui/resolve/issue-116164.stderr
new file mode 100644
index 000000000..5820a189f
--- /dev/null
+++ b/tests/ui/resolve/issue-116164.stderr
@@ -0,0 +1,14 @@
+error[E0425]: cannot find value `ExOne` in this scope
+ --> $DIR/issue-116164.rs:17:5
+ |
+LL | ExOne;
+ | ^^^^^ not found in this scope
+ |
+help: consider importing this unit variant
+ |
+LL + use inner::Example::ExOne;
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/resolve/issue-55673.fixed b/tests/ui/resolve/issue-55673.fixed
new file mode 100644
index 000000000..261742a26
--- /dev/null
+++ b/tests/ui/resolve/issue-55673.fixed
@@ -0,0 +1,21 @@
+// run-rustfix
+#![allow(dead_code)]
+trait Foo {
+ type Bar;
+}
+
+fn foo<T: Foo>()
+where
+ T::Bar: std::fmt::Debug,
+ //~^ ERROR associated type `Baa` not found for `T`
+{
+}
+
+fn bar<T>()
+where
+ T::Bar: std::fmt::Debug, T: Foo
+ //~^ ERROR associated type `Baa` not found for `T`
+{
+}
+
+fn main() {}
diff --git a/tests/ui/resolve/issue-55673.rs b/tests/ui/resolve/issue-55673.rs
index 0436bd397..6ac49be14 100644
--- a/tests/ui/resolve/issue-55673.rs
+++ b/tests/ui/resolve/issue-55673.rs
@@ -1,3 +1,5 @@
+// run-rustfix
+#![allow(dead_code)]
trait Foo {
type Bar;
}
@@ -9,4 +11,11 @@ where
{
}
+fn bar<T>()
+where
+ T::Baa: std::fmt::Debug,
+ //~^ ERROR associated type `Baa` not found for `T`
+{
+}
+
fn main() {}
diff --git a/tests/ui/resolve/issue-55673.stderr b/tests/ui/resolve/issue-55673.stderr
index 39318f959..ffc325223 100644
--- a/tests/ui/resolve/issue-55673.stderr
+++ b/tests/ui/resolve/issue-55673.stderr
@@ -1,9 +1,29 @@
error[E0220]: associated type `Baa` not found for `T`
- --> $DIR/issue-55673.rs:7:8
+ --> $DIR/issue-55673.rs:9:8
|
LL | T::Baa: std::fmt::Debug,
| ^^^ there is a similarly named associated type `Bar` in the trait `Foo`
+ |
+help: change the associated type name to use `Bar` from `Foo`
+ |
+LL | T::Bar: std::fmt::Debug,
+ | ~~~
+
+error[E0220]: associated type `Baa` not found for `T`
+ --> $DIR/issue-55673.rs:16:8
+ |
+LL | T::Baa: std::fmt::Debug,
+ | ^^^ there is a similarly named associated type `Bar` in the trait `Foo`
+ |
+help: consider further restricting type parameter `T`
+ |
+LL | T::Baa: std::fmt::Debug, T: Foo
+ | ~~~~~~~~
+help: and also change the associated type name
+ |
+LL | T::Bar: std::fmt::Debug,
+ | ~~~
-error: aborting due to previous error
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0220`.
diff --git a/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs b/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs
index 49462f52f..927ecd9ae 100644
--- a/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs
+++ b/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs
@@ -9,11 +9,9 @@ impl A {
trait B {
async fn associated();
- //~^ ERROR cannot be declared `async`
}
impl B for A {
async fn associated(); //~ ERROR without body
- //~^ ERROR cannot be declared `async`
}
fn main() {}
diff --git a/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr b/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr
index 1354abb4f..da9eeea95 100644
--- a/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr
+++ b/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr
@@ -15,39 +15,12 @@ LL | async fn inherent();
| help: provide a definition for the function: `{ <body> }`
error: associated function in `impl` without body
- --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5
+ --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:14:5
|
LL | async fn associated();
| ^^^^^^^^^^^^^^^^^^^^^-
| |
| help: provide a definition for the function: `{ <body> }`
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:11:5
- |
-LL | async fn associated();
- | -----^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5
- |
-LL | async fn associated();
- | -----^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 5 previous errors
+error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0706`.
diff --git a/tests/ui/resolve/issue-82865.stderr b/tests/ui/resolve/issue-82865.stderr
index 730fd6d60..9d0439d9d 100644
--- a/tests/ui/resolve/issue-82865.stderr
+++ b/tests/ui/resolve/issue-82865.stderr
@@ -15,6 +15,13 @@ LL | Box::z
LL | mac!();
| ------ in this macro invocation
|
+note: if you're trying to build a new `Box<_, _>` consider using one of the following associated functions:
+ Box::<T>::new
+ Box::<T>::new_uninit
+ Box::<T>::new_zeroed
+ Box::<T>::try_new
+ and 18 others
+ --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
= note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
diff --git a/tests/ui/resolve/resolve-inconsistent-names.stderr b/tests/ui/resolve/resolve-inconsistent-names.stderr
index 42b7281d7..d6240fb8f 100644
--- a/tests/ui/resolve/resolve-inconsistent-names.stderr
+++ b/tests/ui/resolve/resolve-inconsistent-names.stderr
@@ -1,11 +1,3 @@
-error[E0408]: variable `a` is not bound in all patterns
- --> $DIR/resolve-inconsistent-names.rs:13:12
- |
-LL | a | b => {}
- | - ^ pattern doesn't bind `a`
- | |
- | variable not in all patterns
-
error[E0408]: variable `b` is not bound in all patterns
--> $DIR/resolve-inconsistent-names.rs:13:8
|
@@ -14,6 +6,14 @@ LL | a | b => {}
| |
| pattern doesn't bind `b`
+error[E0408]: variable `a` is not bound in all patterns
+ --> $DIR/resolve-inconsistent-names.rs:13:12
+ |
+LL | a | b => {}
+ | - ^ pattern doesn't bind `a`
+ | |
+ | variable not in all patterns
+
error[E0408]: variable `c` is not bound in all patterns
--> $DIR/resolve-inconsistent-names.rs:19:9
|
@@ -54,6 +54,19 @@ LL | (A, B) | (ref B, c) | (c, A) => ()
| |
| first binding
+error[E0408]: variable `Const2` is not bound in all patterns
+ --> $DIR/resolve-inconsistent-names.rs:31:9
+ |
+LL | (CONST1, _) | (_, Const2) => ()
+ | ^^^^^^^^^^^ ------ variable not in all patterns
+ | |
+ | pattern doesn't bind `Const2`
+ |
+help: if you meant to match on constant `m::Const2`, use the full path in the pattern
+ |
+LL | (CONST1, _) | (_, m::Const2) => ()
+ | ~~~~~~~~~
+
error[E0408]: variable `CONST1` is not bound in all patterns
--> $DIR/resolve-inconsistent-names.rs:31:23
|
@@ -68,19 +81,6 @@ note: you might have meant to match on constant `m::CONST1`, which exists but is
LL | const CONST1: usize = 10;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not accessible
-error[E0408]: variable `Const2` is not bound in all patterns
- --> $DIR/resolve-inconsistent-names.rs:31:9
- |
-LL | (CONST1, _) | (_, Const2) => ()
- | ^^^^^^^^^^^ ------ variable not in all patterns
- | |
- | pattern doesn't bind `Const2`
- |
-help: if you meant to match on constant `m::Const2`, use the full path in the pattern
- |
-LL | (CONST1, _) | (_, m::Const2) => ()
- | ~~~~~~~~~
-
error[E0308]: mismatched types
--> $DIR/resolve-inconsistent-names.rs:19:19
|