Skip to content

Commit 0d3f077

Browse files
committed
Skip lifetimes in turbofish suggestions
1 parent 15c74d5 commit 0d3f077

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,11 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
15711571
generics
15721572
.params
15731573
.iter()
1574+
// Do not suggest `foo::<'a, T>()`
1575+
.filter(|p| !matches!(
1576+
p.kind,
1577+
ty::GenericParamDefKind::Lifetime
1578+
))
15741579
.map(|p| p.name.to_string())
15751580
.collect::<Vec<String>>()
15761581
.join(", ")

src/test/ui/issues/issue-12187-2.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ LL | let &v: &T = new();
1010
| ^^^^
1111
help: consider specifying the type arguments in the function call
1212
|
13-
LL | let &v = new::<'r, T>();
14-
| ^^^^^^^^^
13+
LL | let &v = new::<T>();
14+
| ^^^^^
1515

1616
error: aborting due to previous error
1717

0 commit comments

Comments
 (0)