tweak Const::identity_unevaluated name and docs
This commit is contained in:
parent
921a5ef6d7
commit
c55c4c9f9d
2 changed files with 9 additions and 11 deletions
|
@ -221,7 +221,9 @@ pub enum Const<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Const<'tcx> {
|
impl<'tcx> Const<'tcx> {
|
||||||
pub fn identity_unevaluated(
|
/// Creates an unevaluated const from a `DefId` for a const item.
|
||||||
|
/// The binders of the const item still need to be instantiated.
|
||||||
|
pub fn from_unevaluated(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
) -> ty::EarlyBinder<'tcx, Const<'tcx>> {
|
) -> ty::EarlyBinder<'tcx, Const<'tcx>> {
|
||||||
|
|
|
@ -699,21 +699,17 @@ impl<'tcx> Cx<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hir::InlineAsmOperand::Const { ref anon_const } => {
|
hir::InlineAsmOperand::Const { ref anon_const } => {
|
||||||
let value = mir::Const::identity_unevaluated(
|
let value =
|
||||||
tcx,
|
mir::Const::from_unevaluated(tcx, anon_const.def_id.to_def_id())
|
||||||
anon_const.def_id.to_def_id(),
|
.instantiate_identity();
|
||||||
)
|
|
||||||
.instantiate_identity();
|
|
||||||
let span = tcx.def_span(anon_const.def_id);
|
let span = tcx.def_span(anon_const.def_id);
|
||||||
|
|
||||||
InlineAsmOperand::Const { value, span }
|
InlineAsmOperand::Const { value, span }
|
||||||
}
|
}
|
||||||
hir::InlineAsmOperand::SymFn { ref anon_const } => {
|
hir::InlineAsmOperand::SymFn { ref anon_const } => {
|
||||||
let value = mir::Const::identity_unevaluated(
|
let value =
|
||||||
tcx,
|
mir::Const::from_unevaluated(tcx, anon_const.def_id.to_def_id())
|
||||||
anon_const.def_id.to_def_id(),
|
.instantiate_identity();
|
||||||
)
|
|
||||||
.instantiate_identity();
|
|
||||||
let span = tcx.def_span(anon_const.def_id);
|
let span = tcx.def_span(anon_const.def_id);
|
||||||
|
|
||||||
InlineAsmOperand::SymFn { value, span }
|
InlineAsmOperand::SymFn { value, span }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue