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
Upcoming rustc breakage wrt macro re-exporting #95
Comments
I've opened rust-embedded/svd2rust#209 about the breakage of the generated code. |
I don't understand why the word "stable" appears here. There has never been a stable mechanism to reexport macros.
The quasi-stable versions of cortex-m-rt and svd2rust (which already have PRs up) don't make use of |
Sure. However the previous unstable mechanism to re-export macros has been used in embbeded and will not work in the upcoming stable version which is what we're aiming for, no?
😏 That's what a language lawyer would say not how it is perceived by a existing or potential user. Over night this change "broke" (for the lack of a better word that would satisfy a language lawyer) a lot (if not even all) close-to-metal rust crates, so many maintainers will need to take action and in addition it might shy away people trying rust for embedded because they hit a wall they may not be able to work around.
Great to hear. Didn't see them.
Does that re-export the macro? Didn't know that. I was following the hints in the error message, i.e. turn
Exactly like the one above: How to switch from the previous unstable mechanism to the new stable mechanism. |
I don't see what's the problem here. How macros are re-exported is an implementation detail of device crates. Users of those device crates can continue to use Re-exporting macros is not possible on stable today. If that's still not the case for the edition release (*) then we simply won't use this feature on stable embedded Rust. The only impact of doing this is that instead of writing (*) Though I think the plan is to stabilize
Users of nightly are aware that their code can break over night. If they don't want any breakage they should use the stable channel. The ETA for embedded Rust on stable is 1.28; if one doesn't want to deal with breakage they can wait until then.
No, it doesn't. It only imports the macro.
That describes how to migrate macro re-exports from
There's no stable mechanism. If you meant "how to deal with the breakage". The steps are:
|
Funny, you said you don't see the problem and then described it in the very next sentence yourself: Pretty much all device crates are broken and will need to be fixed otherwise they can't be used anymore.
This is a horrible stance to take and I'm not sure why you're saying that. We want people to use Rust on embedded, to join in, help, create code and expand the ecosystem, no? I think it is our obligation to make that as seamless and easy as possible, especially since some details are not stable yet.
As the title implies we're only talking about re-exporting here.
There're different actions for different cases:
No. If the dependency crates are not fixed then you won't even get to the point of compiling code that does the #[macro_use] because the compiler will bomb out earlier (as seen above). |
OK, so the facts here are:
-#![feature(macro_reexport)]
+#![feature(use_extern_macros)]
-#[macro_reexport(foo)]
extern crate bar;
+pub use bar::foo;
Anyone has a concrete proposal to do anything about this issue? I still don't understand what @therealprof meant by 'Upcoming rustc breakage', 'the next stable rust version' and 'part of the "embedded rust goes stable" story'. The process of dealing with the |
Correct. I don't think I've ever written anything else.
I'm in the process of writing a blog article about this. This surprising breakage did cost me some time, prevented me from doing some investigation I wanted to do instead of working around this (you probably guessed by now that this investigation involves a recent compiler version) and I'm very much afraid that this will cause a lot of frustration for newbies so crate maintainers should be reminded that there might be an issue and it would be cool if they could check if there is and fix it rather sooner than later.
That's just my (potentially inaccurate) way of saying that as of a few days ago it is broken. I was not aware at that point that it was an unstable feature.
You can be pretty certain that if we don't do anything about this now it won't be addressed in all crates by the time embedded rust will be available in stable.
I don't see how that statement can be correct, unless you're telling that the plan is to get rid of the re-exports entirely, e.g. in svd2rust generated code... |
Hey guys. Lots of frustration in this thread. I can appreciate that it was difficult but anger isn’t productive in this scenario. If there are breakages, let’s find a way to hunt them down for people and make a strike force to make it awesome as part of the stabilization effort. I wouldn’t mind some mindless PR work on random libraries to change pace a little bit. Crates.io links to source, and I know the compiler team regularly rebuilds a bunch of things from there to confirm all is well. Let’s document to avoid future paper cuts and hunt the existing stuff down instead of letting this discussion get the better of us. |
Yes, unstable features have no place in stable embedded Rust so we are dropping the re-exports. Like I mentioned above the re-exports are just a convenience; you can get e.g. the If
We are removing all unstable features, including |
My blog post about this can be found here: https://www.eggers-club.de/blog/2018/05/06/changes-in-rust-macro-re-exporting/ |
I believe the items in this issue have been addressed. I am nominating this issue to be closed. Please let me know if you feel otherwise. |
I am closing this issue, please feel free to open another issue if you would like this discussed further. |
In recent the next stable rust version, macro re-exporting will work differently hence insta-breaking all current and future crates generated by svd2rust and at least some (if not all) hal implementations and potentially even more.
Apart from fixing svd2rust we should probably prepare for this situation with some helpful advisories as part of the "embedded rust goes stable" story.
The text was updated successfully, but these errors were encountered: