rustc_ast_lowering: make "yield syntax is experimental" translatable
This commit is contained in:
parent
334a097137
commit
290df4fa56
@ -175,6 +175,8 @@ ast_lowering_underscore_expr_lhs_assign =
|
||||
.label = `_` not allowed here
|
||||
|
||||
ast_lowering_use_angle_brackets = use angle brackets instead
|
||||
|
||||
ast_lowering_yield = yield syntax is experimental
|
||||
ast_lowering_yield_in_closure =
|
||||
`yield` can only be used in `#[coroutine]` closures, or `gen` blocks
|
||||
.suggestion = use `#[coroutine]` to make this closure a coroutine
|
||||
|
@ -23,7 +23,7 @@
|
||||
ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs, ResolverAstLoweringExt,
|
||||
};
|
||||
use crate::errors::YieldInClosure;
|
||||
use crate::{FnDeclKind, ImplTraitPosition};
|
||||
use crate::{fluent_generated, FnDeclKind, ImplTraitPosition};
|
||||
|
||||
impl<'hir> LoweringContext<'_, 'hir> {
|
||||
fn lower_exprs(&mut self, exprs: &[AstP<Expr>]) -> &'hir [hir::Expr<'hir>] {
|
||||
@ -1540,7 +1540,6 @@ fn lower_expr_field(&mut self, f: &ExprField) -> hir::ExprField<'hir> {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
fn lower_expr_yield(&mut self, span: Span, opt_expr: Option<&Expr>) -> hir::ExprKind<'hir> {
|
||||
let yielded =
|
||||
opt_expr.as_ref().map(|x| self.lower_expr(x)).unwrap_or_else(|| self.expr_unit(span));
|
||||
@ -1575,7 +1574,7 @@ fn lower_expr_yield(&mut self, span: Span, opt_expr: Option<&Expr>) -> hir::Expr
|
||||
&self.tcx.sess,
|
||||
sym::coroutines,
|
||||
span,
|
||||
"yield syntax is experimental",
|
||||
fluent_generated::ast_lowering_yield,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
@ -1587,7 +1586,7 @@ fn lower_expr_yield(&mut self, span: Span, opt_expr: Option<&Expr>) -> hir::Expr
|
||||
&self.tcx.sess,
|
||||
sym::coroutines,
|
||||
span,
|
||||
"yield syntax is experimental",
|
||||
fluent_generated::ast_lowering_yield,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
@ -73,7 +73,6 @@ LL | let _ = || yield true;
|
||||
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
|
||||
= help: add `#![feature(coroutines)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
|
||||
--> $DIR/gen_block.rs:16:16
|
||||
@ -95,7 +94,6 @@ LL | let _ = #[coroutine] || yield true;
|
||||
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
|
||||
= help: add `#![feature(coroutines)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
|
@ -47,7 +47,6 @@ LL | yield true;
|
||||
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
|
||||
= help: add `#![feature(coroutines)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
|
||||
--> $DIR/feature-gate-coroutines.rs:5:5
|
||||
@ -69,7 +68,6 @@ LL | let _ = || yield true;
|
||||
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
|
||||
= help: add `#![feature(coroutines)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
|
||||
--> $DIR/feature-gate-coroutines.rs:10:16
|
||||
|
Loading…
Reference in New Issue
Block a user