Skip to content

Commit

Permalink
nyahggdshjjghsdfhgsf
Browse files Browse the repository at this point in the history
  • Loading branch information
BoxyUwU committed Jan 15, 2022
1 parent 408a086 commit 3f3a10f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_middle/src/ty/consts/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,22 @@ 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: () }
}
}

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() }
}
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_trait_selection/src/traits/wf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_typeck/src/check/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>)>,
}

Expand Down Expand Up @@ -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, _) => {
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
7 changes: 3 additions & 4 deletions src/tools/clippy/clippy_lints/src/non_copy_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 3 additions & 4 deletions src/tools/clippy/clippy_utils/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 3f3a10f

Please sign in to comment.