mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-23 12:23:22 +00:00
Feature-gate do yeet
inside cfg
s too
This commit is contained in:
parent
9b5766cd24
commit
b317ec1697
@ -619,14 +619,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||
ast::ExprKind::TryBlock(_) => {
|
||||
gate_feature_post!(&self, try_blocks, e.span, "`try` expression is experimental");
|
||||
}
|
||||
ast::ExprKind::Yeet(_) => {
|
||||
gate_feature_post!(
|
||||
&self,
|
||||
yeet_expr,
|
||||
e.span,
|
||||
"`do yeet` expression is experimental"
|
||||
);
|
||||
}
|
||||
ast::ExprKind::Block(_, Some(label)) => {
|
||||
gate_feature_post!(
|
||||
&self,
|
||||
@ -791,6 +783,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) {
|
||||
gate_all!(inline_const, "inline-const is experimental");
|
||||
gate_all!(inline_const_pat, "inline-const in pattern position is experimental");
|
||||
gate_all!(associated_const_equality, "associated const equality is incomplete");
|
||||
gate_all!(yeet_expr, "`do yeet` expression is experimental");
|
||||
|
||||
// All uses of `gate_all!` below this point were added in #65742,
|
||||
// and subsequently disabled (with the non-early gating readded).
|
||||
|
19
src/test/ui/feature-gates/feature-gate-yeet_expr-in-cfg.rs
Normal file
19
src/test/ui/feature-gates/feature-gate-yeet_expr-in-cfg.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// compile-flags: --edition 2021
|
||||
|
||||
pub fn demo() -> Option<i32> {
|
||||
#[cfg(nope)]
|
||||
{
|
||||
do yeet //~ ERROR `do yeet` expression is experimental
|
||||
}
|
||||
|
||||
Some(1)
|
||||
}
|
||||
|
||||
#[cfg(nope)]
|
||||
pub fn alternative() -> Result<(), String> {
|
||||
do yeet "hello"; //~ ERROR `do yeet` expression is experimental
|
||||
}
|
||||
|
||||
fn main() {
|
||||
demo();
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
error[E0658]: `do yeet` expression is experimental
|
||||
--> $DIR/feature-gate-yeet_expr-in-cfg.rs:6:9
|
||||
|
|
||||
LL | do yeet
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: see issue #96373 <https://github.com/rust-lang/rust/issues/96373> for more information
|
||||
= help: add `#![feature(yeet_expr)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: `do yeet` expression is experimental
|
||||
--> $DIR/feature-gate-yeet_expr-in-cfg.rs:14:5
|
||||
|
|
||||
LL | do yeet "hello";
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #96373 <https://github.com/rust-lang/rust/issues/96373> for more information
|
||||
= help: add `#![feature(yeet_expr)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
Loading…
Reference in New Issue
Block a user