From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../ui/impl-trait/in-trait/auxiliary/rpitit.rs | 11 --- .../ui/impl-trait/in-trait/deep-match-works.rs | 16 ----- src/test/ui/impl-trait/in-trait/deep-match.rs | 15 ---- src/test/ui/impl-trait/in-trait/deep-match.stderr | 15 ---- .../impl-trait/in-trait/default-body-type-err-2.rs | 13 ---- .../in-trait/default-body-type-err-2.stderr | 11 --- .../impl-trait/in-trait/default-body-type-err.rs | 13 ---- .../in-trait/default-body-type-err.stderr | 12 ---- .../impl-trait/in-trait/default-body-with-rpit.rs | 21 ------ src/test/ui/impl-trait/in-trait/default-body.rs | 21 ------ src/test/ui/impl-trait/in-trait/doesnt-satisfy.rs | 13 ---- .../ui/impl-trait/in-trait/doesnt-satisfy.stderr | 17 ----- src/test/ui/impl-trait/in-trait/early.rs | 23 ------ src/test/ui/impl-trait/in-trait/encode.rs | 9 --- src/test/ui/impl-trait/in-trait/foreign.rs | 9 --- .../ui/impl-trait/in-trait/generics-mismatch.rs | 17 ----- .../impl-trait/in-trait/generics-mismatch.stderr | 12 ---- src/test/ui/impl-trait/in-trait/issue-102140.rs | 30 -------- .../ui/impl-trait/in-trait/issue-102140.stderr | 29 -------- src/test/ui/impl-trait/in-trait/issue-102301.rs | 18 ----- src/test/ui/impl-trait/in-trait/issue-102571.rs | 24 ------- .../ui/impl-trait/in-trait/issue-102571.stderr | 14 ---- .../in-trait/method-signature-matches.rs | 51 ------------- .../in-trait/method-signature-matches.stderr | 84 ---------------------- src/test/ui/impl-trait/in-trait/nested-rpitit.rs | 32 --------- src/test/ui/impl-trait/in-trait/object-safety.rs | 22 ------ .../ui/impl-trait/in-trait/object-safety.stderr | 50 ------------- .../in-trait/opaque-in-impl-is-opaque.rs | 19 ----- .../in-trait/opaque-in-impl-is-opaque.stderr | 17 ----- src/test/ui/impl-trait/in-trait/opaque-in-impl.rs | 48 ------------- src/test/ui/impl-trait/in-trait/reveal.rs | 18 ----- .../ui/impl-trait/in-trait/signature-mismatch.rs | 21 ------ .../impl-trait/in-trait/signature-mismatch.stderr | 16 ----- .../impl-trait/in-trait/specialization-broken.rs | 26 ------- .../in-trait/specialization-broken.stderr | 23 ------ .../in-trait/specialization-substs-remap.rs | 24 ------- src/test/ui/impl-trait/in-trait/success.rs | 40 ----------- .../in-trait/trait-more-generics-than-impl.rs | 17 ----- .../in-trait/trait-more-generics-than-impl.stderr | 12 ---- src/test/ui/impl-trait/in-trait/wf-bounds.rs | 16 ----- src/test/ui/impl-trait/in-trait/wf-bounds.stderr | 33 --------- src/test/ui/impl-trait/in-trait/where-clause.rs | 24 ------- 42 files changed, 956 deletions(-) delete mode 100644 src/test/ui/impl-trait/in-trait/auxiliary/rpitit.rs delete mode 100644 src/test/ui/impl-trait/in-trait/deep-match-works.rs delete mode 100644 src/test/ui/impl-trait/in-trait/deep-match.rs delete mode 100644 src/test/ui/impl-trait/in-trait/deep-match.stderr delete mode 100644 src/test/ui/impl-trait/in-trait/default-body-type-err-2.rs delete mode 100644 src/test/ui/impl-trait/in-trait/default-body-type-err-2.stderr delete mode 100644 src/test/ui/impl-trait/in-trait/default-body-type-err.rs delete mode 100644 src/test/ui/impl-trait/in-trait/default-body-type-err.stderr delete mode 100644 src/test/ui/impl-trait/in-trait/default-body-with-rpit.rs delete mode 100644 src/test/ui/impl-trait/in-trait/default-body.rs delete mode 100644 src/test/ui/impl-trait/in-trait/doesnt-satisfy.rs delete mode 100644 src/test/ui/impl-trait/in-trait/doesnt-satisfy.stderr delete mode 100644 src/test/ui/impl-trait/in-trait/early.rs delete mode 100644 src/test/ui/impl-trait/in-trait/encode.rs delete mode 100644 src/test/ui/impl-trait/in-trait/foreign.rs delete mode 100644 src/test/ui/impl-trait/in-trait/generics-mismatch.rs delete mode 100644 src/test/ui/impl-trait/in-trait/generics-mismatch.stderr delete mode 100644 src/test/ui/impl-trait/in-trait/issue-102140.rs delete mode 100644 src/test/ui/impl-trait/in-trait/issue-102140.stderr delete mode 100644 src/test/ui/impl-trait/in-trait/issue-102301.rs delete mode 100644 src/test/ui/impl-trait/in-trait/issue-102571.rs delete mode 100644 src/test/ui/impl-trait/in-trait/issue-102571.stderr delete mode 100644 src/test/ui/impl-trait/in-trait/method-signature-matches.rs delete mode 100644 src/test/ui/impl-trait/in-trait/method-signature-matches.stderr delete mode 100644 src/test/ui/impl-trait/in-trait/nested-rpitit.rs delete mode 100644 src/test/ui/impl-trait/in-trait/object-safety.rs delete mode 100644 src/test/ui/impl-trait/in-trait/object-safety.stderr delete mode 100644 src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs delete mode 100644 src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr delete mode 100644 src/test/ui/impl-trait/in-trait/opaque-in-impl.rs delete mode 100644 src/test/ui/impl-trait/in-trait/reveal.rs delete mode 100644 src/test/ui/impl-trait/in-trait/signature-mismatch.rs delete mode 100644 src/test/ui/impl-trait/in-trait/signature-mismatch.stderr delete mode 100644 src/test/ui/impl-trait/in-trait/specialization-broken.rs delete mode 100644 src/test/ui/impl-trait/in-trait/specialization-broken.stderr delete mode 100644 src/test/ui/impl-trait/in-trait/specialization-substs-remap.rs delete mode 100644 src/test/ui/impl-trait/in-trait/success.rs delete mode 100644 src/test/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs delete mode 100644 src/test/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr delete mode 100644 src/test/ui/impl-trait/in-trait/wf-bounds.rs delete mode 100644 src/test/ui/impl-trait/in-trait/wf-bounds.stderr delete mode 100644 src/test/ui/impl-trait/in-trait/where-clause.rs (limited to 'src/test/ui/impl-trait/in-trait') diff --git a/src/test/ui/impl-trait/in-trait/auxiliary/rpitit.rs b/src/test/ui/impl-trait/in-trait/auxiliary/rpitit.rs deleted file mode 100644 index 74df300f8..000000000 --- a/src/test/ui/impl-trait/in-trait/auxiliary/rpitit.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![feature(return_position_impl_trait_in_trait)] - -pub trait Foo { - fn bar() -> impl Sized; -} - -pub struct Foreign; - -impl Foo for Foreign { - fn bar() {} -} diff --git a/src/test/ui/impl-trait/in-trait/deep-match-works.rs b/src/test/ui/impl-trait/in-trait/deep-match-works.rs deleted file mode 100644 index 772da845e..000000000 --- a/src/test/ui/impl-trait/in-trait/deep-match-works.rs +++ /dev/null @@ -1,16 +0,0 @@ -// check-pass - -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -struct Wrapper(T); - -trait Foo { - fn bar() -> Wrapper; -} - -impl Foo for () { - fn bar() -> Wrapper { Wrapper(0) } -} - -fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/deep-match.rs b/src/test/ui/impl-trait/in-trait/deep-match.rs deleted file mode 100644 index a6385147c..000000000 --- a/src/test/ui/impl-trait/in-trait/deep-match.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -struct Wrapper(T); - -trait Foo { - fn bar() -> Wrapper; -} - -impl Foo for () { - fn bar() -> i32 { 0 } - //~^ ERROR method `bar` has an incompatible return type for trait -} - -fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/deep-match.stderr b/src/test/ui/impl-trait/in-trait/deep-match.stderr deleted file mode 100644 index 034ee5ea4..000000000 --- a/src/test/ui/impl-trait/in-trait/deep-match.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0053]: method `bar` has an incompatible return type for trait - --> $DIR/deep-match.rs:11:17 - | -LL | fn bar() -> i32 { 0 } - | ^^^ - | | - | expected struct `Wrapper`, found `i32` - | return type in trait - | - = note: expected struct `Wrapper<_>` - found type `i32` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0053`. diff --git a/src/test/ui/impl-trait/in-trait/default-body-type-err-2.rs b/src/test/ui/impl-trait/in-trait/default-body-type-err-2.rs deleted file mode 100644 index 45ae2b8ad..000000000 --- a/src/test/ui/impl-trait/in-trait/default-body-type-err-2.rs +++ /dev/null @@ -1,13 +0,0 @@ -// edition:2021 - -#![allow(incomplete_features)] -#![feature(async_fn_in_trait)] - -pub trait Foo { - async fn woopsie_async(&self) -> String { - 42 - //~^ ERROR mismatched types - } -} - -fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/default-body-type-err-2.stderr b/src/test/ui/impl-trait/in-trait/default-body-type-err-2.stderr deleted file mode 100644 index 142b1bff1..000000000 --- a/src/test/ui/impl-trait/in-trait/default-body-type-err-2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/default-body-type-err-2.rs:8:9 - | -LL | 42 - | ^^- help: try using a conversion method: `.to_string()` - | | - | expected struct `String`, found integer - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/impl-trait/in-trait/default-body-type-err.rs b/src/test/ui/impl-trait/in-trait/default-body-type-err.rs deleted file mode 100644 index ac9baf91c..000000000 --- a/src/test/ui/impl-trait/in-trait/default-body-type-err.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![allow(incomplete_features)] -#![feature(return_position_impl_trait_in_trait)] - -use std::ops::Deref; - -pub trait Foo { - fn lol(&self) -> impl Deref { - //~^ type mismatch resolving `<&i32 as Deref>::Target == String` - &1i32 - } -} - -fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/default-body-type-err.stderr b/src/test/ui/impl-trait/in-trait/default-body-type-err.stderr deleted file mode 100644 index 461247a3e..000000000 --- a/src/test/ui/impl-trait/in-trait/default-body-type-err.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0271]: type mismatch resolving `<&i32 as Deref>::Target == String` - --> $DIR/default-body-type-err.rs:7:22 - | -LL | fn lol(&self) -> impl Deref { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `String` -LL | -LL | &1i32 - | ----- return type was inferred to be `&i32` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0271`. diff --git a/src/test/ui/impl-trait/in-trait/default-body-with-rpit.rs b/src/test/ui/impl-trait/in-trait/default-body-with-rpit.rs deleted file mode 100644 index ad3cc7c25..000000000 --- a/src/test/ui/impl-trait/in-trait/default-body-with-rpit.rs +++ /dev/null @@ -1,21 +0,0 @@ -// check-pass -// edition:2021 - -#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::fmt::Debug; - -trait Foo { - async fn baz(&self) -> impl Debug { - "" - } -} - -struct Bar; - -impl Foo for Bar {} - -fn main() { - let _ = Bar.baz(); -} diff --git a/src/test/ui/impl-trait/in-trait/default-body.rs b/src/test/ui/impl-trait/in-trait/default-body.rs deleted file mode 100644 index b0baf5bb1..000000000 --- a/src/test/ui/impl-trait/in-trait/default-body.rs +++ /dev/null @@ -1,21 +0,0 @@ -// check-pass -// edition:2021 - -#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::fmt::Debug; - -trait Foo { - async fn baz(&self) -> &str { - "" - } -} - -struct Bar; - -impl Foo for Bar {} - -fn main() { - let _ = Bar.baz(); -} diff --git a/src/test/ui/impl-trait/in-trait/doesnt-satisfy.rs b/src/test/ui/impl-trait/in-trait/doesnt-satisfy.rs deleted file mode 100644 index bb4e0d44f..000000000 --- a/src/test/ui/impl-trait/in-trait/doesnt-satisfy.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -trait Foo { - fn bar() -> impl std::fmt::Display; -} - -impl Foo for () { - fn bar() -> () {} - //~^ ERROR `()` doesn't implement `std::fmt::Display` -} - -fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/doesnt-satisfy.stderr b/src/test/ui/impl-trait/in-trait/doesnt-satisfy.stderr deleted file mode 100644 index aa5492d28..000000000 --- a/src/test/ui/impl-trait/in-trait/doesnt-satisfy.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0277]: `()` doesn't implement `std::fmt::Display` - --> $DIR/doesnt-satisfy.rs:9:17 - | -LL | fn bar() -> () {} - | ^^ `()` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `()` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `Foo::bar::{opaque#0}` - --> $DIR/doesnt-satisfy.rs:5:22 - | -LL | fn bar() -> impl std::fmt::Display; - | ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::bar::{opaque#0}` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/impl-trait/in-trait/early.rs b/src/test/ui/impl-trait/in-trait/early.rs deleted file mode 100644 index 9c1c2b503..000000000 --- a/src/test/ui/impl-trait/in-trait/early.rs +++ /dev/null @@ -1,23 +0,0 @@ -// check-pass -// edition:2021 - -#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -pub trait Foo { - async fn bar<'a: 'a>(&'a mut self); -} - -impl Foo for () { - async fn bar<'a: 'a>(&'a mut self) {} -} - -pub trait Foo2 { - fn bar<'a: 'a>(&'a mut self) -> impl Sized + 'a; -} - -impl Foo2 for () { - fn bar<'a: 'a>(&'a mut self) -> impl Sized + 'a {} -} - -fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/encode.rs b/src/test/ui/impl-trait/in-trait/encode.rs deleted file mode 100644 index efb9f6498..000000000 --- a/src/test/ui/impl-trait/in-trait/encode.rs +++ /dev/null @@ -1,9 +0,0 @@ -// build-pass -// compile-flags: --crate-type=lib - -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -trait Foo { - fn bar() -> impl Sized; -} diff --git a/src/test/ui/impl-trait/in-trait/foreign.rs b/src/test/ui/impl-trait/in-trait/foreign.rs deleted file mode 100644 index 6341f5b42..000000000 --- a/src/test/ui/impl-trait/in-trait/foreign.rs +++ /dev/null @@ -1,9 +0,0 @@ -// check-pass -// aux-build: rpitit.rs - -extern crate rpitit; - -fn main() { - // Witness an RPITIT from another crate - let () = ::bar(); -} diff --git a/src/test/ui/impl-trait/in-trait/generics-mismatch.rs b/src/test/ui/impl-trait/in-trait/generics-mismatch.rs deleted file mode 100644 index cc0fc720e..000000000 --- a/src/test/ui/impl-trait/in-trait/generics-mismatch.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -struct U; - -trait Foo { - fn bar(&self) -> impl Sized; -} - -impl Foo for U { - fn bar(&self) {} - //~^ ERROR method `bar` has 1 type parameter but its trait declaration has 0 type parameters -} - -fn main() { - U.bar(); -} diff --git a/src/test/ui/impl-trait/in-trait/generics-mismatch.stderr b/src/test/ui/impl-trait/in-trait/generics-mismatch.stderr deleted file mode 100644 index cd42683e0..000000000 --- a/src/test/ui/impl-trait/in-trait/generics-mismatch.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0049]: method `bar` has 1 type parameter but its trait declaration has 0 type parameters - --> $DIR/generics-mismatch.rs:11:12 - | -LL | fn bar(&self) -> impl Sized; - | - expected 0 type parameters -... -LL | fn bar(&self) {} - | ^ found 1 type parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0049`. diff --git a/src/test/ui/impl-trait/in-trait/issue-102140.rs b/src/test/ui/impl-trait/in-trait/issue-102140.rs deleted file mode 100644 index be1e012ac..000000000 --- a/src/test/ui/impl-trait/in-trait/issue-102140.rs +++ /dev/null @@ -1,30 +0,0 @@ -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -trait Marker {} -impl Marker for u32 {} - -trait MyTrait { - fn foo(&self) -> impl Marker - where - Self: Sized; -} - -struct Outer; - -impl MyTrait for Outer { - fn foo(&self) -> impl Marker { - 42 - } -} - -impl dyn MyTrait { - fn other(&self) -> impl Marker { - MyTrait::foo(&self) - //~^ ERROR the trait bound `&dyn MyTrait: MyTrait` is not satisfied - //~| ERROR the trait bound `&dyn MyTrait: MyTrait` is not satisfied - //~| ERROR the trait bound `&dyn MyTrait: MyTrait` is not satisfied - } -} - -fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/issue-102140.stderr b/src/test/ui/impl-trait/in-trait/issue-102140.stderr deleted file mode 100644 index 08602185f..000000000 --- a/src/test/ui/impl-trait/in-trait/issue-102140.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied - --> $DIR/issue-102140.rs:23:22 - | -LL | MyTrait::foo(&self) - | ------------ -^^^^ - | | | - | | the trait `MyTrait` is not implemented for `&dyn MyTrait` - | | help: consider removing the leading `&`-reference - | required by a bound introduced by this call - -error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied - --> $DIR/issue-102140.rs:23:9 - | -LL | MyTrait::foo(&self) - | ^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait` - | - = help: the trait `MyTrait` is implemented for `Outer` - -error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied - --> $DIR/issue-102140.rs:23:9 - | -LL | MyTrait::foo(&self) - | ^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait` - | - = help: the trait `MyTrait` is implemented for `Outer` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/impl-trait/in-trait/issue-102301.rs b/src/test/ui/impl-trait/in-trait/issue-102301.rs deleted file mode 100644 index a93714a65..000000000 --- a/src/test/ui/impl-trait/in-trait/issue-102301.rs +++ /dev/null @@ -1,18 +0,0 @@ -// check-pass - -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -trait Foo { - fn foo>(self) -> impl Foo; -} - -struct Bar; - -impl Foo for Bar { - fn foo>(self) -> impl Foo { - self - } -} - -fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/issue-102571.rs b/src/test/ui/impl-trait/in-trait/issue-102571.rs deleted file mode 100644 index 61c91e644..000000000 --- a/src/test/ui/impl-trait/in-trait/issue-102571.rs +++ /dev/null @@ -1,24 +0,0 @@ -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::fmt::Display; -use std::ops::Deref; - -trait Foo { - fn bar(self) -> impl Deref; -} - -struct A; - -impl Foo for A { - fn bar(self) -> &'static str { - "Hello, world" - } -} - -fn foo(t: T) { - let () = t.bar(); - //~^ ERROR mismatched types -} - -fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/issue-102571.stderr b/src/test/ui/impl-trait/in-trait/issue-102571.stderr deleted file mode 100644 index 87219941d..000000000 --- a/src/test/ui/impl-trait/in-trait/issue-102571.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-102571.rs:20:9 - | -LL | let () = t.bar(); - | ^^ ------- this expression has type `impl Deref` - | | - | expected associated type, found `()` - | - = note: expected associated type `impl Deref` - found unit type `()` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/impl-trait/in-trait/method-signature-matches.rs b/src/test/ui/impl-trait/in-trait/method-signature-matches.rs deleted file mode 100644 index c848ee3f6..000000000 --- a/src/test/ui/impl-trait/in-trait/method-signature-matches.rs +++ /dev/null @@ -1,51 +0,0 @@ -// edition: 2021 - -#![feature(return_position_impl_trait_in_trait, async_fn_in_trait)] -#![allow(incomplete_features)] - -trait Uwu { - fn owo(x: ()) -> impl Sized; -} - -impl Uwu for () { - fn owo(_: u8) {} - //~^ ERROR method `owo` has an incompatible type for trait -} - -trait AsyncUwu { - async fn owo(x: ()) {} -} - -impl AsyncUwu for () { - async fn owo(_: u8) {} - //~^ ERROR method `owo` has an incompatible type for trait -} - -trait TooMuch { - fn calm_down_please() -> impl Sized; -} - -impl TooMuch for () { - fn calm_down_please(_: (), _: (), _: ()) {} - //~^ ERROR method `calm_down_please` has 3 parameters but the declaration in trait `TooMuch::calm_down_please` has 0 -} - -trait TooLittle { - fn come_on_a_little_more_effort(_: (), _: (), _: ()) -> impl Sized; -} - -impl TooLittle for () { - fn come_on_a_little_more_effort() {} - //~^ ERROR method `come_on_a_little_more_effort` has 0 parameters but the declaration in trait `TooLittle::come_on_a_little_more_effort` has 3 -} - -trait Lifetimes { - fn early<'early, T>(x: &'early T) -> impl Sized; -} - -impl Lifetimes for () { - fn early<'late, T>(_: &'late ()) {} - //~^ ERROR method `early` has an incompatible type for trait -} - -fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/method-signature-matches.stderr b/src/test/ui/impl-trait/in-trait/method-signature-matches.stderr deleted file mode 100644 index 2b32c52c8..000000000 --- a/src/test/ui/impl-trait/in-trait/method-signature-matches.stderr +++ /dev/null @@ -1,84 +0,0 @@ -error[E0053]: method `owo` has an incompatible type for trait - --> $DIR/method-signature-matches.rs:11:15 - | -LL | fn owo(_: u8) {} - | ^^ - | | - | expected `()`, found `u8` - | help: change the parameter type to match the trait: `()` - | -note: type in trait - --> $DIR/method-signature-matches.rs:7:15 - | -LL | fn owo(x: ()) -> impl Sized; - | ^^ - = note: expected fn pointer `fn(())` - found fn pointer `fn(u8)` - -error[E0053]: method `owo` has an incompatible type for trait - --> $DIR/method-signature-matches.rs:20:21 - | -LL | async fn owo(_: u8) {} - | ^^ - | | - | expected `()`, found `u8` - | help: change the parameter type to match the trait: `()` - | -note: while checking the return type of the `async fn` - --> $DIR/method-signature-matches.rs:20:25 - | -LL | async fn owo(_: u8) {} - | ^ checked the `Output` of this `async fn`, expected opaque type -note: while checking the return type of the `async fn` - --> $DIR/method-signature-matches.rs:20:25 - | -LL | async fn owo(_: u8) {} - | ^ checked the `Output` of this `async fn`, found opaque type -note: type in trait - --> $DIR/method-signature-matches.rs:16:21 - | -LL | async fn owo(x: ()) {} - | ^^ - = note: expected fn pointer `fn(()) -> _` - found fn pointer `fn(u8) -> _` - -error[E0050]: method `calm_down_please` has 3 parameters but the declaration in trait `TooMuch::calm_down_please` has 0 - --> $DIR/method-signature-matches.rs:29:28 - | -LL | fn calm_down_please() -> impl Sized; - | ------------------------------------ trait requires 0 parameters -... -LL | fn calm_down_please(_: (), _: (), _: ()) {} - | ^^^^^^^^^^^^^^^^ expected 0 parameters, found 3 - -error[E0050]: method `come_on_a_little_more_effort` has 0 parameters but the declaration in trait `TooLittle::come_on_a_little_more_effort` has 3 - --> $DIR/method-signature-matches.rs:38:5 - | -LL | fn come_on_a_little_more_effort(_: (), _: (), _: ()) -> impl Sized; - | ---------------- trait requires 3 parameters -... -LL | fn come_on_a_little_more_effort() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 3 parameters, found 0 - -error[E0053]: method `early` has an incompatible type for trait - --> $DIR/method-signature-matches.rs:47:27 - | -LL | fn early<'late, T>(_: &'late ()) {} - | - ^^^^^^^^^ - | | | - | | expected type parameter `T`, found `()` - | | help: change the parameter type to match the trait: `&'early T` - | this type parameter - | -note: type in trait - --> $DIR/method-signature-matches.rs:43:28 - | -LL | fn early<'early, T>(x: &'early T) -> impl Sized; - | ^^^^^^^^^ - = note: expected fn pointer `fn(&'early T)` - found fn pointer `fn(&())` - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0050, E0053. -For more information about an error, try `rustc --explain E0050`. diff --git a/src/test/ui/impl-trait/in-trait/nested-rpitit.rs b/src/test/ui/impl-trait/in-trait/nested-rpitit.rs deleted file mode 100644 index 65285e3a3..000000000 --- a/src/test/ui/impl-trait/in-trait/nested-rpitit.rs +++ /dev/null @@ -1,32 +0,0 @@ -// check-pass - -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::fmt::Display; -use std::ops::Deref; - -trait Foo { - fn bar(self) -> impl Deref; -} - -struct A; - -impl Foo for A { - fn bar(self) -> &'static str { - "Hello, world" - } -} - -struct B; - -impl Foo for B { - fn bar(self) -> Box { - Box::new(42) - } -} - -fn main() { - println!("Message for you: {:?}", &*A.bar()); - println!("Another for you: {:?}", &*B.bar()); -} diff --git a/src/test/ui/impl-trait/in-trait/object-safety.rs b/src/test/ui/impl-trait/in-trait/object-safety.rs deleted file mode 100644 index dd35b9a2d..000000000 --- a/src/test/ui/impl-trait/in-trait/object-safety.rs +++ /dev/null @@ -1,22 +0,0 @@ -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::fmt::Debug; - -trait Foo { - fn baz(&self) -> impl Debug; -} - -impl Foo for u32 { - fn baz(&self) -> u32 { - 32 - } -} - -fn main() { - let i = Box::new(42_u32) as Box; - //~^ ERROR the trait `Foo` cannot be made into an object - //~| ERROR the trait `Foo` cannot be made into an object - let s = i.baz(); - //~^ ERROR the trait `Foo` cannot be made into an object -} diff --git a/src/test/ui/impl-trait/in-trait/object-safety.stderr b/src/test/ui/impl-trait/in-trait/object-safety.stderr deleted file mode 100644 index ca0e760ff..000000000 --- a/src/test/ui/impl-trait/in-trait/object-safety.stderr +++ /dev/null @@ -1,50 +0,0 @@ -error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/object-safety.rs:17:33 - | -LL | let i = Box::new(42_u32) as Box; - | ^^^^^^^^^^^^ `Foo` cannot be made into an object - | -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/object-safety.rs:7:22 - | -LL | trait Foo { - | --- this trait cannot be made into an object... -LL | fn baz(&self) -> impl Debug; - | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type - = help: consider moving `baz` to another trait - -error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/object-safety.rs:20:13 - | -LL | let s = i.baz(); - | ^^^^^^^ `Foo` cannot be made into an object - | -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/object-safety.rs:7:22 - | -LL | trait Foo { - | --- this trait cannot be made into an object... -LL | fn baz(&self) -> impl Debug; - | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type - = help: consider moving `baz` to another trait - -error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/object-safety.rs:17:13 - | -LL | let i = Box::new(42_u32) as Box; - | ^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object - | -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/object-safety.rs:7:22 - | -LL | trait Foo { - | --- this trait cannot be made into an object... -LL | fn baz(&self) -> impl Debug; - | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type - = help: consider moving `baz` to another trait - = note: required for `Box` to implement `CoerceUnsized>` - = note: required by cast to type `Box` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs b/src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs deleted file mode 100644 index 3ac264e8e..000000000 --- a/src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::fmt::Display; - -trait Foo { - fn bar(&self) -> impl Display; -} - -impl Foo for () { - fn bar(&self) -> impl Display { - "Hello, world" - } -} - -fn main() { - let x: &str = ().bar(); - //~^ ERROR mismatched types -} diff --git a/src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr b/src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr deleted file mode 100644 index 15edda483..000000000 --- a/src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/opaque-in-impl-is-opaque.rs:17:19 - | -LL | fn bar(&self) -> impl Display { - | ------------ the found opaque type -... -LL | let x: &str = ().bar(); - | ---- ^^^^^^^^ expected `&str`, found opaque type - | | - | expected due to this - | - = note: expected reference `&str` - found opaque type `impl std::fmt::Display` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/impl-trait/in-trait/opaque-in-impl.rs b/src/test/ui/impl-trait/in-trait/opaque-in-impl.rs deleted file mode 100644 index 2e0662969..000000000 --- a/src/test/ui/impl-trait/in-trait/opaque-in-impl.rs +++ /dev/null @@ -1,48 +0,0 @@ -// check-pass - -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::fmt::Debug; - -trait Foo { - fn foo(&self) -> impl Debug; -} - -impl Foo for () { - fn foo(&self) -> impl Debug { - "Hello, world" - } -} - -impl Foo for std::marker::PhantomData { - fn foo(&self) -> impl Debug { - T::default() - } -} - -trait Bar { - fn bar(&self) -> impl Debug; -} - -impl Bar for () { - fn bar(&self) -> impl Debug { - format!("Hello with generic {}", std::any::type_name::()) - } -} - -trait Baz { - fn baz(&self) -> impl Debug + '_; -} - -impl Baz for String { - fn baz(&self) -> impl Debug + '_ { - (self,) - } -} - -fn main() { - println!("{:?}", ().foo()); - println!("{:?}", ().bar::()); - println!("{:?}", "hi".to_string().baz()); -} diff --git a/src/test/ui/impl-trait/in-trait/reveal.rs b/src/test/ui/impl-trait/in-trait/reveal.rs deleted file mode 100644 index d6ede1cc4..000000000 --- a/src/test/ui/impl-trait/in-trait/reveal.rs +++ /dev/null @@ -1,18 +0,0 @@ -// check-pass - -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -trait Foo { - fn f() -> Box; -} - -impl Foo for () { - fn f() -> Box { - Box::new(String::new()) - } -} - -fn main() { - let x: Box = <() as Foo>::f(); -} diff --git a/src/test/ui/impl-trait/in-trait/signature-mismatch.rs b/src/test/ui/impl-trait/in-trait/signature-mismatch.rs deleted file mode 100644 index 90682631a..000000000 --- a/src/test/ui/impl-trait/in-trait/signature-mismatch.rs +++ /dev/null @@ -1,21 +0,0 @@ -// edition:2021 - -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::future::Future; - -pub trait AsyncTrait { - fn async_fn(&self, buff: &[u8]) -> impl Future>; -} - -pub struct Struct; - -impl AsyncTrait for Struct { - fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future> + 'a { - //~^ ERROR `impl` item signature doesn't match `trait` item signature - async move { buff.to_vec() } - } -} - -fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/signature-mismatch.stderr b/src/test/ui/impl-trait/in-trait/signature-mismatch.stderr deleted file mode 100644 index 6663d7faa..000000000 --- a/src/test/ui/impl-trait/in-trait/signature-mismatch.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error: `impl` item signature doesn't match `trait` item signature - --> $DIR/signature-mismatch.rs:15:5 - | -LL | fn async_fn(&self, buff: &[u8]) -> impl Future>; - | ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future> + 'static` -... -LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future> + 'a { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '2` - | - = note: expected `fn(&'1 Struct, &'2 [u8]) -> impl Future> + 'static` - found `fn(&'1 Struct, &'2 [u8]) -> impl Future> + '2` - = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` - = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output - -error: aborting due to previous error - diff --git a/src/test/ui/impl-trait/in-trait/specialization-broken.rs b/src/test/ui/impl-trait/in-trait/specialization-broken.rs deleted file mode 100644 index 9d27d3710..000000000 --- a/src/test/ui/impl-trait/in-trait/specialization-broken.rs +++ /dev/null @@ -1,26 +0,0 @@ -// FIXME(compiler-errors): I'm not exactly sure if this is expected to pass or not. -// But we fixed an ICE anyways. - -#![feature(specialization)] -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -trait Foo { - fn bar(&self) -> impl Sized; -} - -default impl Foo for U -where - U: Copy, -{ - fn bar(&self) -> U { - //~^ ERROR method `bar` has an incompatible type for trait - *self - } -} - -impl Foo for i32 {} - -fn main() { - 1i32.bar(); -} diff --git a/src/test/ui/impl-trait/in-trait/specialization-broken.stderr b/src/test/ui/impl-trait/in-trait/specialization-broken.stderr deleted file mode 100644 index a30e6346b..000000000 --- a/src/test/ui/impl-trait/in-trait/specialization-broken.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0053]: method `bar` has an incompatible type for trait - --> $DIR/specialization-broken.rs:16:22 - | -LL | default impl Foo for U - | - this type parameter -... -LL | fn bar(&self) -> U { - | ^ - | | - | expected associated type, found type parameter `U` - | help: change the output type to match the trait: `impl Sized` - | -note: type in trait - --> $DIR/specialization-broken.rs:9:22 - | -LL | fn bar(&self) -> impl Sized; - | ^^^^^^^^^^ - = note: expected fn pointer `fn(&U) -> impl Sized` - found fn pointer `fn(&U) -> U` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0053`. diff --git a/src/test/ui/impl-trait/in-trait/specialization-substs-remap.rs b/src/test/ui/impl-trait/in-trait/specialization-substs-remap.rs deleted file mode 100644 index c9ee877db..000000000 --- a/src/test/ui/impl-trait/in-trait/specialization-substs-remap.rs +++ /dev/null @@ -1,24 +0,0 @@ -// check-pass - -#![feature(specialization)] -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -trait Foo { - fn bar(&self) -> impl Sized; -} - -impl Foo for U -where - U: Copy, -{ - fn bar(&self) -> U { - *self - } -} - -impl Foo for i32 {} - -fn main() { - let _: i32 = 1i32.bar(); -} diff --git a/src/test/ui/impl-trait/in-trait/success.rs b/src/test/ui/impl-trait/in-trait/success.rs deleted file mode 100644 index 4cbe682b4..000000000 --- a/src/test/ui/impl-trait/in-trait/success.rs +++ /dev/null @@ -1,40 +0,0 @@ -// check-pass - -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::fmt::Display; - -trait Foo { - fn bar(&self) -> impl Display; -} - -impl Foo for i32 { - fn bar(&self) -> i32 { - *self - } -} - -impl Foo for &'static str { - fn bar(&self) -> &'static str { - *self - } -} - -struct Yay; - -impl Foo for Yay { - fn bar(&self) -> String { - String::from(":^)") - } -} - -fn foo_generically(t: T) { - println!("{}", t.bar()); -} - -fn main() { - println!("{}", "Hello, world.".bar()); - println!("The answer is {}!", 42.bar()); - foo_generically(Yay); -} diff --git a/src/test/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs b/src/test/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs deleted file mode 100644 index 0bbe50ea6..000000000 --- a/src/test/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -struct S; - -trait Foo { - fn bar() -> impl Sized; -} - -impl Foo for S { - fn bar() -> impl Sized {} - //~^ ERROR method `bar` has 0 type parameters but its trait declaration has 1 type parameter -} - -fn main() { - S::bar(); -} diff --git a/src/test/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr b/src/test/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr deleted file mode 100644 index 8ff54cad9..000000000 --- a/src/test/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0049]: method `bar` has 0 type parameters but its trait declaration has 1 type parameter - --> $DIR/trait-more-generics-than-impl.rs:11:11 - | -LL | fn bar() -> impl Sized; - | - expected 1 type parameter -... -LL | fn bar() -> impl Sized {} - | ^ found 0 type parameters - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0049`. diff --git a/src/test/ui/impl-trait/in-trait/wf-bounds.rs b/src/test/ui/impl-trait/in-trait/wf-bounds.rs deleted file mode 100644 index 2c71583b3..000000000 --- a/src/test/ui/impl-trait/in-trait/wf-bounds.rs +++ /dev/null @@ -1,16 +0,0 @@ -// issue #101663 - -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -trait Wf {} - -trait Uwu { - fn nya() -> impl Wf>; - //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time - - fn nya2() -> impl Wf<[u8]>; - //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time -} - -fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/wf-bounds.stderr b/src/test/ui/impl-trait/in-trait/wf-bounds.stderr deleted file mode 100644 index 92e36841b..000000000 --- a/src/test/ui/impl-trait/in-trait/wf-bounds.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/wf-bounds.rs:9:22 - | -LL | fn nya() -> impl Wf>; - | ^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `Vec` - --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - | -LL | pub struct Vec { - | ^ required by this bound in `Vec` - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/wf-bounds.rs:12:23 - | -LL | fn nya2() -> impl Wf<[u8]>; - | ^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `Wf` - --> $DIR/wf-bounds.rs:6:10 - | -LL | trait Wf {} - | ^ required by this bound in `Wf` -help: consider relaxing the implicit `Sized` restriction - | -LL | trait Wf {} - | ++++++++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/impl-trait/in-trait/where-clause.rs b/src/test/ui/impl-trait/in-trait/where-clause.rs deleted file mode 100644 index 87bac519c..000000000 --- a/src/test/ui/impl-trait/in-trait/where-clause.rs +++ /dev/null @@ -1,24 +0,0 @@ -// check-pass -// edition: 2021 - -#![feature(return_position_impl_trait_in_trait)] -#![allow(incomplete_features)] - -use std::fmt::Debug; - -trait Foo { - fn foo<'a>(&'a self) -> impl Debug - where - Item: 'a; -} - -impl Foo for D { - fn foo<'a>(&'a self) -> impl Debug - where - Item: 'a, - { - self.clone() - } -} - -fn main() {} -- cgit v1.2.3