diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:19 +0000 |
commit | a0b8f38ab54ac451646aa00cd5e91b6c76f22a84 (patch) | |
tree | fc451898ccaf445814e26b46664d78702178101d /tests/ui/nll | |
parent | Adding debian version 1.71.1+dfsg1-2. (diff) | |
download | rustc-a0b8f38ab54ac451646aa00cd5e91b6c76f22a84.tar.xz rustc-a0b8f38ab54ac451646aa00cd5e91b6c76f22a84.zip |
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/nll')
-rw-r--r-- | tests/ui/nll/assign-while-to-immutable.rs | 4 | ||||
-rw-r--r-- | tests/ui/nll/issue-112604-closure-output-normalize.rs | 49 | ||||
-rw-r--r-- | tests/ui/nll/issue-53119.rs | 2 | ||||
-rw-r--r-- | tests/ui/nll/issue-54943-3.rs | 2 | ||||
-rw-r--r-- | tests/ui/nll/ty-outlives/impl-trait-captures.stderr | 4 | ||||
-rw-r--r-- | tests/ui/nll/user-annotations/normalization-2.stderr | 2 |
6 files changed, 57 insertions, 6 deletions
diff --git a/tests/ui/nll/assign-while-to-immutable.rs b/tests/ui/nll/assign-while-to-immutable.rs index c803321b5..24eaa8a23 100644 --- a/tests/ui/nll/assign-while-to-immutable.rs +++ b/tests/ui/nll/assign-while-to-immutable.rs @@ -4,8 +4,8 @@ // check-pass fn main() { - let x = while false { + let x: () = while false { break; }; - let y = 'l: while break 'l {}; + let y: () = 'l: while break 'l {}; } diff --git a/tests/ui/nll/issue-112604-closure-output-normalize.rs b/tests/ui/nll/issue-112604-closure-output-normalize.rs new file mode 100644 index 000000000..e4c954eeb --- /dev/null +++ b/tests/ui/nll/issue-112604-closure-output-normalize.rs @@ -0,0 +1,49 @@ +//check-pass + +use higher_kinded_types::*; +mod higher_kinded_types { + pub(crate) trait HKT { + type Of<'lt>; + } + + pub(crate) trait WithLifetime<'lt> { + type T; + } + + impl<T: ?Sized + for<'any> WithLifetime<'any>> HKT for T { + type Of<'lt> = <T as WithLifetime<'lt>>::T; + } +} + +trait Trait { + type Gat<'lt>; +} + +impl Trait for () { + type Gat<'lt> = (); +} + +/// Same as `Trait`, but using HKTs rather than GATs +trait HTrait { + type Hat: ?Sized + HKT; +} + +impl<T: Trait> HTrait for T { + type Hat = dyn for<'lt> WithLifetime<'lt, T = T::Gat<'lt>>; +} + +impl<Hat: ?Sized + HKT> Trait for Box<dyn '_ + HTrait<Hat = Hat>> { + type Gat<'lt> = Hat::Of<'lt>; +} + +fn existential() -> impl for<'a> Trait<Gat<'a> = ()> {} + +fn dyn_hoops<T: Trait>( + _: T, +) -> Box<dyn HTrait<Hat = dyn for<'a> WithLifetime<'a, T = T::Gat<'a>>>> { + loop {} +} + +fn main() { + let _ = || -> _ { dyn_hoops(existential()) }; +} diff --git a/tests/ui/nll/issue-53119.rs b/tests/ui/nll/issue-53119.rs index 03c9c071c..015b72367 100644 --- a/tests/ui/nll/issue-53119.rs +++ b/tests/ui/nll/issue-53119.rs @@ -1,4 +1,6 @@ // check-pass +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next use std::ops::Deref; diff --git a/tests/ui/nll/issue-54943-3.rs b/tests/ui/nll/issue-54943-3.rs index 077eb1563..348b48dba 100644 --- a/tests/ui/nll/issue-54943-3.rs +++ b/tests/ui/nll/issue-54943-3.rs @@ -13,7 +13,7 @@ fn foo<T: 'static + Debug>(_: T) { } fn bar<'a>() { return; - let _x = foo::<Vec<_>>(Vec::<&'a u32>::new()); + foo::<Vec<_>>(Vec::<&'a u32>::new()); } fn main() {} diff --git a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr index da4b9595c..ba885d1b9 100644 --- a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr +++ b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr @@ -1,4 +1,4 @@ -error[E0700]: hidden type for `Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), [ReEarlyBound(0, 'a), T, ReEarlyBound(0, 'a)])` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), [ReEarlyBound(DefId(0:9 ~ impl_trait_captures[aeb9]::foo::'a), 0, 'a), T, ReEarlyBound(DefId(0:9 ~ impl_trait_captures[aeb9]::foo::'a), 0, 'a)])` captures lifetime that does not appear in bounds --> $DIR/impl-trait-captures.rs:11:5 | LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> { @@ -8,7 +8,7 @@ LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> { LL | x | ^ | -help: to declare that `Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), [ReEarlyBound(0, 'a), T, ReEarlyBound(2, 'a)])` captures `ReFree(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[aeb9]::foo::'_), '_))`, you can add an explicit `ReFree(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[aeb9]::foo::'_), '_))` lifetime bound +help: to declare that `Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), [ReEarlyBound(DefId(0:9 ~ impl_trait_captures[aeb9]::foo::'a), 0, 'a), T, ReEarlyBound(DefId(0:14 ~ impl_trait_captures[aeb9]::foo::{opaque#0}::'a), 2, 'a)])` captures `ReFree(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[aeb9]::foo::'_), '_))`, you can add an explicit `ReFree(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[aeb9]::foo::'_), '_))` lifetime bound | LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + ReFree(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[aeb9]::foo::'_), '_)) { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/tests/ui/nll/user-annotations/normalization-2.stderr b/tests/ui/nll/user-annotations/normalization-2.stderr index 5299282ea..6b0dcb414 100644 --- a/tests/ui/nll/user-annotations/normalization-2.stderr +++ b/tests/ui/nll/user-annotations/normalization-2.stderr @@ -147,7 +147,7 @@ LL | fn test_variants<'a, 'b, 'c>() { | -- lifetime `'b` defined here ... LL | <Ty<'b>>::Tuple(); - | ^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static` + | ^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static` error: lifetime may not live long enough --> $DIR/normalization-2.rs:93:5 |