From 67804c57e7a53b96d79b49bf6e356e3ade4d943d Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sun, 25 Aug 2024 16:56:06 -0400 Subject: [PATCH] Adjust tests --- ...d-bounds-on-nested-references-plus-variance-2.rs | 13 +++++++++++++ ...n-nested-references-plus-variance-early-bound.rs | 2 ++ ...sted-references-plus-variance-early-bound.stderr | 2 +- ...-nested-references-plus-variance-unnormalized.rs | 2 ++ ...ted-references-plus-variance-unnormalized.stderr | 2 +- ...ied-bounds-on-nested-references-plus-variance.rs | 2 ++ ...bounds-on-nested-references-plus-variance.stderr | 2 +- 7 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-2.rs diff --git a/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-2.rs b/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-2.rs new file mode 100644 index 00000000000..ca8b8b7e4d9 --- /dev/null +++ b/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-2.rs @@ -0,0 +1,13 @@ +//@ check-pass +//@ known-bug: #25860 + +static UNIT: &'static &'static () = &&(); + +fn foo<'a, 'b, T>(_: &'a &'b (), v: &'b T, _: &()) -> &'a T { v } + +fn bad<'a, T>(x: &'a T) -> &'static T { + let f: fn(_, &'a T, &()) -> &'static T = foo; + f(UNIT, x, &()) +} + +fn main() {} diff --git a/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-early-bound.rs b/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-early-bound.rs index 16095f66da7..226a6fa3016 100644 --- a/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-early-bound.rs +++ b/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-early-bound.rs @@ -1,3 +1,5 @@ +// Regression test for #129021. + static UNIT: &'static &'static () = &&(); fn foo<'a: 'a, 'b: 'b, T>(_: &'a &'b (), v: &'b T) -> &'a T { v } diff --git a/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-early-bound.stderr b/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-early-bound.stderr index 4925576e5a0..84d2a6d2b6a 100644 --- a/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-early-bound.stderr +++ b/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-early-bound.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/implied-bounds-on-nested-references-plus-variance-early-bound.rs:6:12 + --> $DIR/implied-bounds-on-nested-references-plus-variance-early-bound.rs:8:12 | LL | fn bad<'a, T>(x: &'a T) -> &'static T { | -- lifetime `'a` defined here diff --git a/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-unnormalized.rs b/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-unnormalized.rs index b842b21224d..f3068990189 100644 --- a/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-unnormalized.rs +++ b/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-unnormalized.rs @@ -1,3 +1,5 @@ +// Regression test for #129021. + trait ToArg { type Arg; } diff --git a/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-unnormalized.stderr b/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-unnormalized.stderr index a2ac0d897b6..4cdb959786a 100644 --- a/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-unnormalized.stderr +++ b/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-unnormalized.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/implied-bounds-on-nested-references-plus-variance-unnormalized.rs:10:5 + --> $DIR/implied-bounds-on-nested-references-plus-variance-unnormalized.rs:12:5 | LL | fn extend<'a, 'b>(x: &'a str) -> &'b str { | -- -- lifetime `'b` defined here diff --git a/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance.rs b/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance.rs index d40418a4e90..6de81cba728 100644 --- a/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance.rs +++ b/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance.rs @@ -1,3 +1,5 @@ +// Regression test for #129021. + static UNIT: &'static &'static () = &&(); fn foo<'a, 'b, T>(_: &'a &'b (), v: &'b T) -> &'a T { v } diff --git a/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance.stderr b/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance.stderr index 1ad9ba31f37..c96fa92937b 100644 --- a/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance.stderr +++ b/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/implied-bounds-on-nested-references-plus-variance.rs:6:12 + --> $DIR/implied-bounds-on-nested-references-plus-variance.rs:8:12 | LL | fn bad<'a, T>(x: &'a T) -> &'static T { | -- lifetime `'a` defined here