Skip to content

Support leak check for new style region constraint - #164350

Draft
adwinwhite wants to merge 2 commits into
rust-lang:mainfrom
adwinwhite:abby_leak_check2
Draft

adwinwhite wants to merge 2 commits into
rust-lang:mainfrom
adwinwhite:abby_leak_check2

Conversation

@adwinwhite

Copy link
Copy Markdown
Contributor

Supporting leak check is straightforward now that we have a constraint list like before.
TODO: adapt it to handle leaf region constraints from relating.

r? Boxyuwu

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Oct 15, 2026
@rustbot

rustbot commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Boxyuwu is currently at their maximum review capacity.
They may take a while to respond.

Comment on lines +775 to +776
// FIXME: unsure about whether the inherited `VisibleForLeakCheck` is correct.
candidates.push(RegionOutlives(ub, lb, visible_for_leak_check, ()));

@adwinwhite adwinwhite Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsure about whether the inheriting is correct 🤔

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep seems right to me

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-aarch64-gnu-llvm-22-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- [ui] tests/ui/assumptions_on_binders/same-universe-placeholder-outlives.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/assumptions_on_binders/same-universe-placeholder-outlives.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/assumptions_on_binders/same-universe-placeholder-outlives" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2015" "-Zassumptions-on-binders" "-Znext-solver=globally"
stdout: none
--- stderr -------------------------------
error: forall expect clause failed
##[error]  --> /checkout/tests/ui/assumptions_on_binders/same-universe-placeholder-outlives.rs:57:17
   |
---
---- [ui] tests/ui/assumptions_on_binders/test-infra-works.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/assumptions_on_binders/test-infra-works.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/assumptions_on_binders/test-infra-works" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2015" "-Zassumptions-on-binders" "-Znext-solver=globally"
stdout: none
--- stderr -------------------------------
error: forall expect clause failed
##[error]  --> /checkout/tests/ui/assumptions_on_binders/test-infra-works.rs:28:17
   |
---
---- [ui] tests/ui/assumptions_on_binders/test-infra-fails-properly.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/assumptions_on_binders/test-infra-fails-properly/test-infra-fails-properly.stderr`
diff of stderr:

59    = note: and here it is `Debug`ged :3 {type error}
60 
61 error: forall expect clause failed
+   --> $DIR/test-infra-fails-properly.rs:63:17
+    |
+ LL |                 'c: 'b,
+    |                 ^^^^^^
+    |
+ note: constraint from here
+   --> $DIR/test-infra-fails-properly.rs:59:9
+    |
---
78                'static,
+                No,
79            )
80 
81 error: bound type test binder constraint must be alias (it's a AliasTyOutlivesViaEnv)

147 LL |         forall<'a> where 'a: 'static {
148    |         ^^^^^^
149 
- error: aborting due to 16 previous errors
---
-   --> /checkout/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs:63:17
-   --> /checkout/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs:59:9
+   --> $DIR/test-infra-fails-properly.rs:63:17
+    |
+ LL |                 'c: 'b,
+    |                 ^^^^^^
+    |
+ note: constraint from here
+   --> $DIR/test-infra-fails-properly.rs:59:9
+    |
---
To only update this specific test, also pass `--test-args assumptions_on_binders/test-infra-fails-properly.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/assumptions_on_binders/test-infra-fails-properly" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2015" "-Zassumptions-on-binders" "-Znext-solver=globally"
stdout: none
--- stderr -------------------------------
error: expected one of `!`, `(`, `+`, `::`, `:`, or `<`, found `{`
##[error]  --> /checkout/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs:17:20
   |
LL |             forall { }
   |                    ^ expected one of `!`, `(`, `+`, `::`, `:`, or `<`

error: expected one of `!`, `(`, `+`, `::`, `:`, or `<`, found `{`
##[error]  --> /checkout/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs:26:20
   |
LL |             forall { }
   |                    ^ expected one of `!`, `(`, `+`, `::`, `:`, or `<`

error: expected lifetime, found keyword `for`
##[error]  --> /checkout/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs:41:12
   |
LL |         T: for<'b> Trait<'b>,
---
   |                ^
   |
   = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
   = help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: higher-ranked lifetime bound could not be satisfied
##[error]  --> /checkout/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs:9:9
   |
LL |         'a: 'b
   |         ^^^^^^

error: the lhs of a ty outlives must be a placeholder
##[error]  --> /checkout/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs:34:9
   |
LL |         dyn for<'b> Trait<'b>: 'a,
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: it is a (dyn for<'b> Trait<'b> + 'static)
   = note: and here it is `Debug`ged :3 dyn [Binder { value: Trait(Trait<'b>), bound_vars: [Region(BrNamed(DefId(0:15 ~ test_infra_fails_properly[2377]::{test_binder_constraints#1}::'b)))] }] + 'static

error: the lhs of a forall where clause must be an alias, placeholder, or lifetime
##[error]  --> /checkout/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs:48:9
   |
LL |         forall<T> where T: 'a {
   |         ^^^^^^
   |
   = note: the bad clause is {type error}: 'a

error: the lhs of a ty outlives must be a placeholder
##[error]  --> /checkout/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs:51:13
   |
LL |             T: 'a,
   |             ^^^^^
   |
   = note: it is a {type error}
   = note: and here it is `Debug`ged :3 {type error}

error: forall expect clause failed
##[error]  --> /checkout/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs:63:17
   |
LL |                 'c: 'b,
---
               'static,
               No,
           )

error: bound type test binder constraint must be alias (it's a AliasTyOutlivesViaEnv)
##[error]  --> /checkout/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs:73:15
   |
LL |         for<> T: 'a
   |               ^

error: the lhs of a forall where clause must be an alias, placeholder, or lifetime
##[error]  --> /checkout/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs:80:9
   |
LL |         forall<'b> where Struct<'a>: 'b {
   |         ^^^^^^
   |
   = note: the bad clause is for<'b> Struct<'a>: 'b

error: all implied bounds of clauses must themselves be included in the where clause of a forall
##[error]  --> /checkout/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs:80:9
   |
LL |         forall<'b> where Struct<'a>: 'b {
   |         ^^^^^^
   |
   = note: missing clause is for<'b> 'a: 'b

error: forall expect clause failed
##[error]  --> /checkout/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs:91:13
   |
LL |             ambiguity

@rust-bors

rust-bors Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #164355) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants