From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../normalize-under-binder/issue-44005.rs | 31 -------- .../normalize-under-binder/issue-56556.rs | 30 -------- .../normalize-under-binder/issue-62529-1.rs | 88 ---------------------- .../normalize-under-binder/issue-62529-2.rs | 33 -------- .../normalize-under-binder/issue-62529-3.rs | 32 -------- .../normalize-under-binder/issue-62529-3.stderr | 19 ----- .../normalize-under-binder/issue-62529-4.rs | 39 ---------- .../normalize-under-binder/issue-62529-5.rs | 27 ------- .../normalize-under-binder/issue-62529-6.rs | 77 ------------------- .../normalize-under-binder/issue-70120.rs | 31 -------- .../issue-71955.migrate.stderr | 79 ------------------- .../normalize-under-binder/issue-71955.rs | 51 ------------- .../normalize-under-binder/issue-71955.stderr | 79 ------------------- .../normalize-under-binder/issue-74261.rs | 30 -------- .../normalize-under-binder/issue-76956.rs | 15 ---- .../normalize-under-binder/issue-80706.rs | 71 ----------------- .../normalize-under-binder/issue-80956.rs | 21 ------ .../normalize-under-binder/issue-81809.rs | 21 ------ .../normalize-under-binder/issue-85455.rs | 18 ----- .../normalize-under-binder/issue-85455.stderr | 14 ---- .../normalize-under-binder/issue-89118.rs | 32 -------- .../normalize-under-binder/issue-89118.stderr | 63 ---------------- .../normalize-under-binder/issue-89436.rs | 44 ----------- .../normalize-under-binder/issue-90612.rs | 41 ---------- .../normalize-under-binder/issue-90638.rs | 35 --------- .../normalize-under-binder/issue-90875.rs | 31 -------- .../normalize-under-binder/issue-90950.rs | 53 ------------- .../normalize-under-binder/issue-90950.stderr | 21 ------ .../norm-before-method-resolution.rs | 23 ------ .../norm-before-method-resolution.stderr | 18 ----- 30 files changed, 1167 deletions(-) delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-44005.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-56556.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-1.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-2.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.stderr delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-4.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-5.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-6.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-70120.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.migrate.stderr delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.stderr delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-74261.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-76956.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-80706.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-80956.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-81809.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.stderr delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89436.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90612.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90638.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90875.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.rs delete mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr (limited to 'src/test/ui/higher-rank-trait-bounds/normalize-under-binder') diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-44005.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-44005.rs deleted file mode 100644 index f255eac0c..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-44005.rs +++ /dev/null @@ -1,31 +0,0 @@ -// check-pass - -pub trait Foo<'a> { - type Bar; - fn foo(&'a self) -> Self::Bar; -} - -impl<'a, 'b, T: 'a> Foo<'a> for &'b T { - type Bar = &'a T; - fn foo(&'a self) -> &'a T { - self - } -} - -pub fn uncallable(x: T, f: F) -where - T: for<'a> Foo<'a>, - F: for<'a> Fn(>::Bar), -{ - f(x.foo()); -} - -pub fn catalyst(x: &i32) { - broken(x, |_| {}) -} - -pub fn broken(x: &i32, f: F) { - uncallable(x, |y| f(y)); -} - -fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-56556.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-56556.rs deleted file mode 100644 index 4d38cb19e..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-56556.rs +++ /dev/null @@ -1,30 +0,0 @@ -// check-pass - -fn foo(t: T) -> usize -where - for<'a> &'a T: IntoIterator, - for<'a> <&'a T as IntoIterator>::IntoIter: ExactSizeIterator, -{ - t.into_iter().len() -} - -fn main() { - foo::>(vec![]); -} - -mod another { - use std::ops::Deref; - - fn test() - where - T: Deref, - TDeref: ?Sized, - for<'a> &'a TDeref: IntoIterator, - for<'a> <&'a TDeref as IntoIterator>::IntoIter: Clone, - { - } - - fn main() { - test::, _>(); - } -} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-1.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-1.rs deleted file mode 100644 index c6f29fa59..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-1.rs +++ /dev/null @@ -1,88 +0,0 @@ -// check-pass - -// FamilyType (GAT workaround) -pub trait FamilyLt<'a> { - type Out; -} - -struct RefMutFamily(std::marker::PhantomData, ()); -impl<'a, T: 'a> FamilyLt<'a> for RefMutFamily { - type Out = &'a mut T; -} - -pub trait Execute { - type E: Inject; - fn execute(self, value: <::I as FamilyLt>::Out); -} - -pub trait Inject -where - Self: Sized, -{ - type I: for<'a> FamilyLt<'a>; - fn inject(_: &()) -> ::Out; -} - -impl Inject for RefMutFamily { - type I = Self; - fn inject(_: &()) -> ::Out { - unimplemented!() - } -} - -// This struct is only used to give a hint to the compiler about the type `Q` -struct Annotate(std::marker::PhantomData); -impl Annotate { - fn new() -> Self { - Self(std::marker::PhantomData) - } -} - -// This function annotate a closure so it can have Higher-Rank Lifetime Bounds -// -// See 'annotate' workaround: https://github.com/rust-lang/rust/issues/58052 -fn annotate(_q: Annotate, func: F) -> impl Execute + 'static -where - F: for<'r> FnOnce(<::I as FamilyLt<'r>>::Out) + 'static, - Q: Inject + 'static, -{ - let wrapper: Wrapper = Wrapper(std::marker::PhantomData, func); - wrapper -} - -struct Wrapper(std::marker::PhantomData, F); -impl Execute for Wrapper - where - Q: Inject, - F: for<'r> FnOnce(<::I as FamilyLt<'r>>::Out), -{ - type E = Q; - - fn execute(self, value: <::I as FamilyLt>::Out) { - (self.1)(value) - } -} - -struct Task { - _processor: Box, -} - -// This function consume the closure -fn task

