Skip to content

Commit 03515c6

Browse files
committed
Auto merge of #118957 - workingjubilee:rollup-2hcwnp3, r=workingjubilee
Rollup of 4 pull requests Successful merges: - #118908 (Add all known `target_feature` configs to check-cfg) - #118933 (Cleanup errors handlers even more) - #118943 (update `measureme` to 10.1.2 to deduplicate `parking_lot`) - #118948 (Use the `Waker::noop` API in tests) r? `@ghost` `@rustbot` modify labels: rollup
2 parents de686cb + 9648c48 commit 03515c6

File tree

40 files changed

+651
-690
lines changed

40 files changed

+651
-690
lines changed

Diff for: Cargo.lock

+9-34
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ dependencies = [
548548
"futures",
549549
"if_chain",
550550
"itertools",
551-
"parking_lot 0.12.1",
551+
"parking_lot",
552552
"quote",
553553
"regex",
554554
"rustc_tools_util",
@@ -2356,13 +2356,13 @@ dependencies = [
23562356

23572357
[[package]]
23582358
name = "measureme"
2359-
version = "10.1.1"
2359+
version = "10.1.2"
23602360
source = "registry+https://github.com/rust-lang/crates.io-index"
2361-
checksum = "1930d162935fecd56fc4e0f6729eb3483bac1264542eb4ea31570b86a434b6bc"
2361+
checksum = "45e381dcdad44c3c435f8052b08c5c4a1449c48ab56f312345eae12d7a693dbe"
23622362
dependencies = [
23632363
"log",
23642364
"memmap2",
2365-
"parking_lot 0.11.2",
2365+
"parking_lot",
23662366
"perf-event-open-sys",
23672367
"rustc-hash",
23682368
"smallvec",
@@ -2780,39 +2780,14 @@ dependencies = [
27802780
"unicode-width",
27812781
]
27822782

2783-
[[package]]
2784-
name = "parking_lot"
2785-
version = "0.11.2"
2786-
source = "registry+https://github.com/rust-lang/crates.io-index"
2787-
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
2788-
dependencies = [
2789-
"instant",
2790-
"lock_api",
2791-
"parking_lot_core 0.8.6",
2792-
]
2793-
27942783
[[package]]
27952784
name = "parking_lot"
27962785
version = "0.12.1"
27972786
source = "registry+https://github.com/rust-lang/crates.io-index"
27982787
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
27992788
dependencies = [
28002789
"lock_api",
2801-
"parking_lot_core 0.9.8",
2802-
]
2803-
2804-
[[package]]
2805-
name = "parking_lot_core"
2806-
version = "0.8.6"
2807-
source = "registry+https://github.com/rust-lang/crates.io-index"
2808-
checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc"
2809-
dependencies = [
2810-
"cfg-if",
2811-
"instant",
2812-
"libc",
2813-
"redox_syscall 0.2.16",
2814-
"smallvec",
2815-
"winapi",
2790+
"parking_lot_core",
28162791
]
28172792

28182793
[[package]]
@@ -3682,7 +3657,7 @@ dependencies = [
36823657
"libc",
36833658
"measureme",
36843659
"memmap2",
3685-
"parking_lot 0.12.1",
3660+
"parking_lot",
36863661
"portable-atomic",
36873662
"rustc-hash",
36883663
"rustc-rayon",
@@ -4417,7 +4392,7 @@ dependencies = [
44174392
name = "rustc_query_system"
44184393
version = "0.0.0"
44194394
dependencies = [
4420-
"parking_lot 0.12.1",
4395+
"parking_lot",
44214396
"rustc-rayon-core",
44224397
"rustc_ast",
44234398
"rustc_data_structures",
@@ -5134,7 +5109,7 @@ checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b"
51345109
dependencies = [
51355110
"new_debug_unreachable",
51365111
"once_cell",
5137-
"parking_lot 0.12.1",
5112+
"parking_lot",
51385113
"phf_shared",
51395114
"precomputed-hash",
51405115
"serde",
@@ -5659,7 +5634,7 @@ dependencies = [
56595634
"matchers",
56605635
"nu-ansi-term",
56615636
"once_cell",
5662-
"parking_lot 0.12.1",
5637+
"parking_lot",
56635638
"regex",
56645639
"sharded-slab",
56655640
"smallvec",

Diff for: compiler/rustc_borrowck/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2502,8 +2502,8 @@ mod error {
25022502
if !self.errors.buffered.is_empty() {
25032503
self.errors.buffered.sort_by_key(|diag| diag.sort_span);
25042504

2505-
for mut diag in self.errors.buffered.drain(..) {
2506-
self.infcx.tcx.sess.diagnostic().emit_diagnostic(&mut diag);
2505+
for diag in self.errors.buffered.drain(..) {
2506+
self.infcx.tcx.sess.diagnostic().emit_diagnostic(diag);
25072507
}
25082508
}
25092509

Diff for: compiler/rustc_builtin_macros/src/errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ impl<'a> IntoDiagnostic<'a> for EnvNotDefinedWithUserMessage {
453453
rustc::untranslatable_diagnostic,
454454
reason = "cannot translate user-provided messages"
455455
)]
456-
let mut diag = handler.struct_diagnostic(self.msg_from_user.to_string());
456+
let mut diag = handler.struct_err(self.msg_from_user.to_string());
457457
diag.set_span(self.span);
458458
diag
459459
}
@@ -804,7 +804,7 @@ pub(crate) struct AsmClobberNoReg {
804804
impl<'a> IntoDiagnostic<'a> for AsmClobberNoReg {
805805
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
806806
let mut diag =
807-
handler.struct_diagnostic(crate::fluent_generated::builtin_macros_asm_clobber_no_reg);
807+
handler.struct_err(crate::fluent_generated::builtin_macros_asm_clobber_no_reg);
808808
diag.set_span(self.spans.clone());
809809
// eager translation as `span_labels` takes `AsRef<str>`
810810
let lbl1 = handler.eagerly_translate_to_string(

Diff for: compiler/rustc_codegen_gcc/src/gcc_util.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
use gccjit::Context;
33
use smallvec::{smallvec, SmallVec};
44

5-
use rustc_codegen_ssa::target_features::{
6-
supported_target_features, tied_target_features, RUSTC_SPECIFIC_FEATURES,
7-
};
85
use rustc_data_structures::fx::FxHashMap;
96
use rustc_middle::bug;
107
use rustc_session::Session;
8+
use rustc_target::target_features::RUSTC_SPECIFIC_FEATURES;
119

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

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

4644
// -Ctarget-features
47-
let supported_features = supported_target_features(sess);
45+
let supported_features = sess.target.supported_target_features();
4846
let mut featsmap = FxHashMap::default();
4947
let feats = sess.opts.cg.target_feature
5048
.split(',')
@@ -187,7 +185,7 @@ pub fn to_gcc_features<'a>(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]>
187185
// Given a map from target_features to whether they are enabled or disabled,
188186
// ensure only valid combinations are allowed.
189187
pub fn check_tied_features(sess: &Session, features: &FxHashMap<&str, bool>) -> Option<&'static [&'static str]> {
190-
for tied in tied_target_features(sess) {
188+
for tied in sess.target.tied_target_features() {
191189
// Tied features must be set to the same value, or not set at all
192190
let mut tied_iter = tied.iter();
193191
let enabled = features.get(tied_iter.next().unwrap());

Diff for: compiler/rustc_codegen_gcc/src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ use rustc_codegen_ssa::{CodegenResults, CompiledModule, ModuleCodegen};
9797
use rustc_codegen_ssa::base::codegen_crate;
9898
use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput, ModuleConfig, TargetMachineFactoryFn};
9999
use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
100-
use rustc_codegen_ssa::target_features::supported_target_features;
101100
use rustc_data_structures::fx::FxIndexMap;
102101
use rustc_data_structures::sync::IntoDynSyncSend;
103102
use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ThinBufferMethods, WriteBackendMethods};
@@ -397,7 +396,9 @@ fn to_gcc_opt_level(optlevel: Option<OptLevel>) -> OptimizationLevel {
397396
}
398397

399398
pub fn target_features(sess: &Session, allow_unstable: bool, target_info: &LockedTargetInfo) -> Vec<Symbol> {
400-
supported_target_features(sess)
399+
sess
400+
.target
401+
.supported_target_features()
401402
.iter()
402403
.filter_map(
403404
|&(feature, gate)| {

Diff for: compiler/rustc_codegen_llvm/src/errors.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ impl IntoDiagnostic<'_, FatalError> for ParseTargetMachineConfig<'_> {
107107
let (message, _) = diag.styled_message().first().expect("`LlvmError` with no message");
108108
let message = handler.eagerly_translate_to_string(message.clone(), diag.args());
109109

110-
let mut diag = handler.struct_diagnostic(fluent::codegen_llvm_parse_target_machine_config);
110+
let mut diag =
111+
handler.struct_almost_fatal(fluent::codegen_llvm_parse_target_machine_config);
111112
diag.set_arg("error", message);
112113
diag
113114
}

Diff for: compiler/rustc_codegen_llvm/src/llvm_util.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ use crate::errors::{
55
};
66
use crate::llvm;
77
use libc::c_int;
8-
use rustc_codegen_ssa::target_features::{
9-
supported_target_features, tied_target_features, RUSTC_SPECIFIC_FEATURES,
10-
};
118
use rustc_codegen_ssa::traits::PrintBackendInfo;
129
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1310
use rustc_data_structures::small_c_str::SmallCStr;
@@ -17,6 +14,7 @@ use rustc_session::config::{PrintKind, PrintRequest};
1714
use rustc_session::Session;
1815
use rustc_span::symbol::Symbol;
1916
use rustc_target::spec::{MergeFunctions, PanicStrategy};
17+
use rustc_target::target_features::RUSTC_SPECIFIC_FEATURES;
2018

2119
use std::ffi::{c_char, c_void, CStr, CString};
2220
use std::path::Path;
@@ -278,7 +276,7 @@ pub fn check_tied_features(
278276
features: &FxHashMap<&str, bool>,
279277
) -> Option<&'static [&'static str]> {
280278
if !features.is_empty() {
281-
for tied in tied_target_features(sess) {
279+
for tied in sess.target.tied_target_features() {
282280
// Tied features must be set to the same value, or not set at all
283281
let mut tied_iter = tied.iter();
284282
let enabled = features.get(tied_iter.next().unwrap());
@@ -294,7 +292,8 @@ pub fn check_tied_features(
294292
/// Must express features in the way Rust understands them
295293
pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
296294
let target_machine = create_informational_target_machine(sess);
297-
supported_target_features(sess)
295+
sess.target
296+
.supported_target_features()
298297
.iter()
299298
.filter_map(|&(feature, gate)| {
300299
if sess.is_nightly_build() || allow_unstable || gate.is_stable() {
@@ -362,7 +361,9 @@ fn llvm_target_features(tm: &llvm::TargetMachine) -> Vec<(&str, &str)> {
362361
fn print_target_features(out: &mut dyn PrintBackendInfo, sess: &Session, tm: &llvm::TargetMachine) {
363362
let mut llvm_target_features = llvm_target_features(tm);
364363
let mut known_llvm_target_features = FxHashSet::<&'static str>::default();
365-
let mut rustc_target_features = supported_target_features(sess)
364+
let mut rustc_target_features = sess
365+
.target
366+
.supported_target_features()
366367
.iter()
367368
.map(|(feature, _gate)| {
368369
// LLVM asserts that these are sorted. LLVM and Rust both use byte comparison for these strings.
@@ -515,7 +516,7 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
515516
);
516517

517518
// -Ctarget-features
518-
let supported_features = supported_target_features(sess);
519+
let supported_features = sess.target.supported_target_features();
519520
let mut featsmap = FxHashMap::default();
520521
let feats = sess
521522
.opts

Diff for: compiler/rustc_codegen_ssa/src/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,7 @@ impl SharedEmitterMain {
18481848
d.code(code);
18491849
}
18501850
d.replace_args(diag.args);
1851-
handler.emit_diagnostic(&mut d);
1851+
handler.emit_diagnostic(d);
18521852
}
18531853
Ok(SharedEmitterMessage::InlineAsmError(cookie, msg, level, source)) => {
18541854
let msg = msg.strip_prefix("error: ").unwrap_or(&msg).to_string();

0 commit comments

Comments
 (0)