Skip to content

Commit

Permalink
Always run builder to evaluate constants
Browse files Browse the repository at this point in the history
We were previously skipping it for non-generic functions, but this was
leaving some constants unevaluated.
  • Loading branch information
celinval committed Nov 16, 2023
1 parent 08036a8 commit 4c00aa3
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions compiler/rustc_smir/src/rustc_smir/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ impl<'tcx> BodyBuilder<'tcx> {

pub fn build(mut self, tables: &mut Tables<'tcx>) -> stable_mir::mir::Body {
let mut body = self.tcx.instance_mir(self.instance.def).clone();
let generics = self.tcx.generics_of(self.instance.def_id());
if generics.requires_monomorphization(self.tcx) {
self.visit_body(&mut body);
}
self.visit_body(&mut body);
body.stable(tables)
}

Expand Down

0 comments on commit 4c00aa3

Please sign in to comment.