-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Substitute types before checking inlining compatibility. #113802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -440,6 +440,10 @@ impl<'tcx> Inliner<'tcx> { | |
validation: Ok(()), | ||
}; | ||
|
||
for var_debug_info in callee_body.var_debug_info.iter() { | ||
checker.visit_var_debug_info(var_debug_info); | ||
} | ||
|
||
// Traverse the MIR manually so we can account for the effects of inlining on the CFG. | ||
let mut work_list = vec![START_BLOCK]; | ||
let mut visited = BitSet::new_empty(callee_body.basic_blocks.len()); | ||
|
@@ -847,7 +851,16 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> { | |
if let ProjectionElem::Field(f, ty) = elem { | ||
let parent_ty = place_ref.ty(&self.callee_body.local_decls, self.tcx); | ||
let check_equal = |this: &mut Self, f_ty| { | ||
if !util::is_equal_up_to_subtyping(this.tcx, this.param_env, ty, f_ty) { | ||
// Fast path if there is nothing to substitute. | ||
if ty == f_ty { | ||
return; | ||
} | ||
let ty = this.instance.subst_mir(this.tcx, ty::EarlyBinder::bind(&ty)); | ||
let f_ty = this.instance.subst_mir(this.tcx, ty::EarlyBinder::bind(&f_ty)); | ||
if ty == f_ty { | ||
return; | ||
} | ||
if !util::is_subtype(this.tcx, this.param_env, ty, f_ty) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, but why are we changing this from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (answered in: #113802 (comment) ) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be good to add a comment pointing to the issue(s), to give some context to this check. |
||
trace!(?ty, ?f_ty); | ||
this.validation = Err("failed to normalize projection type"); | ||
return; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(answered in: #113802 (comment) )