Skip to content

Conversation

tiif
Copy link
Member

@tiif tiif commented Sep 19, 2025

As per #145095 (comment), we could make the diagnostic for unsatisfiable UnstableFeature clause better.

r? @BoxyUwU

@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 19, 2025
@tiif
Copy link
Member Author

tiif commented Sep 19, 2025

I am actually not sure if enabled is the best word 🤔 . Feel free to suggest alternatives.

@hkBst
Copy link
Member

hkBst commented Sep 19, 2025

@BoxyUwU BoxyUwU added the S-no-work-capacity-tracking Status: Exempted from triagebot work capacity tracking. label Sep 19, 2025
| ---- this field does not implement `ConstParamTy_`
|
note: the `ConstParamTy_` impl for `[u8]` requires that `unstable feature: `unsized_const_params``
note: the `ConstParamTy_` impl for `[u8]` requires that `unstable feature `unsized_const_params` is enabled`
Copy link
Member

@BoxyUwU BoxyUwU Sep 24, 2025

Choose a reason for hiding this comment

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

this kinda results in something like:
"requires that unstable feature unsized const params is enabled"

note how the feature name isnt actually in the backticks. we could drop the backticks and word it as "feature(unsized_const_params) is enabled" which would avoid this problem and still flow naturally I think.

e.g.
"requires that feature(unsized_const_params) is enabled"
or
fn foo where feature(unsized_const_params) is enabled

Copy link
Member

Choose a reason for hiding this comment

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

we could also go the entire way and just print ClauseKind::UnstableFeature as #![feature({symbol})] so you'd get stuff like:

"requries that #![feature(unsized_const_params)]"
or
fn foo where #![feature(unsized_const_params)]
which also seems.... Kind of okay?

Copy link
Member

Choose a reason for hiding this comment

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

or just printing it as feature({symbol}) without the macro stuff 🤔
"requires that feature(unsized_const_params)"
or
fn foo where feature(unsized_const_params)
which does read better in the second example but worse in the first 🤔

Copy link
Member

Choose a reason for hiding this comment

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

I think I prefer printing as feature({symbol}) is enabled, curious what you think

Copy link
Member Author

@tiif tiif Sep 24, 2025

Choose a reason for hiding this comment

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

I think not adding the macro is better because in the case where we want to say "we have an impl that is annotated with #[unstable_feature_bound]" (which is the case here), having #![feature] in the diagnostic can be confusing 🤔

I also prefer feature({symbol}) is enabled because it does flow better in "requires that feature(unsized_const_params) is enabled". It is slightly bad when we have impl<T> Trait for T where feature(bar) is enabled, but I think it is still acceptable.

@BoxyUwU BoxyUwU added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 24, 2025
@rust-cloud-vms rust-cloud-vms bot force-pushed the unsatisfiable-unstable-feature branch from 6fb4509 to f259232 Compare September 24, 2025 15:13
@tiif
Copy link
Member Author

tiif commented Sep 24, 2025

Actually it should be possible to just use one write!, applying the change now

@rust-cloud-vms rust-cloud-vms bot force-pushed the unsatisfiable-unstable-feature branch from f259232 to 4e62715 Compare September 24, 2025 15:22
@tiif
Copy link
Member Author

tiif commented Sep 24, 2025

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 24, 2025
@BoxyUwU
Copy link
Member

BoxyUwU commented Sep 24, 2025

@bors r+ rollup

thanks tiif :3 🎮 :slug:

@bors
Copy link
Collaborator

bors commented Sep 24, 2025

📌 Commit 4e62715 has been approved by BoxyUwU

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 24, 2025
bors added a commit that referenced this pull request Sep 24, 2025
Rollup of 7 pull requests

Successful merges:

 - #146556 (Fix duration_since panic on unix when std is built with integer overflow checks)
 - #146679 (Clarify Display for error should not include source)
 - #146753 (Improve the pretty print of UnstableFeature clause)
 - #146894 (Improve derive suggestion of const param)
 - #146950 (core: simplify `CStr::default()`)
 - #146958 (Fix infinite recursion in Path::eq with String)
 - #146971 (fix ICE in writeback due to bound regions)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Sep 25, 2025
Rollup of 7 pull requests

Successful merges:

 - #146556 (Fix duration_since panic on unix when std is built with integer overflow checks)
 - #146679 (Clarify Display for error should not include source)
 - #146753 (Improve the pretty print of UnstableFeature clause)
 - #146894 (Improve derive suggestion of const param)
 - #146950 (core: simplify `CStr::default()`)
 - #146958 (Fix infinite recursion in Path::eq with String)
 - #146971 (fix ICE in writeback due to bound regions)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7a4ac48 into rust-lang:master Sep 25, 2025
10 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Sep 25, 2025
rust-timer added a commit that referenced this pull request Sep 25, 2025
Rollup merge of #146753 - tiif:unsatisfiable-unstable-feature, r=BoxyUwU

Improve the pretty print of UnstableFeature clause

As per #145095 (comment), we could make the diagnostic for unsatisfiable ``UnstableFeature`` clause better.

r? `@BoxyUwU`
github-actions bot pushed a commit to rust-lang/rust-analyzer that referenced this pull request Sep 29, 2025
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#146556 (Fix duration_since panic on unix when std is built with integer overflow checks)
 - rust-lang/rust#146679 (Clarify Display for error should not include source)
 - rust-lang/rust#146753 (Improve the pretty print of UnstableFeature clause)
 - rust-lang/rust#146894 (Improve derive suggestion of const param)
 - rust-lang/rust#146950 (core: simplify `CStr::default()`)
 - rust-lang/rust#146958 (Fix infinite recursion in Path::eq with String)
 - rust-lang/rust#146971 (fix ICE in writeback due to bound regions)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-no-work-capacity-tracking Status: Exempted from triagebot work capacity tracking. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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