Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit f0411ff

Browse files
committedMay 30, 2023
Auto merge of rust-lang#111881 - lcnr:leak-check, r=nikomatsakis,jackh726
refactor and cleanup the leak check, add it to new solver ended up being a bit more involved than I wanted but is hopefully still easy enough to review as a single PR, can split it into separate ones otherwise. this can be reviewed commit by commit: a473d55cdb9284aa2b01282d1b529a2a4d26547b 31a686646534ca006d906ec757ece4e771d6f973 949039c107852a5e36361c08b62821a0613656f5 242917bf5170d9a723c6c8e23e9d9d0c2fa8dc9d ed2b25a7aa28be3184be9e3022c2796a30eaad87 are all pretty straightforward. 03dd83b4c3f4ff27558f5c8ab859bd9f83db1d04 makes it easier to refactor coherence in a later commit, see the commit description, cc `@oli-obk` 4fe311d807a77b6270f384e41689bf5d58f46aec I don't quite remember what we wanted to test here, this definitely doesn't test that the occurs check doesn't cause incorrect errors in coherence, also cc `@oli-obk` here. I may end up writing a new test for this myself later. 5c200d88a91b75bd0875b973150655bd581ef97a is the main refactor of the leak check, changing it to take the `outer_universe` instead of getting it from a snapshot. Using a snapshot requires us to be in a probe which we aren't in the new solver, it also just feels dirty as snapshots don't really have anything to do with universes. with all of this cfc230d54188d9c7ed867a9a0d1f51be77b485f9 is now kind of trivial. r? `@nikomatsakis`
2 parents a9251b6 + 0b81f99 commit f0411ff

File tree

138 files changed

+320
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+320
-244
lines changed
 

‎compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,8 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
808808
G: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
809809
{
810810
self.commit_if_ok(|snapshot| {
811+
let outer_universe = self.infcx.universe();
812+
811813
let result = if let ty::FnPtr(fn_ty_b) = b.kind()
812814
&& let (hir::Unsafety::Normal, hir::Unsafety::Unsafe) =
813815
(fn_ty_a.unsafety(), fn_ty_b.unsafety())
@@ -824,7 +826,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
824826
// want the coerced type to be the actual supertype of these two,
825827
// but for now, we want to just error to ensure we don't lock
826828
// ourselves into a specific behavior with NLL.
827-
self.leak_check(false, snapshot)?;
829+
self.leak_check(outer_universe, Some(snapshot))?;
828830

829831
result
830832
})

‎compiler/rustc_infer/src/infer/at.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ impl<'tcx> InferCtxt<'tcx> {
7070
tcx: self.tcx,
7171
defining_use_anchor: self.defining_use_anchor,
7272
considering_regions: self.considering_regions,
73+
skip_leak_check: self.skip_leak_check,
7374
inner: self.inner.clone(),
74-
skip_leak_check: self.skip_leak_check.clone(),
7575
lexical_region_resolutions: self.lexical_region_resolutions.clone(),
7676
selection_cache: self.selection_cache.clone(),
7777
evaluation_cache: self.evaluation_cache.clone(),

0 commit comments

Comments
 (0)
This repository has been archived.