Skip to content
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

Derive Debug fails for unsized structs #14768

Closed
ForrestOfBarnes opened this issue May 9, 2023 · 3 comments · Fixed by #14788
Closed

Derive Debug fails for unsized structs #14768

ForrestOfBarnes opened this issue May 9, 2023 · 3 comments · Fixed by #14788
Assignees
Labels
C-bug Category: bug

Comments

@ForrestOfBarnes
Copy link

ForrestOfBarnes commented May 9, 2023

rust-analyzer version: 0.3.1506-standalone

rustc version: 1.69.0

relevant settings: N/A

#[derive(Debug)]
struct Foo([u8])

This compiles correctly, but rust-analyzer thinks the derive macro contains an error: "expected &dyn Debug, found &[u8]". Oddly, derive macros for Eq, PartialEq, Ord, and PartialOrd, all function correctly.

@ForrestOfBarnes ForrestOfBarnes added the C-bug Category: bug label May 9, 2023
@HKalbasi HKalbasi self-assigned this May 9, 2023
@Veykril
Copy link
Member

Veykril commented May 9, 2023

Underlying issue is #11847

@ForrestOfBarnes
Copy link
Author

Thank you, I'll close this then.

@HKalbasi
Copy link
Member

HKalbasi commented May 9, 2023

I think this one is different. &[u8] is not coercible into &dyn Debug since [u8] is unsized, but &&[u8] is coercible. Rustc uses double reference for last field, we should either do the same or use double reference always which I think is harmless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants