Skip to content

Commit

Permalink
Auto merge of rust-lang#3803 - RalfJung:rustup, r=RalfJung
Browse files Browse the repository at this point in the history
Rustup
  • Loading branch information
bors committed Aug 14, 2024
2 parents 6ff09af + db3f921 commit f25ca7e
Show file tree
Hide file tree
Showing 677 changed files with 9,038 additions and 5,211 deletions.
10 changes: 10 additions & 0 deletions compiler/rustc_ast_lowering/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,21 @@ ast_lowering_template_modifier = template modifier
ast_lowering_this_not_async = this is not `async`
ast_lowering_underscore_array_length_unstable =
using `_` for array lengths is unstable
ast_lowering_underscore_expr_lhs_assign =
in expressions, `_` can only be used on the left-hand side of an assignment
.label = `_` not allowed here
ast_lowering_unstable_inline_assembly = inline assembly is not stable yet on this architecture
ast_lowering_unstable_inline_assembly_label_operands =
label operands for inline assembly are unstable
ast_lowering_unstable_may_unwind = the `may_unwind` option is unstable
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
36 changes: 16 additions & 20 deletions compiler/rustc_ast_lowering/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ use super::errors::{
InvalidRegisterClass, RegisterClassOnlyClobber, RegisterConflict,
};
use super::LoweringContext;
use crate::{ImplTraitContext, ImplTraitPosition, ParamMode, ResolverAstLoweringExt};
use crate::{
fluent_generated as fluent, ImplTraitContext, ImplTraitPosition, ParamMode,
ResolverAstLoweringExt,
};

impl<'a, 'hir> LoweringContext<'a, 'hir> {
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
pub(crate) fn lower_inline_asm(
&mut self,
sp: Span,
Expand Down Expand Up @@ -52,7 +54,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
&self.tcx.sess,
sym::asm_experimental_arch,
sp,
"inline assembly is not stable yet on this architecture",
fluent::ast_lowering_unstable_inline_assembly,
)
.emit();
}
Expand All @@ -64,8 +66,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
self.dcx().emit_err(AttSyntaxOnlyX86 { span: sp });
}
if asm.options.contains(InlineAsmOptions::MAY_UNWIND) && !self.tcx.features().asm_unwind {
feature_err(&self.tcx.sess, sym::asm_unwind, sp, "the `may_unwind` option is unstable")
.emit();
feature_err(
&self.tcx.sess,
sym::asm_unwind,
sp,
fluent::ast_lowering_unstable_may_unwind,
)
.emit();
}

let mut clobber_abis = FxIndexMap::default();
Expand Down Expand Up @@ -176,20 +183,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
out_expr: out_expr.as_ref().map(|expr| self.lower_expr(expr)),
}
}
InlineAsmOperand::Const { anon_const } => {
if !self.tcx.features().asm_const {
feature_err(
sess,
sym::asm_const,
*op_sp,
"const operands for inline assembly are unstable",
)
.emit();
}
hir::InlineAsmOperand::Const {
anon_const: self.lower_anon_const_to_anon_const(anon_const),
}
}
InlineAsmOperand::Const { anon_const } => hir::InlineAsmOperand::Const {
anon_const: self.lower_anon_const_to_anon_const(anon_const),
},
InlineAsmOperand::Sym { sym } => {
let static_def_id = self
.resolver
Expand Down Expand Up @@ -246,7 +242,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
sess,
sym::asm_goto,
*op_sp,
"label operands for inline assembly are unstable",
fluent::ast_lowering_unstable_inline_assembly_label_operands,
)
.emit();
}
Expand Down
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
3 changes: 1 addition & 2 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2326,7 +2326,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
self.expr_block(block)
}

