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 4 pull requests #118957

Merged
merged 19 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
43a0f55
Remove unused `Handler::treat_err_as_bug`.
nnethercote Dec 14, 2023
dc05a30
Inline and remove `HandlerInner::emit_diag_at_span`.
nnethercote Dec 13, 2023
7bdb227
Avoid `struct_diagnostic` where possible.
nnethercote Dec 13, 2023
e3b7ecc
Remove one use of `span_bug_no_panic`.
nnethercote Dec 13, 2023
428395e
Move rustc_codegen_ssa target features to rustc_target
Urgau Dec 12, 2023
acac133
Use all the known features in check-cfg
Urgau Dec 12, 2023
c355040
Don't forget pure rustc target features in check-cfg
Urgau Dec 12, 2023
3ea1331
Fix target_feature config in portable-simd
Urgau Dec 12, 2023
4cb2a28
update measureme to 10.1.2 to deduplicate parking_lot
lqd Dec 14, 2023
05b64a8
remove `instant` from allowed dependencies
lqd Dec 14, 2023
3c17514
Use the Waker::noop API in tests
compiler-errors Dec 14, 2023
19d28a4
Change `msg: impl Into<String>` for bug diagnostics.
nnethercote Dec 14, 2023
b0d5b44
Avoid `DiagnosticBuilder::<T>::new` calls.
nnethercote Dec 13, 2023
2c2c7f1
Remove `Handler::emit_diag_at_span`.
nnethercote Dec 13, 2023
9a78412
Split `Handler::emit_diagnostic` in two.
nnethercote Dec 14, 2023
576a74b
Rollup merge of #118908 - Urgau:check-cfg-target-features, r=TaKO8Ki,…
workingjubilee Dec 15, 2023
9e872b7
Rollup merge of #118933 - nnethercote:cleanup-errors-even-more, r=com…
workingjubilee Dec 15, 2023
b62511f
Rollup merge of #118943 - lqd:update-deps2, r=michaelwoerister
workingjubilee Dec 15, 2023
9648c48
Rollup merge of #118948 - compiler-errors:noop, r=eholk
workingjubilee Dec 15, 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
43 changes: 9 additions & 34 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ dependencies = [
"futures",
"if_chain",
"itertools",
"parking_lot 0.12.1",
"parking_lot",
"quote",
"regex",
"rustc_tools_util",
Expand Down Expand Up @@ -2356,13 +2356,13 @@ dependencies = [

[[package]]
name = "measureme"
version = "10.1.1"
version = "10.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1930d162935fecd56fc4e0f6729eb3483bac1264542eb4ea31570b86a434b6bc"
checksum = "45e381dcdad44c3c435f8052b08c5c4a1449c48ab56f312345eae12d7a693dbe"
dependencies = [
"log",
"memmap2",
"parking_lot 0.11.2",
"parking_lot",
"perf-event-open-sys",
"rustc-hash",
"smallvec",
Expand Down Expand Up @@ -2780,39 +2780,14 @@ dependencies = [
"unicode-width",
]

[[package]]
name = "parking_lot"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [
"instant",
"lock_api",
"parking_lot_core 0.8.6",
]

[[package]]
name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core 0.9.8",
]

[[package]]
name = "parking_lot_core"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc"
dependencies = [
"cfg-if",
"instant",
"libc",
"redox_syscall 0.2.16",
"smallvec",
"winapi",
"parking_lot_core",
]

[[package]]
Expand Down Expand Up @@ -3682,7 +3657,7 @@ dependencies = [
"libc",
"measureme",
"memmap2",
"parking_lot 0.12.1",
"parking_lot",
"portable-atomic",
"rustc-hash",
"rustc-rayon",
Expand Down Expand Up @@ -4417,7 +4392,7 @@ dependencies = [
name = "rustc_query_system"
version = "0.0.0"
dependencies = [
"parking_lot 0.12.1",
"parking_lot",
"rustc-rayon-core",
"rustc_ast",
"rustc_data_structures",
Expand Down Expand Up @@ -5134,7 +5109,7 @@ checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b"
dependencies = [
"new_debug_unreachable",
"once_cell",
"parking_lot 0.12.1",
"parking_lot",
"phf_shared",
"precomputed-hash",
"serde",
Expand Down Expand Up @@ -5659,7 +5634,7 @@ dependencies = [
"matchers",
"nu-ansi-term",
"once_cell",
"parking_lot 0.12.1",
"parking_lot",
"regex",
"sharded-slab",
"smallvec",
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2502,8 +2502,8 @@ mod error {
if !self.errors.buffered.is_empty() {
self.errors.buffered.sort_by_key(|diag| diag.sort_span);

for mut diag in self.errors.buffered.drain(..) {
self.infcx.tcx.sess.diagnostic().emit_diagnostic(&mut diag);
for diag in self.errors.buffered.drain(..) {
self.infcx.tcx.sess.diagnostic().emit_diagnostic(diag);
}
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_builtin_macros/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ impl<'a> IntoDiagnostic<'a> for EnvNotDefinedWithUserMessage {
rustc::untranslatable_diagnostic,
reason = "cannot translate user-provided messages"
)]
let mut diag = handler.struct_diagnostic(self.msg_from_user.to_string());
let mut diag = handler.struct_err(self.msg_from_user.to_string());
diag.set_span(self.span);
diag
}
Expand Down Expand Up @@ -804,7 +804,7 @@ pub(crate) struct AsmClobberNoReg {
impl<'a> IntoDiagnostic<'a> for AsmClobberNoReg {
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
let mut diag =
handler.struct_diagnostic(crate::fluent_generated::builtin_macros_asm_clobber_no_reg);
handler.struct_err(crate::fluent_generated::builtin_macros_asm_clobber_no_reg);
diag.set_span(self.spans.clone());
// eager translation as `span_labels` takes `AsRef<str>`
let lbl1 = handler.eagerly_translate_to_string(
Expand Down
8 changes: 3 additions & 5 deletions compiler/rustc_codegen_gcc/src/gcc_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
use gccjit::Context;
use smallvec::{smallvec, SmallVec};

use rustc_codegen_ssa::target_features::{
supported_target_features, tied_target_features, RUSTC_SPECIFIC_FEATURES,
};
use rustc_data_structures::fx::FxHashMap;
use rustc_middle::bug;
use rustc_session::Session;
use rustc_target::target_features::RUSTC_SPECIFIC_FEATURES;

use crate::errors::{PossibleFeature, TargetFeatureDisableOrEnable, UnknownCTargetFeature, UnknownCTargetFeaturePrefix};

Expand Down Expand Up @@ -44,7 +42,7 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri
);

// -Ctarget-features
let supported_features = supported_target_features(sess);
let supported_features = sess.target.supported_target_features();
let mut featsmap = FxHashMap::default();
let feats = sess.opts.cg.target_feature
.split(',')
Expand Down Expand Up @@ -187,7 +185,7 @@ pub fn to_gcc_features<'a>(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]>
// Given a map from target_features to whether they are enabled or disabled,
// ensure only valid combinations are allowed.
pub fn check_tied_features(sess: &Session, features: &FxHashMap<&str, bool>) -> Option<&'static [&'static str]> {
for tied in tied_target_features(sess) {
for tied in sess.target.tied_target_features() {
// Tied features must be set to the same value, or not set at all
let mut tied_iter = tied.iter();
let enabled = features.get(tied_iter.next().unwrap());
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_codegen_gcc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ use rustc_codegen_ssa::{CodegenResults, CompiledModule, ModuleCodegen};
use rustc_codegen_ssa::base::codegen_crate;
use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput, ModuleConfig, TargetMachineFactoryFn};
use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
use rustc_codegen_ssa::target_features::supported_target_features;
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::sync::IntoDynSyncSend;
use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ThinBufferMethods, WriteBackendMethods};
Expand Down Expand Up @@ -397,7 +396,9 @@ fn to_gcc_opt_level(optlevel: Option<OptLevel>) -> OptimizationLevel {
}

pub fn target_features(sess: &Session, allow_unstable: bool, target_info: &LockedTargetInfo) -> Vec<Symbol> {
supported_target_features(sess)
sess
.target
.supported_target_features()
.iter()
.filter_map(
|&(feature, gate)| {
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_llvm/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ impl IntoDiagnostic<'_, FatalError> for ParseTargetMachineConfig<'_> {
let (message, _) = diag.styled_message().first().expect("`LlvmError` with no message");
let message = handler.eagerly_translate_to_string(message.clone(), diag.args());

let mut diag = handler.struct_diagnostic(fluent::codegen_llvm_parse_target_machine_config);
let mut diag =
handler.struct_almost_fatal(fluent::codegen_llvm_parse_target_machine_config);
diag.set_arg("error", message);
diag
}
Expand Down
15 changes: 8 additions & 7 deletions compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ use crate::errors::{
};
use crate::llvm;
use libc::c_int;
use rustc_codegen_ssa::target_features::{
supported_target_features, tied_target_features, RUSTC_SPECIFIC_FEATURES,
};
use rustc_codegen_ssa::traits::PrintBackendInfo;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::small_c_str::SmallCStr;
Expand All @@ -17,6 +14,7 @@ use rustc_session::config::{PrintKind, PrintRequest};
use rustc_session::Session;
use rustc_span::symbol::Symbol;
use rustc_target::spec::{MergeFunctions, PanicStrategy};
use rustc_target::target_features::RUSTC_SPECIFIC_FEATURES;

use std::ffi::{c_char, c_void, CStr, CString};
use std::path::Path;
Expand Down Expand Up @@ -278,7 +276,7 @@ pub fn check_tied_features(
features: &FxHashMap<&str, bool>,
) -> Option<&'static [&'static str]> {
if !features.is_empty() {
for tied in tied_target_features(sess) {
for tied in sess.target.tied_target_features() {
// Tied features must be set to the same value, or not set at all
let mut tied_iter = tied.iter();
let enabled = features.get(tied_iter.next().unwrap());
Expand All @@ -294,7 +292,8 @@ pub fn check_tied_features(
/// Must express features in the way Rust understands them
pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
let target_machine = create_informational_target_machine(sess);
supported_target_features(sess)
sess.target
.supported_target_features()
.iter()
.filter_map(|&(feature, gate)| {
if sess.is_nightly_build() || allow_unstable || gate.is_stable() {
Expand Down Expand Up @@ -362,7 +361,9 @@ fn llvm_target_features(tm: &llvm::TargetMachine) -> Vec<(&str, &str)> {
fn print_target_features(out: &mut dyn PrintBackendInfo, sess: &Session, tm: &llvm::TargetMachine) {
let mut llvm_target_features = llvm_target_features(tm);
let mut known_llvm_target_features = FxHashSet::<&'static str>::default();
let mut rustc_target_features = supported_target_features(sess)
let mut rustc_target_features = sess
.target
.supported_target_features()
.iter()
.map(|(feature, _gate)| {
// LLVM asserts that these are sorted. LLVM and Rust both use byte comparison for these strings.
Expand Down Expand Up @@ -515,7 +516,7 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
);

// -Ctarget-features
let supported_features = supported_target_features(sess);
let supported_features = sess.target.supported_target_features();
let mut featsmap = FxHashMap::default();
let feats = sess
.opts
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,7 @@ impl SharedEmitterMain {
d.code(code);
}
d.replace_args(diag.args);
handler.emit_diagnostic(&mut d);
handler.emit_diagnostic(d);
}
Ok(SharedEmitterMessage::InlineAsmError(cookie, msg, level, source)) => {
let msg = msg.strip_prefix("error: ").unwrap_or(&msg).to_string();
Expand Down
Loading
Loading