We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f75aebe + 393f9cc commit 5bc2e65Copy full SHA for 5bc2e65
src/tools/rust-analyzer/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
src/tools/rust-analyzer/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