-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Allow macros in type positions #27245
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
The feature gate for this points at #27336, should it point here instead? |
How is this going? Is anything on fire yet? |
Signed-off-by: NODA, Kai <nodakai@gmail.com>
Type macro is tracked at #27245, not 27336
Signed-off-by: NODA, Kai <nodakai@gmail.com>
Type macro is tracked at #27245, not 27336
Is there any review/stability status on this feature by any chance? |
Any update on this? |
cc @rust-lang/lang. This seems like a constrained extension to macros, that we could consider stabilising. |
There's an issue re interaction with deriving, see #32950, but I think it's minor. |
Going to FCP for this feature seems good to me. If people are using it successfully (or have found bugs!) please say so :-) |
+1 to stabilising. There are still a few issues with type macros, but just bugs, and nothing major that I'm aware of. |
Did the lang team decide to FCP or wait? |
We went to FCP. Apologies @durka for the dropped administrative work recently -- all of the Mozilla folks just traveled to London for a week and the preparations for that resulted in some balls being dropped. |
This feature is in its final comment period for stabilization (in 1.11). |
rustc 1.11 still reports type macros as unstable. Is there any chance of having this feature stabilized in 1.12? |
Yes, it's ready for immediate stabilization. Anyone should feel free to open a stabilization PR and ping me on it. |
Indeed I am slow in writing it up, but the @rust-lang/lang team decided formally to stabilize this feature (as @aturon commented). Horray! |
I am tagging the issue with E-mentor because I would be happy to mentor someone through the process of implementing a stabilization PR. |
@nikomatsakis I don't have experience with rustc internals, but I'd be happy to try to implement the stabilization PR. :-) |
@slash3g ok, basically all you have to do is to modify pub fn expand_type(t: P<ast::Ty>, fld: &mut MacroExpander) -> P<ast::Ty> {
let t = match t.node.clone() {
ast::TyKind::Mac(mac) => {
if fld.cx.ecfg.features.unwrap().type_macros {
expand_mac_invoc(mac, None, Vec::new(), t.span, fld)
} else {
feature_gate::emit_feature_err(
&fld.cx.parse_sess.span_diagnostic,
"type_macros",
t.span,
feature_gate::GateIssue::Language,
"type macros are experimental");
DummyResult::raw_ty(t.span)
}
}
_ => t
};
fold::noop_fold_ty(t, fld)
} you also need to change this declaration from // Allows macros to appear in the type position.
(active, type_macros, "1.3.0", Some(27245)), |
Also remove |
Ok, I've removed the check on the feature gate in
|
…komatsakis Stabilize type-macros Closes rust-lang#27245 r? @nikomatsakis
Tracking issue for rust-lang/rfcs#873
The text was updated successfully, but these errors were encountered: