Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
8c4b3dbb
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8c4b3dbb
编写于
3月 22, 2021
作者:
M
mark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename :pat2018 -> :pat215
上级
d04c3aa8
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
21 addition
and
21 deletion
+21
-21
compiler/rustc_ast/src/token.rs
compiler/rustc_ast/src/token.rs
+7
-7
compiler/rustc_expand/src/mbe/macro_rules.rs
compiler/rustc_expand/src/mbe/macro_rules.rs
+1
-1
compiler/rustc_expand/src/mbe/quoted.rs
compiler/rustc_expand/src/mbe/quoted.rs
+2
-2
compiler/rustc_feature/src/active.rs
compiler/rustc_feature/src/active.rs
+1
-1
compiler/rustc_parse/src/parser/nonterminal.rs
compiler/rustc_parse/src/parser/nonterminal.rs
+3
-3
compiler/rustc_span/src/symbol.rs
compiler/rustc_span/src/symbol.rs
+1
-1
src/test/ui/feature-gates/feature-gate-edition_macro_pats.rs
src/test/ui/feature-gates/feature-gate-edition_macro_pats.rs
+2
-2
src/test/ui/feature-gates/feature-gate-edition_macro_pats.stderr
...t/ui/feature-gates/feature-gate-edition_macro_pats.stderr
+3
-3
src/test/ui/macros/edition-macro-pats.rs
src/test/ui/macros/edition-macro-pats.rs
+1
-1
未找到文件。
compiler/rustc_ast/src/token.rs
浏览文件 @
8c4b3dbb
...
...
@@ -688,13 +688,13 @@ pub enum NonterminalKind {
Item
,
Block
,
Stmt
,
Pat201
8
{
/// Keep track of whether the user used `:pat201
8
` or `:pat` and we inferred it from the
Pat201
5
{
/// Keep track of whether the user used `:pat201
5
` or `:pat` and we inferred it from the
/// edition of the span. This is used for diagnostics.
inferred
:
bool
,
},
Pat2021
{
/// Keep track of whether the user used `:pat201
8
` or `:pat` and we inferred it from the
/// Keep track of whether the user used `:pat201
5
` or `:pat` and we inferred it from the
/// edition of the span. This is used for diagnostics.
inferred
:
bool
,
},
...
...
@@ -722,11 +722,11 @@ pub fn from_symbol(
sym
::
stmt
=>
NonterminalKind
::
Stmt
,
sym
::
pat
=>
match
edition
()
{
Edition
::
Edition2015
|
Edition
::
Edition2018
=>
{
NonterminalKind
::
Pat201
8
{
inferred
:
true
}
NonterminalKind
::
Pat201
5
{
inferred
:
true
}
}
Edition
::
Edition2021
=>
NonterminalKind
::
Pat2021
{
inferred
:
true
},
},
sym
::
pat201
8
=>
NonterminalKind
::
Pat2018
{
inferred
:
false
},
sym
::
pat201
5
=>
NonterminalKind
::
Pat2015
{
inferred
:
false
},
sym
::
pat2021
=>
NonterminalKind
::
Pat2021
{
inferred
:
false
},
sym
::
expr
=>
NonterminalKind
::
Expr
,
sym
::
ty
=>
NonterminalKind
::
Ty
,
...
...
@@ -745,9 +745,9 @@ fn symbol(self) -> Symbol {
NonterminalKind
::
Item
=>
sym
::
item
,
NonterminalKind
::
Block
=>
sym
::
block
,
NonterminalKind
::
Stmt
=>
sym
::
stmt
,
NonterminalKind
::
Pat201
8
{
inferred
:
false
}
=>
sym
::
pat2018
,
NonterminalKind
::
Pat201
5
{
inferred
:
false
}
=>
sym
::
pat2015
,
NonterminalKind
::
Pat2021
{
inferred
:
false
}
=>
sym
::
pat2021
,
NonterminalKind
::
Pat201
8
{
inferred
:
true
}
NonterminalKind
::
Pat201
5
{
inferred
:
true
}
|
NonterminalKind
::
Pat2021
{
inferred
:
true
}
=>
sym
::
pat
,
NonterminalKind
::
Expr
=>
sym
::
expr
,
NonterminalKind
::
Ty
=>
sym
::
ty
,
...
...
compiler/rustc_expand/src/mbe/macro_rules.rs
浏览文件 @
8c4b3dbb
...
...
@@ -1080,7 +1080,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow {
_
=>
IsInFollow
::
No
(
TOKENS
),
}
}
NonterminalKind
::
Pat201
8
{
..
}
|
NonterminalKind
::
Pat2021
{
..
}
=>
{
NonterminalKind
::
Pat201
5
{
..
}
|
NonterminalKind
::
Pat2021
{
..
}
=>
{
const
TOKENS
:
&
[
&
str
]
=
&
[
"`=>`"
,
"`,`"
,
"`=`"
,
"`|`"
,
"`if`"
,
"`in`"
];
match
tok
{
TokenTree
::
Token
(
token
)
=>
match
token
.kind
{
...
...
compiler/rustc_expand/src/mbe/quoted.rs
浏览文件 @
8c4b3dbb
...
...
@@ -63,13 +63,13 @@ pub(super) fn parse(
let
span
=
token
.span
.with_lo
(
start_sp
.lo
());
match
frag
.name
{
sym
::
pat201
8
|
sym
::
pat2021
=>
{
sym
::
pat201
5
|
sym
::
pat2021
=>
{
if
!
features
.edition_macro_pats
{
feature_err
(
sess
,
sym
::
edition_macro_pats
,
frag
.span
,
"`pat201
8
` and `pat2021` are unstable."
,
"`pat201
5
` and `pat2021` are unstable."
,
)
.emit
();
}
...
...
compiler/rustc_feature/src/active.rs
浏览文件 @
8c4b3dbb
...
...
@@ -614,7 +614,7 @@ pub fn set(&self, features: &mut Features, span: Span) {
/// Allows arbitrary expressions in key-value attributes at parse time.
(
active
,
extended_key_value_attributes
,
"1.50.0"
,
Some
(
78835
),
None
),
/// `:pat201
8
` and `:pat2021` macro matchers.
/// `:pat201
5
` and `:pat2021` macro matchers.
(
active
,
edition_macro_pats
,
"1.51.0"
,
Some
(
54883
),
None
),
/// Allows const generics to have default values (e.g. `struct Foo<const N: usize = 3>(...);`).
...
...
compiler/rustc_parse/src/parser/nonterminal.rs
浏览文件 @
8c4b3dbb
...
...
@@ -61,7 +61,7 @@ fn may_be_ident(nt: &token::Nonterminal) -> bool {
},
_
=>
false
,
},
NonterminalKind
::
Pat201
8
{
..
}
|
NonterminalKind
::
Pat2021
{
..
}
=>
match
token
.kind
{
NonterminalKind
::
Pat201
5
{
..
}
|
NonterminalKind
::
Pat2021
{
..
}
=>
match
token
.kind
{
token
::
Ident
(
..
)
|
// box, ref, mut, and other identifiers (can stricten)
token
::
OpenDelim
(
token
::
Paren
)
|
// tuple pattern
token
::
OpenDelim
(
token
::
Bracket
)
|
// slice pattern
...
...
@@ -118,9 +118,9 @@ pub fn parse_nonterminal(&mut self, kind: NonterminalKind) -> PResult<'a, Nonter
return
Err
(
self
.struct_span_err
(
self
.token.span
,
"expected a statement"
));
}
},
NonterminalKind
::
Pat201
8
{
..
}
|
NonterminalKind
::
Pat2021
{
..
}
=>
{
NonterminalKind
::
Pat201
5
{
..
}
|
NonterminalKind
::
Pat2021
{
..
}
=>
{
token
::
NtPat
(
self
.collect_tokens_no_attrs
(|
this
|
match
kind
{
NonterminalKind
::
Pat201
8
{
..
}
=>
this
.parse_pat_no_top_alt
(
None
),
NonterminalKind
::
Pat201
5
{
..
}
=>
this
.parse_pat_no_top_alt
(
None
),
NonterminalKind
::
Pat2021
{
..
}
=>
{
this
.parse_pat_allow_top_alt
(
None
,
GateOr
::
Yes
,
RecoverComma
::
No
)
}
...
...
compiler/rustc_span/src/symbol.rs
浏览文件 @
8c4b3dbb
...
...
@@ -845,7 +845,7 @@
partial_ord
,
passes
,
pat
,
pat201
8
,
pat201
5
,
pat2021
,
path
,
pattern_parentheses
,
...
...
src/test/ui/feature-gates/feature-gate-edition_macro_pats.rs
浏览文件 @
8c4b3dbb
// Feature gate test for `edition_macro_pats` feature.
macro_rules!
foo
{
(
$x:pat201
8
)
=>
{};
//~ERROR `pat2018
` and `pat2021` are unstable
(
$x:pat2021
)
=>
{};
//~ERROR `pat201
8
` and `pat2021` are unstable
(
$x:pat201
5
)
=>
{};
//~ERROR `pat2015
` and `pat2021` are unstable
(
$x:pat2021
)
=>
{};
//~ERROR `pat201
5
` and `pat2021` are unstable
}
fn
main
()
{}
src/test/ui/feature-gates/feature-gate-edition_macro_pats.stderr
浏览文件 @
8c4b3dbb
error[E0658]: `pat201
8
` and `pat2021` are unstable.
error[E0658]: `pat201
5
` and `pat2021` are unstable.
--> $DIR/feature-gate-edition_macro_pats.rs:4:9
|
LL | ($x:pat201
8
) => {};
LL | ($x:pat201
5
) => {};
| ^^^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(edition_macro_pats)]` to the crate attributes to enable
error[E0658]: `pat201
8
` and `pat2021` are unstable.
error[E0658]: `pat201
5
` and `pat2021` are unstable.
--> $DIR/feature-gate-edition_macro_pats.rs:5:9
|
LL | ($x:pat2021) => {};
...
...
src/test/ui/macros/edition-macro-pats.rs
浏览文件 @
8c4b3dbb
...
...
@@ -4,7 +4,7 @@
#![feature(edition_macro_pats)]
macro_rules!
foo
{
(
a
$x:pat201
8
)
=>
{};
(
a
$x:pat201
5
)
=>
{};
(
b
$x:pat2021
)
=>
{};
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录