Skip to content

Provide more context on "not general enough" error - #163081

Open
estebank wants to merge 1 commit into
rust-lang:mainfrom
estebank:not-general-enough
Open

estebank wants to merge 1 commit into
rust-lang:mainfrom
estebank:not-general-enough

Conversation

@estebank

Copy link
Copy Markdown
Contributor

Point at the source bound that was unmet when a HRTB is unmet.

error: implementation of `TheTrait` is not general enough
  --> $DIR/associated-types-eq-hr.rs:96:5
   |
LL | fn tuple_one<T>()
   |    --------- due to a where-clause on `tuple_one`...
LL | where
LL |     T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>,
   |        ----------------------------------------------------------- unsatisfied where-clause on `tuple_one`
...
LL |     tuple_one::<Tuple>();
   |     ^^^^^^^^^^^^^^^^^^^^
   |
   = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
   = note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`

This increases the size of ConstraintCategory, which might be a perf regression.

Point at the source bound that was unmet when a HRTB is unmet.

```
error: implementation of `TheTrait` is not general enough
  --> $DIR/associated-types-eq-hr.rs:96:5
   |
LL | fn tuple_one<T>()
   |    --------- due to a where-clause on `tuple_one`...
LL | where
LL |     T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>,
   |        ----------------------------------------------------------- unsatisfied where-clause on `tuple_one`
...
LL |     tuple_one::<Tuple>();
   |     ^^^^^^^^^^^^^^^^^^^^
   |
   = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
   = note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
```

This increases the size of `ConstraintCategory`, which might be a perf regression.
@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. labels Sep 20, 2026
@rustbot

rustbot commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

r? @mati865

rustbot has assigned @mati865.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 77 candidates
  • Random selection from 18 candidates

@estebank

Copy link
Copy Markdown
Contributor Author

This needs a perf run.

@chenyukang

Copy link
Copy Markdown
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 21, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 21, 2026
Provide more context on "not general enough" error
@rust-bors

rust-bors Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: c4ffd9d (c4ffd9d2a6d3ecf29ea25ad730a7e06b80944815)
Base parent: d287eb7 (d287eb7a292caa8abbe12051dce2ee707fe03200)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (c4ffd9d): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.3% [0.2%, 0.3%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.6% [-0.6%, -0.6%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

This perf run didn't have relevant results for this metric.

Cycles

This perf run didn't have relevant results for this metric.

Binary size

Results (primary -0.0%, secondary -0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.0% [-0.1%, -0.0%] 15
Improvements ✅
(secondary)
-0.0% [-0.1%, -0.0%] 7
All ❌✅ (primary) -0.0% [-0.1%, -0.0%] 15

Bootstrap: 503.997s -> 499.936s (-0.81%)
Artifact size: 408.93 MiB -> 408.90 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 21, 2026
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants