Skip to content

Commit

Permalink
Parse and feature gate raw address of expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewjasper committed Nov 24, 2019
1 parent a8efd31 commit 064bed0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/librustc_parse/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ impl<'a> Parser<'a> {
}
}

/// Parse `& mut? <expr>` or `& raw [ const | mut ] <expr>`
/// Parse `& mut? <expr>` or `& raw [ const | mut ] <expr>`.
fn parse_address_of(&mut self, lo: Span) -> PResult<'a, (Span, ExprKind)> {
self.expect_and()?;
let (k, m) = if self.check_keyword(kw::Raw)
Expand Down
5 changes: 4 additions & 1 deletion src/libsyntax/feature_gate/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,13 +520,16 @@ declare_features! (
/// Allows using the `efiapi` ABI.
(active, abi_efiapi, "1.40.0", Some(65815), None),

/// Allows `&raw const $place_expr` and `&raw mut $place_expr` expressions.
(active, raw_ref_op, "1.41.0", Some(64490), None),

/// Allows diverging expressions to fall back to `!` rather than `()`.
(active, never_type_fallback, "1.41.0", Some(65992), None),

/// Allows using the `#[register_attr]` attribute.
(active, register_attr, "1.41.0", Some(66080), None),

/// Allows using the `#[register_attr]` attribute.
/// Allows using the `#[register_tool]` attribute.
(active, register_tool, "1.41.0", Some(66079), None),

/// Allows the use of `if` and `match` in constants.
Expand Down
1 change: 1 addition & 0 deletions src/libsyntax/feature_gate/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ pub fn check_crate(krate: &ast::Crate,
gate_all!(generators, "yield syntax is experimental");
gate_all!(or_patterns, "or-patterns syntax is experimental");
gate_all!(const_extern_fn, "`const extern fn` definitions are unstable");
gate_all!(raw_ref_op, "raw address of syntax is experimental");

// All uses of `gate_all!` below this point were added in #65742,
// and subsequently disabled (with the non-early gating readded).
Expand Down
2 changes: 2 additions & 0 deletions src/libsyntax_pos/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ symbols! {
Auto: "auto",
Catch: "catch",
Default: "default",
Raw: "raw",
Union: "union",
}

Expand Down Expand Up @@ -546,6 +547,7 @@ symbols! {
RangeToInclusive,
raw_dylib,
raw_identifiers,
raw_ref_op,
Ready,
reason,
recursion_limit,
Expand Down

0 comments on commit 064bed0

Please sign in to comment.