@@ -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) ) ]
@@ -105,18 +103,15 @@ fn eval_body_using_ecx<'tcx, R: InterpretationResult<'tcx>>(
105
103
return Err ( ecx
106
104
. tcx
107
105
. dcx ( )
108
- . emit_err ( DanglingPtrInFinal { span : ecx. tcx . span , kind : intern_kind } )
106
+ . emit_err ( errors :: DanglingPtrInFinal { span : ecx. tcx . span , kind : intern_kind } )
109
107
. into ( ) ) ;
110
108
}
111
109
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 ( ) ) ;
120
115
}
121
116
}
122
117
@@ -448,7 +443,12 @@ fn report_eval_error<'tcx>(
448
443
error,
449
444
DUMMY_SP ,
450
445
|| 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
+ } ,
452
452
)
453
453
}
454
454
0 commit comments