From d1b2d29528b7794b41e66fc2136e395a02f8529b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:59:35 +0200 Subject: Merging upstream version 1.73.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/resolve/112590-2.fixed | 34 +++++++++++ tests/ui/resolve/112590-2.rs | 26 ++++++++ tests/ui/resolve/112590-2.stderr | 71 ++++++++++++++++++++++ tests/ui/resolve/bad-expr-path.stderr | 12 ++-- tests/ui/resolve/bad-expr-path2.stderr | 12 ++-- tests/ui/resolve/derive-macro-1.rs | 18 ++++++ tests/ui/resolve/derive-macro-2.rs | 18 ++++++ .../ui/resolve/export-fully-qualified-2018.stderr | 5 -- tests/ui/resolve/export-fully-qualified.stderr | 5 -- tests/ui/resolve/issue-112831.rs | 20 ------ ...-invalid-unused-qualifications-suggestion.fixed | 31 ++++++++++ ...808-invalid-unused-qualifications-suggestion.rs | 31 ++++++++++ ...invalid-unused-qualifications-suggestion.stderr | 31 ++++++++++ ...433-invalid-unused-qualifications-suggestion.rs | 10 +++ tests/ui/resolve/issue-2356.stderr | 21 ++----- tests/ui/resolve/resolve-inconsistent-names.stderr | 18 +++--- tests/ui/resolve/resolve-self-in-impl.stderr | 1 + tests/ui/resolve/unresolved-segments-visibility.rs | 11 ++++ .../resolve/unresolved-segments-visibility.stderr | 9 +++ .../resolve/unused-qualifications-suggestion.fixed | 23 +++++++ .../ui/resolve/unused-qualifications-suggestion.rs | 23 +++++++ .../unused-qualifications-suggestion.stderr | 31 ++++++++++ 22 files changed, 395 insertions(+), 66 deletions(-) create mode 100644 tests/ui/resolve/112590-2.fixed create mode 100644 tests/ui/resolve/112590-2.rs create mode 100644 tests/ui/resolve/112590-2.stderr create mode 100644 tests/ui/resolve/derive-macro-1.rs create mode 100644 tests/ui/resolve/derive-macro-2.rs delete mode 100644 tests/ui/resolve/issue-112831.rs create mode 100644 tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.fixed create mode 100644 tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.rs create mode 100644 tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.stderr create mode 100644 tests/ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs create mode 100644 tests/ui/resolve/unresolved-segments-visibility.rs create mode 100644 tests/ui/resolve/unresolved-segments-visibility.stderr create mode 100644 tests/ui/resolve/unused-qualifications-suggestion.fixed create mode 100644 tests/ui/resolve/unused-qualifications-suggestion.rs create mode 100644 tests/ui/resolve/unused-qualifications-suggestion.stderr (limited to 'tests/ui/resolve') diff --git a/tests/ui/resolve/112590-2.fixed b/tests/ui/resolve/112590-2.fixed new file mode 100644 index 000000000..3bfe81ae8 --- /dev/null +++ b/tests/ui/resolve/112590-2.fixed @@ -0,0 +1,34 @@ +// run-rustfix +use std::vec; + +use std::sync::atomic::AtomicBool; + +mod foo { + pub mod bar { + pub mod baz { + pub use std::vec::Vec as MyVec; + } + } +} + +mod u { + use foo::bar::baz::MyVec; + +fn _a() { + let _: Vec = MyVec::new(); //~ ERROR failed to resolve + } +} + +mod v { + use foo::bar::baz::MyVec; + +fn _b() { + let _: Vec = MyVec::new(); //~ ERROR failed to resolve + } +} + +fn main() { + let _t: Vec = Vec::new(); //~ ERROR failed to resolve + type _B = vec::Vec::; //~ ERROR failed to resolve + let _t = AtomicBool::new(true); //~ ERROR failed to resolve +} diff --git a/tests/ui/resolve/112590-2.rs b/tests/ui/resolve/112590-2.rs new file mode 100644 index 000000000..e5914cd67 --- /dev/null +++ b/tests/ui/resolve/112590-2.rs @@ -0,0 +1,26 @@ +// run-rustfix +mod foo { + pub mod bar { + pub mod baz { + pub use std::vec::Vec as MyVec; + } + } +} + +mod u { + fn _a() { + let _: Vec = super::foo::baf::baz::MyVec::new(); //~ ERROR failed to resolve + } +} + +mod v { + fn _b() { + let _: Vec = fox::bar::baz::MyVec::new(); //~ ERROR failed to resolve + } +} + +fn main() { + let _t: Vec = vec::new(); //~ ERROR failed to resolve + type _B = vec::Vec::; //~ ERROR failed to resolve + let _t = std::sync_error::atomic::AtomicBool::new(true); //~ ERROR failed to resolve +} diff --git a/tests/ui/resolve/112590-2.stderr b/tests/ui/resolve/112590-2.stderr new file mode 100644 index 000000000..0db20249d --- /dev/null +++ b/tests/ui/resolve/112590-2.stderr @@ -0,0 +1,71 @@ +error[E0433]: failed to resolve: could not find `baf` in `foo` + --> $DIR/112590-2.rs:12:39 + | +LL | let _: Vec = super::foo::baf::baz::MyVec::new(); + | ^^^ could not find `baf` in `foo` + | +help: consider importing this struct through its public re-export + | +LL + use foo::bar::baz::MyVec; + | +help: if you import `MyVec`, refer to it directly + | +LL - let _: Vec = super::foo::baf::baz::MyVec::new(); +LL + let _: Vec = MyVec::new(); + | + +error[E0433]: failed to resolve: use of undeclared crate or module `fox` + --> $DIR/112590-2.rs:18:27 + | +LL | let _: Vec = fox::bar::baz::MyVec::new(); + | ^^^ use of undeclared crate or module `fox` + | +help: consider importing this struct through its public re-export + | +LL + use foo::bar::baz::MyVec; + | +help: if you import `MyVec`, refer to it directly + | +LL - let _: Vec = fox::bar::baz::MyVec::new(); +LL + let _: Vec = MyVec::new(); + | + +error[E0433]: failed to resolve: use of undeclared crate or module `vec` + --> $DIR/112590-2.rs:24:15 + | +LL | type _B = vec::Vec::; + | ^^^ use of undeclared crate or module `vec` + | +help: consider importing this module + | +LL + use std::vec; + | + +error[E0433]: failed to resolve: could not find `sync_error` in `std` + --> $DIR/112590-2.rs:25:19 + | +LL | let _t = std::sync_error::atomic::AtomicBool::new(true); + | ^^^^^^^^^^ could not find `sync_error` in `std` + | +help: consider importing this struct + | +LL + use std::sync::atomic::AtomicBool; + | +help: if you import `AtomicBool`, refer to it directly + | +LL - let _t = std::sync_error::atomic::AtomicBool::new(true); +LL + let _t = AtomicBool::new(true); + | + +error[E0433]: failed to resolve: use of undeclared crate or module `vec` + --> $DIR/112590-2.rs:23:24 + | +LL | let _t: Vec = vec::new(); + | ^^^ + | | + | use of undeclared crate or module `vec` + | help: a struct with a similar name exists (notice the capitalization): `Vec` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/resolve/bad-expr-path.stderr b/tests/ui/resolve/bad-expr-path.stderr index 8261e8e53..411130913 100644 --- a/tests/ui/resolve/bad-expr-path.stderr +++ b/tests/ui/resolve/bad-expr-path.stderr @@ -10,12 +10,6 @@ error[E0425]: cannot find value `arguments` in module `m1` LL | log(debug, m1::arguments); | ^^^^^^^^^ not found in `m1` -error[E0425]: cannot find function `log` in this scope - --> $DIR/bad-expr-path.rs:4:5 - | -LL | log(debug, m1::arguments); - | ^^^ not found in this scope - error[E0580]: `main` function has wrong type --> $DIR/bad-expr-path.rs:3:1 | @@ -25,6 +19,12 @@ LL | fn main(arguments: Vec) { = note: expected fn pointer `fn()` found fn pointer `fn(Vec)` +error[E0425]: cannot find function `log` in this scope + --> $DIR/bad-expr-path.rs:4:5 + | +LL | log(debug, m1::arguments); + | ^^^ not found in this scope + error: aborting due to 4 previous errors Some errors have detailed explanations: E0425, E0580. diff --git a/tests/ui/resolve/bad-expr-path2.stderr b/tests/ui/resolve/bad-expr-path2.stderr index 6e11296d9..af3ca99c5 100644 --- a/tests/ui/resolve/bad-expr-path2.stderr +++ b/tests/ui/resolve/bad-expr-path2.stderr @@ -10,12 +10,6 @@ error[E0423]: expected value, found module `m1::arguments` LL | log(debug, m1::arguments); | ^^^^^^^^^^^^^ not a value -error[E0425]: cannot find function `log` in this scope - --> $DIR/bad-expr-path2.rs:6:5 - | -LL | log(debug, m1::arguments); - | ^^^ not found in this scope - error[E0580]: `main` function has wrong type --> $DIR/bad-expr-path2.rs:5:1 | @@ -25,6 +19,12 @@ LL | fn main(arguments: Vec) { = note: expected fn pointer `fn()` found fn pointer `fn(Vec)` +error[E0425]: cannot find function `log` in this scope + --> $DIR/bad-expr-path2.rs:6:5 + | +LL | log(debug, m1::arguments); + | ^^^ not found in this scope + error: aborting due to 4 previous errors Some errors have detailed explanations: E0423, E0425, E0580. diff --git a/tests/ui/resolve/derive-macro-1.rs b/tests/ui/resolve/derive-macro-1.rs new file mode 100644 index 000000000..90cbd903a --- /dev/null +++ b/tests/ui/resolve/derive-macro-1.rs @@ -0,0 +1,18 @@ +// check-pass +// aux-build:issue-112831-aux.rs + +mod z { + pub trait Zeroable {} +} + +use z::*; + +mod pod { + use super::*; + pub trait Pod: Zeroable {} +} + +extern crate issue_112831_aux; +use issue_112831_aux::Zeroable; + +fn main() {} diff --git a/tests/ui/resolve/derive-macro-2.rs b/tests/ui/resolve/derive-macro-2.rs new file mode 100644 index 000000000..7cecdd9e3 --- /dev/null +++ b/tests/ui/resolve/derive-macro-2.rs @@ -0,0 +1,18 @@ +// check-pass +// aux-build:issue-112831-aux.rs + +extern crate issue_112831_aux; +use issue_112831_aux::Zeroable; + +mod z { + pub trait Zeroable {} +} + +use z::*; + +mod pod { + use super::*; + pub trait Pod: Zeroable {} +} + +fn main() {} diff --git a/tests/ui/resolve/export-fully-qualified-2018.stderr b/tests/ui/resolve/export-fully-qualified-2018.stderr index 366ffd9bb..b724da930 100644 --- a/tests/ui/resolve/export-fully-qualified-2018.stderr +++ b/tests/ui/resolve/export-fully-qualified-2018.stderr @@ -3,11 +3,6 @@ error[E0433]: failed to resolve: use of undeclared crate or module `foo` | 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 diff --git a/tests/ui/resolve/export-fully-qualified.stderr b/tests/ui/resolve/export-fully-qualified.stderr index 0cd516ee1..a8af0c7c9 100644 --- a/tests/ui/resolve/export-fully-qualified.stderr +++ b/tests/ui/resolve/export-fully-qualified.stderr @@ -3,11 +3,6 @@ error[E0433]: failed to resolve: use of undeclared crate or module `foo` | 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/issue-112831.rs b/tests/ui/resolve/issue-112831.rs deleted file mode 100644 index ffd83ea8b..000000000 --- a/tests/ui/resolve/issue-112831.rs +++ /dev/null @@ -1,20 +0,0 @@ -// 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/issue-113808-invalid-unused-qualifications-suggestion.fixed b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.fixed new file mode 100644 index 000000000..e730f9466 --- /dev/null +++ b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.fixed @@ -0,0 +1,31 @@ +// run-rustfix + +#![deny(unused_qualifications)] +#![feature(unsized_fn_params)] + +#[allow(unused_imports)] +use std::ops; +use std::ops::Index; + +pub struct A; + +impl Index for A { + //~^ ERROR unnecessary qualification + type Output = (); + fn index(&self, _: str) -> &Self::Output { + &() + } +} + +mod inner { + pub trait Trait {} +} + +// the import needs to be here for the lint to show up +#[allow(unused_imports)] +use inner::Trait; + +impl Trait for () {} +//~^ ERROR unnecessary qualification + +fn main() {} diff --git a/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.rs b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.rs new file mode 100644 index 000000000..641c892e3 --- /dev/null +++ b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.rs @@ -0,0 +1,31 @@ +// run-rustfix + +#![deny(unused_qualifications)] +#![feature(unsized_fn_params)] + +#[allow(unused_imports)] +use std::ops; +use std::ops::Index; + +pub struct A; + +impl ops::Index for A { + //~^ ERROR unnecessary qualification + type Output = (); + fn index(&self, _: str) -> &Self::Output { + &() + } +} + +mod inner { + pub trait Trait {} +} + +// the import needs to be here for the lint to show up +#[allow(unused_imports)] +use inner::Trait; + +impl inner::Trait for () {} +//~^ ERROR unnecessary qualification + +fn main() {} diff --git a/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.stderr b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.stderr new file mode 100644 index 000000000..d9c7fd218 --- /dev/null +++ b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.stderr @@ -0,0 +1,31 @@ +error: unnecessary qualification + --> $DIR/issue-113808-invalid-unused-qualifications-suggestion.rs:12:6 + | +LL | impl ops::Index for A { + | ^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/issue-113808-invalid-unused-qualifications-suggestion.rs:3:9 + | +LL | #![deny(unused_qualifications)] + | ^^^^^^^^^^^^^^^^^^^^^ +help: remove the unnecessary path segments + | +LL - impl ops::Index for A { +LL + impl Index for A { + | + +error: unnecessary qualification + --> $DIR/issue-113808-invalid-unused-qualifications-suggestion.rs:28:6 + | +LL | impl inner::Trait for () {} + | ^^^^^^^^^^^^^^^^ + | +help: remove the unnecessary path segments + | +LL - impl inner::Trait for () {} +LL + impl Trait for () {} + | + +error: aborting due to 2 previous errors + diff --git a/tests/ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs b/tests/ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs new file mode 100644 index 000000000..83349dd33 --- /dev/null +++ b/tests/ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs @@ -0,0 +1,10 @@ +#![deny(unused_qualifications)] +// check-pass +fn bar() { + match Option::>::None { + Some(v) => {} + None => {} + } +} + +fn main() {} diff --git a/tests/ui/resolve/issue-2356.stderr b/tests/ui/resolve/issue-2356.stderr index 313b3e30d..30f5f0595 100644 --- a/tests/ui/resolve/issue-2356.stderr +++ b/tests/ui/resolve/issue-2356.stderr @@ -1,18 +1,3 @@ -error[E0425]: cannot find function `default` in this scope - --> $DIR/issue-2356.rs:31:5 - | -LL | default(); - | ^^^^^^^ - | -help: you might have meant to call the associated function - | -LL | Self::default(); - | ~~~~~~~~~~~~~ -help: consider importing this function - | -LL + use std::default::default; - | - error[E0425]: cannot find value `whiskers` in this scope --> $DIR/issue-2356.rs:39:5 | @@ -64,6 +49,12 @@ error[E0425]: cannot find function `clone` in this scope LL | clone(); | ^^^^^ help: you might have meant to call the method: `self.clone` +error[E0425]: cannot find function `default` in this scope + --> $DIR/issue-2356.rs:31:5 + | +LL | default(); + | ^^^^^^^ help: you might have meant to call the associated function: `Self::default` + error[E0425]: cannot find function `shave` in this scope --> $DIR/issue-2356.rs:41:5 | diff --git a/tests/ui/resolve/resolve-inconsistent-names.stderr b/tests/ui/resolve/resolve-inconsistent-names.stderr index 023db303d..42b7281d7 100644 --- a/tests/ui/resolve/resolve-inconsistent-names.stderr +++ b/tests/ui/resolve/resolve-inconsistent-names.stderr @@ -14,6 +14,15 @@ LL | a | b => {} | | | pattern doesn't bind `b` +error[E0408]: variable `c` is not bound in all patterns + --> $DIR/resolve-inconsistent-names.rs:19:9 + | +LL | (A, B) | (ref B, c) | (c, A) => () + | ^^^^^^ - - variable not in all patterns + | | | + | | variable not in all patterns + | pattern doesn't bind `c` + error[E0408]: variable `A` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:19:18 | @@ -37,15 +46,6 @@ LL | (A, B) | (ref B, c) | (c, A) => () | | variable not in all patterns | variable not in all patterns -error[E0408]: variable `c` is not bound in all patterns - --> $DIR/resolve-inconsistent-names.rs:19:9 - | -LL | (A, B) | (ref B, c) | (c, A) => () - | ^^^^^^ - - variable not in all patterns - | | | - | | variable not in all patterns - | pattern doesn't bind `c` - error[E0409]: variable `B` is bound inconsistently across alternatives separated by `|` --> $DIR/resolve-inconsistent-names.rs:19:23 | diff --git a/tests/ui/resolve/resolve-self-in-impl.stderr b/tests/ui/resolve/resolve-self-in-impl.stderr index 9f9ed6889..183a17171 100644 --- a/tests/ui/resolve/resolve-self-in-impl.stderr +++ b/tests/ui/resolve/resolve-self-in-impl.stderr @@ -56,6 +56,7 @@ LL | | trait Tr { LL | | LL | | fn main() {} | |____________^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 6 previous errors diff --git a/tests/ui/resolve/unresolved-segments-visibility.rs b/tests/ui/resolve/unresolved-segments-visibility.rs new file mode 100644 index 000000000..c26171f75 --- /dev/null +++ b/tests/ui/resolve/unresolved-segments-visibility.rs @@ -0,0 +1,11 @@ +// Check that we do not ICE due to unresolved segments in visibility path. +#![crate_type = "lib"] + +extern crate alloc as b; + +mod foo { + mod bar { + pub(in b::string::String::newy) extern crate alloc as e; + //~^ ERROR failed to resolve: `String` is a struct, not a module [E0433] + } +} diff --git a/tests/ui/resolve/unresolved-segments-visibility.stderr b/tests/ui/resolve/unresolved-segments-visibility.stderr new file mode 100644 index 000000000..0a11549cd --- /dev/null +++ b/tests/ui/resolve/unresolved-segments-visibility.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: `String` is a struct, not a module + --> $DIR/unresolved-segments-visibility.rs:8:27 + | +LL | pub(in b::string::String::newy) extern crate alloc as e; + | ^^^^^^ `String` is a struct, not a module + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/resolve/unused-qualifications-suggestion.fixed b/tests/ui/resolve/unused-qualifications-suggestion.fixed new file mode 100644 index 000000000..0d4b9007c --- /dev/null +++ b/tests/ui/resolve/unused-qualifications-suggestion.fixed @@ -0,0 +1,23 @@ +// run-rustfix + +#![deny(unused_qualifications)] + +mod foo { + pub fn bar() {} +} + +mod baz { + pub mod qux { + pub fn quux() {} + } +} + +fn main() { + use foo::bar; + bar(); + //~^ ERROR unnecessary qualification + + use baz::qux::quux; + quux(); + //~^ ERROR unnecessary qualification +} diff --git a/tests/ui/resolve/unused-qualifications-suggestion.rs b/tests/ui/resolve/unused-qualifications-suggestion.rs new file mode 100644 index 000000000..f6722e965 --- /dev/null +++ b/tests/ui/resolve/unused-qualifications-suggestion.rs @@ -0,0 +1,23 @@ +// run-rustfix + +#![deny(unused_qualifications)] + +mod foo { + pub fn bar() {} +} + +mod baz { + pub mod qux { + pub fn quux() {} + } +} + +fn main() { + use foo::bar; + foo::bar(); + //~^ ERROR unnecessary qualification + + use baz::qux::quux; + baz::qux::quux(); + //~^ ERROR unnecessary qualification +} diff --git a/tests/ui/resolve/unused-qualifications-suggestion.stderr b/tests/ui/resolve/unused-qualifications-suggestion.stderr new file mode 100644 index 000000000..e3dac37fc --- /dev/null +++ b/tests/ui/resolve/unused-qualifications-suggestion.stderr @@ -0,0 +1,31 @@ +error: unnecessary qualification + --> $DIR/unused-qualifications-suggestion.rs:17:5 + | +LL | foo::bar(); + | ^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/unused-qualifications-suggestion.rs:3:9 + | +LL | #![deny(unused_qualifications)] + | ^^^^^^^^^^^^^^^^^^^^^ +help: remove the unnecessary path segments + | +LL - foo::bar(); +LL + bar(); + | + +error: unnecessary qualification + --> $DIR/unused-qualifications-suggestion.rs:21:5 + | +LL | baz::qux::quux(); + | ^^^^^^^^^^^^^^ + | +help: remove the unnecessary path segments + | +LL - baz::qux::quux(); +LL + quux(); + | + +error: aborting due to 2 previous errors + -- cgit v1.2.3