@@ -10,21 +10,19 @@ use rustc_middle::traits::Reveal;
1010use rustc_middle:: ty:: layout:: LayoutOf ;
1111use rustc_middle:: ty:: print:: with_no_trimmed_paths;
1212use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
13- use rustc_session:: lint;
1413use rustc_span:: def_id:: LocalDefId ;
1514use rustc_span:: { Span , DUMMY_SP } ;
1615use rustc_target:: abi:: { self , Abi } ;
1716use tracing:: { debug, instrument, trace} ;
1817
1918use super :: { CanAccessMutGlobal , CompileTimeInterpCx , CompileTimeMachine } ;
2019use crate :: const_eval:: CheckAlignment ;
21- use crate :: errors:: { self , ConstEvalError , DanglingPtrInFinal } ;
2220use crate :: interpret:: {
2321 create_static_alloc, eval_nullary_intrinsic, intern_const_alloc_recursive, throw_exhaust,
2422 CtfeValidationMode , GlobalId , Immediate , InternKind , InternResult , InterpCx , InterpError ,
2523 InterpResult , MPlaceTy , MemoryKind , OpTy , RefTracking , StackPopCleanup ,
2624} ;
27- use crate :: CTRL_C_RECEIVED ;
25+ use crate :: { errors , CTRL_C_RECEIVED } ;
2826
2927// Returns a pointer to where the result lives
3028#[ instrument( level = "trace" , skip( ecx, body) ) ]
@@ -105,18 +103,15 @@ fn eval_body_using_ecx<'tcx, R: InterpretationResult<'tcx>>(
105103 return Err ( ecx
106104 . tcx
107105 . dcx ( )
108- . emit_err ( DanglingPtrInFinal { span : ecx. tcx . span , kind : intern_kind } )
106+ . emit_err ( errors :: DanglingPtrInFinal { span : ecx. tcx . span , kind : intern_kind } )
109107 . into ( ) ) ;
110108 }
111109 Err ( InternResult :: FoundBadMutablePointer ) => {
112- // only report mutable pointers if there were no dangling pointers
113- let err_diag = errors:: MutablePtrInFinal { span : ecx. tcx . span , kind : intern_kind } ;
114- ecx. tcx . emit_node_span_lint (
115- lint:: builtin:: CONST_EVAL_MUTABLE_PTR_IN_FINAL_VALUE ,
116- ecx. machine . best_lint_scope ( * ecx. tcx ) ,
117- err_diag. span ,
118- err_diag,
119- )
110+ return Err ( ecx
111+ . tcx
112+ . dcx ( )
113+ . emit_err ( errors:: MutablePtrInFinal { span : ecx. tcx . span , kind : intern_kind } )
114+ . into ( ) ) ;
120115 }
121116 }
122117
@@ -448,7 +443,12 @@ fn report_eval_error<'tcx>(
448443 error,
449444 DUMMY_SP ,
450445 || super :: get_span_and_frames ( ecx. tcx , ecx. stack ( ) ) ,
451- |span, frames| ConstEvalError { span, error_kind : kind, instance, frame_notes : frames } ,
446+ |span, frames| errors:: ConstEvalError {
447+ span,
448+ error_kind : kind,
449+ instance,
450+ frame_notes : frames,
451+ } ,
452452 )
453453}
454454
0 commit comments