diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/namespace | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/namespace')
8 files changed, 1063 insertions, 0 deletions
diff --git a/src/test/ui/namespace/auxiliary/namespace-mix.rs b/src/test/ui/namespace/auxiliary/namespace-mix.rs new file mode 100644 index 000000000..fb39d29f8 --- /dev/null +++ b/src/test/ui/namespace/auxiliary/namespace-mix.rs @@ -0,0 +1,66 @@ +pub mod c { + pub struct S {} + pub struct TS(); + pub struct US; + pub enum E { + V {}, + TV(), + UV, + } + + pub struct Item; +} + +pub mod xm1 { + pub use ::c::*; + pub type S = ::c::Item; +} +pub mod xm2 { + pub use ::c::*; + pub const S: ::c::Item = ::c::Item; +} + +pub mod xm3 { + pub use ::c::*; + pub type TS = ::c::Item; +} +pub mod xm4 { + pub use ::c::*; + pub const TS: ::c::Item = ::c::Item; +} + +pub mod xm5 { + pub use ::c::*; + pub type US = ::c::Item; +} +pub mod xm6 { + pub use ::c::*; + pub const US: ::c::Item = ::c::Item; +} + +pub mod xm7 { + pub use ::c::E::*; + pub type V = ::c::Item; +} +pub mod xm8 { + pub use ::c::E::*; + pub const V: ::c::Item = ::c::Item; +} + +pub mod xm9 { + pub use ::c::E::*; + pub type TV = ::c::Item; +} +pub mod xmA { + pub use ::c::E::*; + pub const TV: ::c::Item = ::c::Item; +} + +pub mod xmB { + pub use ::c::E::*; + pub type UV = ::c::Item; +} +pub mod xmC { + pub use ::c::E::*; + pub const UV: ::c::Item = ::c::Item; +} diff --git a/src/test/ui/namespace/auxiliary/namespaced_enums.rs b/src/test/ui/namespace/auxiliary/namespaced_enums.rs new file mode 100644 index 000000000..d3548c76c --- /dev/null +++ b/src/test/ui/namespace/auxiliary/namespaced_enums.rs @@ -0,0 +1,10 @@ +pub enum Foo { + A, + B(isize), + C { a: isize }, +} + +impl Foo { + pub fn foo() {} + pub fn bar(&self) {} +} diff --git a/src/test/ui/namespace/namespace-mix.rs b/src/test/ui/namespace/namespace-mix.rs new file mode 100644 index 000000000..b0f7e3c62 --- /dev/null +++ b/src/test/ui/namespace/namespace-mix.rs @@ -0,0 +1,155 @@ +// aux-build:namespace-mix.rs + +extern crate namespace_mix; +use namespace_mix::*; + +mod c { + pub struct S {} + pub struct TS(); + pub struct US; + pub enum E { + V {}, + TV(), + UV, + } + + pub struct Item; +} + +// Use something emitting the type argument name, e.g., unsatisfied bound. +trait Impossible {} +fn check<T: Impossible>(_: T) {} + +mod m1 { + pub use ::c::*; + pub type S = ::c::Item; +} +mod m2 { + pub use ::c::*; + pub const S: ::c::Item = ::c::Item; +} + +fn f12() { + check(m1::S{}); //~ ERROR c::Item + check(m1::S); //~ ERROR expected value, found type alias `m1::S` + check(m2::S{}); //~ ERROR c::S + check(m2::S); //~ ERROR c::Item +} +fn xf12() { + check(xm1::S{}); //~ ERROR c::Item + check(xm1::S); //~ ERROR expected value, found type alias `xm1::S` + check(xm2::S{}); //~ ERROR c::S + check(xm2::S); //~ ERROR c::Item +} + +mod m3 { + pub use ::c::*; + pub type TS = ::c::Item; +} +mod m4 { + pub use ::c::*; + pub const TS: ::c::Item = ::c::Item; +} + +fn f34() { + check(m3::TS{}); //~ ERROR c::Item + check(m3::TS); //~ ERROR c::TS + check(m4::TS{}); //~ ERROR c::TS + check(m4::TS); //~ ERROR c::Item +} +fn xf34() { + check(xm3::TS{}); //~ ERROR c::Item + check(xm3::TS); //~ ERROR c::TS + check(xm4::TS{}); //~ ERROR c::TS + check(xm4::TS); //~ ERROR c::Item +} + +mod m5 { + pub use ::c::*; + pub type US = ::c::Item; +} +mod m6 { + pub use ::c::*; + pub const US: ::c::Item = ::c::Item; +} + +fn f56() { + check(m5::US{}); //~ ERROR c::Item + check(m5::US); //~ ERROR c::US + check(m6::US{}); //~ ERROR c::US + check(m6::US); //~ ERROR c::Item +} +fn xf56() { + check(xm5::US{}); //~ ERROR c::Item + check(xm5::US); //~ ERROR c::US + check(xm6::US{}); //~ ERROR c::US + check(xm6::US); //~ ERROR c::Item +} + +mod m7 { + pub use ::c::E::*; + pub type V = ::c::Item; +} +mod m8 { + pub use ::c::E::*; + pub const V: ::c::Item = ::c::Item; +} + +fn f78() { + check(m7::V{}); //~ ERROR c::Item + check(m7::V); //~ ERROR expected value, found struct variant `m7::V` + check(m8::V{}); //~ ERROR c::E + check(m8::V); //~ ERROR c::Item +} +fn xf78() { + check(xm7::V{}); //~ ERROR c::Item + check(xm7::V); //~ ERROR expected value, found struct variant `xm7::V` + check(xm8::V{}); //~ ERROR c::E + check(xm8::V); //~ ERROR c::Item +} + +mod m9 { + pub use ::c::E::*; + pub type TV = ::c::Item; +} +mod mA { + pub use ::c::E::*; + pub const TV: ::c::Item = ::c::Item; +} + +fn f9A() { + check(m9::TV{}); //~ ERROR c::Item + check(m9::TV); //~ ERROR c::E + check(mA::TV{}); //~ ERROR c::E + check(mA::TV); //~ ERROR c::Item +} +fn xf9A() { + check(xm9::TV{}); //~ ERROR c::Item + check(xm9::TV); //~ ERROR c::E + check(xmA::TV{}); //~ ERROR c::E + check(xmA::TV); //~ ERROR c::Item +} + +mod mB { + pub use ::c::E::*; + pub type UV = ::c::Item; +} +mod mC { + pub use ::c::E::*; + pub const UV: ::c::Item = ::c::Item; +} + +fn fBC() { + check(mB::UV{}); //~ ERROR c::Item + check(mB::UV); //~ ERROR c::E + check(mC::UV{}); //~ ERROR c::E + check(mC::UV); //~ ERROR c::Item +} +fn xfBC() { + check(xmB::UV{}); //~ ERROR c::Item + check(xmB::UV); //~ ERROR c::E + check(xmC::UV{}); //~ ERROR c::E + check(xmC::UV); //~ ERROR c::Item +} + +fn main() {} diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr new file mode 100644 index 000000000..b04ea14d1 --- /dev/null +++ b/src/test/ui/namespace/namespace-mix.stderr @@ -0,0 +1,738 @@ +error[E0423]: expected value, found type alias `m1::S` + --> $DIR/namespace-mix.rs:34:11 + | +LL | pub struct TS(); + | ---------------- similarly named tuple struct `TS` defined here +... +LL | check(m1::S); + | ^^^^^ + | + = note: can't use a type alias as a constructor +help: a tuple struct with a similar name exists + | +LL | check(m1::TS); + | ~~ +help: consider importing one of these items instead + | +LL | use m2::S; + | +LL | use xm2::S; + | +help: if you import `S`, refer to it directly + | +LL - check(m1::S); +LL + check(S); + | + +error[E0423]: expected value, found type alias `xm1::S` + --> $DIR/namespace-mix.rs:40:11 + | +LL | check(xm1::S); + | ^^^^^^ + | + ::: $DIR/auxiliary/namespace-mix.rs:3:5 + | +LL | pub struct TS(); + | ------------- similarly named tuple struct `TS` defined here + | + = note: can't use a type alias as a constructor +help: a tuple struct with a similar name exists + | +LL | check(xm1::TS); + | ~~ +help: consider importing one of these items instead + | +LL | use m2::S; + | +LL | use xm2::S; + | +help: if you import `S`, refer to it directly + | +LL - check(xm1::S); +LL + check(S); + | + +error[E0423]: expected value, found struct variant `m7::V` + --> $DIR/namespace-mix.rs:100:11 + | +LL | V {}, + | ---- `m7::V` defined here +LL | TV(), + | ---- similarly named tuple variant `TV` defined here +... +LL | check(m7::V); + | ^^^^^ + | +help: use struct literal syntax instead + | +LL | check(m7::V {}); + | ~~~~~~~~ +help: a tuple variant with a similar name exists + | +LL | check(m7::TV); + | ~~ +help: consider importing one of these items instead + | +LL | use m8::V; + | +LL | use xm8::V; + | +help: if you import `V`, refer to it directly + | +LL - check(m7::V); +LL + check(V); + | + +error[E0423]: expected value, found struct variant `xm7::V` + --> $DIR/namespace-mix.rs:106:11 + | +LL | check(xm7::V); + | ^^^^^^ + | + ::: $DIR/auxiliary/namespace-mix.rs:6:9 + | +LL | V {}, + | - `xm7::V` defined here +LL | TV(), + | -- similarly named tuple variant `TV` defined here + | +help: use struct literal syntax instead + | +LL | check(xm7::V { /* fields */ }); + | ~~~~~~~~~~~~~~~~~~~~~~~ +help: a tuple variant with a similar name exists + | +LL | check(xm7::TV); + | ~~ +help: consider importing one of these items instead + | +LL | use m8::V; + | +LL | use xm8::V; + | +help: if you import `V`, refer to it directly + | +LL - check(xm7::V); +LL + check(V); + | + +error[E0277]: the trait bound `c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:33:11 + | +LL | check(m1::S{}); + | ----- ^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::S: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:35:11 + | +LL | check(m2::S{}); + | ----- ^^^^^^^ the trait `Impossible` is not implemented for `c::S` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:36:11 + | +LL | check(m2::S); + | ----- ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:39:11 + | +LL | check(xm1::S{}); + | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::S: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:41:11 + | +LL | check(xm2::S{}); + | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::S` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:42:11 + | +LL | check(xm2::S); + | ----- ^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:55:11 + | +LL | check(m3::TS{}); + | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `fn() -> c::TS {c::TS}: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:56:11 + | +LL | check(m3::TS); + | ----- ^^^^^^ the trait `Impossible` is not implemented for `fn() -> c::TS {c::TS}` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::TS: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:57:11 + | +LL | check(m4::TS{}); + | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::TS` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:58:11 + | +LL | check(m4::TS); + | ----- ^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:61:11 + | +LL | check(xm3::TS{}); + | ----- ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `fn() -> namespace_mix::c::TS {namespace_mix::c::TS}: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:62:11 + | +LL | check(xm3::TS); + | ----- ^^^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::TS {namespace_mix::c::TS}` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::TS: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:63:11 + | +LL | check(xm4::TS{}); + | ----- ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::TS` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:64:11 + | +LL | check(xm4::TS); + | ----- ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:77:11 + | +LL | check(m5::US{}); + | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::US: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:78:11 + | +LL | check(m5::US); + | ----- ^^^^^^ the trait `Impossible` is not implemented for `c::US` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::US: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:79:11 + | +LL | check(m6::US{}); + | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::US` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:80:11 + | +LL | check(m6::US); + | ----- ^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:83:11 + | +LL | check(xm5::US{}); + | ----- ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::US: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:84:11 + | +LL | check(xm5::US); + | ----- ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::US: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:85:11 + | +LL | check(xm6::US{}); + | ----- ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:86:11 + | +LL | check(xm6::US); + | ----- ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:99:11 + | +LL | check(m7::V{}); + | ----- ^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::E: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:101:11 + | +LL | check(m8::V{}); + | ----- ^^^^^^^ the trait `Impossible` is not implemented for `c::E` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:102:11 + | +LL | check(m8::V); + | ----- ^^^^^ the trait `Impossible` is not implemented for `c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:105:11 + | +LL | check(xm7::V{}); + | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:107:11 + | +LL | check(xm8::V{}); + | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:108:11 + | +LL | check(xm8::V); + | ----- ^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:121:11 + | +LL | check(m9::TV{}); + | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `fn() -> c::E {c::E::TV}: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:122:11 + | +LL | check(m9::TV); + | ----- ^^^^^^ the trait `Impossible` is not implemented for `fn() -> c::E {c::E::TV}` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::E: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:123:11 + | +LL | check(mA::TV{}); + | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::E` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:124:11 + | +LL | check(mA::TV); + | ----- ^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:127:11 + | +LL | check(xm9::TV{}); + | ----- ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `fn() -> namespace_mix::c::E {namespace_mix::xm7::TV}: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:128:11 + | +LL | check(xm9::TV); + | ----- ^^^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::E {namespace_mix::xm7::TV}` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:129:11 + | +LL | check(xmA::TV{}); + | ----- ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:130:11 + | +LL | check(xmA::TV); + | ----- ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:143:11 + | +LL | check(mB::UV{}); + | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::E: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:144:11 + | +LL | check(mB::UV); + | ----- ^^^^^^ the trait `Impossible` is not implemented for `c::E` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::E: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:145:11 + | +LL | check(mC::UV{}); + | ----- ^^^^^^^^ the trait `Impossible` is not implemented for `c::E` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:146:11 + | +LL | check(mC::UV); + | ----- ^^^^^^ the trait `Impossible` is not implemented for `c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:149:11 + | +LL | check(xmB::UV{}); + | ----- ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:150:11 + | +LL | check(xmB::UV); + | ----- ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:151:11 + | +LL | check(xmC::UV{}); + | ----- ^^^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied + --> $DIR/namespace-mix.rs:152:11 + | +LL | check(xmC::UV); + | ----- ^^^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/namespace-mix.rs:21:13 + | +LL | fn check<T: Impossible>(_: T) {} + | ^^^^^^^^^^ required by this bound in `check` + +error: aborting due to 48 previous errors + +Some errors have detailed explanations: E0277, E0423. +For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.rs b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.rs new file mode 100644 index 000000000..feb94b681 --- /dev/null +++ b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.rs @@ -0,0 +1,15 @@ +// aux-build:namespaced_enums.rs +extern crate namespaced_enums; + +mod m { + pub use namespaced_enums::Foo::*; +} + +pub fn main() { + use namespaced_enums::Foo::*; + + foo(); //~ ERROR cannot find function `foo` in this scope + m::foo(); //~ ERROR cannot find function `foo` in module `m` + bar(); //~ ERROR cannot find function `bar` in this scope + m::bar(); //~ ERROR cannot find function `bar` in module `m` +} diff --git a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr new file mode 100644 index 000000000..f3dbcc2d7 --- /dev/null +++ b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr @@ -0,0 +1,27 @@ +error[E0425]: cannot find function `foo` in this scope + --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:11:5 + | +LL | foo(); + | ^^^ not found in this scope + +error[E0425]: cannot find function `foo` in module `m` + --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:12:8 + | +LL | m::foo(); + | ^^^ not found in `m` + +error[E0425]: cannot find function `bar` in this scope + --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:13:5 + | +LL | bar(); + | ^^^ not found in this scope + +error[E0425]: cannot find function `bar` in module `m` + --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:14:8 + | +LL | m::bar(); + | ^^^ not found in `m` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.rs b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.rs new file mode 100644 index 000000000..ab24f36f9 --- /dev/null +++ b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.rs @@ -0,0 +1,25 @@ +mod m2 { + pub enum Foo { + A, + B(isize), + C { a: isize }, + } + + impl Foo { + pub fn foo() {} + pub fn bar(&self) {} + } +} + +mod m { + pub use m2::Foo::*; +} + +pub fn main() { + use m2::Foo::*; + + foo(); //~ ERROR cannot find function `foo` in this scope + m::foo(); //~ ERROR cannot find function `foo` in module `m` + bar(); //~ ERROR cannot find function `bar` in this scope + m::bar(); //~ ERROR cannot find function `bar` in module `m` +} diff --git a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr new file mode 100644 index 000000000..98784de8e --- /dev/null +++ b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr @@ -0,0 +1,27 @@ +error[E0425]: cannot find function `foo` in this scope + --> $DIR/namespaced-enum-glob-import-no-impls.rs:21:5 + | +LL | foo(); + | ^^^ not found in this scope + +error[E0425]: cannot find function `foo` in module `m` + --> $DIR/namespaced-enum-glob-import-no-impls.rs:22:8 + | +LL | m::foo(); + | ^^^ not found in `m` + +error[E0425]: cannot find function `bar` in this scope + --> $DIR/namespaced-enum-glob-import-no-impls.rs:23:5 + | +LL | bar(); + | ^^^ not found in this scope + +error[E0425]: cannot find function `bar` in module `m` + --> $DIR/namespaced-enum-glob-import-no-impls.rs:24:8 + | +LL | m::bar(); + | ^^^ not found in `m` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0425`. |