File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
compiler/rustc_errors/src Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -245,7 +245,6 @@ pub(crate) struct SubstitutionHighlight {
245245impl SubstitutionPart {
246246 /// Try to turn a replacement into an addition when the span that is being
247247 /// overwritten matches either the prefix or suffix of the replacement.
248- #[ instrument( level = "debug" , skip( self , sm) ) ]
249248 fn trim_trivial_replacements ( self , sm : & SourceMap ) -> TrimmedSubstitutionPart {
250249 let mut trimmed_part = TrimmedSubstitutionPart {
251250 original_span : self . span ,
@@ -307,6 +306,9 @@ impl TrimmedSubstitutionPart {
307306/// `BB` is. Return the length of the prefix, the "trimmed" suggestion, and the length
308307/// of the suffix.
309308fn as_substr < ' a > ( original : & ' a str , suggestion : & ' a str ) -> Option < ( usize , & ' a str , usize ) > {
309+ // Case for import paths where the suggestion shares a prefix with the original.
310+ // Without this, suggesting `std::sync` for `sync` would incorrectly highlight `td::s`
311+ // instead of `std::` because of the common 's' prefix. See #148070.
310312 if suggestion. contains ( "::" )
311313 && suggestion. ends_with ( original)
312314 && suggestion. len ( ) > original. len ( )
You can’t perform that action at this time.
0 commit comments