Skip to content

Commit c55c4c9

Browse files
committed
tweak Const::identity_unevaluated name and docs
1 parent 921a5ef commit c55c4c9

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

compiler/rustc_middle/src/mir/consts.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ pub enum Const<'tcx> {
221221
}
222222

223223
impl<'tcx> Const<'tcx> {
224-
pub fn identity_unevaluated(
224+
/// Creates an unevaluated const from a `DefId` for a const item.
225+
/// The binders of the const item still need to be instantiated.
226+
pub fn from_unevaluated(
225227
tcx: TyCtxt<'tcx>,
226228
def_id: DefId,
227229
) -> ty::EarlyBinder<'tcx, Const<'tcx>> {

compiler/rustc_mir_build/src/thir/cx/expr.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -699,21 +699,17 @@ impl<'tcx> Cx<'tcx> {
699699
}
700700
}
701701
hir::InlineAsmOperand::Const { ref anon_const } => {
702-
let value = mir::Const::identity_unevaluated(
703-
tcx,
704-
anon_const.def_id.to_def_id(),
705-
)
706-
.instantiate_identity();
702+
let value =
703+
mir::Const::from_unevaluated(tcx, anon_const.def_id.to_def_id())
704+
.instantiate_identity();
707705
let span = tcx.def_span(anon_const.def_id);
708706

709707
InlineAsmOperand::Const { value, span }
710708
}
711709
hir::InlineAsmOperand::SymFn { ref anon_const } => {
712-
let value = mir::Const::identity_unevaluated(
713-
tcx,
714-
anon_const.def_id.to_def_id(),
715-
)
716-
.instantiate_identity();
710+
let value =
711+
mir::Const::from_unevaluated(tcx, anon_const.def_id.to_def_id())
712+
.instantiate_identity();
717713
let span = tcx.def_span(anon_const.def_id);
718714

719715
InlineAsmOperand::SymFn { value, span }

0 commit comments

Comments
 (0)