Remove WithOptconstParam.
This commit is contained in:
parent
0e017fc94a
commit
b275d2c30b
68 changed files with 335 additions and 960 deletions
|
@ -198,7 +198,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
|
|||
let term: ty::EarlyBinder<ty::Term<'tcx>> = if is_const {
|
||||
let identity_substs =
|
||||
ty::InternalSubsts::identity_for_item(tcx, assoc_def.item.def_id);
|
||||
let did = ty::WithOptConstParam::unknown(assoc_def.item.def_id);
|
||||
let did = assoc_def.item.def_id;
|
||||
let kind =
|
||||
ty::ConstKind::Unevaluated(ty::UnevaluatedConst::new(did, identity_substs));
|
||||
ty.map_bound(|ty| tcx.mk_const(kind, ty).into())
|
||||
|
|
|
@ -796,10 +796,9 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
|||
Ok(Some(valtree)) => Ok(selcx.tcx().mk_const(valtree, c.ty())),
|
||||
Ok(None) => {
|
||||
let tcx = self.tcx;
|
||||
let def_id = unevaluated.def.did;
|
||||
let reported =
|
||||
tcx.sess.emit_err(UnableToConstructConstantValue {
|
||||
span: tcx.def_span(def_id),
|
||||
span: tcx.def_span(unevaluated.def),
|
||||
unevaluated: unevaluated,
|
||||
});
|
||||
Err(ErrorHandled::Reported(reported))
|
||||
|
|
|
@ -44,7 +44,7 @@ pub fn is_const_evaluatable<'tcx>(
|
|||
let ct = tcx.expand_abstract_consts(unexpanded_ct);
|
||||
|
||||
let is_anon_ct = if let ty::ConstKind::Unevaluated(uv) = ct.kind() {
|
||||
tcx.def_kind(uv.def.did) == DefKind::AnonConst
|
||||
tcx.def_kind(uv.def) == DefKind::AnonConst
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
@ -119,7 +119,7 @@ pub fn is_const_evaluatable<'tcx>(
|
|||
tcx.sess
|
||||
.struct_span_fatal(
|
||||
// Slightly better span than just using `span` alone
|
||||
if span == rustc_span::DUMMY_SP { tcx.def_span(uv.def.did) } else { span },
|
||||
if span == rustc_span::DUMMY_SP { tcx.def_span(uv.def) } else { span },
|
||||
"failed to evaluate generic const expression",
|
||||
)
|
||||
.note("the crate this constant originates from uses `#![feature(generic_const_exprs)]`")
|
||||
|
|
|
@ -1476,7 +1476,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
};
|
||||
let mut err =
|
||||
self.tcx.sess.struct_span_err(span, "unconstrained generic constant");
|
||||
let const_span = self.tcx.def_span(uv.def.did);
|
||||
let const_span = self.tcx.def_span(uv.def);
|
||||
match self.tcx.sess.source_map().span_to_snippet(const_span) {
|
||||
Ok(snippet) => err.help(&format!(
|
||||
"try adding a `where` bound using this expression: `where [(); {}]:`",
|
||||
|
@ -1771,7 +1771,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
.tcx
|
||||
.mk_const(
|
||||
ty::UnevaluatedConst {
|
||||
def: ty::WithOptConstParam::unknown(data.projection_ty.def_id),
|
||||
def: data.projection_ty.def_id,
|
||||
substs: data.projection_ty.substs,
|
||||
},
|
||||
ct.ty(),
|
||||
|
|
|
@ -540,8 +540,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
|
|||
use ty::ConstKind::Unevaluated;
|
||||
match (c1.kind(), c2.kind()) {
|
||||
(Unevaluated(a), Unevaluated(b))
|
||||
if a.def.did == b.def.did
|
||||
&& tcx.def_kind(a.def.did) == DefKind::AssocConst =>
|
||||
if a.def == b.def && tcx.def_kind(a.def) == DefKind::AssocConst =>
|
||||
{
|
||||
if let Ok(new_obligations) = infcx
|
||||
.at(&obligation.cause, obligation.param_env)
|
||||
|
|
|
@ -2131,9 +2131,8 @@ fn confirm_impl_candidate<'cx, 'tcx>(
|
|||
let ty = tcx.type_of(assoc_ty.item.def_id);
|
||||
let is_const = matches!(tcx.def_kind(assoc_ty.item.def_id), DefKind::AssocConst);
|
||||
let term: ty::EarlyBinder<ty::Term<'tcx>> = if is_const {
|
||||
let identity_substs =
|
||||
crate::traits::InternalSubsts::identity_for_item(tcx, assoc_ty.item.def_id);
|
||||
let did = ty::WithOptConstParam::unknown(assoc_ty.item.def_id);
|
||||
let did = assoc_ty.item.def_id;
|
||||
let identity_substs = crate::traits::InternalSubsts::identity_for_item(tcx, did);
|
||||
let kind = ty::ConstKind::Unevaluated(ty::UnevaluatedConst::new(did, identity_substs));
|
||||
ty.map_bound(|ty| tcx.mk_const(kind, ty).into())
|
||||
} else {
|
||||
|
|
|
@ -896,8 +896,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
use ty::ConstKind::Unevaluated;
|
||||
match (c1.kind(), c2.kind()) {
|
||||
(Unevaluated(a), Unevaluated(b))
|
||||
if a.def.did == b.def.did
|
||||
&& tcx.def_kind(a.def.did) == DefKind::AssocConst =>
|
||||
if a.def == b.def && tcx.def_kind(a.def) == DefKind::AssocConst =>
|
||||
{
|
||||
if let Ok(InferOk { obligations, value: () }) = self
|
||||
.infcx
|
||||
|
|
|
@ -478,7 +478,7 @@ impl<'tcx> WfPredicates<'tcx> {
|
|||
match ct.kind() {
|
||||
ty::ConstKind::Unevaluated(uv) => {
|
||||
if !ct.has_escaping_bound_vars() {
|
||||
let obligations = self.nominal_obligations(uv.def.did, uv.substs);
|
||||
let obligations = self.nominal_obligations(uv.def, uv.substs);
|
||||
self.out.extend(obligations);
|
||||
|
||||
let predicate =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue