Skip to content

Fix rustdoc ICE when a const is actually a type #119739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

GuillaumeGomez
Copy link
Member

Fixes #119529.

r? @fmease

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jan 8, 2024
@fmease
Copy link
Member

fmease commented Jan 8, 2024

I already have a fix locally but I'm gonna check out your fix later once I find the time

Comment on lines +128 to +130
match default.skip_binder().unpack() {
GenericArgKind::Const(_) => {}
GenericArgKind::Type(_) | GenericArgKind::Lifetime(_) => {
Copy link
Member

@fmease fmease Jan 8, 2024

Choose a reason for hiding this comment

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

This is treating symptoms not the root cause, we shouldn't have a mismatch between generics and ty_args in the first place. The root cause is an off-by-one error introduced by me since I forgot to handle trait object types correctly whose generics args don't contain a Self type.

I'm gonna submit an alternative fix shortly.

Your PR also doesn't fix (without double-checking):

pub trait Trait<const K: u32 = 0, T = ()> {}
pub type Alias<const K: u32> = dyn Trait<K>;
pub use dependency::*;
// ICE: expected a type, but found another kind

You'd need to update the outer GenericArgKind::Type branch, too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll gladly take a look at your fix then. :)

Closing this PR then!

@GuillaumeGomez GuillaumeGomez deleted the fix-issue-119529 branch January 8, 2024 16:50
@fmease fmease removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rustdoc ICE - 'expected a const, but found another kind'
3 participants