Skip to content

Commit 247e44e

Browse files
committed
Auto merge of rust-lang#106324 - compiler-errors:rollup-2m9njin, r=compiler-errors
Rollup of 9 pull requests Successful merges: - rust-lang#105903 (Unify id-based thread parking implementations) - rust-lang#106232 (CFI: Monomorphize transparent ADTs before typeid) - rust-lang#106248 (Revert "Implement allow-by-default `multiple_supertrait_upcastable` lint") - rust-lang#106286 (Make tidy errors red) - rust-lang#106295 (Extend scraped examples layout GUI test for position of buttons) - rust-lang#106305 ( bootstrap: Get rid of tail_args in stream_cargo) - rust-lang#106310 (Dont use `--merge-base` during bootstrap formatting subcommand) - rust-lang#106314 (Fix panic on `x build --help`) - rust-lang#106317 (Only deduplicate stack traces for good path bugs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5570cda + d798e22 commit 247e44e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+428
-578
lines changed

Cargo.lock

+5-4
Original file line numberDiff line numberDiff line change
@@ -2675,9 +2675,9 @@ dependencies = [
26752675

26762676
[[package]]
26772677
name = "owo-colors"
2678-
version = "3.4.0"
2678+
version = "3.5.0"
26792679
source = "registry+https://github.com/rust-lang/crates.io-index"
2680-
checksum = "decf7381921fea4dcb2549c5667eda59b3ec297ab7e2b5fc33eac69d2e7da87b"
2680+
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
26812681

26822682
[[package]]
26832683
name = "packed_simd_2"
@@ -5203,9 +5203,9 @@ dependencies = [
52035203

52045204
[[package]]
52055205
name = "termcolor"
5206-
version = "1.1.2"
5206+
version = "1.1.3"
52075207
source = "registry+https://github.com/rust-lang/crates.io-index"
5208-
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
5208+
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
52095209
dependencies = [
52105210
"winapi-util",
52115211
]
@@ -5309,6 +5309,7 @@ dependencies = [
53095309
"lazy_static",
53105310
"miropt-test-tools",
53115311
"regex",
5312+
"termcolor",
53125313
"walkdir",
53135314
]
53145315

compiler/rustc_driver/src/lib.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1199,8 +1199,8 @@ static DEFAULT_HOOK: LazyLock<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send +
11991199
};
12001200

12011201
// Invoke the default handler, which prints the actual panic message and optionally a backtrace
1202-
// Don't do this for `ExplicitBug`, which has an unhelpful message and backtrace.
1203-
if !info.payload().is::<rustc_errors::ExplicitBug>() {
1202+
// Don't do this for `GoodPathBug`, which already emits its own more useful backtrace.
1203+
if !info.payload().is::<rustc_errors::GoodPathBug>() {
12041204
(*DEFAULT_HOOK)(info);
12051205

12061206
// Separate the output with an empty line
@@ -1237,7 +1237,9 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
12371237

12381238
// a .span_bug or .bug call has already printed what
12391239
// it wants to print.
1240-
if !info.payload().is::<rustc_errors::ExplicitBug>() {
1240+
if !info.payload().is::<rustc_errors::ExplicitBug>()
1241+
&& !info.payload().is::<rustc_errors::GoodPathBug>()
1242+
{
12411243
let mut d = rustc_errors::Diagnostic::new(rustc_errors::Level::Bug, "unexpected panic");
12421244
handler.emit_diagnostic(&mut d);
12431245
}

compiler/rustc_errors/src/lib.rs

+18-12
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ use rustc_span::source_map::SourceMap;
4040
use rustc_span::HashStableContext;
4141
use rustc_span::{Loc, Span};
4242

43+
use std::any::Any;
4344
use std::borrow::Cow;
45+
use std::fmt;
4446
use std::hash::Hash;
4547
use std::num::NonZeroUsize;
4648
use std::panic;
4749
use std::path::Path;
48-
use std::{error, fmt};
4950

5051
use termcolor::{Color, ColorSpec};
5152

@@ -361,16 +362,11 @@ pub use rustc_span::fatal_error::{FatalError, FatalErrorMarker};
361362

362363
/// Signifies that the compiler died with an explicit call to `.bug`
363364
/// or `.span_bug` rather than a failed assertion, etc.
364-
#[derive(Copy, Clone, Debug)]
365365
pub struct ExplicitBug;
366366

367-
impl fmt::Display for ExplicitBug {
368-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
369-
write!(f, "parser internal bug")
370-
}
371-
}
372-
373-
impl error::Error for ExplicitBug {}
367+
/// Signifies that the compiler died with an explicit call to `.delay_good_path_bug`
368+
/// rather than a failed assertion, etc.
369+
pub struct GoodPathBug;
374370

375371
pub use diagnostic::{
376372
AddToDiagnostic, DecorateLint, Diagnostic, DiagnosticArg, DiagnosticArgValue, DiagnosticId,
@@ -507,7 +503,11 @@ impl Drop for HandlerInner {
507503

508504
if !self.has_errors() {
509505
let bugs = std::mem::replace(&mut self.delayed_span_bugs, Vec::new());
510-
self.flush_delayed(bugs, "no errors encountered even though `delay_span_bug` issued");
506+
self.flush_delayed(
507+
bugs,
508+
"no errors encountered even though `delay_span_bug` issued",
509+
ExplicitBug,
510+
);
511511
}
512512

513513
// FIXME(eddyb) this explains what `delayed_good_path_bugs` are!
@@ -520,6 +520,7 @@ impl Drop for HandlerInner {
520520
self.flush_delayed(
521521
bugs.into_iter().map(DelayedDiagnostic::decorate),
522522
"no warnings or errors encountered even though `delayed_good_path_bugs` issued",
523+
GoodPathBug,
523524
);
524525
}
525526

@@ -1203,7 +1204,11 @@ impl Handler {
12031204
pub fn flush_delayed(&self) {
12041205
let mut inner = self.inner.lock();
12051206
let bugs = std::mem::replace(&mut inner.delayed_span_bugs, Vec::new());
1206-
inner.flush_delayed(bugs, "no errors encountered even though `delay_span_bug` issued");
1207+
inner.flush_delayed(
1208+
bugs,
1209+
"no errors encountered even though `delay_span_bug` issued",
1210+
ExplicitBug,
1211+
);
12071212
}
12081213
}
12091214

@@ -1580,6 +1585,7 @@ impl HandlerInner {
15801585
&mut self,
15811586
bugs: impl IntoIterator<Item = Diagnostic>,
15821587
explanation: impl Into<DiagnosticMessage> + Copy,
1588+
panic_with: impl Any + Send + 'static,
15831589
) {
15841590
let mut no_bugs = true;
15851591
for mut bug in bugs {
@@ -1607,7 +1613,7 @@ impl HandlerInner {
16071613

16081614
// Panic with `ExplicitBug` to avoid "unexpected panic" messages.
16091615
if !no_bugs {
1610-
panic::panic_any(ExplicitBug);
1616+
panic::panic_any(panic_with);
16111617
}
16121618
}
16131619

compiler/rustc_feature/src/active.rs

-2
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,6 @@ declare_features! (
160160
(active, intrinsics, "1.0.0", None, None),
161161
/// Allows using `#[lang = ".."]` attribute for linking items to special compiler logic.
162162
(active, lang_items, "1.0.0", None, None),
163-
/// Allows the `multiple_supertrait_upcastable` lint.
164-
(active, multiple_supertrait_upcastable, "CURRENT_RUSTC_VERSION", None, None),
165163
/// Allows using `#[omit_gdb_pretty_printer_section]`.
166164
(active, omit_gdb_pretty_printer_section, "1.5.0", None, None),
167165
/// Allows using `#[prelude_import]` on glob `use` items.

compiler/rustc_lint/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ mod late;
6161
mod let_underscore;
6262
mod levels;
6363
mod methods;
64-
mod multiple_supertrait_upcastable;
6564
mod non_ascii_idents;
6665
mod non_fmt_panic;
6766
mod nonstandard_style;
@@ -96,7 +95,6 @@ use hidden_unicode_codepoints::*;
9695
use internal::*;
9796
use let_underscore::*;
9897
use methods::*;
99-
use multiple_supertrait_upcastable::*;
10098
use non_ascii_idents::*;
10199
use non_fmt_panic::NonPanicFmt;
102100
use nonstandard_style::*;
@@ -231,7 +229,6 @@ late_lint_methods!(
231229
InvalidAtomicOrdering: InvalidAtomicOrdering,
232230
NamedAsmLabels: NamedAsmLabels,
233231
OpaqueHiddenInferredBound: OpaqueHiddenInferredBound,
234-
MultipleSupertraitUpcastable: MultipleSupertraitUpcastable,
235232
]
236233
]
237234
);

compiler/rustc_lint/src/multiple_supertrait_upcastable.rs

-63
This file was deleted.

compiler/rustc_span/src/symbol.rs

-1
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,6 @@ symbols! {
944944
mul,
945945
mul_assign,
946946
mul_with_overflow,
947-
multiple_supertrait_upcastable,
948947
must_not_suspend,
949948
must_use,
950949
naked,

compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ fn encode_const<'tcx>(
164164

165165
/// Encodes a FnSig using the Itanium C++ ABI with vendor extended type qualifiers and types for
166166
/// Rust types that are not used at the FFI boundary.
167+
#[instrument(level = "trace", skip(tcx, dict))]
167168
fn encode_fnsig<'tcx>(
168169
tcx: TyCtxt<'tcx>,
169170
fn_sig: &FnSig<'tcx>,
@@ -653,6 +654,7 @@ fn encode_ty<'tcx>(
653654
// Transforms a ty:Ty for being encoded and used in the substitution dictionary. It transforms all
654655
// c_void types into unit types unconditionally, and generalizes all pointers if
655656
// TransformTyOptions::GENERALIZE_POINTERS option is set.
657+
#[instrument(level = "trace", skip(tcx))]
656658
fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptions) -> Ty<'tcx> {
657659
let mut ty = ty;
658660

@@ -698,7 +700,7 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio
698700
!is_zst
699701
});
700702
if let Some(field) = field {
701-
let ty0 = tcx.type_of(field.did);
703+
let ty0 = tcx.bound_type_of(field.did).subst(tcx, substs);
702704
// Generalize any repr(transparent) user-defined type that is either a pointer
703705
// or reference, and either references itself or any other type that contains or
704706
// references itself, to avoid a reference cycle.
@@ -827,6 +829,7 @@ fn transform_substs<'tcx>(
827829

828830
/// Returns a type metadata identifier for the specified FnAbi using the Itanium C++ ABI with vendor
829831
/// extended type qualifiers and types for Rust types that are not used at the FFI boundary.
832+
#[instrument(level = "trace", skip(tcx))]
830833
pub fn typeid_for_fnabi<'tcx>(
831834
tcx: TyCtxt<'tcx>,
832835
fn_abi: &FnAbi<'tcx, Ty<'tcx>>,

library/alloc/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
#![warn(missing_debug_implementations)]
8888
#![warn(missing_docs)]
8989
#![allow(explicit_outlives_requirements)]
90-
#![cfg_attr(not(bootstrap), warn(multiple_supertrait_upcastable))]
9190
//
9291
// Library features:
9392
#![feature(alloc_layout_extra)]
@@ -192,7 +191,6 @@
192191
#![feature(unsized_fn_params)]
193192
#![feature(c_unwind)]
194193
#![feature(with_negative_coherence)]
195-
#![cfg_attr(not(bootstrap), feature(multiple_supertrait_upcastable))]
196194
//
197195
// Rustdoc features:
198196
#![feature(doc_cfg)]

library/core/src/error.rs

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use crate::fmt::{Debug, Display};
2828
#[stable(feature = "rust1", since = "1.0.0")]
2929
#[cfg_attr(not(test), rustc_diagnostic_item = "Error")]
3030
#[rustc_has_incoherent_inherent_impls]
31-
#[cfg_attr(not(bootstrap), allow(multiple_supertrait_upcastable))]
3231
pub trait Error: Debug + Display {
3332
/// The lower-level source of this error, if any.
3433
///

library/core/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
#![warn(missing_docs)]
9696
#![allow(explicit_outlives_requirements)]
9797
#![allow(incomplete_features)]
98-
#![cfg_attr(not(bootstrap), warn(multiple_supertrait_upcastable))]
9998
//
10099
// Library features:
101100
#![feature(const_align_offset)]
@@ -232,7 +231,6 @@
232231
#![feature(unsized_fn_params)]
233232
#![feature(asm_const)]
234233
#![feature(const_transmute_copy)]
235-
#![cfg_attr(not(bootstrap), feature(multiple_supertrait_upcastable))]
236234
//
237235
// Target features:
238236
#![feature(arm_target_feature)]

library/std/src/sys/sgx/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub mod process;
3434
pub mod stdio;
3535
pub mod thread;
3636
pub mod thread_local_key;
37-
pub mod thread_parker;
37+
pub mod thread_parking;
3838
pub mod time;
3939

4040
mod condvar;

library/std/src/sys/sgx/thread.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ mod task_queue {
6565
/// execution. The signal is sent once all TLS destructors have finished at
6666
/// which point no new thread locals should be created.
6767
pub mod wait_notify {
68-
use super::super::thread_parker::Parker;
6968
use crate::pin::Pin;
7069
use crate::sync::Arc;
70+
use crate::sys_common::thread_parking::Parker;
7171

7272
pub struct Notifier(Arc<Parker>);
7373

@@ -87,14 +87,14 @@ pub mod wait_notify {
8787
/// called, this will return immediately, otherwise the current thread
8888
/// is blocked until notified.
8989
pub fn wait(self) {
90-
// This is not actually `unsafe`, but it uses the `Parker` API,
91-
// which needs `unsafe` on some platforms.
90+
// SAFETY:
91+
// This is only ever called on one thread.
9292
unsafe { Pin::new(&*self.0).park() }
9393
}
9494
}
9595

9696
pub fn new() -> (Notifier, Waiter) {
97-
let inner = Arc::new(Parker::new_internal());
97+
let inner = Arc::new(Parker::new());
9898
(Notifier(inner.clone()), Waiter(inner))
9999
}
100100
}

0 commit comments

Comments
 (0)