-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Compiler panic in objrs package attribute macros class and root_class #82836
Comments
CodeMinor changes to https://gitlab.com/ootoo1/objrs.git (added min_const_generics + allow(const_err)), the above errors are gone, but the compiler panic remains. Error output
|
@ottobommer would be great to provide a smaller reproducible for this also cc: @rustbot ping icebreakers-cleanup-crew |
Hey Cleanup Crew ICE-breakers! This bug has been identified as a good cc @AminArria @camelid @chrissimpkins @contrun @DutchGhost @elshize @ethanboxx @h-michael @HallerPatrick @hdhoang @hellow554 @henryboisdequin @imtsuki @JamesPatrickGill @kanru @KarlK90 @LeSeulArtichaut @MAdrianMattocks @matheus-consoli @mental32 @nmccarty @Noah-Kennedy @pard68 @PeytonT @pierreN @Redblueflame @RobbieClarken @RobertoSnap @robjtede @SarthakSingh31 @shekohex @sinato @smmalis37 @steffahn @Stupremee @tamuhey @turboladen @woshilapin @yerke |
I can't compile this code:
@ottobommer what is wrong here? Edit: I removed the code that did not compile, It panics now. |
This is a somewhat minimal example, next step would be to get rid of all the other code (: extern crate objrs;
use objrs::objrs;
#[objrs(class, root_class)]
pub struct NSArray<T: objrs::marker::Class + ?Sized>;
#[objrs(impl)]
#[link(name = "Foundation", kind = "framework")]
impl<T: objrs::marker::Class + ?Sized> NSArray<T> {
#[objrs(selector = "firstObject")]
pub fn first_object<'a>(&'a self) -> Option<&'a T> {}
} |
searched toolchains nightly-2020-06-01 through nightly-2021-02-04 So the error is somewhere here: 09f4c9f...ceedf1d sadly there are no more artifacts available and I don't want to compile rust on my machine today.. ^^ So this must be it. |
@apiraino OK, will try to make a smaller example. As it is not my code this may take some time. |
I minimized the example somewhat, it can be pulled from the repository below, let me know if a further reduction is needed.
|
Assigning |
@ottobommer an ideal testcase would be one file without any dependencies (even std, but |
@hellow554 OK, I got it down to 3 files (proc macro lib.rs, lib.rs, test case panic.rs), however the total lines of code is still around 1000:
|
In the end, it's so simple...
It seems to be a problem with After all, my humble advice would be, stay away from that code. It is the most unrusty code I've seen in a long time. So many mut variables, returns, unnecessary nested types (Result<Result<...>>)... I mean it's impressive that it works, and if you have a usecase, go for it. Make the world a better place ;) I'm bisecting it now. @rustbot modify labels: -E-needs-mcve |
Regression in nightly-2020-07-31, somewhere between db0492a...cfc572c |
(not sure if it helps but) I'll add the relevant merged PRs
|
@jonas-schievink you tagged this as |
I tagged it based on the panic path The backtrace involves |
Ah, nevermind, that one looks related but different. |
#52334 looks also very similar to this. |
Turns out it is not a duplicate, because this still reproduces on nightly. An easy way to reproduce is to copy-paste this to bash: cat <<EOF | rustc +nightly --crate-type lib -
extern "C" fn _panic<'a, T: ?Sized>() -> Option<&'a T> {
panic!()
}
EOF |
Triage: Fixed on the latest nightly, marking as |
Fixed in 1.74.0 by #115631, which already added a test to |
Code
git clone https://gitlab.com/ootoo1/objrs.git
cd objrs/frameworks/foundation/
cargo build
Meta
rustc --version --verbose
:Error output
The text was updated successfully, but these errors were encountered: