diff options
| author | bors <bors@rust-lang.org> | 2023-02-26 17:17:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-02-26 17:17:25 +0000 |
| commit | 56ac6bfc87cce22feffc079c0540c8774b00a5ca (patch) | |
| tree | e430c91fb4e29070945f79df7a47639e5cf4f9b1 /compiler/rustc_codegen_ssa/src | |
| parent | ffd12f67cfa28891bbd1fa81d5e80a128f346ace (diff) | |
| parent | cb45103358c0fef99d7659e0949b3c65b3eabdd6 (diff) | |
| download | rust-56ac6bfc87cce22feffc079c0540c8774b00a5ca.tar.gz rust-56ac6bfc87cce22feffc079c0540c8774b00a5ca.zip | |
Auto merge of #2803 - RalfJung:rustup, r=RalfJung
Rustup
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/linker.rs | 16 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/symbol_export.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/base.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/errors.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/lib.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/block.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/mod.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/rvalue.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/traits/backend.rs | 4 |
9 files changed, 27 insertions, 18 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index eaf1e9817c2..52c01b423a7 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -473,13 +473,13 @@ impl<'a> Linker for GccLinker<'a> { self.cmd.arg(path); } fn full_relro(&mut self) { - self.linker_args(&["-zrelro", "-znow"]); + self.linker_args(&["-z", "relro", "-z", "now"]); } fn partial_relro(&mut self) { - self.linker_arg("-zrelro"); + self.linker_args(&["-z", "relro"]); } fn no_relro(&mut self) { - self.linker_arg("-znorelro"); + self.linker_args(&["-z", "norelro"]); } fn link_rust_dylib(&mut self, lib: &str, _path: &Path) { @@ -758,7 +758,7 @@ impl<'a> Linker for GccLinker<'a> { if self.sess.target.is_like_windows { self.linker_arg("--nxcompat"); } else if self.is_gnu { - self.linker_arg("-znoexecstack"); + self.linker_args(&["-z", "noexecstack"]); } } @@ -1364,16 +1364,16 @@ impl<'a> Linker for L4Bender<'a> { } fn full_relro(&mut self) { - self.cmd.arg("-zrelro"); - self.cmd.arg("-znow"); + self.cmd.arg("-z").arg("relro"); + self.cmd.arg("-z").arg("now"); } fn partial_relro(&mut self) { - self.cmd.arg("-zrelro"); + self.cmd.arg("-z").arg("relro"); } fn no_relro(&mut self) { - self.cmd.arg("-znorelro"); + self.cmd.arg("-z").arg("norelro"); } fn cmd(&mut self) -> &mut Command { diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs index 11bd47a8f0c..067a3e167fe 100644 --- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs @@ -373,7 +373,7 @@ fn upstream_monomorphizations_provider( ExportedSymbol::Generic(def_id, substs) => (def_id, substs), ExportedSymbol::DropGlue(ty) => { if let Some(drop_in_place_fn_def_id) = drop_in_place_fn_def_id { - (drop_in_place_fn_def_id, tcx.intern_substs(&[ty.into()])) + (drop_in_place_fn_def_id, tcx.mk_substs(&[ty.into()])) } else { // `drop_in_place` in place does not exist, don't try // to use it. diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index 4e13d4dbcb7..73179249bc4 100644 --- a/compiler/rustc_codegen_ssa/src/base.rs +++ b/compiler/rustc_codegen_ssa/src/base.rs @@ -476,7 +476,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( cx.tcx(), ty::ParamEnv::reveal_all(), start_def_id, - cx.tcx().intern_substs(&[main_ret_ty.into()]), + cx.tcx().mk_substs(&[main_ret_ty.into()]), ) .unwrap() .unwrap(), diff --git a/compiler/rustc_codegen_ssa/src/errors.rs b/compiler/rustc_codegen_ssa/src/errors.rs index d81252653df..6dea7496fc3 100644 --- a/compiler/rustc_codegen_ssa/src/errors.rs +++ b/compiler/rustc_codegen_ssa/src/errors.rs @@ -1,8 +1,9 @@ //! Errors emitted by codegen_ssa use crate::back::command::Command; +use crate::fluent_generated as fluent; use rustc_errors::{ - fluent, DiagnosticArgValue, DiagnosticBuilder, ErrorGuaranteed, Handler, IntoDiagnostic, + DiagnosticArgValue, DiagnosticBuilder, ErrorGuaranteed, Handler, IntoDiagnostic, IntoDiagnosticArg, }; use rustc_macros::Diagnostic; @@ -388,7 +389,7 @@ pub struct LinkerNotFound { #[derive(Diagnostic)] #[diag(codegen_ssa_unable_to_exe_linker)] #[note] -#[note(command_note)] +#[note(codegen_ssa_command_note)] pub struct UnableToExeLinker { pub linker_path: PathBuf, pub error: Error, diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index 7d51cee307e..ebe9e50ffe6 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -25,7 +25,9 @@ extern crate rustc_middle; use rustc_ast as ast; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::Lrc; +use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage}; use rustc_hir::def_id::CrateNum; +use rustc_macros::fluent_messages; use rustc_middle::dep_graph::WorkProduct; use rustc_middle::middle::dependency_format::Dependencies; use rustc_middle::middle::exported_symbols::SymbolExportKind; @@ -54,6 +56,8 @@ pub mod mono_item; pub mod target_features; pub mod traits; +fluent_messages! { "../locales/en-US.ftl" } + pub struct ModuleCodegen<M> { /// The name of the module. When the crate may be saved between /// compilations, incremental compilation requires that name be diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index e105322a0b4..f6c1b7a98aa 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -16,7 +16,7 @@ use rustc_index::vec::Idx; use rustc_middle::mir::{self, AssertKind, SwitchTargets}; use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf}; use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths}; -use rustc_middle::ty::{self, Instance, Ty, TypeVisitable}; +use rustc_middle::ty::{self, Instance, Ty, TypeVisitableExt}; use rustc_session::config::OptLevel; use rustc_span::source_map::Span; use rustc_span::{sym, Symbol}; @@ -783,7 +783,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { }; let extra_args = &args[sig.inputs().skip_binder().len()..]; - let extra_args = bx.tcx().mk_type_list(extra_args.iter().map(|op_arg| { + let extra_args = bx.tcx().mk_type_list_from_iter(extra_args.iter().map(|op_arg| { let op_ty = op_arg.ty(self.mir, bx.tcx()); self.monomorphize(op_ty) })); @@ -1547,7 +1547,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { slot } else { let layout = cx.layout_of( - cx.tcx().intern_tup(&[cx.tcx().mk_mut_ptr(cx.tcx().types.u8), cx.tcx().types.i32]), + cx.tcx().mk_tup(&[cx.tcx().mk_mut_ptr(cx.tcx().types.u8), cx.tcx().types.i32]), ); let slot = PlaceRef::alloca(bx, layout); self.personality_slot = Some(slot); diff --git a/compiler/rustc_codegen_ssa/src/mir/mod.rs b/compiler/rustc_codegen_ssa/src/mir/mod.rs index eec91ffa44a..2ec9fdbf44f 100644 --- a/compiler/rustc_codegen_ssa/src/mir/mod.rs +++ b/compiler/rustc_codegen_ssa/src/mir/mod.rs @@ -3,7 +3,7 @@ use crate::traits::*; use rustc_middle::mir; use rustc_middle::mir::interpret::ErrorHandled; use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, TyAndLayout}; -use rustc_middle::ty::{self, Instance, Ty, TypeFoldable}; +use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable, TypeVisitableExt}; use rustc_target::abi::call::{FnAbi, PassMode}; use std::iter; @@ -105,7 +105,7 @@ pub struct FunctionCx<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> { impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { pub fn monomorphize<T>(&self, value: T) -> T where - T: Copy + TypeFoldable<'tcx>, + T: Copy + TypeFoldable<TyCtxt<'tcx>>, { debug!("monomorphize: self.instance={:?}", self.instance); self.instance.subst_mir_and_normalize_erasing_regions( diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs index 41cd1c09a4e..3d856986fb4 100644 --- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs +++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs @@ -413,7 +413,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { lhs.layout.ty, ); let val_ty = op.ty(bx.tcx(), lhs.layout.ty, rhs.layout.ty); - let operand_ty = bx.tcx().intern_tup(&[val_ty, bx.tcx().types.bool]); + let operand_ty = bx.tcx().mk_tup(&[val_ty, bx.tcx().types.bool]); OperandRef { val: result, layout: bx.cx().layout_of(operand_ty) } } diff --git a/compiler/rustc_codegen_ssa/src/traits/backend.rs b/compiler/rustc_codegen_ssa/src/traits/backend.rs index 5c35070ea66..64bebe50ddb 100644 --- a/compiler/rustc_codegen_ssa/src/traits/backend.rs +++ b/compiler/rustc_codegen_ssa/src/traits/backend.rs @@ -57,6 +57,10 @@ impl<'tcx, T> Backend<'tcx> for T where } pub trait CodegenBackend { + /// Locale resources for diagnostic messages - a string the content of the Fluent resource. + /// Called before `init` so that all other functions are able to emit translatable diagnostics. + fn locale_resource(&self) -> &'static str; + fn init(&self, _sess: &Session) {} fn print(&self, _req: PrintRequest, _sess: &Session) {} fn target_features(&self, _sess: &Session, _allow_unstable: bool) -> Vec<Symbol> { |
