Description
(Originally found here)
I tried this code:
fn extend<T>(input: &T) -> &'static T {
struct Bounded<'a, 'b: 'static, T>(&'a T, [&'b (); 0]);
let n: Box<dyn FnOnce(&T) -> Bounded<'static, '_, T>> = Box::new(|x| Bounded(x, []));
n(input).0
}
fn extend_mut<'a, T>(input: &'a mut T) -> &'static mut T {
struct Bounded<'a, 'b: 'static, T>(&'a mut T, [&'b (); 0]);
let mut n: Box<dyn FnMut(&mut T) -> Bounded<'static, '_, T>> = Box::new(|x| Bounded(x, []));
n(input).0
}
I expected to see this happen: lifetime error, 'a
is not 'static
Instead, this happened: compiles
Meta
Regression in nightly-2022-08-10
found 7 bors merge commits in the specified range
commit[0] 2022-08-08: Auto merge of #98863 - compiler-errors:projection-msg, r=estebank
commit[1] 2022-08-09: Auto merge of #100205 - cjgillot:noice-doc, r=camelid
commit[2] 2022-08-09: Auto merge of #100304 - matthiaskrgr:rollup-gs56vlw, r=matthiaskrgr
commit[3] 2022-08-09: Auto merge of #100089 - JakobDegen:no-invalidate-visitor, r=tmiasko
commit[4] 2022-08-09: Auto merge of #100318 - Dylan-DPC:rollup-18tzp6q, r=Dylan-DPC
commit[5] 2022-08-09: Auto merge of #99217 - lcnr:implied-bounds-pre-norm, r=lcnr
commit[6] 2022-08-09: Auto merge of #100150 - notriddle:notriddle/implementors-js, r=GuillaumeGomez
@rustbot label T-types T-compiler regression-from-stable-to-stable I-unsound A-lifetimes