We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3d03432 + 1418338 commit dfee4c8Copy full SHA for dfee4c8
crates/hir-ty/src/object_safety.rs
@@ -349,7 +349,7 @@ where
349
ControlFlow::Continue(())
350
} else {
351
let generic_params = db.generic_params(item.into());
352
- if generic_params.len_type_or_consts() > 0 {
+ if !generic_params.is_empty() {
353
cb(ObjectSafetyViolation::GAT(it))
354
355
crates/hir-ty/src/object_safety/tests.rs
@@ -378,3 +378,16 @@ pub trait Error: core::fmt::Debug + core::fmt::Display {
378
[("Error", vec![])],
379
);
380
}
381
+
382
+#[test]
383
+fn lifetime_gat_is_object_unsafe() {
384
+ check_object_safety(
385
+ r#"
386
+//- minicore: dispatch_from_dyn
387
+trait Foo {
388
+ type Bar<'a>;
389
+}
390
+"#,
391
+ [("Foo", vec![ObjectSafetyViolationKind::GAT])],
392
+ );
393
0 commit comments