From ef24de24a82fe681581cc130f342363c47c0969a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 7 Jun 2024 07:48:48 +0200 Subject: Merging upstream version 1.75.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/resolve/fn-new-doesnt-exist.rs | 5 +++ tests/ui/resolve/fn-new-doesnt-exist.stderr | 14 ++++++++ tests/ui/resolve/issue-116164.rs | 19 ++++++++++ tests/ui/resolve/issue-116164.stderr | 14 ++++++++ tests/ui/resolve/issue-55673.fixed | 21 +++++++++++ tests/ui/resolve/issue-55673.rs | 9 +++++ tests/ui/resolve/issue-55673.stderr | 24 +++++++++++-- .../issue-70736-async-fn-no-body-def-collector.rs | 2 -- ...sue-70736-async-fn-no-body-def-collector.stderr | 31 ++-------------- tests/ui/resolve/issue-82865.stderr | 7 ++++ tests/ui/resolve/resolve-inconsistent-names.stderr | 42 +++++++++++----------- 11 files changed, 134 insertions(+), 54 deletions(-) create mode 100644 tests/ui/resolve/fn-new-doesnt-exist.rs create mode 100644 tests/ui/resolve/fn-new-doesnt-exist.stderr create mode 100644 tests/ui/resolve/issue-116164.rs create mode 100644 tests/ui/resolve/issue-116164.stderr create mode 100644 tests/ui/resolve/issue-55673.fixed (limited to 'tests/ui/resolve') 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() +where + T::Bar: std::fmt::Debug, + //~^ ERROR associated type `Baa` not found for `T` +{ +} + +fn bar() +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() +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: `{ }` 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: `{ }` -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 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 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::::new + Box::::new_uninit + Box::::new_zeroed + Box::::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 | -- cgit v1.2.3