@@ -5,7 +5,6 @@ use std::convert::TryFrom;
5
5
use rustc_middle:: mir;
6
6
use rustc_middle:: ty:: { self , TyCtxt } ;
7
7
use rustc_span:: { source_map:: DUMMY_SP , symbol:: Symbol } ;
8
- use rustc_target:: abi:: VariantIdx ;
9
8
10
9
use crate :: interpret:: { intern_const_alloc_recursive, ConstValue , InternKind , InterpCx } ;
11
10
@@ -19,32 +18,6 @@ pub use eval_queries::*;
19
18
pub use fn_queries:: * ;
20
19
pub use machine:: * ;
21
20
22
- /// Extracts a field of a (variant of a) const.
23
- // this function uses `unwrap` copiously, because an already validated constant must have valid
24
- // fields and can thus never fail outside of compiler bugs
25
- pub ( crate ) fn const_field < ' tcx > (
26
- tcx : TyCtxt < ' tcx > ,
27
- param_env : ty:: ParamEnv < ' tcx > ,
28
- variant : Option < VariantIdx > ,
29
- field : mir:: Field ,
30
- value : & ' tcx ty:: Const < ' tcx > ,
31
- ) -> ConstValue < ' tcx > {
32
- trace ! ( "const_field: {:?}, {:?}" , field, value) ;
33
- let ecx = mk_eval_cx ( tcx, DUMMY_SP , param_env, false ) ;
34
- // get the operand again
35
- let op = ecx. eval_const_to_op ( value, None ) . unwrap ( ) ;
36
- // downcast
37
- let down = match variant {
38
- None => op,
39
- Some ( variant) => ecx. operand_downcast ( op, variant) . unwrap ( ) ,
40
- } ;
41
- // then project
42
- let field = ecx. operand_field ( down, field. index ( ) ) . unwrap ( ) ;
43
- // and finally move back to the const world, always normalizing because
44
- // this is not called for statics.
45
- op_to_const ( & ecx, field)
46
- }
47
-
48
21
pub ( crate ) fn const_caller_location (
49
22
tcx : TyCtxt < ' tcx > ,
50
23
( file, line, col) : ( Symbol , u32 , u32 ) ,
0 commit comments