Adjust tests

This commit is contained in:
Michael Goulet 2024-08-25 16:56:06 -04:00
parent e8472e84e3
commit 67804c57e7
7 changed files with 22 additions and 3 deletions

View File

@ -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() {}

View File

@ -1,3 +1,5 @@
// Regression test for #129021.
static UNIT: &'static &'static () = &&(); static UNIT: &'static &'static () = &&();
fn foo<'a: 'a, 'b: 'b, T>(_: &'a &'b (), v: &'b T) -> &'a T { v } fn foo<'a: 'a, 'b: 'b, T>(_: &'a &'b (), v: &'b T) -> &'a T { v }

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough 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 { LL | fn bad<'a, T>(x: &'a T) -> &'static T {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here

View File

@ -1,3 +1,5 @@
// Regression test for #129021.
trait ToArg<T> { trait ToArg<T> {
type Arg; type Arg;
} }

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough 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 { LL | fn extend<'a, 'b>(x: &'a str) -> &'b str {
| -- -- lifetime `'b` defined here | -- -- lifetime `'b` defined here

View File

@ -1,3 +1,5 @@
// Regression test for #129021.
static UNIT: &'static &'static () = &&(); static UNIT: &'static &'static () = &&();
fn foo<'a, 'b, T>(_: &'a &'b (), v: &'b T) -> &'a T { v } fn foo<'a, 'b, T>(_: &'a &'b (), v: &'b T) -> &'a T { v }

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough 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 { LL | fn bad<'a, T>(x: &'a T) -> &'static T {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here