Fix tools
This commit is contained in:
parent
484480412e
commit
79fd535473
7 changed files with 27 additions and 9 deletions
|
|
@ -130,7 +130,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
|||
return;
|
||||
}
|
||||
|
||||
let idx = generic_args[2].expect_const().to_value().valtree.unwrap_branch();
|
||||
let idx = generic_args[2].expect_const().to_branch();
|
||||
|
||||
assert_eq!(x.layout(), y.layout());
|
||||
let layout = x.layout();
|
||||
|
|
|
|||
|
|
@ -319,6 +319,10 @@ pub(crate) fn clean_const<'tcx>(constant: &hir::ConstArg<'tcx>) -> ConstantKind
|
|||
hir::ConstArgKind::Path(qpath) => {
|
||||
ConstantKind::Path { path: qpath_to_string(qpath).into() }
|
||||
}
|
||||
hir::ConstArgKind::Struct(..) => {
|
||||
// FIXME(mgca): proper printing :3
|
||||
ConstantKind::Path { path: "/* STRUCT EXPR */".to_string().into() }
|
||||
}
|
||||
hir::ConstArgKind::Anon(anon) => ConstantKind::Anonymous { body: anon.body },
|
||||
hir::ConstArgKind::Infer(..) | hir::ConstArgKind::Error(..) => ConstantKind::Infer,
|
||||
}
|
||||
|
|
@ -1800,7 +1804,7 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T
|
|||
let ct = cx.tcx.normalize_erasing_regions(typing_env, ct);
|
||||
print_const(cx, ct)
|
||||
}
|
||||
hir::ConstArgKind::Path(..) => {
|
||||
hir::ConstArgKind::Struct(..) | hir::ConstArgKind::Path(..) => {
|
||||
let ct = lower_const_arg_for_rustdoc(cx.tcx, const_arg, FeedConstTy::No);
|
||||
print_const(cx, ct)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -357,7 +357,7 @@ pub(crate) fn print_const(cx: &DocContext<'_>, n: ty::Const<'_>) -> String {
|
|||
}
|
||||
// array lengths are obviously usize
|
||||
ty::ConstKind::Value(cv) if *cv.ty.kind() == ty::Uint(ty::UintTy::Usize) => {
|
||||
cv.valtree.unwrap_leaf().to_string()
|
||||
cv.to_leaf().to_string()
|
||||
}
|
||||
_ => n.to_string(),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -319,6 +319,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
|
|||
chain!(self, "let ConstArgKind::Anon({anon_const}) = {const_arg}.kind");
|
||||
self.body(field!(anon_const.body));
|
||||
},
|
||||
ConstArgKind::Struct(..) => chain!(self, "let ConstArgKind::Struct(..) = {const_arg}.kind"),
|
||||
ConstArgKind::Infer(..) => chain!(self, "let ConstArgKind::Infer(..) = {const_arg}.kind"),
|
||||
ConstArgKind::Error(..) => chain!(self, "let ConstArgKind::Error(..) = {const_arg}.kind"),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1139,7 +1139,7 @@ pub fn const_item_rhs_to_expr<'tcx>(tcx: TyCtxt<'tcx>, ct_rhs: ConstItemRhs<'tcx
|
|||
ConstItemRhs::Body(body_id) => Some(tcx.hir_body(body_id).value),
|
||||
ConstItemRhs::TypeConst(const_arg) => match const_arg.kind {
|
||||
ConstArgKind::Anon(anon) => Some(tcx.hir_body(anon.body).value),
|
||||
ConstArgKind::Path(_) | ConstArgKind::Error(..) | ConstArgKind::Infer(..) => None,
|
||||
ConstArgKind::Struct(..) | ConstArgKind::Path(_) | ConstArgKind::Error(..) | ConstArgKind::Infer(..) => None,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -477,11 +477,18 @@ impl HirEqInterExpr<'_, '_, '_> {
|
|||
(ConstArgKind::Path(l_p), ConstArgKind::Path(r_p)) => self.eq_qpath(l_p, r_p),
|
||||
(ConstArgKind::Anon(l_an), ConstArgKind::Anon(r_an)) => self.eq_body(l_an.body, r_an.body),
|
||||
(ConstArgKind::Infer(..), ConstArgKind::Infer(..)) => true,
|
||||
(ConstArgKind::Struct(path_a, inits_a), ConstArgKind::Struct(path_b, inits_b)) => {
|
||||
self.eq_qpath(path_a, path_b)
|
||||
&& inits_a.iter().zip(*inits_b).all(|(init_a, init_b)| {
|
||||
self.eq_const_arg(init_a.expr, init_b.expr)
|
||||
})
|
||||
}
|
||||
// Use explicit match for now since ConstArg is undergoing flux.
|
||||
(ConstArgKind::Path(..), ConstArgKind::Anon(..))
|
||||
| (ConstArgKind::Anon(..), ConstArgKind::Path(..))
|
||||
| (ConstArgKind::Infer(..) | ConstArgKind::Error(..), _)
|
||||
| (_, ConstArgKind::Infer(..) | ConstArgKind::Error(..)) => false,
|
||||
(ConstArgKind::Path(..), _)
|
||||
| (ConstArgKind::Anon(..), _)
|
||||
| (ConstArgKind::Infer(..), _)
|
||||
| (ConstArgKind::Struct(..), _)
|
||||
| (ConstArgKind::Error(..), _) => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1332,6 +1339,12 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
|
|||
match &const_arg.kind {
|
||||
ConstArgKind::Path(path) => self.hash_qpath(path),
|
||||
ConstArgKind::Anon(anon) => self.hash_body(anon.body),
|
||||
ConstArgKind::Struct(path, inits) => {
|
||||
self.hash_qpath(path);
|
||||
for init in *inits {
|
||||
self.hash_const_arg(init.expr);
|
||||
}
|
||||
}
|
||||
ConstArgKind::Infer(..) | ConstArgKind::Error(..) => {},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
|
||||
let get_ord_at = |i: usize| {
|
||||
let ordering = generic_args.const_at(i).to_value();
|
||||
ordering.valtree.unwrap_branch()[0].unwrap_leaf().to_atomic_ordering()
|
||||
ordering.to_branch()[0].to_value().to_leaf().to_atomic_ordering()
|
||||
};
|
||||
|
||||
fn read_ord(ord: AtomicOrdering) -> AtomicReadOrd {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue