diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-08-30 21:55:10 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2021-08-30 21:55:10 +0200 |
| commit | 4986bbf135d477f73af96ef235407921ce952dc0 (patch) | |
| tree | 56a5a9b28b6d1b3071dbd6e0dc401b059b169515 | |
| parent | 13edc17f65bcad7fe9046720a16fc192e810970e (diff) | |
| download | rust-4986bbf135d477f73af96ef235407921ce952dc0.tar.gz rust-4986bbf135d477f73af96ef235407921ce952dc0.zip | |
Keep turbofish in prelude collision lint.
| -rw-r--r-- | compiler/rustc_typeck/src/check/method/prelude2021.rs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/compiler/rustc_typeck/src/check/method/prelude2021.rs b/compiler/rustc_typeck/src/check/method/prelude2021.rs index b5bc9d3599a..384d25ed771 100644 --- a/compiler/rustc_typeck/src/check/method/prelude2021.rs +++ b/compiler/rustc_typeck/src/check/method/prelude2021.rs @@ -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, ); |
