@@ -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) ) ]
@@ -103,18 +101,15 @@ fn eval_body_using_ecx<'tcx, R: InterpretationResult<'tcx>>(
103101 return Err ( ecx
104102 . tcx
105103 . dcx ( )
106- . emit_err ( DanglingPtrInFinal { span : ecx. tcx . span , kind : intern_kind } )
104+ . emit_err ( errors :: DanglingPtrInFinal { span : ecx. tcx . span , kind : intern_kind } )
107105 . into ( ) ) ;
108106 }
109107 Err ( InternResult :: FoundBadMutablePointer ) => {
110- // only report mutable pointers if there were no dangling pointers
111- let err_diag = errors:: MutablePtrInFinal { span : ecx. tcx . span , kind : intern_kind } ;
112- ecx. tcx . emit_node_span_lint (
113- lint:: builtin:: CONST_EVAL_MUTABLE_PTR_IN_FINAL_VALUE ,
114- ecx. machine . best_lint_scope ( * ecx. tcx ) ,
115- err_diag. span ,
116- err_diag,
117- )
108+ return Err ( ecx
109+ . tcx
110+ . dcx ( )
111+ . emit_err ( errors:: MutablePtrInFinal { span : ecx. tcx . span , kind : intern_kind } )
112+ . into ( ) ) ;
118113 }
119114 }
120115
@@ -446,7 +441,12 @@ fn report_eval_error<'tcx>(
446441 error,
447442 DUMMY_SP ,
448443 || super :: get_span_and_frames ( ecx. tcx , ecx. stack ( ) ) ,
449- |span, frames| ConstEvalError { span, error_kind : kind, instance, frame_notes : frames } ,
444+ |span, frames| errors:: ConstEvalError {
445+ span,
446+ error_kind : kind,
447+ instance,
448+ frame_notes : frames,
449+ } ,
450450 )
451451}
452452
0 commit comments