Skip to content

Commit df7a513

Browse files
committed
manual: update list of feature gates, add phase attribute
1 parent f4ef36e commit df7a513

File tree

2 files changed

+73
-5
lines changed

2 files changed

+73
-5
lines changed

src/doc/rust.md

+71-5
Original file line numberDiff line numberDiff line change
@@ -1950,6 +1950,12 @@ interpreted:
19501950
- `unsafe_no_drop_flag` - on structs, remove the flag that prevents
19511951
destructors from being run twice. Destructors might be run multiple times on
19521952
the same object with this attribute.
1953+
- `phase` - on `extern crate` statements, allows specifying which "phase" of
1954+
compilation the crate should be loaded for. Currently, there are two
1955+
choices: `link` and `plugin`. `link` is the default. `plugin` will load the
1956+
crate at compile-time and use any syntax extensions or lints that the crate
1957+
defines. They can both be specified, `#[phase(link, plugin)]` to use a crate
1958+
both at runtime and compiletime.
19531959

19541960
### Conditional compilation
19551961

@@ -2395,17 +2401,17 @@ The currently implemented features of the reference compiler are:
23952401
closure as `once` is unlikely to be supported going forward. So
23962402
they are hidden behind this feature until they are to be removed.
23972403

2398-
* `managed_boxes` - Usage of `@` pointers is gated due to many
2404+
* `asm` - The `asm!` macro provides a means for inline assembly. This is often
2405+
useful, but the exact syntax for this feature along with its semantics
2406+
are likely to change, so this macro usage must be opted into.
2407+
2408+
* `managed_boxes` - Usage of `@` is gated due to many
23992409
planned changes to this feature. In the past, this has meant
24002410
"a GC pointer", but the current implementation uses
24012411
reference counting and will likely change drastically over
24022412
time. Additionally, the `@` syntax will no longer be used to
24032413
create GC boxes.
24042414

2405-
* `asm` - The `asm!` macro provides a means for inline assembly. This is often
2406-
useful, but the exact syntax for this feature along with its semantics
2407-
are likely to change, so this macro usage must be opted into.
2408-
24092415
* `non_ascii_idents` - The compiler supports the use of non-ascii identifiers,
24102416
but the implementation is a little rough around the
24112417
edges, so this can be seen as an experimental feature for
@@ -2427,6 +2433,66 @@ The currently implemented features of the reference compiler are:
24272433
if the system linker is not used then specifying custom flags
24282434
doesn't have much meaning.
24292435

2436+
* `phase` - Usage of the `#[phase]` attribute allows loading compiler plugins
2437+
for custom lints or syntax extensions. The implementation is considered
2438+
unwholesome and in need of overhaul, and it is not clear what they
2439+
will look like moving forward.
2440+
2441+
* `plugin_registrar` - Indicates that a crate has compiler plugins that it
2442+
wants to load. As with `phase`, the implementation is
2443+
in need of a overhaul, and it is not clear that plugins
2444+
defined using this will continue to work.
2445+
2446+
* `log_syntax` - Allows use of the `log_syntax` macro attribute, which is a
2447+
nasty hack that will certainly be removed.
2448+
2449+
* `trace_macros` - Allows use of the `trace_macros` macro, which is a nasty
2450+
hack that will certainly be removed.
2451+
2452+
* `concat_idents` - Allows use of the `concat_idents` macro, which is in many
2453+
ways insufficient for concatenating identifiers, and may
2454+
be removed entirely for something more wholsome.
2455+
2456+
* `unsafe_destructor` - Allows use of the `#[unsafe_destructor]` attribute,
2457+
which is considered wildly unsafe and will be
2458+
obsoleted by language improvements.
2459+
2460+
* `intrinsics` - Allows use of the "rust-intrinsics" ABI. Compiler intrinsics
2461+
are inherently unstable and no promise about them is made.
2462+
2463+
* `lang_items` - Allows use of the `#[lang]` attribute. Like `intrinsics`,
2464+
lang items are inherently unstable and no promise about
2465+
them is made.
2466+
2467+
* `simd` - Allows use of the `#[simd]` attribute, which is overly simple and
2468+
not the SIMD interface we want to expose in the long term.
2469+
2470+
* `default_type_params` - Allows use of default type parameters. The future of
2471+
this feature is uncertain.
2472+
2473+
* `quote` - Allows use of the `quote_*!` family of macros, which are
2474+
implemented very poorly and will likely change significantly
2475+
with a proper implementation.
2476+
2477+
* `linkage` - Allows use of the `linkage` attribute, which is not portable.
2478+
2479+
* `struct_inherit` - Allows using struct inheritance, which is barely
2480+
implemented and will probably be removed. Don't use this.
2481+
2482+
* `overloaded_calls` - Allow implementing the `Fn*` family of traits on user
2483+
types, allowing overloading the call operator (`()`).
2484+
This feature may still undergo changes before being
2485+
stabilized.
2486+
2487+
* `unboxed_closure_sugar` - Allows using `|Foo| -> Bar` as a trait bound
2488+
meaning one of the `Fn` traits. Still
2489+
experimental.
2490+
2491+
* `rustc_diagnostic_macros`- A mysterious feature, used in the implementation
2492+
of rustc, not meant for mortals.
2493+
2494+
* `unboxed_closures` - A work in progress feature with many known bugs.
2495+
24302496
If a feature is promoted to a language feature, then all existing programs will
24312497
start to receive compilation warnings about #[feature] directives which enabled
24322498
the new feature (because the directive is no longer necessary). However, if

src/librustc/front/feature_gate.rs

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
6969
("rustc_diagnostic_macros", Active),
7070
("unboxed_closures", Active),
7171

72+
// if you change this list without updating src/doc/rust.md, cmr will be sad
73+
7274
// A temporary feature gate used to enable parser extensions needed
7375
// to bootstrap fix for #5723.
7476
("issue_5723_bootstrap", Active),

0 commit comments

Comments
 (0)