Skip to content

Implement param bounds on non-lifetime binders#158031

Draft
makai410 wants to merge 9 commits into
rust-lang:mainfrom
makai410:non-lifetime-binder-where-clauses
Draft

Implement param bounds on non-lifetime binders#158031
makai410 wants to merge 9 commits into
rust-lang:mainfrom
makai410:non-lifetime-binder-where-clauses

Conversation

@makai410

Copy link
Copy Markdown
Member

Continuation of: #115362

Quote from the previous PR:

This PR adds resolution and AST lowering for where clauses on binders. The meaning for for<T> now becomes for<T: Sized> like regular generics positions, and you are now able to write for<T: Trait> (and for<T: ?Sized>). Binder predicates are only considered in the new solver today. Since non-lifetime binders is an incomplete feature, I don't think we need to do any messaging to tell people that they don't work correctly in the old solver, but I'll see to that in a follow-up.

This PR then adds a new List<ty::Clause> to binders. Most places in the compiler shouldn't care about them existing, but eventually as support for non-lifetime binders gets fleshed out we should be more careful about asserting that they're handled. This will not happen in this PR.

Tracking:

r? @ghost

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jun 17, 2026
@makai410 makai410 force-pushed the non-lifetime-binder-where-clauses branch from 042d5e1 to 25396c6 Compare June 17, 2026 14:43
@makai410 makai410 force-pushed the non-lifetime-binder-where-clauses branch from 25396c6 to c4b7ff7 Compare June 17, 2026 15:21
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-pre-stabilization 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/traits/non_lifetime_binders/unifying-placeholders-in-query-response.rs#next stdout ----

error in revision `next`: 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/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/checkout/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.rs" "-Zthreads=1" "-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/x86_64-unknown-linux-gnu/stage1" "--target=x86_64-unknown-linux-gnu" "--cfg" "next" "--check-cfg" "cfg(test,FALSE,current,next)" "--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/x86_64-unknown-linux-gnu/test/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.next" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Znext-solver"
stdout: none
--- stderr -------------------------------
error[E0283]: type annotations needed: cannot satisfy `T1: Foo<usize>`
##[error]  --> /checkout/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.rs:21:9
   |
LL |     T1: for<T: ?Sized> Foo<usize, Bar<T> = T>,
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: cannot satisfy `T1: Foo<usize>`
help: the trait `Foo<usize>` is implemented for `()`
  --> /checkout/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.rs:15:1

For more information how to resolve CI failures of this job, visit this link.

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-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc 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