-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
ICE: malformed malformed repr(align(N))
#132391
Comments
malformed repr(align(N))
Without performing an exact bisection, I think this is #131633. |
Actually, #131633 simply exposed a pre-existing bug: this doesn't even error on stable or beta, lmao. Actually there's like at least 2 separate bugs here:
|
cargo bisect-rustc does pin it down to that: |
Yes, #131633, because we should've emitted an error already by that point but didn't. |
...I guess this is technically a regression? |
The previous behavior is also unintentionally accepted code, I think. |
This is actually a deficiency in how attributes are currently handled, pending a work cf. rust-lang/compiler-team#796. This should not be spot-fixed, how this is even handled in the first place needs to be fixed (allow-list rather than deny-list), and preferably don't mix AST with HIR. |
expecting this to be resolved either by #131808 or a followup |
@rustbot claim |
Marking as P-low because it's accepting code that we shouldn't be accepting, the ICE is just "don't write malformed code" but yeah. |
woo i uncovered a bug! i knew attribute handling was weird, but i'm shocked that it's possible to hit this code path without trying to parse the repr attribute anywhere else that would error. |
@rustbot label +A-repr +A-align |
(due diligence, cc #132693 (comment)) |
…<try> disallow `repr()` on invalid items fixes rust-lang#129606 fixes rust-lang#132391 Disallows `repr()` (so a repr with no arguments) on items where that won't ever make sense. Also this generates an error when `repr` is used on a trait method and the `fn_align` feature is not enabled. Looks like that was missed here: https://github.com/rust-lang/rust/pull/110313/files Which first accepts the align attribute on trait methods. r? `@compiler-errors` cc `@jdonszelmann` who claimed rust-lang#132391 and generally has been working on attributes
…r=compiler-errors disallow `repr()` on invalid items fixes rust-lang#129606 fixes rust-lang#132391 Disallows `repr()` (so a repr with no arguments) on items where that won't ever make sense. Also this generates an error when `repr` is used on a trait method and the `fn_align` feature is not enabled. Looks like that was missed here: https://github.com/rust-lang/rust/pull/110313/files Which first accepts the align attribute on trait methods. r? `@compiler-errors` cc `@jdonszelmann` who claimed rust-lang#132391 and generally has been working on attributes
Rollup merge of rust-lang#133925 - folkertdev:improve-repr-warnings, r=compiler-errors disallow `repr()` on invalid items fixes rust-lang#129606 fixes rust-lang#132391 Disallows `repr()` (so a repr with no arguments) on items where that won't ever make sense. Also this generates an error when `repr` is used on a trait method and the `fn_align` feature is not enabled. Looks like that was missed here: https://github.com/rust-lang/rust/pull/110313/files Which first accepts the align attribute on trait methods. r? `@compiler-errors` cc `@jdonszelmann` who claimed rust-lang#132391 and generally has been working on attributes
This should be reopen, PR #133925 only fixed the ICE for #[repr()] Not fixed for code in this case: #[repr(align)] |
there's a test for this in #135726 to show that this it fixes this. I expect to merge it in the coming week or two closing this one for good |
New attribute parsing infrastructure Another step in the plan outlined in rust-lang#131229 introduces infrastructure for structured parsers for attributes, as well as converting a couple of complex attributes to have such structured parsers. This PR may prove too large to review. I left some of my own comments to guide it a little. Some general notes: - The first commit is basically standalone. It just preps some mostly unrelated sources for the rest of the PR to work. It might not have enormous merit on its own, but not negative merit either. Could be merged alone, but also doesn't make the review a whole lot easier. (but it's only +274 -209) - The second commit is the one that introduces new infrastructure. It's the important one to review. - The 3rd commit uses the new infrastructure showing how some of the more complex attributes can be parsed using it. Theoretically can be split up, though the parsers in this commit are the ones that really test the new infrastructure and show that it all works. - The 4th commit fixes up rustdoc and clippy. In the previous 2 they didn't compile yet while the compiler does. Separated them out to separate concerns and make the rest more palatable. - The 5th commit blesses some test outputs. Sometimes that's just because a diagnostic happens slightly earlier than before, which I'd say is acceptable. Sometimes a diagnostic is now only emitted once where it would've been twice before (yay! fixed some bugs). One test I actually moved from crashes to fixed, because it simply doesn't crash anymore. That's why this PR Closes rust-lang#132391. I think most choices I made here are generally reasonable, but let me know if you disagree anywhere. - The 6th commit adds a derive to pretty print attributes - The 7th removes smir apis for attributes, for the time being. The api will at some point be replaced by one based on `rustc_ast_data_structures::AttributeKind` In general, a lot of the additions here are comments. I've found it very important to document new things in the 2nd commit well so other people can start using it. Closes rust-lang#132391 Closes rust-lang#136717
New attribute parsing infrastructure Another step in the plan outlined in rust-lang#131229 introduces infrastructure for structured parsers for attributes, as well as converting a couple of complex attributes to have such structured parsers. This PR may prove too large to review. I left some of my own comments to guide it a little. Some general notes: - The first commit is basically standalone. It just preps some mostly unrelated sources for the rest of the PR to work. It might not have enormous merit on its own, but not negative merit either. Could be merged alone, but also doesn't make the review a whole lot easier. (but it's only +274 -209) - The second commit is the one that introduces new infrastructure. It's the important one to review. - The 3rd commit uses the new infrastructure showing how some of the more complex attributes can be parsed using it. Theoretically can be split up, though the parsers in this commit are the ones that really test the new infrastructure and show that it all works. - The 4th commit fixes up rustdoc and clippy. In the previous 2 they didn't compile yet while the compiler does. Separated them out to separate concerns and make the rest more palatable. - The 5th commit blesses some test outputs. Sometimes that's just because a diagnostic happens slightly earlier than before, which I'd say is acceptable. Sometimes a diagnostic is now only emitted once where it would've been twice before (yay! fixed some bugs). One test I actually moved from crashes to fixed, because it simply doesn't crash anymore. That's why this PR Closes rust-lang#132391. I think most choices I made here are generally reasonable, but let me know if you disagree anywhere. - The 6th commit adds a derive to pretty print attributes - The 7th removes smir apis for attributes, for the time being. The api will at some point be replaced by one based on `rustc_ast_data_structures::AttributeKind` In general, a lot of the additions here are comments. I've found it very important to document new things in the 2nd commit well so other people can start using it. Closes rust-lang#132391 Closes rust-lang#136717
Code
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: