-
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
std: Stablize the macros module #20657
Conversation
r? @aturon |
r? @pcwalton (rust_highfive has picked a reviewer for you, use r? to override) |
fb397cf
to
25dc7e8
Compare
25dc7e8
to
5f42217
Compare
($fmt:expr, $($arg:tt)*) => ({ | ||
panic!(concat!("internal error: entered unreachable code: ", $fmt), $($arg)*) | ||
}); | ||
() => (panic!("internal error: entered unreachable code")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the rationale for dropping the functionality here, rather than beefing up unimplemented
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd personally like to remove both of them as they're just longer versions of panic!
in my mind, but failing that I'd rather stick to a more conservative approach where we don't just duplicate-panic-in-each-macro just yet.
This basically looks good to me, but we may want to get input from someone with deeper macros knowledge. Also, are we 100% sure we want to stabilize |
With regard to
I do agree though that we've put ourselves in a corner with |
@@ -353,9 +350,6 @@ fn initial_syntax_expander_table(ecfg: &expand::ExpansionConfig) -> SyntaxEnv { | |||
syntax_expanders.insert(intern("option_env"), | |||
builtin_normal_expander( | |||
ext::env::expand_option_env)); | |||
syntax_expanders.insert(intern("bytes"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is being removed, shouldn't the ext::bytes module be removed as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, indeed!
The commit should be tagged as a |
@alexcrichton Yep, those were pretty much exactly my thoughts. The only question is whether we want to fully commit now, or wait till beta to admit that we have to. |
5f42217
to
e7c9102
Compare
I think the best case outcome for |
These changes look good to me. |
e7c9102
to
dc49783
Compare
rebased, re-r? @aturon |
dc49783
to
940fe74
Compare
This commit performs a pass over the `std::macros` module, applying stability attributes where necessary. In particular, this audits macros for patterns such as: * Standard use of forward-to-format-args via `$($arg:tt)*` (or `+`) * Prevent macro-defined identifiers from leaking into expression arguments as hygiene is not perfectly implemented. * Wherever possible, `$crate` is used now. Specifically, the following actions were taken: * The `std::macros` module itself is no longer public. * The `panic!` macro is stable * The `assert!` macro is stable * The `assert_eq!` macro is stable * The `debug_assert!` macro is stable * The `debug_assert_eq!` macro is stable * The `unreachable!` macro is stable after removing the extra forms to bring the definition in line with the `unimplemented!` macro. * The `try!` macro is stable * The `vec!` macro is stable [breaking-change]
940fe74
to
209c701
Compare
This commit performs a pass over the
std::macros
module, applying stabilityattributes where necessary. In particular, this audits macros for patterns such
as:
$($arg:tt)*
(or+
)hygiene is not perfectly implemented.
$crate
is used now.Specifically, the following actions were taken:
std::macros
module itself is no longer public.panic!
macro is stableassert!
macro is stableassert_eq!
macro is stabledebug_assert!
macro is stabledebug_assert_eq!
macro is stableunreachable!
macro is stable after removing the extra forms to bring thedefinition in line with the
unimplemented!
macro.try!
macro is stablevec!
macro is stable