Skip to content

Commit 4986bbf

Browse files
committed
Keep turbofish in prelude collision lint.
1 parent 13edc17 commit 4986bbf

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Diff for: compiler/rustc_typeck/src/check/method/prelude2021.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,22 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
163163
sp,
164164
"disambiguate the associated function",
165165
format!(
166-
"{}::{}({}{})",
167-
trait_name, segment.ident.name, self_adjusted, args
166+
"{}::{}{}({}{})",
167+
trait_name,
168+
segment.ident.name,
169+
if let Some(args) = segment.args.as_ref().and_then(|args| self
170+
.sess()
171+
.source_map()
172+
.span_to_snippet(args.span_ext)
173+
.ok())
174+
{
175+
// Keep turbofish.
176+
format!("::{}", args)
177+
} else {
178+
String::new()
179+
},
180+
self_adjusted,
181+
args,
168182
),
169183
Applicability::MachineApplicable,
170184
);

0 commit comments

Comments
 (0)