Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of some #[allow(rustc::untranslatable_diagnostic)] #128886

Merged
merged 21 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f83b085
rustc_attr: remove redundant `#[allow(rustc::untranslatable_diagnosti…
GrigorenkoPV Aug 7, 2024
43f3a21
rustc_const_eval: remove redundant `#[allow(rustc::untranslatable_dia…
GrigorenkoPV Aug 7, 2024
3a18c6b
rustc_const_eval: make message about "const stable" translatable
GrigorenkoPV Aug 7, 2024
a11922d
rustc_const_eval: make LazyLock suggestion translatable
GrigorenkoPV Aug 7, 2024
c36b21a
rustc_attr: make "compact `cfg(target(..))` is unstable" translatable
GrigorenkoPV Aug 7, 2024
334a097
rustc_ast_lowering: make "using `_` for array lengths is unstable" tr…
GrigorenkoPV Aug 7, 2024
290df4f
rustc_ast_lowering: make "yield syntax is experimental" translatable
GrigorenkoPV Aug 7, 2024
6760298
rustc_ast_lowering: make asm-related unstability messages translatable
GrigorenkoPV Aug 7, 2024
48413cf
rustc_borrowck: make dereference suggestion translatable
GrigorenkoPV Aug 8, 2024
446e03e
rustc_borrowck: make suggestion to move closure translatable
GrigorenkoPV Aug 8, 2024
1b6cc24
rustc_borrowck: make some suggestion about static lifetimes translatable
GrigorenkoPV Aug 8, 2024
1481ab3
rustc_borrowck: make "implicit static" suff translatable
GrigorenkoPV Aug 8, 2024
f43cdce
rustc_borrowck: fmt
GrigorenkoPV Aug 8, 2024
fbc2459
rustc_expand: remove some redundant `#[allow(rustc::untranslatable_di…
GrigorenkoPV Aug 8, 2024
1373074
rustc_expand: make a message translatable
GrigorenkoPV Aug 8, 2024
cbae581
rustc_interface: remove a redundant `#[allow(rustc::untranslatable_di…
GrigorenkoPV Aug 8, 2024
2babab6
rustc_lint: remove some redundant `#[allow(rustc::untranslatable_diag…
GrigorenkoPV Aug 8, 2024
d548636
rustc_metadata: remove a redundant `#[allow(rustc::untranslatable_dia…
GrigorenkoPV Aug 8, 2024
007cc2c
rustc_metadata: make "link {arg,cfg} is unstable" translatable
GrigorenkoPV Aug 8, 2024
fcdb374
rustc_passes: remove a redundant `#[allow(rustc::untranslatable_diagn…
GrigorenkoPV Aug 9, 2024
f09a2b0
rustc_passes: make some messages in check_attr translatable
GrigorenkoPV Aug 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/rustc_ast_lowering/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 3 additions & 4 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use super::{
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>] {
Expand Down Expand Up @@ -1540,7 +1540,6 @@ impl<'hir> LoweringContext<'_, '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));
Expand Down Expand Up @@ -1575,7 +1574,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
&self.tcx.sess,
sym::coroutines,
span,
"yield syntax is experimental",
fluent_generated::ast_lowering_yield,
)
.emit();
}
Expand All @@ -1587,7 +1586,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
&self.tcx.sess,
sym::coroutines,
span,
"yield syntax is experimental",
fluent_generated::ast_lowering_yield,
)
.emit();
}
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/coroutine/gen_block.none.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this note go away?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Genuinely no idea. Maybe something to do with replacing two equal strings with one Fluent message.
290df4f#diff-d93592ecc730e2061ac31cad11e78e3bb7cdc7ca3257a85f04bbd3f48c0c6521L1578-R1589


error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
--> $DIR/gen_block.rs:16:16
Expand All @@ -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

Expand Down
2 changes: 0 additions & 2 deletions tests/ui/feature-gates/feature-gate-coroutines.none.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down