5
5
//! generic parameters are unused (and eventually, in what ways generic parameters are used - only
6
6
//! for their size, offset of a field, etc.).
7
7
8
- use rustc_hir:: { def:: DefKind , def_id:: DefId } ;
8
+ use rustc_hir:: { def:: DefKind , def_id:: DefId , ConstContext } ;
9
9
use rustc_index:: bit_set:: FiniteBitSet ;
10
10
use rustc_middle:: mir:: {
11
11
visit:: { TyContext , Visitor } ,
@@ -56,7 +56,7 @@ fn unused_generic_params(tcx: TyCtxt<'_>, def_id: DefId) -> FiniteBitSet<u32> {
56
56
// Exit early when there is no MIR available.
57
57
let context = tcx. hir ( ) . body_const_context ( def_id. expect_local ( ) ) ;
58
58
match context {
59
- Some ( ConstContext :: Fn ) | None if !tcx. is_mir_available ( def_id) => {
59
+ Some ( ConstContext :: ConstFn ) | None if !tcx. is_mir_available ( def_id) => {
60
60
debug ! ( "unused_generic_params: (no mir available) def_id={:?}" , def_id) ;
61
61
return FiniteBitSet :: new_empty ( ) ;
62
62
}
@@ -80,7 +80,7 @@ fn unused_generic_params(tcx: TyCtxt<'_>, def_id: DefId) -> FiniteBitSet<u32> {
80
80
let body = match context {
81
81
// Const functions are actually called and should thus be considered for polymorphization
82
82
// via their runtime MIR
83
- Some ( ConstContext :: Fn ) | None => tcx. optimized_mir ( def_id) ,
83
+ Some ( ConstContext :: ConstFn ) | None => tcx. optimized_mir ( def_id) ,
84
84
Some ( _) => tcx. mir_for_ctfe ( def_id) ,
85
85
} ;
86
86
let mut vis = MarkUsedGenericParams { tcx, def_id, unused_parameters : & mut unused_parameters } ;
0 commit comments