diff options
| author | Michael Goulet <michael@errs.io> | 2023-03-11 21:29:15 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-03-11 21:29:28 +0000 |
| commit | c3159b851a90d3071a97cfb84416f09058c1733a (patch) | |
| tree | 45c42cac47f42cd636ffb88d5e4960da4fcc4149 /compiler/rustc_parse/src/parser/mod.rs | |
| parent | bd4355500a53ba2b3d82d754d1d669710d4b442c (diff) | |
| download | rust-c3159b851a90d3071a97cfb84416f09058c1733a.tar.gz rust-c3159b851a90d3071a97cfb84416f09058c1733a.zip | |
Gate const closures even when they appear in macros
Diffstat (limited to 'compiler/rustc_parse/src/parser/mod.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 6e9b447fa61..3251dd6d0c6 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -1196,9 +1196,13 @@ impl<'a> Parser<'a> { self.parse_constness_(case, false) } - /// Parses constness for closures - fn parse_closure_constness(&mut self, case: Case) -> Const { - self.parse_constness_(case, true) + /// Parses constness for closures (case sensitive, feature-gated) + fn parse_closure_constness(&mut self) -> Const { + let constness = self.parse_constness_(Case::Sensitive, true); + if let Const::Yes(span) = constness { + self.sess.gated_spans.gate(sym::const_closures, span); + } + constness } fn parse_constness_(&mut self, case: Case, is_closure: bool) -> Const { |
