nyahggdshjjghsdfhgsf
This commit is contained in:
parent
408a086f97
commit
3f3a10fa64
@ -21,6 +21,7 @@ pub struct Unevaluated<'tcx, P = Option<Promoted>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Unevaluated<'tcx> {
|
impl<'tcx> Unevaluated<'tcx> {
|
||||||
|
#[inline]
|
||||||
pub fn shrink(self) -> Unevaluated<'tcx, ()> {
|
pub fn shrink(self) -> Unevaluated<'tcx, ()> {
|
||||||
debug_assert_eq!(self.promoted, None);
|
debug_assert_eq!(self.promoted, None);
|
||||||
Unevaluated { def: self.def, substs: self.substs, promoted: () }
|
Unevaluated { def: self.def, substs: self.substs, promoted: () }
|
||||||
@ -28,12 +29,14 @@ impl<'tcx> Unevaluated<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Unevaluated<'tcx, ()> {
|
impl<'tcx> Unevaluated<'tcx, ()> {
|
||||||
|
#[inline]
|
||||||
pub fn expand(self) -> Unevaluated<'tcx> {
|
pub fn expand(self) -> Unevaluated<'tcx> {
|
||||||
Unevaluated { def: self.def, substs: self.substs, promoted: None }
|
Unevaluated { def: self.def, substs: self.substs, promoted: None }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, P: Default> Unevaluated<'tcx, P> {
|
impl<'tcx, P: Default> Unevaluated<'tcx, P> {
|
||||||
|
#[inline]
|
||||||
pub fn new(def: ty::WithOptConstParam<DefId>, substs: SubstsRef<'tcx>) -> Unevaluated<'tcx, P> {
|
pub fn new(def: ty::WithOptConstParam<DefId>, substs: SubstsRef<'tcx>) -> Unevaluated<'tcx, P> {
|
||||||
Unevaluated { def, substs, promoted: Default::default() }
|
Unevaluated { def, substs, promoted: Default::default() }
|
||||||
}
|
}
|
||||||
|
@ -442,8 +442,6 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
|||||||
GenericArgKind::Const(constant) => {
|
GenericArgKind::Const(constant) => {
|
||||||
match constant.val {
|
match constant.val {
|
||||||
ty::ConstKind::Unevaluated(uv) => {
|
ty::ConstKind::Unevaluated(uv) => {
|
||||||
assert!(uv.promoted.is_none());
|
|
||||||
|
|
||||||
let obligations = self.nominal_obligations(uv.def.did, uv.substs);
|
let obligations = self.nominal_obligations(uv.def.did, uv.substs);
|
||||||
self.out.extend(obligations);
|
self.out.extend(obligations);
|
||||||
|
|
||||||
|
@ -491,9 +491,9 @@ pub(super) fn check_opaque_for_inheriting_lifetimes<'tcx>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct ProhibitOpaqueVisitor<'tcx> {
|
struct ProhibitOpaqueVisitor<'tcx> {
|
||||||
|
tcx: TyCtxt<'tcx>,
|
||||||
opaque_identity_ty: Ty<'tcx>,
|
opaque_identity_ty: Ty<'tcx>,
|
||||||
generics: &'tcx ty::Generics,
|
generics: &'tcx ty::Generics,
|
||||||
tcx: TyCtxt<'tcx>,
|
|
||||||
selftys: Vec<(Span, Option<String>)>,
|
selftys: Vec<(Span, Option<String>)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1471,8 +1471,8 @@ fn opaque_type_cycle_error(tcx: TyCtxt<'_>, def_id: LocalDefId, span: Span) {
|
|||||||
.filter_map(|e| typeck_results.node_type_opt(e.hir_id).map(|t| (e.span, t)))
|
.filter_map(|e| typeck_results.node_type_opt(e.hir_id).map(|t| (e.span, t)))
|
||||||
.filter(|(_, ty)| !matches!(ty.kind(), ty::Never))
|
.filter(|(_, ty)| !matches!(ty.kind(), ty::Never))
|
||||||
{
|
{
|
||||||
struct VisitTypes(Vec<DefId>);
|
struct OpaqueTypeCollector(Vec<DefId>);
|
||||||
impl<'tcx> ty::fold::TypeVisitor<'tcx> for VisitTypes {
|
impl<'tcx> ty::fold::TypeVisitor<'tcx> for OpaqueTypeCollector {
|
||||||
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||||
match *t.kind() {
|
match *t.kind() {
|
||||||
ty::Opaque(def, _) => {
|
ty::Opaque(def, _) => {
|
||||||
@ -1483,7 +1483,7 @@ fn opaque_type_cycle_error(tcx: TyCtxt<'_>, def_id: LocalDefId, span: Span) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut visitor = VisitTypes(vec![]);
|
let mut visitor = OpaqueTypeCollector(vec![]);
|
||||||
ty.visit_with(&mut visitor);
|
ty.visit_with(&mut visitor);
|
||||||
for def_id in visitor.0 {
|
for def_id in visitor.0 {
|
||||||
let ty_span = tcx.def_span(def_id);
|
let ty_span = tcx.def_span(def_id);
|
||||||
|
@ -54,7 +54,7 @@ fn is_non_trait_box(ty: Ty<'_>) -> bool {
|
|||||||
struct EscapeDelegate<'a, 'tcx> {
|
struct EscapeDelegate<'a, 'tcx> {
|
||||||
cx: &'a LateContext<'tcx>,
|
cx: &'a LateContext<'tcx>,
|
||||||
set: HirIdSet,
|
set: HirIdSet,
|
||||||
trait_self_ty: Option<Ty<'a>>,
|
trait_self_ty: Option<Ty<'tcx>>,
|
||||||
too_large_for_stack: u64,
|
too_large_for_stack: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,11 +188,10 @@ fn is_value_unfrozen_expr<'tcx>(cx: &LateContext<'tcx>, hir_id: HirId, def_id: D
|
|||||||
|
|
||||||
let result = cx.tcx.const_eval_resolve(
|
let result = cx.tcx.const_eval_resolve(
|
||||||
cx.param_env,
|
cx.param_env,
|
||||||
ty::Unevaluated {
|
ty::Unevaluated::new(
|
||||||
def: ty::WithOptConstParam::unknown(def_id),
|
ty::WithOptConstParam::unknown(def_id),
|
||||||
substs,
|
substs,
|
||||||
promoted: None,
|
),
|
||||||
},
|
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
is_value_unfrozen_raw(cx, result, ty)
|
is_value_unfrozen_raw(cx, result, ty)
|
||||||
|
@ -413,11 +413,10 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
|
|||||||
.tcx
|
.tcx
|
||||||
.const_eval_resolve(
|
.const_eval_resolve(
|
||||||
self.param_env,
|
self.param_env,
|
||||||
ty::Unevaluated {
|
ty::Unevaluated::new(
|
||||||
def: ty::WithOptConstParam::unknown(def_id),
|
ty::WithOptConstParam::unknown(def_id),
|
||||||
substs,
|
substs,
|
||||||
promoted: None,
|
),
|
||||||
},
|
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.ok()
|
.ok()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user