@@ -10,21 +10,19 @@ use rustc_middle::traits::Reveal;
10
10
use rustc_middle:: ty:: layout:: LayoutOf ;
11
11
use rustc_middle:: ty:: print:: with_no_trimmed_paths;
12
12
use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
13
- use rustc_session:: lint;
14
13
use rustc_span:: def_id:: LocalDefId ;
15
14
use rustc_span:: { Span , DUMMY_SP } ;
16
15
use rustc_target:: abi:: { self , Abi } ;
17
16
use tracing:: { debug, instrument, trace} ;
18
17
19
18
use super :: { CanAccessMutGlobal , CompileTimeInterpCx , CompileTimeMachine } ;
20
19
use crate :: const_eval:: CheckAlignment ;
21
- use crate :: errors:: { self , ConstEvalError , DanglingPtrInFinal } ;
22
20
use crate :: interpret:: {
23
21
create_static_alloc, eval_nullary_intrinsic, intern_const_alloc_recursive, throw_exhaust,
24
22
CtfeValidationMode , GlobalId , Immediate , InternKind , InternResult , InterpCx , InterpError ,
25
23
InterpResult , MPlaceTy , MemoryKind , OpTy , RefTracking , StackPopCleanup ,
26
24
} ;
27
- use crate :: CTRL_C_RECEIVED ;
25
+ use crate :: { errors , CTRL_C_RECEIVED } ;
28
26
29
27
// Returns a pointer to where the result lives
30
28
#[ instrument( level = "trace" , skip( ecx, body) ) ]
@@ -103,18 +101,15 @@ fn eval_body_using_ecx<'tcx, R: InterpretationResult<'tcx>>(
103
101
return Err ( ecx
104
102
. tcx
105
103
. dcx ( )
106
- . emit_err ( DanglingPtrInFinal { span : ecx. tcx . span , kind : intern_kind } )
104
+ . emit_err ( errors :: DanglingPtrInFinal { span : ecx. tcx . span , kind : intern_kind } )
107
105
. into ( ) ) ;
108
106
}
109
107
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 ( ) ) ;
118
113
}
119
114
}
120
115
@@ -446,7 +441,12 @@ fn report_eval_error<'tcx>(
446
441
error,
447
442
DUMMY_SP ,
448
443
|| 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
+ } ,
450
450
)
451
451
}
452
452
0 commit comments