Skip to content

Commit 6e354fb

Browse files
committed
Remove another unneeded argument
1 parent ddfdbe0 commit 6e354fb

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
680680
if let ty::subst::GenericArgKind::Type(ty) = ty.unpack()
681681
&& let ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }) = *ty.kind()
682682
&& let Some(def_id) = def_id.as_local()
683-
&& self.opaque_type_origin(def_id, DUMMY_SP, self.param_env).is_some() {
683+
&& self.opaque_type_origin(def_id, DUMMY_SP).is_some() {
684684
return None;
685685
}
686686
}

compiler/rustc_infer/src/infer/opaque_types.rs

+8-16
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl<'tcx> InferCtxt<'tcx> {
6060
let replace_opaque_type = |def_id: DefId| {
6161
def_id
6262
.as_local()
63-
.map_or(false, |def_id| self.opaque_type_origin(def_id, span, param_env).is_some())
63+
.map_or(false, |def_id| self.opaque_type_origin(def_id, span).is_some())
6464
};
6565
let value = value.fold_with(&mut BottomUpFolder {
6666
tcx: self.tcx,
@@ -145,7 +145,7 @@ impl<'tcx> InferCtxt<'tcx> {
145145
// let x = || foo(); // returns the Opaque assoc with `foo`
146146
// }
147147
// ```
148-
self.opaque_type_origin(def_id, cause.span, param_env)?
148+
self.opaque_type_origin(def_id, cause.span)?
149149
}
150150
DefiningAnchor::Bubble => self.opaque_ty_origin_unchecked(def_id, cause.span),
151151
DefiningAnchor::Error => return None,
@@ -156,10 +156,9 @@ impl<'tcx> InferCtxt<'tcx> {
156156
// no one encounters it in practice.
157157
// It does occur however in `fn fut() -> impl Future<Output = i32> { async { 42 } }`,
158158
// where it is of no concern, so we only check for TAITs.
159-
if let Some(OpaqueTyOrigin::TyAlias) =
160-
b_def_id.as_local().and_then(|b_def_id| {
161-
self.opaque_type_origin(b_def_id, cause.span, param_env)
162-
})
159+
if let Some(OpaqueTyOrigin::TyAlias) = b_def_id
160+
.as_local()
161+
.and_then(|b_def_id| self.opaque_type_origin(b_def_id, cause.span))
163162
{
164163
self.tcx.sess.emit_err(OpaqueHiddenTypeDiag {
165164
span: cause.span,
@@ -374,12 +373,7 @@ impl<'tcx> InferCtxt<'tcx> {
374373
}
375374

376375
#[instrument(skip(self), level = "trace", ret)]
377-
pub fn opaque_type_origin(
378-
&self,
379-
def_id: LocalDefId,
380-
span: Span,
381-
param_env: ty::ParamEnv<'tcx>,
382-
) -> Option<OpaqueTyOrigin> {
376+
pub fn opaque_type_origin(&self, def_id: LocalDefId, span: Span) -> Option<OpaqueTyOrigin> {
383377
let parent_def_id = match self.defining_use_anchor {
384378
DefiningAnchor::Bubble | DefiningAnchor::Error => return None,
385379
DefiningAnchor::Bind(bind) => bind,
@@ -400,9 +394,7 @@ impl<'tcx> InferCtxt<'tcx> {
400394
// Anonymous `impl Trait`
401395
hir::OpaqueTyOrigin::FnReturn(parent) => parent == parent_def_id,
402396
// Named `type Foo = impl Bar;`
403-
hir::OpaqueTyOrigin::TyAlias => {
404-
may_define_opaque_type(self.tcx, parent_def_id, def_id, param_env)
405-
}
397+
hir::OpaqueTyOrigin::TyAlias => may_define_opaque_type(self.tcx, parent_def_id, def_id),
406398
};
407399
trace!(?origin);
408400
in_definition_scope.then_some(*origin)
@@ -650,8 +642,8 @@ fn may_define_opaque_type<'tcx>(
650642
tcx: TyCtxt<'tcx>,
651643
def_id: LocalDefId,
652644
opaque_def_id: LocalDefId,
653-
param_env: ty::ParamEnv<'tcx>,
654645
) -> bool {
646+
let param_env = tcx.param_env(def_id);
655647
let opaque_hir_id = tcx.hir().local_def_id_to_hir_id(opaque_def_id);
656648
let mut hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
657649

0 commit comments

Comments
 (0)