Skip to content

stepping into NormalizesTo where-clauses may be productive#155388

Open
lcnr wants to merge 1 commit intorust-lang:mainfrom
lcnr:norm-where-bounds-may-be-productive
Open

stepping into NormalizesTo where-clauses may be productive#155388
lcnr wants to merge 1 commit intorust-lang:mainfrom
lcnr:norm-where-bounds-may-be-productive

Conversation

@lcnr
Copy link
Copy Markdown
Contributor

@lcnr lcnr commented Apr 16, 2026

fixes rust-lang/trait-system-refactor-initiative#273

Whether stepping into a where-clause is productive depends not on whether we're proving a NormalizesTo or Trait goal, but instead on how both the impl and the cycle rely on it.

In the example in tests/ui/traits/next-solver/cycles/normalizes-to-is-not-productive-2.rs this is just a productive use given the way @Nadrieril and I are thinking about it right now.

We're changing such cycles to be ambiguous for now, so this does not commit us to anything

r? @BoxyUwU or @nikomatsakis

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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 Apr 16, 2026
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
Executing "/scripts/stage_2_test_set1.sh"
+ /scripts/stage_2_test_set1.sh
PR_CI_JOB set; skipping tidy
+ '[' 1 == 1 ']'
+ echo 'PR_CI_JOB set; skipping tidy'
+ SKIP_TIDY='--skip tidy'
+ ../x.py --stage 2 test --skip tidy --skip compiler --skip src
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.04s
##[endgroup]
downloading https://static.rust-lang.org/dist/2026-03-05/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz
---

10 LL | |     Self::Item: 'a,
11    | |___________________^ missing `Item` in implementation
12 
- error[E0277]: the trait bound `&'a T: Foo` is not satisfied
+ error[E0283]: type annotations needed: cannot satisfy `&'a T: Foo`
14   --> $DIR/next-solver-region-resolution.rs:12:21
15    |
16 LL | impl<'a, T> Foo for &'a T

-    |                     ^^^^^ the trait `Foo` is not implemented for `&'a T`
+    |                     ^^^^^
18    |
- help: the trait `Foo` is not implemented for `&'a _`
-       but it is implemented for `&_`
+ note: multiple `impl`s satisfying `&'a T: Foo` found
21   --> $DIR/next-solver-region-resolution.rs:12:1
22    |
23 LL | / impl<'a, T> Foo for &'a T

25 LL | | where
26 LL | |     Self::Item: 'a,
27    | |___________________^
- 
- error[E0277]: the trait bound `&'a T: Foo` is not satisfied
-   --> $DIR/next-solver-region-resolution.rs:15:17
-    |
- LL |     Self::Item: 'a,
-    |                 ^^ the trait `Foo` is not implemented for `&'a T`
-    |
- help: the trait `Foo` is not implemented for `&'a _`
---
40 LL | |
41 LL | | where
- LL | |     Self::Item: 'a,
-    | |___________________^
+ LL | |     Self::Item: Baz,
+    | |____________________^
44 
45 error[E0046]: not all trait items implemented, missing: `Item`
46   --> $DIR/next-solver-region-resolution.rs:19:1

---
69 For more information about an error, try `rustc --explain E0046`.
70 

Note: some mismatched output was normalized before being compared
- LL | / impl<'a, T> Foo for &T //~ ERROR not all trait items implemented, missing: `Item`
- LL | | //~| ERROR cannot normalize `<&_ as Foo>::Item: '_`
+ error[E0283]: type annotations needed: cannot satisfy `&'a T: Foo`
+    |                     ^^^^^
+ note: multiple `impl`s satisfying `&'a T: Foo` found
+ ...
+ LL | / impl<'a, T> Foo for &T
+ LL | |     Self::Item: Baz,
+    | |____________________^
+ error: aborting due to 4 previous errors
+ Some errors have detailed explanations: E0046, E0283.


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args specialization/min_specialization/next-solver-region-resolution.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/specialization/min_specialization/next-solver-region-resolution.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/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/specialization/min_specialization/next-solver-region-resolution" "-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" "-Znext-solver=globally"
stdout: none
--- stderr -------------------------------
error[E0046]: not all trait items implemented, missing: `Item`
##[error]  --> /checkout/tests/ui/specialization/min_specialization/next-solver-region-resolution.rs:12:1
   |
LL |       type Item;
   |       --------- `Item` from trait
...
LL | / impl<'a, T> Foo for &'a T //~ ERROR not all trait items implemented, missing: `Item`
LL | | //~| ERROR the trait bound `&'a T: Foo` is not satisfied
LL | | where
LL | |     Self::Item: 'a, //~ ERROR the trait bound `&'a T: Foo` is not satisfied
   | |___________________^ missing `Item` in implementation

error[E0283]: type annotations needed: cannot satisfy `&'a T: Foo`
##[error]  --> /checkout/tests/ui/specialization/min_specialization/next-solver-region-resolution.rs:12:21
   |
LL | impl<'a, T> Foo for &'a T //~ ERROR not all trait items implemented, missing: `Item`
   |                     ^^^^^
   |
note: multiple `impl`s satisfying `&'a T: Foo` found
  --> /checkout/tests/ui/specialization/min_specialization/next-solver-region-resolution.rs:12:1
   |
LL | / impl<'a, T> Foo for &'a T //~ ERROR not all trait items implemented, missing: `Item`
LL | | //~| ERROR the trait bound `&'a T: Foo` is not satisfied
LL | | where
LL | |     Self::Item: 'a, //~ ERROR the trait bound `&'a T: Foo` is not satisfied
   | |___________________^
...
LL | / impl<'a, T> Foo for &T //~ ERROR not all trait items implemented, missing: `Item`
LL | | //~| ERROR cannot normalize `<&_ as Foo>::Item: '_`
LL | | where
LL | |     Self::Item: Baz,
   | |____________________^

error[E0046]: not all trait items implemented, missing: `Item`
##[error]  --> /checkout/tests/ui/specialization/min_specialization/next-solver-region-resolution.rs:19:1
   |
LL |       type Item;
   |       --------- `Item` from trait
...
LL | / impl<'a, T> Foo for &T //~ ERROR not all trait items implemented, missing: `Item`
LL | | //~| ERROR cannot normalize `<&_ as Foo>::Item: '_`
LL | | where
LL | |     Self::Item: Baz,
   | |____________________^ missing `Item` in implementation

error: cannot normalize `<&_ as Foo>::Item: '_`
##[error]  --> /checkout/tests/ui/specialization/min_specialization/next-solver-region-resolution.rs:19:1
   |
LL | / impl<'a, T> Foo for &T //~ ERROR not all trait items implemented, missing: `Item`
LL | | //~| ERROR cannot normalize `<&_ as Foo>::Item: '_`
LL | | where
LL | |     Self::Item: Baz,
   | |____________________^

error: aborting due to 4 previous errors

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

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

entering normalization where-bounds incorrectly considered non-productive

4 participants