diff options
| author | bors <bors@rust-lang.org> | 2021-11-29 19:26:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-11-29 19:26:50 +0000 |
| commit | f1edd0429582dd29cccacaf50fd134b05593bd9c (patch) | |
| tree | fc7c7d5cf467d21e4a0c1dade1f4ffad3dbd1b6f /src | |
| parent | 7e15b235f62dce8a21e51c2eff6b2c0cde9b018e (diff) | |
| parent | a9174cf94e72378d7aa8c5eb4fb9d85f392c00df (diff) | |
| download | rust-1.57.0.tar.gz rust-1.57.0.zip | |
Auto merge of #91361 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum 1.57.0
[stable] 1.57.0 artifacts This is the standard beta->stable promotion, and includes a last-minute backports of: * #90044 via inclusion of #91220. * [beta] Don't treat unnormalized function arguments as well-formed #91242 r? `@Mark-Simulacrum`
Diffstat (limited to 'src')
| -rw-r--r-- | src/ci/channel | 2 | ||||
| -rw-r--r-- | src/test/ui/fn/implied-bounds-unnorm-associated-type.nll.stderr | 14 | ||||
| -rw-r--r-- | src/test/ui/fn/implied-bounds-unnorm-associated-type.rs | 22 | ||||
| -rw-r--r-- | src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr | 13 | ||||
| -rw-r--r-- | src/test/ui/generic-associated-types/issue-87748.rs | 30 |
5 files changed, 50 insertions, 31 deletions
diff --git a/src/ci/channel b/src/ci/channel index 65b2df87f7d..2bf5ad0447d 100644 --- a/src/ci/channel +++ b/src/ci/channel @@ -1 +1 @@ -beta +stable diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type.nll.stderr b/src/test/ui/fn/implied-bounds-unnorm-associated-type.nll.stderr new file mode 100644 index 00000000000..e37ec7f2665 --- /dev/null +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type.nll.stderr @@ -0,0 +1,14 @@ +error: lifetime may not live long enough + --> $DIR/implied-bounds-unnorm-associated-type.rs:14:5 + | +LL | fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | s + | ^ returning this value requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` + +error: aborting due to previous error + diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs b/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs new file mode 100644 index 00000000000..2e5ac7d7398 --- /dev/null +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs @@ -0,0 +1,22 @@ +// check-fail +// See issue #91068. Types in the substs of an associated type can't be implied +// to be WF, since they don't actually have to be constructed. + +trait Trait { + type Type; +} + +impl<T> Trait for T { + type Type = (); +} + +fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str { + s //~ ERROR lifetime mismatch [E0623] +} + +fn main() { + let x = String::from("Hello World!"); + let y = f(&x, ()); + drop(x); + println!("{}", y); +} diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr b/src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr new file mode 100644 index 00000000000..93ab5dceee9 --- /dev/null +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr @@ -0,0 +1,13 @@ +error[E0623]: lifetime mismatch + --> $DIR/implied-bounds-unnorm-associated-type.rs:14:5 + | +LL | fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str { + | ------- ---------- + | | + | these two types are declared with different lifetimes... +LL | s + | ^ ...but data from `s` flows here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/generic-associated-types/issue-87748.rs b/src/test/ui/generic-associated-types/issue-87748.rs deleted file mode 100644 index 93c3b3937cb..00000000000 --- a/src/test/ui/generic-associated-types/issue-87748.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Checks that we properly add implied bounds from unnormalized projections in -// inputs when typechecking functions. - -// check-pass - -#![feature(generic_associated_types)] - -trait MyTrait { - type Assoc<'a, 'b> where 'b: 'a; - fn do_sth(arg: Self::Assoc<'_, '_>); -} - -struct A; -struct B; -struct C; - -impl MyTrait for A { - type Assoc<'a, 'b> where 'b: 'a = u32; - fn do_sth(_: u32) {} -} -impl MyTrait for B { - type Assoc<'a, 'b> where 'b: 'a = u32; - fn do_sth(_: Self::Assoc<'_, '_>) {} -} -impl MyTrait for C { - type Assoc<'a, 'b> where 'b: 'a = u32; - fn do_sth(_: Self::Assoc<'static, 'static>) {} -} - -fn main () {} |
