From c160ecf34778b4f57f2f58b7053aa1033fefd92d Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 25 Nov 2024 13:43:11 -0800 Subject: [PATCH 1/3] Move weak keyword lexer section to the top I'm not sure why it ended up in the bottom. Normally we have these lexer/syntax sections towards the beginning of a section. --- src/keywords.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/keywords.md b/src/keywords.md index cec609bc7..41d760a3b 100644 --- a/src/keywords.md +++ b/src/keywords.md @@ -100,6 +100,14 @@ The following keywords are reserved beginning in the 2024 edition. These keywords have special meaning only in certain contexts. For example, it is possible to declare a variable or method with the name `union`. +> **Lexer**\ +> KW_MACRO_RULES : `macro_rules`\ +> KW_UNION : `union`\ +> KW_STATICLIFETIME : `'static` +> +> **Lexer 2015**\ +> KW_DYN : `dyn` + * `macro_rules` is used to create custom [macros]. * `union` is used to declare a [union] and is only a keyword when used in a union declaration. @@ -116,13 +124,6 @@ is possible to declare a variable or method with the name `union`. Beginning in the 2018 edition, `dyn` has been promoted to a strict keyword. -> **Lexer**\ -> KW_MACRO_RULES : `macro_rules`\ -> KW_UNION : `union`\ -> KW_STATICLIFETIME : `'static` -> -> **Lexer 2015**\ -> KW_DYN : `dyn` * `safe` is used for functions and statics, which has meaning in [external blocks]. [items]: items.md From fb9701ce687a185d806dc8c46867131cbb3062e0 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 25 Nov 2024 13:43:52 -0800 Subject: [PATCH 2/3] Add `safe` keyword to lexer list Somehow missed this in https://github.com/rust-lang/reference/pull/1536 --- src/keywords.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/keywords.md b/src/keywords.md index 41d760a3b..747623853 100644 --- a/src/keywords.md +++ b/src/keywords.md @@ -103,7 +103,8 @@ is possible to declare a variable or method with the name `union`. > **Lexer**\ > KW_MACRO_RULES : `macro_rules`\ > KW_UNION : `union`\ -> KW_STATICLIFETIME : `'static` +> KW_STATICLIFETIME : `'static`\ +> KW_SAFE : `safe` > > **Lexer 2015**\ > KW_DYN : `dyn` From 1dd1c64e56b3facbd95746de8c3012fbfb48cd4b Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 25 Nov 2024 13:54:01 -0800 Subject: [PATCH 3/3] Add `raw` weak keyword This was missed in https://github.com/rust-lang/reference/pull/1567 --- src/keywords.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/keywords.md b/src/keywords.md index 747623853..e44301d39 100644 --- a/src/keywords.md +++ b/src/keywords.md @@ -104,7 +104,8 @@ is possible to declare a variable or method with the name `union`. > KW_MACRO_RULES : `macro_rules`\ > KW_UNION : `union`\ > KW_STATICLIFETIME : `'static`\ -> KW_SAFE : `safe` +> KW_SAFE : `safe`\ +> KW_RAW : `raw` > > **Lexer 2015**\ > KW_DYN : `dyn` @@ -127,6 +128,8 @@ is possible to declare a variable or method with the name `union`. * `safe` is used for functions and statics, which has meaning in [external blocks]. +* `raw` is used for [raw borrow operators], and is only a keyword when matching a raw borrow operator form (such as `&raw const expr` or `&raw mut expr`). + [items]: items.md [Variables]: variables.md [Type parameters]: types/parameters.md @@ -141,3 +144,4 @@ is possible to declare a variable or method with the name `union`. [loop label]: expressions/loop-expr.md#loop-labels [generic lifetime parameter]: items/generics.md [external blocks]: items/external-blocks.md +[raw borrow operators]: expressions/operator-expr.md#raw-borrow-operators