@@ -4425,7 +4425,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
44254425 let Finalize { node_id, path_span, .. } = finalize;
44264426 let report_errors = |this : & mut Self , res : Option < Res > | {
44274427 if this. should_report_errs ( ) {
4428- let ( err, candidates) = this. smart_resolve_report_errors (
4428+ let ( mut err, candidates) = this. smart_resolve_report_errors (
44294429 path,
44304430 None ,
44314431 path_span,
@@ -4436,7 +4436,8 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
44364436
44374437 let def_id = this. parent_scope . module . nearest_parent_mod ( ) ;
44384438 let instead = res. is_some ( ) ;
4439- let suggestion = if let Some ( ( start, end) ) = this. diag_metadata . in_range
4439+ let ( suggestion, const_err) = if let Some ( ( start, end) ) =
4440+ this. diag_metadata . in_range
44404441 && path[ 0 ] . ident . span . lo ( ) == end. span . lo ( )
44414442 && !matches ! ( start. kind, ExprKind :: Lit ( _) )
44424443 {
@@ -4448,22 +4449,30 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
44484449 span = span. with_lo ( span. lo ( ) + BytePos ( 1 ) ) ;
44494450 sugg = "" ;
44504451 }
4451- Some ( (
4452- span,
4453- "you might have meant to write `.` instead of `..`" ,
4454- sugg. to_string ( ) ,
4455- Applicability :: MaybeIncorrect ,
4456- ) )
4452+ (
4453+ Some ( (
4454+ span,
4455+ "you might have meant to write `.` instead of `..`" ,
4456+ sugg. to_string ( ) ,
4457+ Applicability :: MaybeIncorrect ,
4458+ ) ) ,
4459+ None ,
4460+ )
44574461 } else if res. is_none ( )
44584462 && let PathSource :: Type
44594463 | PathSource :: Expr ( _)
44604464 | PathSource :: PreciseCapturingArg ( ..) = source
44614465 {
44624466 this. suggest_adding_generic_parameter ( path, source)
44634467 } else {
4464- None
4468+ ( None , None )
44654469 } ;
44664470
4471+ if let Some ( const_err) = const_err {
4472+ err. cancel ( ) ;
4473+ err = const_err;
4474+ }
4475+
44674476 let ue = UseError {
44684477 err,
44694478 candidates,
0 commit comments