Adjust imports
This commit is contained in:
parent
7202054800
commit
f6d54aa0c1
1 changed files with 3 additions and 3 deletions
|
@ -5,7 +5,7 @@
|
||||||
//! generic parameters are unused (and eventually, in what ways generic parameters are used - only
|
//! generic parameters are unused (and eventually, in what ways generic parameters are used - only
|
||||||
//! for their size, offset of a field, etc.).
|
//! for their size, offset of a field, etc.).
|
||||||
|
|
||||||
use rustc_hir::{def::DefKind, def_id::DefId};
|
use rustc_hir::{def::DefKind, def_id::DefId, ConstContext};
|
||||||
use rustc_index::bit_set::FiniteBitSet;
|
use rustc_index::bit_set::FiniteBitSet;
|
||||||
use rustc_middle::mir::{
|
use rustc_middle::mir::{
|
||||||
visit::{TyContext, Visitor},
|
visit::{TyContext, Visitor},
|
||||||
|
@ -56,7 +56,7 @@ fn unused_generic_params(tcx: TyCtxt<'_>, def_id: DefId) -> FiniteBitSet<u32> {
|
||||||
// Exit early when there is no MIR available.
|
// Exit early when there is no MIR available.
|
||||||
let context = tcx.hir().body_const_context(def_id.expect_local());
|
let context = tcx.hir().body_const_context(def_id.expect_local());
|
||||||
match context {
|
match context {
|
||||||
Some(ConstContext::Fn) | None if !tcx.is_mir_available(def_id) => {
|
Some(ConstContext::ConstFn) | None if !tcx.is_mir_available(def_id) => {
|
||||||
debug!("unused_generic_params: (no mir available) def_id={:?}", def_id);
|
debug!("unused_generic_params: (no mir available) def_id={:?}", def_id);
|
||||||
return FiniteBitSet::new_empty();
|
return FiniteBitSet::new_empty();
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ fn unused_generic_params(tcx: TyCtxt<'_>, def_id: DefId) -> FiniteBitSet<u32> {
|
||||||
let body = match context {
|
let body = match context {
|
||||||
// Const functions are actually called and should thus be considered for polymorphization
|
// Const functions are actually called and should thus be considered for polymorphization
|
||||||
// via their runtime MIR
|
// via their runtime MIR
|
||||||
Some(ConstContext::Fn) | None => tcx.optimized_mir(def_id),
|
Some(ConstContext::ConstFn) | None => tcx.optimized_mir(def_id),
|
||||||
Some(_) => tcx.mir_for_ctfe(def_id),
|
Some(_) => tcx.mir_for_ctfe(def_id),
|
||||||
};
|
};
|
||||||
let mut vis = MarkUsedGenericParams { tcx, def_id, unused_parameters: &mut unused_parameters };
|
let mut vis = MarkUsedGenericParams { tcx, def_id, unused_parameters: &mut unused_parameters };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue