diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/crashes/121613-2.rs | 28 | ||||
| -rw-r--r-- | tests/crashes/121613.rs | 24 | ||||
| -rw-r--r-- | tests/crashes/122914.rs | 11 | ||||
| -rw-r--r-- | tests/crashes/127222.rs | 3 | ||||
| -rw-r--r-- | tests/ui/inference/need_type_info/incompat-call-after-qualified-path-0.rs | 24 | ||||
| -rw-r--r-- | tests/ui/inference/need_type_info/incompat-call-after-qualified-path-0.stderr | 32 | ||||
| -rw-r--r-- | tests/ui/inference/need_type_info/incompat-call-after-qualified-path-1.rs | 28 | ||||
| -rw-r--r-- | tests/ui/inference/need_type_info/incompat-call-after-qualified-path-1.stderr | 32 | ||||
| -rw-r--r-- | tests/ui/methods/dont-ice-on-object-lookup-w-error-region.rs | 11 | ||||
| -rw-r--r-- | tests/ui/methods/dont-ice-on-object-lookup-w-error-region.stderr | 11 | ||||
| -rw-r--r-- | tests/ui/sanitizer/cfi-sized-associated-ty.rs | 38 | ||||
| -rw-r--r-- | tests/ui/traits/alias/not-a-marker.rs | 7 | ||||
| -rw-r--r-- | tests/ui/traits/alias/not-a-marker.stderr | 11 |
13 files changed, 194 insertions, 66 deletions
diff --git a/tests/crashes/121613-2.rs b/tests/crashes/121613-2.rs deleted file mode 100644 index ddc4f37c96a..00000000000 --- a/tests/crashes/121613-2.rs +++ /dev/null @@ -1,28 +0,0 @@ -//@ known-bug: #121613 -fn main() { - // destructure through a qualified path - let <Foo as A>::Assoc { br } = StructStruct { br: 2 }; - //~^ ERROR usage of qualified paths in this context is experimental - let _ = <Foo as A>::Assoc { br: 2 }; - //~^ ERROR usage of qualified paths in this context is experimental - let <E>::V(..) = E::V(|a, b| a.cmp(b)); - //~^ ERROR usage of qualified paths in this context is experimental -} - -struct StructStruct { - br: i8, -} - -struct Foo; - -trait A { - type Assoc; -} - -impl A for Foo { - type Assoc = StructStruct; -} - -enum E { - V(u8) -} diff --git a/tests/crashes/121613.rs b/tests/crashes/121613.rs deleted file mode 100644 index ec9ba82a68c..00000000000 --- a/tests/crashes/121613.rs +++ /dev/null @@ -1,24 +0,0 @@ -//@ known-bug: #121613 -fn main() { - let _ = <Foo as A>::Assoc { br: 2 }; - - let <E>::V(..) = E::V(|a, b| a.cmp(b)); -} - -struct StructStruct { - br: i8, -} - -struct Foo; - -trait A { - type Assoc; -} - -impl A for Foo { - type Assoc = StructStruct; -} - -enum E { - V(u8), -} diff --git a/tests/crashes/122914.rs b/tests/crashes/122914.rs deleted file mode 100644 index 63a84bc8099..00000000000 --- a/tests/crashes/122914.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ known-bug: #122914 -use std::future::Future; -use std::pin::Pin; - -impl<'a, F> Poll { - fn project<'_>(self: Pin<&'pin mut Future>) -> Projection<'pin, 'a, F> { - me.local_set.with(|| { - let _ = self.poll(cx); - }) - } -} diff --git a/tests/crashes/127222.rs b/tests/crashes/127222.rs deleted file mode 100644 index eda0ea3d9b7..00000000000 --- a/tests/crashes/127222.rs +++ /dev/null @@ -1,3 +0,0 @@ -//@ known-bug: rust-lang/rust#127222 -#[marker] -trait Foo = PartialEq<i32> + Send; diff --git a/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-0.rs b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-0.rs new file mode 100644 index 00000000000..830a6390fce --- /dev/null +++ b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-0.rs @@ -0,0 +1,24 @@ +// issue#121613 + +#![feature(more_qualified_paths)] + +struct S {} + +struct Foo; + +trait A { + type Assoc; +} + +impl A for Foo { + type Assoc = S; +} + +fn f() {} + +fn main() { + <Foo as A>::Assoc {}; + f(|a, b| a.cmp(b)); + //~^ ERROR: type annotations needed + //~| ERROR: this function takes 0 arguments but 1 argument was supplied +} diff --git a/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-0.stderr b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-0.stderr new file mode 100644 index 00000000000..10056bdf3d4 --- /dev/null +++ b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-0.stderr @@ -0,0 +1,32 @@ +error[E0282]: type annotations needed + --> $DIR/incompat-call-after-qualified-path-0.rs:21:6 + | +LL | f(|a, b| a.cmp(b)); + | ^ - type must be known at this point + | +help: consider giving this closure parameter an explicit type + | +LL | f(|a: /* Type */, b| a.cmp(b)); + | ++++++++++++ + +error[E0061]: this function takes 0 arguments but 1 argument was supplied + --> $DIR/incompat-call-after-qualified-path-0.rs:21:3 + | +LL | f(|a, b| a.cmp(b)); + | ^ --------------- unexpected argument + | +note: function defined here + --> $DIR/incompat-call-after-qualified-path-0.rs:17:4 + | +LL | fn f() {} + | ^ +help: remove the extra argument + | +LL - f(|a, b| a.cmp(b)); +LL + f(); + | + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0061, E0282. +For more information about an error, try `rustc --explain E0061`. diff --git a/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-1.rs b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-1.rs new file mode 100644 index 00000000000..6b786332a8f --- /dev/null +++ b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-1.rs @@ -0,0 +1,28 @@ +// issue#121613 + +#![feature(more_qualified_paths)] + +struct S<T> { + a: T +} + +struct Foo; + +trait A { + type Assoc<T>; +} + +impl A for Foo { + type Assoc<T> = S<T>; +} + +fn f() {} + +fn main() { + <Foo as A>::Assoc::<i32> { + a: 1 + }; + f(|a, b| a.cmp(b)); + //~^ ERROR: type annotations needed + //~| ERROR: this function takes 0 arguments but 1 argument was supplied +} diff --git a/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-1.stderr b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-1.stderr new file mode 100644 index 00000000000..632a9b99f84 --- /dev/null +++ b/tests/ui/inference/need_type_info/incompat-call-after-qualified-path-1.stderr @@ -0,0 +1,32 @@ +error[E0282]: type annotations needed + --> $DIR/incompat-call-after-qualified-path-1.rs:25:6 + | +LL | f(|a, b| a.cmp(b)); + | ^ - type must be known at this point + | +help: consider giving this closure parameter an explicit type + | +LL | f(|a: /* Type */, b| a.cmp(b)); + | ++++++++++++ + +error[E0061]: this function takes 0 arguments but 1 argument was supplied + --> $DIR/incompat-call-after-qualified-path-1.rs:25:3 + | +LL | f(|a, b| a.cmp(b)); + | ^ --------------- unexpected argument + | +note: function defined here + --> $DIR/incompat-call-after-qualified-path-1.rs:19:4 + | +LL | fn f() {} + | ^ +help: remove the extra argument + | +LL - f(|a, b| a.cmp(b)); +LL + f(); + | + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0061, E0282. +For more information about an error, try `rustc --explain E0061`. diff --git a/tests/ui/methods/dont-ice-on-object-lookup-w-error-region.rs b/tests/ui/methods/dont-ice-on-object-lookup-w-error-region.rs new file mode 100644 index 00000000000..0a6d196364f --- /dev/null +++ b/tests/ui/methods/dont-ice-on-object-lookup-w-error-region.rs @@ -0,0 +1,11 @@ +// Fix for issue: #122914 + +use std::future::Future; +use std::pin::Pin; + +fn project(x: Pin<&'missing mut dyn Future<Output = ()>>) { + //~^ ERROR use of undeclared lifetime name `'missing` + let _ = x.poll(todo!()); +} + +fn main() {} diff --git a/tests/ui/methods/dont-ice-on-object-lookup-w-error-region.stderr b/tests/ui/methods/dont-ice-on-object-lookup-w-error-region.stderr new file mode 100644 index 00000000000..2c33941be43 --- /dev/null +++ b/tests/ui/methods/dont-ice-on-object-lookup-w-error-region.stderr @@ -0,0 +1,11 @@ +error[E0261]: use of undeclared lifetime name `'missing` + --> $DIR/dont-ice-on-object-lookup-w-error-region.rs:6:20 + | +LL | fn project(x: Pin<&'missing mut dyn Future<Output = ()>>) { + | - ^^^^^^^^ undeclared lifetime + | | + | help: consider introducing lifetime `'missing` here: `<'missing>` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/sanitizer/cfi-sized-associated-ty.rs b/tests/ui/sanitizer/cfi-sized-associated-ty.rs new file mode 100644 index 00000000000..f5b4e22e9d9 --- /dev/null +++ b/tests/ui/sanitizer/cfi-sized-associated-ty.rs @@ -0,0 +1,38 @@ +// Check that we only elaborate non-`Self: Sized` associated types when +// erasing the receiver from trait ref. + +//@ revisions: cfi kcfi +// FIXME(#122848) Remove only-linux once OSX CFI binaries work +//@ only-linux +//@ [cfi] needs-sanitizer-cfi +//@ [kcfi] needs-sanitizer-kcfi +//@ compile-flags: -C target-feature=-crt-static +//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 +//@ [cfi] compile-flags: -Z sanitizer=cfi +//@ [kcfi] compile-flags: -Z sanitizer=kcfi +//@ [kcfi] compile-flags: -C panic=abort -C prefer-dynamic=off +//@ run-pass + +trait Foo { + type Bar<'a> + where + Self: Sized; + + fn test(&self); +} + +impl Foo for () { + type Bar<'a> = () + where + Self: Sized; + + fn test(&self) {} +} + +fn test(x: &dyn Foo) { + x.test(); +} + +fn main() { + test(&()); +} diff --git a/tests/ui/traits/alias/not-a-marker.rs b/tests/ui/traits/alias/not-a-marker.rs new file mode 100644 index 00000000000..b004b9ff9ae --- /dev/null +++ b/tests/ui/traits/alias/not-a-marker.rs @@ -0,0 +1,7 @@ +#![feature(trait_alias, marker_trait_attr)] + +#[marker] +//~^ ERROR attribute should be applied to a trait +trait Foo = Send; + +fn main() {} diff --git a/tests/ui/traits/alias/not-a-marker.stderr b/tests/ui/traits/alias/not-a-marker.stderr new file mode 100644 index 00000000000..2f3f6fea30f --- /dev/null +++ b/tests/ui/traits/alias/not-a-marker.stderr @@ -0,0 +1,11 @@ +error: attribute should be applied to a trait + --> $DIR/not-a-marker.rs:3:1 + | +LL | #[marker] + | ^^^^^^^^^ +LL | +LL | trait Foo = Send; + | ----------------- not a trait + +error: aborting due to 1 previous error + |