#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
fn lower_array_length(&mut self, c: &AnonConst) -> hir::ArrayLen<'hir> {
match c.value.kind {
ExprKind::Underscore => {
Expand All @@ -2340,7 +2339,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
&self.tcx.sess,
sym::generic_arg_infer,
c.value.span,
"using `_` for array lengths is unstable",
fluent_generated::ast_lowering_underscore_array_length_unstable,
)
.stash(c.value.span, StashKey::UnderscoreForArrayLengths);
hir::ArrayLen::Body(self.lower_anon_const_to_const_arg(c))
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_attr/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ attr_unknown_meta_item =
attr_unknown_version_literal =
unknown version literal format, assuming it refers to a future version
attr_unstable_cfg_target_compact =
compact `cfg(target(..))` is experimental and subject to change
attr_unsupported_literal_cfg_string =
literal in `cfg` predicate value must be a string
attr_unsupported_literal_deprecated_kv_pair =
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_attr/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use rustc_span::hygiene::Transparency;
use rustc_span::symbol::{sym, Symbol};
use rustc_span::Span;

use crate::fluent_generated;
use crate::session_diagnostics::{self, IncorrectReprFormatGenericCause};

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

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

/// Evaluate a cfg-like condition (with `any` and `all`), using `eval` to
/// evaluate individual items.
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
pub fn eval_condition(
cfg: &ast::MetaItem,
sess: &Session,
Expand Down Expand Up @@ -680,7 +679,7 @@ pub fn eval_condition(
sess,
sym::cfg_target_compact,
cfg.span,
"compact `cfg(target(..))` is experimental and subject to change",
fluent_generated::attr_unstable_cfg_target_compact,
)
.emit();
}
Expand Down
21 changes: 21 additions & 0 deletions compiler/rustc_borrowck/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ borrowck_could_not_normalize =
borrowck_could_not_prove =
could not prove `{$predicate}`
borrowck_dereference_suggestion =
dereference the return value
borrowck_func_take_self_moved_place =
`{$func}` takes ownership of the receiver `self`, which moves {$place_name}
Expand All @@ -74,9 +77,24 @@ borrowck_higher_ranked_lifetime_error =
borrowck_higher_ranked_subtype_error =
higher-ranked subtype error
borrowck_implicit_static =
this has an implicit `'static` lifetime requirement
borrowck_implicit_static_introduced =
calling this method introduces the `impl`'s `'static` requirement
borrowck_implicit_static_relax =
consider relaxing the implicit `'static` requirement
borrowck_lifetime_constraints_error =
lifetime may not live long enough
borrowck_limitations_implies_static =
due to current limitations in the borrow checker, this implies a `'static` lifetime
borrowck_move_closure_suggestion =
consider adding 'move' keyword before the nested closure
borrowck_move_out_place_here =
{$place} is moved here
Expand Down Expand Up @@ -163,6 +181,9 @@ borrowck_partial_var_move_by_use_in_coroutine =
*[false] moved
} due to use in coroutine
borrowck_restrict_to_static =
consider restricting the type parameter to the `'static` lifetime
borrowck_returned_async_block_escaped =
returns an `async` block that contains a reference to a captured variable, which then escapes the closure body
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3989,7 +3989,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
} else {
let ty = self.infcx.tcx.type_of(self.mir_def_id()).instantiate_identity();
match ty.kind() {
ty::FnDef(_, _) | ty::FnPtr(_) => self.annotate_fn_sig(
ty::FnDef(_, _) | ty::FnPtr(..) => self.annotate_fn_sig(
self.mir_def_id(),
self.infcx.tcx.fn_sig(self.mir_def_id()).instantiate_identity(),
),
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]

use std::assert_matches::assert_matches;

use rustc_errors::{Applicability, Diag};
use rustc_hir as hir;
use rustc_hir::intravisit::Visitor;
Expand Down Expand Up @@ -116,7 +118,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
// path_span must be `Some` as otherwise the if condition is true
let path_span = path_span.unwrap();
// path_span is only present in the case of closure capture
assert!(matches!(later_use_kind, LaterUseKind::ClosureCapture));
assert_matches!(later_use_kind, LaterUseKind::ClosureCapture);
if !borrow_span.is_some_and(|sp| sp.overlaps(var_or_use_span)) {
let path_label = "used here by closure";
let capture_kind_label = message;
Expand Down Expand Up @@ -147,7 +149,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
// path_span must be `Some` as otherwise the if condition is true
let path_span = path_span.unwrap();
// path_span is only present in the case of closure capture
assert!(matches!(later_use_kind, LaterUseKind::ClosureCapture));
assert_matches!(later_use_kind, LaterUseKind::ClosureCapture);
if borrow_span.map(|sp| !sp.overlaps(var_or_use_span)).unwrap_or(true) {
let path_label = "used here by closure";
let capture_kind_label = message;
Expand Down
Loading

0 comments on commit f25ca7e

Please sign in to comment.