Skip to content

Commit

Permalink
super_const and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ouz-a committed Oct 4, 2023
1 parent 8bc1355 commit e3c1139
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions compiler/rustc_mir_transform/src/add_subtyping_projections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ impl<'a, 'tcx> MutVisitor<'tcx> for SubTypeChecker<'a, 'tcx> {
rvalue: &mut Rvalue<'tcx>,
location: Location,
) {
// We don't need to do anything for internal locals as they are
// not part of the source code, but used for desugaring purposes.
if self.local_decls[place.local].internal {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ fn run_runtime_lowering_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
// These next passes must be executed together
&add_call_guards::CriticalCallEdges,
&reveal_all::RevealAll, // has to be done before drop elaboration, since we need to drop opaque types, too.
&add_subtyping_projections::Subtyper,
&add_subtyping_projections::Subtyper, // calling this after reveal_all ensures that we don't deal with opaque types
&elaborate_drops::ElaborateDrops,
// This will remove extraneous landing pads which are no longer
// necessary as well as well as forcing any call in a non-unwinding
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_mir_transform/src/reveal_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ impl<'tcx> MutVisitor<'tcx> for RevealAllVisitor<'tcx> {
}

#[inline]
fn visit_constant(&mut self, constant: &mut ConstOperand<'tcx>, _: Location) {
fn visit_constant(&mut self, constant: &mut ConstOperand<'tcx>, location: Location) {
// We have to use `try_normalize_erasing_regions` here, since it's
// possible that we visit impossible-to-satisfy where clauses here,
// see #91745
if let Ok(c) = self.tcx.try_normalize_erasing_regions(self.param_env, constant.const_) {
constant.const_ = c;
}
self.super_constant(constant, location);
}

#[inline]
Expand Down

0 comments on commit e3c1139

Please sign in to comment.