Skip to content

Commit f25ca7e

Browse files
committed
Auto merge of #3803 - RalfJung:rustup, r=RalfJung
Rustup
2 parents 6ff09af + db3f921 commit f25ca7e

File tree

677 files changed

+9038
-5211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

677 files changed

+9038
-5211
lines changed

compiler/rustc_ast_lowering/messages.ftl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,21 @@ ast_lowering_template_modifier = template modifier
167167
168168
ast_lowering_this_not_async = this is not `async`
169169
170+
ast_lowering_underscore_array_length_unstable =
171+
using `_` for array lengths is unstable
172+
170173
ast_lowering_underscore_expr_lhs_assign =
171174
in expressions, `_` can only be used on the left-hand side of an assignment
172175
.label = `_` not allowed here
173176
177+
ast_lowering_unstable_inline_assembly = inline assembly is not stable yet on this architecture
178+
ast_lowering_unstable_inline_assembly_label_operands =
179+
label operands for inline assembly are unstable
180+
ast_lowering_unstable_may_unwind = the `may_unwind` option is unstable
181+
174182
ast_lowering_use_angle_brackets = use angle brackets instead
183+
184+
ast_lowering_yield = yield syntax is experimental
175185
ast_lowering_yield_in_closure =
176186
`yield` can only be used in `#[coroutine]` closures, or `gen` blocks
177187
.suggestion = use `#[coroutine]` to make this closure a coroutine

compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ use super::errors::{
1919
InvalidRegisterClass, RegisterClassOnlyClobber, RegisterConflict,
2020
};
2121
use super::LoweringContext;
22-
use crate::{ImplTraitContext, ImplTraitPosition, ParamMode, ResolverAstLoweringExt};
22+
use crate::{
23+
fluent_generated as fluent, ImplTraitContext, ImplTraitPosition, ParamMode,
24+
ResolverAstLoweringExt,
25+
};
2326

2427
impl<'a, 'hir> LoweringContext<'a, 'hir> {
25-
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
2628
pub(crate) fn lower_inline_asm(
2729
&mut self,
2830
sp: Span,
@@ -52,7 +54,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
5254
&self.tcx.sess,
5355
sym::asm_experimental_arch,
5456
sp,
55-
"inline assembly is not stable yet on this architecture",
57+
fluent::ast_lowering_unstable_inline_assembly,
5658
)
5759
.emit();
5860
}
@@ -64,8 +66,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
6466
self.dcx().emit_err(AttSyntaxOnlyX86 { span: sp });
6567
}
6668
if asm.options.contains(InlineAsmOptions::MAY_UNWIND) && !self.tcx.features().asm_unwind {
67-
feature_err(&self.tcx.sess, sym::asm_unwind, sp, "the `may_unwind` option is unstable")
68-
.emit();
69+
feature_err(
70+
&self.tcx.sess,
71+
sym::asm_unwind,
72+
sp,
73+
fluent::ast_lowering_unstable_may_unwind,
74+
)
75+
.emit();
6976
}
7077

7178
let mut clobber_abis = FxIndexMap::default();
@@ -176,20 +183,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
176183
out_expr: out_expr.as_ref().map(|expr| self.lower_expr(expr)),
177184
}
178185
}
179-
InlineAsmOperand::Const { anon_const } => {
180-
if !self.tcx.features().asm_const {
181-
feature_err(
182-
sess,
183-
sym::asm_const,
184-
*op_sp,
185-
"const operands for inline assembly are unstable",
186-
)
187-
.emit();
188-
}
189-
hir::InlineAsmOperand::Const {
190-
anon_const: self.lower_anon_const_to_anon_const(anon_const),
191-
}
192-
}
186+
InlineAsmOperand::Const { anon_const } => hir::InlineAsmOperand::Const {
187+
anon_const: self.lower_anon_const_to_anon_const(anon_const),
188+
},
193189
InlineAsmOperand::Sym { sym } => {
194190
let static_def_id = self
195191
.resolver
@@ -246,7 +242,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
246242
sess,
247243
sym::asm_goto,
248244
*op_sp,
249-
"label operands for inline assembly are unstable",
245+
fluent::ast_lowering_unstable_inline_assembly_label_operands,
250246
)
251247
.emit();
252248
}

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use super::{
2323
ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs, ResolverAstLoweringExt,
2424
};
2525
use crate::errors::YieldInClosure;
26-
use crate::{FnDeclKind, ImplTraitPosition};
26+
use crate::{fluent_generated, FnDeclKind, ImplTraitPosition};
2727

2828
impl<'hir> LoweringContext<'_, 'hir> {
2929
fn lower_exprs(&mut self, exprs: &[AstP<Expr>]) -> &'hir [hir::Expr<'hir>] {
@@ -1540,7 +1540,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
15401540
}
15411541
}
15421542

1543-
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
15441543
fn lower_expr_yield(&mut self, span: Span, opt_expr: Option<&Expr>) -> hir::ExprKind<'hir> {
15451544
let yielded =
15461545
opt_expr.as_ref().map(|x| self.lower_expr(x)).unwrap_or_else(|| self.expr_unit(span));
@@ -1575,7 +1574,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
15751574
&self.tcx.sess,
15761575
sym::coroutines,
15771576
span,
1578-
"yield syntax is experimental",
1577+
fluent_generated::ast_lowering_yield,
15791578
)
15801579
.emit();
15811580
}
@@ -1587,7 +1586,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
15871586
&self.tcx.sess,
15881587
sym::coroutines,
15891588
span,
1590-
"yield syntax is experimental",
1589+
fluent_generated::ast_lowering_yield,
15911590
)
15921591
.emit();
15931592
}

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2326,7 +2326,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23262326
self.expr_block(block)
23272327
}
23282328

2329-
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
23302329
fn lower_array_length(&mut self, c: &AnonConst) -> hir::ArrayLen<'hir> {
23312330
match c.value.kind {
23322331
ExprKind::Underscore => {
@@ -2340,7 +2339,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23402339
&self.tcx.sess,
23412340
sym::generic_arg_infer,
23422341
c.value.span,
2343-
"using `_` for array lengths is unstable",
2342+
fluent_generated::ast_lowering_underscore_array_length_unstable,
23442343
)
23452344
.stash(c.value.span, StashKey::UnderscoreForArrayLengths);
23462345
hir::ArrayLen::Body(self.lower_anon_const_to_const_arg(c))

compiler/rustc_attr/messages.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ attr_unknown_meta_item =
104104
attr_unknown_version_literal =
105105
unknown version literal format, assuming it refers to a future version
106106
107+
attr_unstable_cfg_target_compact =
108+
compact `cfg(target(..))` is experimental and subject to change
109+
107110
attr_unsupported_literal_cfg_string =
108111
literal in `cfg` predicate value must be a string
109112
attr_unsupported_literal_deprecated_kv_pair =

compiler/rustc_attr/src/builtin.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use rustc_span::hygiene::Transparency;
2020
use rustc_span::symbol::{sym, Symbol};
2121
use rustc_span::Span;
2222

23+
use crate::fluent_generated;
2324
use crate::session_diagnostics::{self, IncorrectReprFormatGenericCause};
2425

2526
/// The version placeholder that recently stabilized features contain inside the
@@ -521,7 +522,6 @@ pub struct Condition {
521522
}
522523

523524
/// Tests if a cfg-pattern matches the cfg set
524-
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
525525
pub fn cfg_matches(
526526
cfg: &ast::MetaItem,
527527
sess: &Session,
@@ -593,7 +593,6 @@ pub fn parse_version(s: Symbol) -> Option<RustcVersion> {
593593

594594
/// Evaluate a cfg-like condition (with `any` and `all`), using `eval` to
595595
/// evaluate individual items.
596-
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
597596
pub fn eval_condition(
598597
cfg: &ast::MetaItem,
599598
sess: &Session,
@@ -680,7 +679,7 @@ pub fn eval_condition(
680679
sess,
681680
sym::cfg_target_compact,
682681
cfg.span,
683-
"compact `cfg(target(..))` is experimental and subject to change",
682+
fluent_generated::attr_unstable_cfg_target_compact,
684683
)
685684
.emit();
686685
}

compiler/rustc_borrowck/messages.ftl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ borrowck_could_not_normalize =
6262
borrowck_could_not_prove =
6363
could not prove `{$predicate}`
6464
65+
borrowck_dereference_suggestion =
66+
dereference the return value
67+
6568
borrowck_func_take_self_moved_place =
6669
`{$func}` takes ownership of the receiver `self`, which moves {$place_name}
6770
@@ -74,9 +77,24 @@ borrowck_higher_ranked_lifetime_error =
7477
borrowck_higher_ranked_subtype_error =
7578
higher-ranked subtype error
7679
80+
borrowck_implicit_static =
81+
this has an implicit `'static` lifetime requirement
82+
83+
borrowck_implicit_static_introduced =
84+
calling this method introduces the `impl`'s `'static` requirement
85+
86+
borrowck_implicit_static_relax =
87+
consider relaxing the implicit `'static` requirement
88+
7789
borrowck_lifetime_constraints_error =
7890
lifetime may not live long enough
7991
92+
borrowck_limitations_implies_static =
93+
due to current limitations in the borrow checker, this implies a `'static` lifetime
94+
95+
borrowck_move_closure_suggestion =
96+
consider adding 'move' keyword before the nested closure
97+
8098
borrowck_move_out_place_here =
8199
{$place} is moved here
82100
@@ -163,6 +181,9 @@ borrowck_partial_var_move_by_use_in_coroutine =
163181
*[false] moved
164182
} due to use in coroutine
165183
184+
borrowck_restrict_to_static =
185+
consider restricting the type parameter to the `'static` lifetime
186+
166187
borrowck_returned_async_block_escaped =
167188
returns an `async` block that contains a reference to a captured variable, which then escapes the closure body
168189

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3989,7 +3989,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
39893989
} else {
39903990
let ty = self.infcx.tcx.type_of(self.mir_def_id()).instantiate_identity();
39913991
match ty.kind() {
3992-
ty::FnDef(_, _) | ty::FnPtr(_) => self.annotate_fn_sig(
3992+
ty::FnDef(_, _) | ty::FnPtr(..) => self.annotate_fn_sig(
39933993
self.mir_def_id(),
39943994
self.infcx.tcx.fn_sig(self.mir_def_id()).instantiate_identity(),
39953995
),

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#![allow(rustc::diagnostic_outside_of_impl)]
44
#![allow(rustc::untranslatable_diagnostic)]
55

6+
use std::assert_matches::assert_matches;
7+
68
use rustc_errors::{Applicability, Diag};
79
use rustc_hir as hir;
810
use rustc_hir::intravisit::Visitor;
@@ -116,7 +118,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
116118
// path_span must be `Some` as otherwise the if condition is true
117119
let path_span = path_span.unwrap();
118120
// path_span is only present in the case of closure capture
119-
assert!(matches!(later_use_kind, LaterUseKind::ClosureCapture));
121+
assert_matches!(later_use_kind, LaterUseKind::ClosureCapture);
120122
if !borrow_span.is_some_and(|sp| sp.overlaps(var_or_use_span)) {
121123
let path_label = "used here by closure";
122124
let capture_kind_label = message;
@@ -147,7 +149,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
147149
// path_span must be `Some` as otherwise the if condition is true
148150
let path_span = path_span.unwrap();
149151
// path_span is only present in the case of closure capture
150-
assert!(matches!(later_use_kind, LaterUseKind::ClosureCapture));
152+
assert_matches!(later_use_kind, LaterUseKind::ClosureCapture);
151153
if borrow_span.map(|sp| !sp.overlaps(var_or_use_span)).unwrap_or(true) {
152154
let path_label = "used here by closure";
153155
let capture_kind_label = message;

0 commit comments

Comments
 (0)