Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion compiler/rustc_index/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#![feature(unboxed_closures)]
#![feature(test)]
#![feature(fn_traits)]
#![feature(trusted_step)]

pub mod bit_set;
pub mod vec;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_index/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Idx for u32 {
/// `u32::MAX`. You can also customize things like the `Debug` impl,
/// what traits are derived, and so forth via the macro.
#[macro_export]
#[allow_internal_unstable(step_trait, rustc_attrs)]
#[allow_internal_unstable(step_trait, rustc_attrs, trusted_step)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what this does? I don't know how allow_internal_unstable works.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow_internal_unstable allows a macro to use a feature gate without having to enable the feature gate in the target crate. This is for example used by libstd to allow panic!() to call an unstable function to start panicking without the user having to enable the respective feature gate.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, that seems fine in the compiler itself.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, how does that work? Aren't feature gates checked after macro expansion usually?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expansion data retrievable based on the expansion id stored in a span contains a field with all allow_internal_unstable feature gates set for the expanding macro. span.allows_unstable(feature) checks this list.

macro_rules! newtype_index {
// ---- public rules ----

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_span/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#![feature(nll)]
#![feature(min_specialization)]
#![feature(thread_local_const_init)]
#![feature(trusted_step)]

#[macro_use]
extern crate rustc_macros;
Expand Down