Cleanup some remains of hr_lifetime_in_assoc_type compatibility lint
This commit is contained in:
parent
ad36f8feba
commit
80cf3f99f4
17 changed files with 113 additions and 278 deletions
|
|
@ -43,23 +43,19 @@ fn baz<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
|
|||
(a, b)
|
||||
}
|
||||
|
||||
// FIXME(#32330)
|
||||
//#[cfg(transmute)] // one instantiations: BAD
|
||||
//fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
|
||||
// bar(foo, x) //[transmute] ERROR E0495
|
||||
//}
|
||||
#[cfg(transmute)] // one instantiations: BAD
|
||||
fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
|
||||
bar(foo, x) //[transmute]~ ERROR E0495
|
||||
}
|
||||
|
||||
// FIXME(#32330)
|
||||
//#[cfg(krisskross)] // two instantiations, mixing and matching: BAD
|
||||
//fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
|
||||
// let a = bar(foo, y); //[krisskross] ERROR E0495
|
||||
// let b = bar(foo, x); //[krisskross] ERROR E0495
|
||||
// (a, b)
|
||||
//}
|
||||
#[cfg(krisskross)] // two instantiations, mixing and matching: BAD
|
||||
fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
|
||||
let a = bar(foo, y); //[krisskross]~ ERROR E0495
|
||||
let b = bar(foo, x); //[krisskross]~ ERROR E0495
|
||||
(a, b)
|
||||
}
|
||||
|
||||
#[rustc_error]
|
||||
fn main() { }
|
||||
//[ok]~^ ERROR compilation successful
|
||||
//[oneuse]~^^ ERROR compilation successful
|
||||
//[transmute]~^^^ ERROR compilation successful
|
||||
//[krisskross]~^^^^ ERROR compilation successful
|
||||
|
|
|
|||
|
|
@ -42,35 +42,29 @@ fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
|||
(a, b)
|
||||
}
|
||||
|
||||
// FIXME(#32330)
|
||||
//#[cfg(oneuse)] // one instantiation: BAD
|
||||
//fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
// let f = foo; // <-- No consistent type can be inferred for `f` here.
|
||||
// let a = bar(f, x); //[oneuse] ERROR E0495
|
||||
// let b = bar(f, y);
|
||||
// (a, b)
|
||||
//}
|
||||
#[cfg(oneuse)] // one instantiation: BAD
|
||||
fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
let f = foo; // <-- No consistent type can be inferred for `f` here.
|
||||
let a = bar(f, x); //[oneuse]~^ ERROR E0495
|
||||
let b = bar(f, y);
|
||||
(a, b)
|
||||
}
|
||||
|
||||
// FIXME(#32330)
|
||||
//#[cfg(transmute)] // one instantiations: BAD
|
||||
//fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
|
||||
// // Cannot instantiate `foo` with any lifetime other than `'a`,
|
||||
// // since it is provided as input.
|
||||
//
|
||||
// bar(foo, x) //[transmute] ERROR E0495
|
||||
//}
|
||||
#[cfg(transmute)] // one instantiations: BAD
|
||||
fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
|
||||
// Cannot instantiate `foo` with any lifetime other than `'a`,
|
||||
// since it is provided as input.
|
||||
|
||||
// FIXME(#32330)
|
||||
//#[cfg(krisskross)] // two instantiations, mixing and matching: BAD
|
||||
//fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
// let a = bar(foo, y); //[krisskross] ERROR E0495
|
||||
// let b = bar(foo, x); //[krisskross] ERROR E0495
|
||||
// (a, b)
|
||||
//}
|
||||
bar(foo, x) //[transmute]~ ERROR E0495
|
||||
}
|
||||
|
||||
#[cfg(krisskross)] // two instantiations, mixing and matching: BAD
|
||||
fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
let a = bar(foo, y); //[krisskross]~ ERROR E0495
|
||||
let b = bar(foo, x); //[krisskross]~ ERROR E0495
|
||||
(a, b)
|
||||
}
|
||||
|
||||
#[rustc_error]
|
||||
fn main() { }
|
||||
//[ok]~^ ERROR compilation successful
|
||||
//[oneuse]~^^ ERROR compilation successful
|
||||
//[transmute]~^^^ ERROR compilation successful
|
||||
//[krisskross]~^^^^ ERROR compilation successful
|
||||
|
|
|
|||
|
|
@ -91,9 +91,6 @@ check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
|
|||
// - if we are covariant, then 'a and 'b can be set to the call-site
|
||||
// intersection;
|
||||
// - if we are contravariant, then 'a can be inferred to 'static.
|
||||
//
|
||||
// FIXME(#32330) this is true, but we are not currently impl'ing this
|
||||
// full semantics
|
||||
check! { bound_a_b_vs_bound_a: (for<'a,'b> fn(&'a u32, &'b u32),
|
||||
for<'a> fn(&'a u32, &'a u32)) }
|
||||
check! { bound_co_a_b_vs_bound_co_a: (for<'a,'b> fn(Co<'a>, Co<'b>),
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ error[E0308]: mismatched types
|
|||
|
|
||||
= note: expected type `fn(&'cx S) -> &'cx S`
|
||||
found type `fn(&'a S) -> &S {bar::<'_>}`
|
||||
= note: lifetime parameter `'b` declared on fn `bar` appears only in the return type, but here is required to be higher-ranked, which means that `'b` must appear in both argument and return types
|
||||
= note: this error is the result of a recent bug fix; for more information, see issue #33685 <https://github.com/rust-lang/rust/issues/33685>
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue