mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
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> {
|
||||
#[inline]
|
||||
pub fn shrink(self) -> Unevaluated<'tcx, ()> {
|
||||
debug_assert_eq!(self.promoted, None);
|
||||
Unevaluated { def: self.def, substs: self.substs, promoted: () }
|
||||
@ -28,12 +29,14 @@ impl<'tcx> Unevaluated<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> Unevaluated<'tcx, ()> {
|
||||
#[inline]
|
||||
pub fn expand(self) -> Unevaluated<'tcx> {
|
||||
Unevaluated { def: self.def, substs: self.substs, promoted: None }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, P: Default> Unevaluated<'tcx, P> {
|
||||
#[inline]
|
||||
pub fn new(def: ty::WithOptConstParam<DefId>, substs: SubstsRef<'tcx>) -> Unevaluated<'tcx, P> {
|
||||
Unevaluated { def, substs, promoted: Default::default() }
|
||||
}
|
||||
|
@ -442,8 +442,6 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
||||
GenericArgKind::Const(constant) => {
|
||||
match constant.val {
|
||||
ty::ConstKind::Unevaluated(uv) => {
|
||||
assert!(uv.promoted.is_none());
|
||||
|
||||
let obligations = self.nominal_obligations(uv.def.did, uv.substs);
|
||||
self.out.extend(obligations);
|
||||
|
||||
|
@ -491,9 +491,9 @@ pub(super) fn check_opaque_for_inheriting_lifetimes<'tcx>(
|
||||
}
|
||||
|
||||
struct ProhibitOpaqueVisitor<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
opaque_identity_ty: Ty<'tcx>,
|
||||
generics: &'tcx ty::Generics,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
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(|(_, ty)| !matches!(ty.kind(), ty::Never))
|
||||
{
|
||||
struct VisitTypes(Vec<DefId>);
|
||||
impl<'tcx> ty::fold::TypeVisitor<'tcx> for VisitTypes {
|
||||
struct OpaqueTypeCollector(Vec<DefId>);
|
||||
impl<'tcx> ty::fold::TypeVisitor<'tcx> for OpaqueTypeCollector {
|
||||
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
match *t.kind() {
|
||||
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);
|
||||
for def_id in visitor.0 {
|
||||
let ty_span = tcx.def_span(def_id);
|
||||
|
@ -54,7 +54,7 @@ fn is_non_trait_box(ty: Ty<'_>) -> bool {
|
||||
struct EscapeDelegate<'a, 'tcx> {
|
||||
cx: &'a LateContext<'tcx>,
|
||||
set: HirIdSet,
|
||||
trait_self_ty: Option<Ty<'a>>,
|
||||
trait_self_ty: Option<Ty<'tcx>>,
|
||||
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(
|
||||
cx.param_env,
|
||||
ty::Unevaluated {
|
||||
def: ty::WithOptConstParam::unknown(def_id),
|
||||
ty::Unevaluated::new(
|
||||
ty::WithOptConstParam::unknown(def_id),
|
||||
substs,
|
||||
promoted: None,
|
||||
},
|
||||
),
|
||||
None,
|
||||
);
|
||||
is_value_unfrozen_raw(cx, result, ty)
|
||||
|
@ -413,11 +413,10 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
|
||||
.tcx
|
||||
.const_eval_resolve(
|
||||
self.param_env,
|
||||
ty::Unevaluated {
|
||||
def: ty::WithOptConstParam::unknown(def_id),
|
||||
ty::Unevaluated::new(
|
||||
ty::WithOptConstParam::unknown(def_id),
|
||||
substs,
|
||||
promoted: None,
|
||||
},
|
||||
),
|
||||
None,
|
||||
)
|
||||
.ok()
|
||||
|
Loading…
Reference in New Issue
Block a user