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

Rollup of 6 pull requests #108317

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6506837
Add mir-opt test.
cjgillot Feb 18, 2023
7213eaa
Flood aggregate assignments with `Top`.
cjgillot Feb 18, 2023
efb4688
Use the correct place for enum variants.
cjgillot Feb 18, 2023
c13d5f1
Make sure test_type_match doesn't ICE with late-bound types
compiler-errors Feb 18, 2023
9b27e4e
Define the `named_static_lifetimes` lint
jeremydavis519 Jun 14, 2022
17a7ccc
Merge branch 'master' into enhance/warning
LittleFall Feb 19, 2023
f043106
fix build
LittleFall Feb 19, 2023
0be2da3
use "UNUSED_LIFETIMES" instead
LittleFall Feb 19, 2023
c40ec11
update 1 test and fix typo
LittleFall Feb 20, 2023
f337a79
update tests
LittleFall Feb 20, 2023
5fb9c8b
fix tests: add extra blank line
LittleFall Feb 20, 2023
a58682d
Specify what 'this' actually is
compiler-errors Feb 21, 2023
271fcbb
errors: generate typed identifiers in each crate
davidtwco Oct 13, 2022
8e0db2d
errors: fix translation's run-make test
davidtwco Oct 17, 2022
9146879
various: translation resources from cg backend
davidtwco Oct 17, 2022
6e34e65
Fix compiletest crash when test file path does not exist
chenyukang Feb 21, 2023
a0711f0
Rollup merge of #103042 - davidtwco:translation-distributed-ftl, r=ol…
compiler-errors Feb 21, 2023
ef0642a
Rollup merge of #108202 - compiler-errors:non_lifetime_binders-type-m…
compiler-errors Feb 21, 2023
ff1bd3d
Rollup merge of #108208 - cjgillot:flood-enum, r=oli-obk
compiler-errors Feb 21, 2023
f9d71d2
Rollup merge of #108230 - LittleFall:enhance/warning, r=estebank
compiler-errors Feb 21, 2023
c4d5cb4
Rollup merge of #108295 - compiler-errors:wtf-is-this, r=cjgillot
compiler-errors Feb 21, 2023
f047f6a
Rollup merge of #108313 - chenyukang:yukang/fix-only-modified, r=oli-obk
compiler-errors Feb 21, 2023
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
21 changes: 21 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3920,26 +3920,47 @@ version = "0.0.0"
dependencies = [
"libc",
"rustc_ast",
"rustc_ast_lowering",
"rustc_ast_passes",
"rustc_ast_pretty",
"rustc_attr",
"rustc_borrowck",
"rustc_builtin_macros",
"rustc_codegen_ssa",
"rustc_const_eval",
"rustc_data_structures",
"rustc_error_codes",
"rustc_error_messages",
"rustc_errors",
"rustc_expand",
"rustc_feature",
"rustc_hir",
"rustc_hir_analysis",
"rustc_hir_pretty",
"rustc_hir_typeck",
"rustc_incremental",
"rustc_infer",
"rustc_interface",
"rustc_lint",
"rustc_log",
"rustc_macros",
"rustc_metadata",
"rustc_middle",
"rustc_mir_build",
"rustc_mir_dataflow",
"rustc_monomorphize",
"rustc_parse",
"rustc_passes",
"rustc_plugin_impl",
"rustc_privacy",
"rustc_query_system",
"rustc_resolve",
"rustc_session",
"rustc_span",
"rustc_symbol_mangling",
"rustc_target",
"rustc_trait_selection",
"rustc_ty_utils",
"serde_json",
"tracing",
"winapi",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ pub struct InclusiveRangeWithNoEnd {
#[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering_trait_fn_async, code = "E0706")]
#[note]
#[note(note2)]
#[note(ast_lowering_note2)]
pub struct TraitFnAsync {
#[primary_span]
pub fn_span: Span,
Expand Down
13 changes: 10 additions & 3 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,20 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sorted_map::SortedMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_data_structures::sync::Lrc;
use rustc_errors::{DiagnosticArgFromDisplay, Handler, StashKey};
use rustc_errors::{
DiagnosticArgFromDisplay, DiagnosticMessage, Handler, StashKey, SubdiagnosticMessage,
};
use rustc_hir as hir;
use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
use rustc_hir::definitions::DefPathData;
use rustc_hir::{ConstArg, GenericArg, ItemLocalId, ParamName, TraitCandidate};
use rustc_index::vec::{Idx, IndexVec};
use rustc_middle::span_bug;
use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
use rustc_macros::fluent_messages;
use rustc_middle::{
span_bug,
ty::{ResolverAstLowering, TyCtxt},
};
use rustc_session::parse::feature_err;
use rustc_span::hygiene::MacroKind;
use rustc_span::source_map::DesugaringKind;
Expand All @@ -87,6 +92,8 @@ mod lifetime_collector;
mod pat;
mod path;

fluent_messages! { "../locales/en-US.ftl" }

struct LoweringContext<'a, 'hir> {
tcx: TyCtxt<'hir>,
resolver: &'a mut ResolverAstLowering,
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use rustc_ast::walk_list;
use rustc_ast::*;
use rustc_ast_pretty::pprust::{self, State};
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::{error_code, fluent, pluralize, struct_span_err, Applicability};
use rustc_errors::{error_code, pluralize, struct_span_err, Applicability};
use rustc_macros::Subdiagnostic;
use rustc_parse::validate_attr;
use rustc_session::lint::builtin::{
Expand All @@ -30,6 +30,7 @@ use std::ops::{Deref, DerefMut};
use thin_vec::thin_vec;

use crate::errors::*;
use crate::fluent_generated as fluent;

const MORE_EXTERN: &str =
"for more information, visit https://doc.rust-lang.org/std/keyword.extern.html";
Expand Down Expand Up @@ -1723,12 +1724,12 @@ pub(crate) enum ForbiddenLetReason {
/// `let` is not valid and the source environment is not important
GenericForbidden,
/// A let chain with the `||` operator
#[note(not_supported_or)]
#[note(ast_passes_not_supported_or)]
NotSupportedOr(#[primary_span] Span),
/// A let chain with invalid parentheses
///
/// For example, `let 1 = 1 && (expr && expr)` is allowed
/// but `(let 1 = 1 && (let 1 = 1 && (let 1 = 1))) && let a = 1` is not
#[note(not_supported_parentheses)]
#[note(ast_passes_not_supported_parentheses)]
NotSupportedParentheses(#[primary_span] Span),
}
6 changes: 3 additions & 3 deletions compiler/rustc_ast_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ pub struct InvalidLabel {
pub struct InvalidVisibility {
#[primary_span]
pub span: Span,
#[label(implied)]
#[label(ast_passes_implied)]
pub implied: Option<Span>,
#[subdiagnostic]
pub note: Option<InvalidVisibilityNote>,
}

#[derive(Subdiagnostic)]
pub enum InvalidVisibilityNote {
#[note(individual_impl_items)]
#[note(ast_passes_individual_impl_items)]
IndividualImplItems,
#[note(individual_foreign_items)]
#[note(ast_passes_individual_foreign_items)]
IndividualForeignItems,
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl<'a> PostExpansionVisitor<'a> {
&self.sess.parse_sess,
sym::non_lifetime_binders,
non_lt_param_spans,
rustc_errors::fluent::ast_passes_forbidden_non_lifetime_param,
crate::fluent_generated::ast_passes_forbidden_non_lifetime_param,
)
.emit();
}
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_ast_passes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@
#![feature(let_chains)]
#![recursion_limit = "256"]

use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;

pub mod ast_validation;
mod errors;
pub mod feature_gate;
pub mod node_count;
pub mod show_span;

fluent_messages! { "../locales/en-US.ftl" }
5 changes: 5 additions & 0 deletions compiler/rustc_attr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#[macro_use]
extern crate rustc_macros;

use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;

mod builtin;
mod session_diagnostics;

Expand All @@ -22,3 +25,5 @@ pub use StabilityLevel::*;
pub use rustc_ast::attr::*;

pub(crate) use rustc_ast::HashStableContext;

fluent_messages! { "../locales/en-US.ftl" }
19 changes: 10 additions & 9 deletions compiler/rustc_attr/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ use std::num::IntErrorKind;

use rustc_ast as ast;
use rustc_errors::{
error_code, fluent, Applicability, DiagnosticBuilder, ErrorGuaranteed, Handler, IntoDiagnostic,
error_code, Applicability, DiagnosticBuilder, ErrorGuaranteed, Handler, IntoDiagnostic,
};
use rustc_macros::Diagnostic;
use rustc_span::{Span, Symbol};

use crate::fluent_generated as fluent;
use crate::UnsupportedLiteralReason;

#[derive(Diagnostic)]
Expand Down Expand Up @@ -59,7 +60,7 @@ impl<'a> IntoDiagnostic<'a> for UnknownMetaItem<'_> {
);
diag.set_arg("item", self.item);
diag.set_arg("expected", expected.join(", "));
diag.span_label(self.span, fluent::label);
diag.span_label(self.span, fluent::attr_label);
diag
}
}
Expand Down Expand Up @@ -99,31 +100,31 @@ pub(crate) struct InvalidIssueString {
// translatable.
#[derive(Subdiagnostic)]
pub(crate) enum InvalidIssueStringCause {
#[label(must_not_be_zero)]
#[label(attr_must_not_be_zero)]
MustNotBeZero {
#[primary_span]
span: Span,
},

#[label(empty)]
#[label(attr_empty)]
Empty {
#[primary_span]
span: Span,
},

#[label(invalid_digit)]
#[label(attr_invalid_digit)]
InvalidDigit {
#[primary_span]
span: Span,
},

#[label(pos_overflow)]
#[label(attr_pos_overflow)]
PosOverflow {
#[primary_span]
span: Span,
},

#[label(neg_overflow)]
#[label(attr_neg_overflow)]
NegOverflow {
#[primary_span]
span: Span,
Expand Down Expand Up @@ -275,7 +276,7 @@ pub(crate) struct IncorrectReprFormatGeneric<'a> {

#[derive(Subdiagnostic)]
pub(crate) enum IncorrectReprFormatGenericCause<'a> {
#[suggestion(suggestion, code = "{name}({int})", applicability = "machine-applicable")]
#[suggestion(attr_suggestion, code = "{name}({int})", applicability = "machine-applicable")]
Int {
#[primary_span]
span: Span,
Expand All @@ -287,7 +288,7 @@ pub(crate) enum IncorrectReprFormatGenericCause<'a> {
int: u128,
},

#[suggestion(suggestion, code = "{name}({symbol})", applicability = "machine-applicable")]
#[suggestion(attr_suggestion, code = "{name}({symbol})", applicability = "machine-applicable")]
Symbol {
#[primary_span]
span: Span,
Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ extern crate tracing;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::graph::dominators::Dominators;
use rustc_data_structures::vec_map::VecMap;
use rustc_errors::{Diagnostic, DiagnosticBuilder};
use rustc_errors::{Diagnostic, DiagnosticBuilder, DiagnosticMessage, SubdiagnosticMessage};
use rustc_hir as hir;
use rustc_hir::def_id::LocalDefId;
use rustc_index::bit_set::ChunkedBitSet;
use rustc_index::vec::IndexVec;
use rustc_infer::infer::{DefiningAnchor, InferCtxt, TyCtxtInferExt};
use rustc_macros::fluent_messages;
use rustc_middle::mir::{
traversal, Body, ClearCrossCrate, Local, Location, Mutability, NonDivergingIntrinsic, Operand,
Place, PlaceElem, PlaceRef, VarDebugInfoContents,
Expand Down Expand Up @@ -95,6 +96,8 @@ use place_ext::PlaceExt;
use places_conflict::{places_conflict, PlaceConflictBias};
use region_infer::RegionInferenceContext;

fluent_messages! { "../locales/en-US.ftl" }

// FIXME(eddyb) perhaps move this somewhere more centrally.
#[derive(Debug)]
struct Upvar<'tcx> {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub(crate) struct VarNeedNotMut {
#[derive(Diagnostic)]
#[diag(borrowck_var_cannot_escape_closure)]
#[note]
#[note(cannot_escape)]
#[note(borrowck_cannot_escape)]
pub(crate) struct FnMutError {
#[primary_span]
pub span: Span,
Expand Down Expand Up @@ -223,7 +223,7 @@ pub(crate) struct MoveBorrow<'a> {
pub borrow_place: &'a str,
pub value_place: &'a str,
#[primary_span]
#[label(move_label)]
#[label(borrowck_move_label)]
pub span: Span,
#[label]
pub borrow_span: Span,
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_builtin_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ extern crate tracing;

use crate::deriving::*;

use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_expand::base::{MacroExpanderFn, ResolverExpand, SyntaxExtensionKind};
use rustc_expand::proc_macro::BangProcMacro;
use rustc_macros::fluent_messages;
use rustc_span::symbol::sym;

mod alloc_error_handler;
Expand Down Expand Up @@ -54,6 +56,8 @@ pub mod proc_macro_harness;
pub mod standard_library_imports;
pub mod test_harness;

fluent_messages! { "../locales/en-US.ftl" }

pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) {
let mut register = |name, kind| resolver.register_builtin_macro(name, kind);
macro register_bang($($name:ident: $f:expr,)*) {
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_codegen_cranelift/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ pub struct CraneliftCodegenBackend {
}

impl CodegenBackend for CraneliftCodegenBackend {
fn locale_resource(&self) -> &'static str {
// FIXME(rust-lang/rust#100717) - cranelift codegen backend is not yet translated
""
}

fn init(&self, sess: &Session) {
use rustc_session::config::Lto;
match sess.lto() {
Expand Down
9 changes: 8 additions & 1 deletion compiler/rustc_codegen_gcc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModul
use rustc_codegen_ssa::target_features::supported_target_features;
use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ModuleBufferMethods, ThinBufferMethods, WriteBackendMethods};
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::{ErrorGuaranteed, Handler};
use rustc_errors::{DiagnosticMessage, ErrorGuaranteed, Handler, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_metadata::EncodedMetadata;
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::ty::TyCtxt;
Expand All @@ -84,6 +85,8 @@ use rustc_span::Symbol;
use rustc_span::fatal_error::FatalError;
use tempfile::TempDir;

fluent_messages! { "../locales/en-US.ftl" }

pub struct PrintOnPanic<F: Fn() -> String>(pub F);

impl<F: Fn() -> String> Drop for PrintOnPanic<F> {
Expand All @@ -100,6 +103,10 @@ pub struct GccCodegenBackend {
}

impl CodegenBackend for GccCodegenBackend {
fn locale_resource(&self) -> &'static str {
crate::DEFAULT_LOCALE_RESOURCE
}

fn init(&self, sess: &Session) {
if sess.lto() != Lto::No {
sess.emit_warning(LTONotSupported {});
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_codegen_llvm/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use std::borrow::Cow;
use std::ffi::CString;
use std::path::Path;

use crate::fluent_generated as fluent;
use rustc_data_structures::small_c_str::SmallCStr;
use rustc_errors::{
fluent, DiagnosticBuilder, EmissionGuarantee, ErrorGuaranteed, Handler, IntoDiagnostic,
DiagnosticBuilder, EmissionGuarantee, ErrorGuaranteed, Handler, IntoDiagnostic,
};
use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_span::Span;
Expand All @@ -27,9 +28,9 @@ pub(crate) struct UnknownCTargetFeature<'a> {

#[derive(Subdiagnostic)]
pub(crate) enum PossibleFeature<'a> {
#[help(possible_feature)]
#[help(codegen_llvm_possible_feature)]
Some { rust_feature: &'a str },
#[help(consider_filing_feature_request)]
#[help(codegen_llvm_consider_filing_feature_request)]
None,
}

Expand Down
Loading