gate gen fn behind gen_blocks
This commit is contained in:
parent
c104f3b629
commit
7c43784cb0
3 changed files with 9 additions and 3 deletions
|
@ -2410,6 +2410,10 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Gen::Yes { span, .. } = genness {
|
||||||
|
self.sess.gated_spans.gate(sym::gen_blocks, span);
|
||||||
|
}
|
||||||
|
|
||||||
if !self.eat_keyword_case(kw::Fn, case) {
|
if !self.eat_keyword_case(kw::Fn, case) {
|
||||||
// It is possible for `expect_one_of` to recover given the contents of
|
// It is possible for `expect_one_of` to recover given the contents of
|
||||||
// `self.expected_tokens`, therefore, do not use `self.unexpected()` which doesn't
|
// `self.expected_tokens`, therefore, do not use `self.unexpected()` which doesn't
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
error: `gen` functions are not yet implemented
|
error[E0658]: gen blocks are experimental
|
||||||
--> $DIR/gen_fn.rs:4:1
|
--> $DIR/gen_fn.rs:4:1
|
||||||
|
|
|
|
||||||
LL | gen fn foo() {}
|
LL | gen fn foo() {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: for now you can use `gen {}` blocks and return `impl Iterator` instead
|
= note: see issue #117078 <https://github.com/rust-lang/rust/issues/117078> for more information
|
||||||
|
= help: add `#![feature(gen_blocks)]` to the crate attributes to enable
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0658`.
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
|
|
||||||
gen fn foo() {}
|
gen fn foo() {}
|
||||||
//[none]~^ ERROR: expected one of `#`, `async`, `const`, `default`, `extern`, `fn`, `pub`, `unsafe`, or `use`, found `gen`
|
//[none]~^ ERROR: expected one of `#`, `async`, `const`, `default`, `extern`, `fn`, `pub`, `unsafe`, or `use`, found `gen`
|
||||||
//[e2024]~^^ ERROR: `gen` functions are not yet implemented
|
//[e2024]~^^ ERROR: gen blocks are experimental
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue