Consider lifetime GATs object unsafe
This commit is contained in:
parent
814da15d8b
commit
393f9cc0ba
@ -349,7 +349,7 @@ fn object_safety_violation_for_assoc_item<F>(
|
|||||||
ControlFlow::Continue(())
|
ControlFlow::Continue(())
|
||||||
} else {
|
} else {
|
||||||
let generic_params = db.generic_params(item.into());
|
let generic_params = db.generic_params(item.into());
|
||||||
if generic_params.len_type_or_consts() > 0 {
|
if !generic_params.is_empty() {
|
||||||
cb(ObjectSafetyViolation::GAT(it))
|
cb(ObjectSafetyViolation::GAT(it))
|
||||||
} else {
|
} else {
|
||||||
ControlFlow::Continue(())
|
ControlFlow::Continue(())
|
||||||
|
@ -378,3 +378,16 @@ pub trait Error: core::fmt::Debug + core::fmt::Display {
|
|||||||
[("Error", vec![])],
|
[("Error", vec![])],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn lifetime_gat_is_object_unsafe() {
|
||||||
|
check_object_safety(
|
||||||
|
r#"
|
||||||
|
//- minicore: dispatch_from_dyn
|
||||||
|
trait Foo {
|
||||||
|
type Bar<'a>;
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
[("Foo", vec![ObjectSafetyViolationKind::GAT])],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user