(processor: P) -> Task -where P: Execute + 'static { - Task { - _processor: Box::new(move || { - let q = P::E::inject(&()); - processor.execute(q); - }) - } -} - -fn main() { - task(annotate( - Annotate::>::new(), - |value: &mut usize| { - *value = 2; - } - )); -} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-2.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-2.rs deleted file mode 100644 index 002054732..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-2.rs +++ /dev/null @@ -1,33 +0,0 @@ -// check-pass - -use std::marker::PhantomData; - -trait Lt<'a> { - type T; -} -struct Id(PhantomData); -impl<'a,T> Lt<'a> for Id { - type T = T; -} - -struct Ref(PhantomData) where T: ?Sized; -impl<'a,T> Lt<'a> for Ref -where T: 'a + Lt<'a> + ?Sized -{ - type T = &'a T; -} -struct Mut(PhantomData) where T: ?Sized; -impl<'a,T> Lt<'a> for Mut -where T: 'a + Lt<'a> + ?Sized -{ - type T = &'a mut T; -} - -struct C(for<'a> fn(>::T) -> O) where I: for<'a> Lt<'a>; - - -fn main() { - let c = C::,_>(|()| 3); - c.0(()); - -} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.rs deleted file mode 100644 index d84e30f49..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.rs +++ /dev/null @@ -1,32 +0,0 @@ -trait ATC<'a> { - type Type: Sized; -} - -trait WithDefault: for<'a> ATC<'a> { - fn with_default Fn(>::Type)>(f: F); -} - -fn call<'b, T: for<'a> ATC<'a>, F: for<'a> Fn(>::Type)>( - f: F, - x: >::Type, -) { - f(x); -} - -impl<'a> ATC<'a> for () { - type Type = Self; -} - -impl WithDefault for () { - fn with_default Fn(>::Type)>(f: F) { - // Errors with a bogus type mismatch. - //f(()); - // Going through another generic function works fine. - call(f, ()); - //~^ expected a - } -} - -fn main() { - // <()>::with_default(|_| {}); -} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.stderr deleted file mode 100644 index b30dd36d2..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0277]: expected a `Fn<(<_ as ATC<'a>>::Type,)>` closure, found `F` - --> $DIR/issue-62529-3.rs:25:14 - | -LL | call(f, ()); - | ---- ^ expected an `Fn<(<_ as ATC<'a>>::Type,)>` closure, found `F` - | | - | required by a bound introduced by this call - | - = note: expected a closure with arguments `((),)` - found a closure with arguments `(<_ as ATC<'a>>::Type,)` -note: required by a bound in `call` - --> $DIR/issue-62529-3.rs:9:36 - | -LL | fn call<'b, T: for<'a> ATC<'a>, F: for<'a> Fn(>::Type)>( - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-4.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-4.rs deleted file mode 100644 index 8c2a59868..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-4.rs +++ /dev/null @@ -1,39 +0,0 @@ -// check-pass - -use std::marker::PhantomData; -use std::mem; - -trait Container<'a> { - type Root: 'a; -} - -type RootOf<'a, T> = >::Root; - -struct Test<'a, T> where T: Container<'a> { - pub root: T::Root, - marker: PhantomData<&'a mut &'a mut ()>, -} - -impl<'a, 'b> Container<'b> for &'a str { - type Root = &'b str; -} - -impl<'a, T> Test<'a, T> where T: for<'b> Container<'b> { - fn new(root: RootOf<'a, T>) -> Test<'a, T> { - Test { - root: root, - marker: PhantomData - } - } - - fn with_mut(&mut self, f: F) -> R where - F: for<'b> FnOnce(&'b mut RootOf<'b, T>) -> R { - f(unsafe { mem::transmute(&mut self.root) }) - } -} - -fn main() { - let val = "root"; - let mut test: Test<&str> = Test::new(val); - test.with_mut(|_| { }); -} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-5.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-5.rs deleted file mode 100644 index 03f257a02..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-5.rs +++ /dev/null @@ -1,27 +0,0 @@ -// check-pass - -pub struct Struct {} - -pub trait Trait<'a> { - type Assoc; - - fn method() -> Self::Assoc; -} - -impl<'a> Trait<'a> for Struct { - type Assoc = (); - - fn method() -> Self::Assoc {} -} - -pub fn function(f: F) -where - F: for<'a> FnOnce(>::Assoc), - T: for<'b> Trait<'b>, -{ - f(T::method()); -} - -fn main() { - function::<_, Struct>(|_| {}); -} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-6.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-6.rs deleted file mode 100644 index 74a4785e4..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-6.rs +++ /dev/null @@ -1,77 +0,0 @@ -// check-pass - -use std::cell::RefMut; - -fn main() { - StateMachine2::Init.resume(); -} - -enum StateMachine2<'a> { - Init, - #[allow(dead_code)] // match required for ICE - AfterTwoYields { - p: Backed<'a, *mut String>, - }, -} - -impl<'a> StateMachine2<'a> { - fn take(&self) -> Self { - StateMachine2::Init - } -} - -impl<'a> StateMachine2<'a> { - fn resume(&mut self) -> () { - use StateMachine2::*; - match self.take() { - AfterTwoYields { p } => { - p.with(|_| {}); - } - _ => panic!("Resume after completed."), - } - } -} - -unsafe trait Unpack<'a> { - type Unpacked: 'a; - - fn unpack(&self) -> Self::Unpacked { - unsafe { std::mem::transmute_copy(&self) } - } -} - -unsafe trait Pack { - type Packed; - - fn pack(&self) -> Self::Packed { - unsafe { std::mem::transmute_copy(&self) } - } -} - -unsafe impl<'a> Unpack<'a> for String { - type Unpacked = String; -} - -unsafe impl Pack for String { - type Packed = String; -} - -unsafe impl<'a> Unpack<'a> for *mut String { - type Unpacked = &'a mut String; -} - -unsafe impl<'a> Pack for &'a mut String { - type Packed = *mut String; -} - -struct Backed<'a, U>(RefMut<'a, Option>, U); - -impl<'a, 'b, U: Unpack<'b>> Backed<'a, U> { - fn with(self, f: F) -> Backed<'a, ()> - where - F: for<'f> FnOnce(>::Unpacked) -> (), - { - let result = f(self.1.unpack()); - Backed(self.0, result) - } -} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-70120.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-70120.rs deleted file mode 100644 index 3ced40230..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-70120.rs +++ /dev/null @@ -1,31 +0,0 @@ -// check-pass - -pub trait MyTrait<'a> { - type Output: 'a; - fn gimme_value(&self) -> Self::Output; -} - -pub struct MyStruct; - -impl<'a> MyTrait<'a> for MyStruct { - type Output = &'a usize; - fn gimme_value(&self) -> Self::Output { - unimplemented!() - } -} - -fn meow(t: T, f: F) -where - T: for<'any> MyTrait<'any>, - F: for<'any2> Fn(>::Output), -{ - let v = t.gimme_value(); - f(v); -} - -fn main() { - let struc = MyStruct; - meow(struc, |foo| { - println!("{:?}", foo); - }) -} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.migrate.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.migrate.stderr deleted file mode 100644 index 0f38f8e32..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.migrate.stderr +++ /dev/null @@ -1,79 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-71955.rs:54:5 - | -LL | foo(bar, "string", |s| s.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected type `for<'r, 's> FnOnce<(&'r &'s str,)>` - found type `for<'r> FnOnce<(&'r &str,)>` -note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:54:24 - | -LL | foo(bar, "string", |s| s.len() == 5); - | ^^^^^^^^^^^^^^^^ -note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:34:9 - | -LL | F2: FnOnce(&::Output) -> bool - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0308]: mismatched types - --> $DIR/issue-71955.rs:54:5 - | -LL | foo(bar, "string", |s| s.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected type `FnOnce<(&&str,)>` - found type `for<'r> FnOnce<(&'r &str,)>` -note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:54:24 - | -LL | foo(bar, "string", |s| s.len() == 5); - | ^^^^^^^^^^^^^^^^ -note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:34:44 - | -LL | F2: FnOnce(&::Output) -> bool - | ^^^^ - -error[E0308]: mismatched types - --> $DIR/issue-71955.rs:58:5 - | -LL | foo(baz, "string", |s| s.0.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected type `for<'r, 's> FnOnce<(&'r Wrapper<'s>,)>` - found type `for<'r> FnOnce<(&'r Wrapper<'_>,)>` -note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:58:24 - | -LL | foo(baz, "string", |s| s.0.len() == 5); - | ^^^^^^^^^^^^^^^^^^ -note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:34:9 - | -LL | F2: FnOnce(&::Output) -> bool - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0308]: mismatched types - --> $DIR/issue-71955.rs:58:5 - | -LL | foo(baz, "string", |s| s.0.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected type `FnOnce<(&Wrapper<'_>,)>` - found type `for<'r> FnOnce<(&'r Wrapper<'_>,)>` -note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:58:24 - | -LL | foo(baz, "string", |s| s.0.len() == 5); - | ^^^^^^^^^^^^^^^^^^ -note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:34:44 - | -LL | F2: FnOnce(&::Output) -> bool - | ^^^^ - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.rs deleted file mode 100644 index 1d90226a3..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.rs +++ /dev/null @@ -1,51 +0,0 @@ -// check-fail -#![feature(rustc_attrs)] - -trait Parser<'s> { - type Output; - - fn call(&self, input: &'s str) -> (&'s str, Self::Output); -} - -impl<'s, F, T> Parser<'s> for F -where F: Fn(&'s str) -> (&'s str, T) { - type Output = T; - fn call(&self, input: &'s str) -> (&'s str, T) { - self(input) - } -} - -fn foo( - f1: F1, - base: &'static str, - f2: F2 -) -where - F1: for<'a> Parser<'a>, - F2: FnOnce(&::Output) -> bool -{ - let s: String = base.to_owned(); - let str_ref = s.as_ref(); - let (remaining, produced) = f1.call(str_ref); - assert!(f2(&produced)); - assert_eq!(remaining.len(), 0); -} - -struct Wrapper<'a>(&'a str); - -fn main() { - fn bar<'a>(s: &'a str) -> (&'a str, &'a str) { - (&s[..1], &s[..]) - } - - fn baz<'a>(s: &'a str) -> (&'a str, Wrapper<'a>) { - (&s[..1], Wrapper(&s[..])) - } - - foo(bar, "string", |s| s.len() == 5); - //~^ ERROR mismatched types - //~| ERROR mismatched types - foo(baz, "string", |s| s.0.len() == 5); - //~^ ERROR mismatched types - //~| ERROR mismatched types -} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.stderr deleted file mode 100644 index 4ef96cd95..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.stderr +++ /dev/null @@ -1,79 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-71955.rs:45:5 - | -LL | foo(bar, "string", |s| s.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected trait `for<'a, 'b> FnOnce<(&'a &'b str,)>` - found trait `for<'a> FnOnce<(&'a &str,)>` -note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:45:24 - | -LL | foo(bar, "string", |s| s.len() == 5); - | ^^^ -note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:25:9 - | -LL | F2: FnOnce(&::Output) -> bool - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0308]: mismatched types - --> $DIR/issue-71955.rs:45:5 - | -LL | foo(bar, "string", |s| s.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected trait `for<'a, 'b> FnOnce<(&'a &'b str,)>` - found trait `for<'a> FnOnce<(&'a &str,)>` -note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:45:24 - | -LL | foo(bar, "string", |s| s.len() == 5); - | ^^^ -note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:25:44 - | -LL | F2: FnOnce(&::Output) -> bool - | ^^^^ - -error[E0308]: mismatched types - --> $DIR/issue-71955.rs:48:5 - | -LL | foo(baz, "string", |s| s.0.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected trait `for<'a, 'b> FnOnce<(&'a Wrapper<'b>,)>` - found trait `for<'a> FnOnce<(&'a Wrapper<'_>,)>` -note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:48:24 - | -LL | foo(baz, "string", |s| s.0.len() == 5); - | ^^^ -note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:25:9 - | -LL | F2: FnOnce(&::Output) -> bool - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0308]: mismatched types - --> $DIR/issue-71955.rs:48:5 - | -LL | foo(baz, "string", |s| s.0.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected trait `for<'a, 'b> FnOnce<(&'a Wrapper<'b>,)>` - found trait `for<'a> FnOnce<(&'a Wrapper<'_>,)>` -note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:48:24 - | -LL | foo(baz, "string", |s| s.0.len() == 5); - | ^^^ -note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:25:44 - | -LL | F2: FnOnce(&::Output) -> bool - | ^^^^ - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-74261.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-74261.rs deleted file mode 100644 index 93ccb4268..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-74261.rs +++ /dev/null @@ -1,30 +0,0 @@ -// check-pass - -use std::marker::PhantomData; - -trait A<'a> { - type B; - fn b(self) -> Self::B; -} - -struct T; -struct S<'a>(PhantomData<&'a ()>); - -impl<'a> A<'a> for T { - type B = S<'a>; - fn b(self) -> Self::B { - S(PhantomData) - } -} - -fn s(t: TT, f: F) -where - TT: for<'a> A<'a>, - F: for<'a> FnOnce(>::B) -{ - f(t.b()); -} - -fn main() { - s(T, |_| {}); -} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-76956.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-76956.rs deleted file mode 100644 index 583470080..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-76956.rs +++ /dev/null @@ -1,15 +0,0 @@ -// check-pass - -use std::ops::Deref; - -struct Data { - boxed: Box<&'static i32> -} - -impl Data { - fn use_data(&self, user: impl for <'a> FnOnce( as Deref>::Target)) { - user(*self.boxed) - } -} - -fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-80706.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-80706.rs deleted file mode 100644 index 00a866f22..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-80706.rs +++ /dev/null @@ -1,71 +0,0 @@ -// build-pass -// edition:2018 - -type BoxFuture = std::pin::Pin>>; - -fn main() { - f(); -} - -async fn f() { - run("dependency").await; -} - -struct InMemoryStorage; - -struct User<'dep> { - dep: &'dep str, -} - -impl<'a> StorageRequest for SaveUser<'a> { - fn execute(&self) -> BoxFuture> { - todo!() - } -} - -trait Storage { - type Error; -} - -impl Storage for InMemoryStorage { - type Error = String; -} - -trait StorageRequestReturnType { - type Output; -} - -trait StorageRequest: StorageRequestReturnType { - fn execute( - &self, - ) -> BoxFuture::Output, ::Error>>; -} - -struct SaveUser<'a> { - name: &'a str, -} - -impl<'a> StorageRequestReturnType for SaveUser<'a> { - type Output = (); -} - -impl<'dep> User<'dep> { - async fn save(self) - where - S: Storage, - for<'a> SaveUser<'a>: StorageRequest, - { - SaveUser { name: "Joe" } - .execute() - .await; - } -} - -async fn run(dep: &str) -where - S: Storage, - for<'a> SaveUser<'a>: StorageRequest, - for<'a> SaveUser<'a>: StorageRequestReturnType, -{ - User { dep }.save().await; -} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-80956.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-80956.rs deleted file mode 100644 index 6316ceea1..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-80956.rs +++ /dev/null @@ -1,21 +0,0 @@ -// check-pass - -trait Bar { - type Type; -} -struct Foo<'a>(&'a ()); -impl<'a> Bar for Foo<'a> { - type Type = (); -} - -fn func<'a>(_: as Bar>::Type) {} -fn assert_is_func(_: fn(A)) {} - -fn test() -where - for<'a> as Bar>::Type: Sized, -{ - assert_is_func(func); -} - -fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-81809.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-81809.rs deleted file mode 100644 index f6ab9c203..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-81809.rs +++ /dev/null @@ -1,21 +0,0 @@ -// check-pass - -pub trait Indexable { - type Idx; -} -impl Indexable for u8 { - type Idx = u8; -} -impl Indexable for u16 { - type Idx = u16; -} - -pub trait Indexer: std::ops::Index {} - -trait StoreIndex: Indexer + Indexer {} - -fn foo(st: &impl StoreIndex) -> &dyn StoreIndex { - st as &dyn StoreIndex -} - -fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.rs deleted file mode 100644 index c10a0888a..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.rs +++ /dev/null @@ -1,18 +0,0 @@ -#![feature(unboxed_closures)] - -trait SomeTrait<'a> { - type Associated; -} - -fn give_me_ice() { - callee:: >::Associated>(); - //~^ ERROR the trait bound `for<'a> T: SomeTrait<'a>` is not satisfied [E0277] -} - -fn callee>() { - println!("{}", std::any::type_name::<>::Output>()); -} - -fn main() { - give_me_ice::<()>(); -} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.stderr deleted file mode 100644 index 25a4f6088..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0277]: the trait bound `for<'a> T: SomeTrait<'a>` is not satisfied - --> $DIR/issue-85455.rs:8:5 - | -LL | callee:: >::Associated>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> SomeTrait<'a>` is not implemented for `T` - | -help: consider restricting type parameter `T` - | -LL | fn give_me_ice SomeTrait<'a>>() { - | +++++++++++++++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.rs deleted file mode 100644 index fffb54f86..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.rs +++ /dev/null @@ -1,32 +0,0 @@ -trait BufferMut {} -struct Ctx(D); - -trait BufferUdpStateContext {} -impl BufferUdpStateContext for C {} - -trait StackContext -where - Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>, -{ - type Dispatcher; -} - -trait TimerContext { - type Handler; -} -impl TimerContext for C -where - C: StackContext, - //~^ ERROR: is not satisfied [E0277] -{ - type Handler = Ctx; - //~^ ERROR: is not satisfied [E0277] -} - -struct EthernetWorker(C) -where - Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>; -impl EthernetWorker {} -//~^ ERROR: is not satisfied [E0277] - -fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr deleted file mode 100644 index 14fe1803b..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr +++ /dev/null @@ -1,63 +0,0 @@ -error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied - --> $DIR/issue-89118.rs:19:8 - | -LL | C: StackContext, - | ^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` - | -note: required for `Ctx<()>` to implement `for<'a> BufferUdpStateContext<&'a ()>` - --> $DIR/issue-89118.rs:5:23 - | -LL | impl BufferUdpStateContext for C {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -note: required by a bound in `StackContext` - --> $DIR/issue-89118.rs:9:14 - | -LL | trait StackContext - | ------------ required by a bound in this -LL | where -LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext` - -error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied - --> $DIR/issue-89118.rs:29:9 - | -LL | impl EthernetWorker {} - | ^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` - | -note: required for `Ctx<()>` to implement `for<'a> BufferUdpStateContext<&'a ()>` - --> $DIR/issue-89118.rs:5:23 - | -LL | impl BufferUdpStateContext for C {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -note: required by a bound in `EthernetWorker` - --> $DIR/issue-89118.rs:28:14 - | -LL | struct EthernetWorker(C) - | -------------- required by a bound in this -LL | where -LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EthernetWorker` - -error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied - --> $DIR/issue-89118.rs:22:20 - | -LL | type Handler = Ctx; - | ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` - | -note: required for `Ctx<()>` to implement `for<'a> BufferUdpStateContext<&'a ()>` - --> $DIR/issue-89118.rs:5:23 - | -LL | impl BufferUdpStateContext for C {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ -note: required by a bound in `StackContext` - --> $DIR/issue-89118.rs:9:14 - | -LL | trait StackContext - | ------------ required by a bound in this -LL | where -LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89436.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89436.rs deleted file mode 100644 index f7e467b37..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89436.rs +++ /dev/null @@ -1,44 +0,0 @@ -// check-pass - -#![allow(unused)] - -trait MiniYokeable<'a> { - type Output; -} - -struct MiniYoke MiniYokeable<'a>> { - pub yokeable: Y, -} - -fn map_project_broken( - source: MiniYoke, - f: impl for<'a> FnOnce( - >::Output, - core::marker::PhantomData<&'a ()>, - ) ->

>::Output, -) -> MiniYoke

-where - Y: for<'a> MiniYokeable<'a>, - P: for<'a> MiniYokeable<'a> -{ - unimplemented!() -} - -struct Bar<'a> { - string_1: &'a str, - string_2: &'a str, -} - -impl<'a> MiniYokeable<'a> for Bar<'static> { - type Output = Bar<'a>; -} - -impl<'a> MiniYokeable<'a> for &'static str { - type Output = &'a str; -} - -fn demo_broken(bar: MiniYoke>) -> MiniYoke<&'static str> { - map_project_broken(bar, |bar, _| bar.string_1) -} - -fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90612.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90612.rs deleted file mode 100644 index effc32945..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90612.rs +++ /dev/null @@ -1,41 +0,0 @@ -// check-pass - -use std::marker::PhantomData; - -trait Family: Sized { - type Item<'a>; - - fn apply_all(&self, f: F) - where - F: FamilyItemFn { } -} - -struct Array(PhantomData); - -impl Family for Array { - type Item<'a> = &'a T; -} - -trait FamilyItemFn { - fn apply(&self, item: T::Item<'_>); -} - -impl FamilyItemFn for F -where - T: Family, - for<'a> F: Fn(T::Item<'a>) -{ - fn apply(&self, item: T::Item<'_>) { - (*self)(item); - } -} - -fn process(array: Array) { - // Works - array.apply_all(|x: &T| { }); - - // ICE: NoSolution - array.apply_all(|x: as Family>::Item<'_>| { }); -} - -fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90638.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90638.rs deleted file mode 100644 index 628b5cba1..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90638.rs +++ /dev/null @@ -1,35 +0,0 @@ -//check-pass - -trait Yokeable<'a>: 'static { - type Output: 'a; -} - -trait IsCovariant<'a> {} - -struct Yoke Yokeable<'a>> { - data: Y, -} - -impl Yokeable<'a>> Yoke { - fn project Yokeable<'a>>(&self, _f: for<'a> fn(>::Output, &'a ()) - -> >::Output) -> Yoke { - - unimplemented!() - } -} - -fn _upcast(x: Yoke) -> Yoke + 'static>> where - Y: for<'a> Yokeable<'a>, - for<'a> >::Output: IsCovariant<'a> - { - x.project(|data, _| { - Box::new(data) - }) -} - - -impl<'a> Yokeable<'a> for Box + 'static> { - type Output = Box + 'a>; -} - -fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90875.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90875.rs deleted file mode 100644 index ffd6857d8..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90875.rs +++ /dev/null @@ -1,31 +0,0 @@ -// check-pass - -trait Variable<'a> { - type Type; -} - -impl Variable<'_> for () { - type Type = (); -} - -fn check(_: F) -where - F: Fn(T), // <- if removed, all fn_* then require type annotations - F: for<'a> Fn(>::Type), - T: for<'a> Variable<'a>, -{ -} - -fn test(arg: impl Fn(())) { - fn fn_1(_: ()) {} - let fn_2 = |_: ()| (); - let fn_3 = |a| fn_1(a); - let fn_4 = arg; - - check(fn_1); // Error - check(fn_2); // Ok - check(fn_3); // Ok - check(fn_4); // Error -} - -fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.rs deleted file mode 100644 index ab9d9a7ce..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.rs +++ /dev/null @@ -1,53 +0,0 @@ -// check-fail -// known-bug: #90950 - -trait Yokeable<'a>: 'static { - type Output: 'a; -} - - -trait IsCovariant<'a> {} - -struct Yoke Yokeable<'a>> { - data: Y, -} - - -// impl Yokeable<'a>> Yoke { -// fn project Yokeable<'a>>( -// &self, -// f: for<'a> fn(>::Output, &'a (), -// ) -> >::Output) -> Yoke { -// unimplemented!() -// } -// } - -fn upcast(x: Yoke) -> Yoke + 'static>> where - Y: for<'a> Yokeable<'a>, - for<'a> >::Output: IsCovariant<'a> - { - // x.project(|data, _| { - // Box::new(data) - // }) - unimplemented!() -} - - -impl<'a> Yokeable<'a> for Box + 'static> { - type Output = Box + 'a>; -} - -// this impl is mostly an example and unnecessary for the pure repro -use std::borrow::*; -impl<'a, T: ToOwned + ?Sized> Yokeable<'a> for Cow<'static, T> { - type Output = Cow<'a, T>; -} -impl<'a, T: ToOwned + ?Sized> IsCovariant<'a> for Cow<'a, T> {} - - - -fn upcast_yoke(y: Yoke>) -> Yoke + 'static>> { - upcast(y) -} - -fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr deleted file mode 100644 index 6206b167b..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0277]: the trait bound `for<'a> <_ as Yokeable<'a>>::Output: IsCovariant<'a>` is not satisfied - --> $DIR/issue-90950.rs:50:12 - | -LL | upcast(y) - | ------ ^ the trait `for<'a> IsCovariant<'a>` is not implemented for `<_ as Yokeable<'a>>::Output` - | | - | required by a bound introduced by this call - | - = help: the trait `IsCovariant<'a>` is implemented for `std::borrow::Cow<'a, T>` -note: required by a bound in `upcast` - --> $DIR/issue-90950.rs:27:42 - | -LL | fn upcast(x: Yoke) -> Yoke + 'static>> where - | ------ required by a bound in this -LL | Y: for<'a> Yokeable<'a>, -LL | for<'a> >::Output: IsCovariant<'a> - | ^^^^^^^^^^^^^^^ required by this bound in `upcast` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.rs deleted file mode 100644 index 7693b1182..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.rs +++ /dev/null @@ -1,23 +0,0 @@ -// check-fail -// known-bug: #89196 - -// Should pass, but we normalize and check bounds before we resolve the generics -// of the function (which we know because of the return type). - -trait Trait<'a> { - type Out; -} - -impl<'a, T> Trait<'a> for T { - type Out = T; -} - -fn weird_bound() -> X - where - for<'a> X: Trait<'a>, - for<'a> >::Out: Copy -{ todo!() } - -fn main() { - let _: () = weird_bound(); -} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr deleted file mode 100644 index 51c964600..000000000 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0277]: the trait bound `for<'a> <_ as Trait<'a>>::Out: Copy` is not satisfied - --> $DIR/norm-before-method-resolution.rs:22:17 - | -LL | let _: () = weird_bound(); - | ^^^^^^^^^^^ the trait `for<'a> Copy` is not implemented for `<_ as Trait<'a>>::Out` - | -note: required by a bound in `weird_bound` - --> $DIR/norm-before-method-resolution.rs:18:40 - | -LL | fn weird_bound() -> X - | ----------- required by a bound in this -... -LL | for<'a> >::Out: Copy - | ^^^^ required by this bound in `weird_bound` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. -- cgit v1.2.3