check WF of HRTB args even if there are escaping bound vars - #162454
check WF of HRTB args even if there are escaping bound vars#162454sjwang05 wants to merge 1 commit into
Conversation
|
changes to the core type system cc @lcnr |
|
r? @davidtwco rustbot has assigned @davidtwco. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| ); | ||
| } | ||
| } | ||
| }; |
There was a problem hiding this comment.
I'm a bit unhappy with how messy the diag formatting code here is, but I couldn't think of a better way 🤔
|
|
||
| let errors = infcx.resolve_regions_with_outlives_env(&outlives_env, tcx.def_span(body_def_id)); | ||
| if errors.is_empty() { | ||
| check_escaping_bound_vars_fcw(); |
There was a problem hiding this comment.
A bit concerned about perf since this runs on the Ok paths, even though we have the fcw_obligations.is_empty check, and I don't expect to encounter such obligations in practice very much
|
@bors try @rust-timer queue can you change the FCW to also point to the self-type when applicable, rn the diagnostic is kinda meh |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
check WF of HRTB args even if there are escaping bound vars
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (147db73): comparison URL. Overall result: ❌ regressions - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 0.4%, secondary -2.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 0.1%, secondary 0.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 478.441s -> 478.264s (-0.04%) |
We previously retained only
Terms that didn't have escaping bound vars when collecting WF obligations, leading us to wrongly accepting code like this:as
T: Bounddoes not hold inwf's where-clauses. Immediately turning this into a hard error caused substantial crater breakage (#122501), so for now we collect these kinds of obligations separately and prove them in a forked param env, emitting an FCW if the proof fails and there are no other errors from wfchecking.cc https://rust-lang.zulipchat.com/#narrow/channel/618216-t-types.2Fcall-for-participation/topic/check.20WF.20of.20trait.20args.20even.20with.20escaping.20bound.20vars/with/621059871
cc #162200