Keep turbofish in prelude collision lint.

This commit is contained in:
Mara Bos 2021-08-30 21:55:10 +02:00
parent 13edc17f65
commit 4986bbf135

View File

@ -163,8 +163,22 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
sp,
"disambiguate the associated function",
format!(
"{}::{}({}{})",
trait_name, segment.ident.name, self_adjusted, args
"{}::{}{}({}{})",
trait_name,
segment.ident.name,
if let Some(args) = segment.args.as_ref().and_then(|args| self
.sess()
.source_map()
.span_to_snippet(args.span_ext)
.ok())
{
// Keep turbofish.
format!("::{}", args)
} else {
String::new()
},
self_adjusted,
args,
),
Applicability::MachineApplicable,
);