Skip to content

Commit

Permalink
Rollup merge of rust-lang#106248 - dtolnay:revertupcastlint, r=jackh726
Browse files Browse the repository at this point in the history
Revert "Implement allow-by-default `multiple_supertrait_upcastable` lint"

This is a clean revert of rust-lang#105484.

I confirmed that reverting that PR fixes the regression reported in rust-lang#106247. ~~I can't say I understand what this code is doing, but maybe it can be re-landed with a different implementation.~~ **Edit:** rust-lang#106247 (comment) has an explanation of why rust-lang#105484 ends up surfacing spurious `where_clause_object_safety` errors. The implementation of `where_clause_object_safety` assumes we only check whether a trait is object safe when somebody actually uses that trait with `dyn`. However the implementation of `multiple_supertrait_upcastable` added in the problematic PR involves checking *every* trait for whether it is object-safe.

FYI `@nbdd0121` `@compiler-errors`
  • Loading branch information
compiler-errors committed Dec 31, 2022
2 parents fad7339 + 4271ed4 commit 5b74a33
Show file tree
Hide file tree
Showing 12 changed files with 9 additions and 167 deletions.
2 changes: 0 additions & 2 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ declare_features! (
(active, intrinsics, "1.0.0", None, None),
/// Allows using `#[lang = ".."]` attribute for linking items to special compiler logic.
(active, lang_items, "1.0.0", None, None),
/// Allows the `multiple_supertrait_upcastable` lint.
(active, multiple_supertrait_upcastable, "CURRENT_RUSTC_VERSION", None, None),
/// Allows using `#[omit_gdb_pretty_printer_section]`.
(active, omit_gdb_pretty_printer_section, "1.5.0", None, None),
/// Allows using `#[prelude_import]` on glob `use` items.
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ mod late;
mod let_underscore;
mod levels;
mod methods;
mod multiple_supertrait_upcastable;
mod non_ascii_idents;
mod non_fmt_panic;
mod nonstandard_style;
Expand Down Expand Up @@ -96,7 +95,6 @@ use hidden_unicode_codepoints::*;
use internal::*;
use let_underscore::*;
use methods::*;
use multiple_supertrait_upcastable::*;
use non_ascii_idents::*;
use non_fmt_panic::NonPanicFmt;
use nonstandard_style::*;
Expand Down Expand Up @@ -231,7 +229,6 @@ late_lint_methods!(
InvalidAtomicOrdering: InvalidAtomicOrdering,
NamedAsmLabels: NamedAsmLabels,
OpaqueHiddenInferredBound: OpaqueHiddenInferredBound,
MultipleSupertraitUpcastable: MultipleSupertraitUpcastable,
]
]
);
Expand Down
63 changes: 0 additions & 63 deletions compiler/rustc_lint/src/multiple_supertrait_upcastable.rs

This file was deleted.

1 change: 0 additions & 1 deletion compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,6 @@ symbols! {
mul,
mul_assign,
mul_with_overflow,
multiple_supertrait_upcastable,
must_not_suspend,
must_use,
naked,
Expand Down
2 changes: 0 additions & 2 deletions library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
#![warn(missing_debug_implementations)]
#![warn(missing_docs)]
#![allow(explicit_outlives_requirements)]
#![cfg_attr(not(bootstrap), warn(multiple_supertrait_upcastable))]
//
// Library features:
#![feature(alloc_layout_extra)]
Expand Down Expand Up @@ -192,7 +191,6 @@
#![feature(unsized_fn_params)]
#![feature(c_unwind)]
#![feature(with_negative_coherence)]
#![cfg_attr(not(bootstrap), feature(multiple_supertrait_upcastable))]
//
// Rustdoc features:
#![feature(doc_cfg)]
Expand Down
1 change: 0 additions & 1 deletion library/core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use crate::fmt::{Debug, Display};
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "Error")]
#[rustc_has_incoherent_inherent_impls]
#[cfg_attr(not(bootstrap), allow(multiple_supertrait_upcastable))]
pub trait Error: Debug + Display {
/// The lower-level source of this error, if any.
///
Expand Down
2 changes: 0 additions & 2 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
#![warn(missing_docs)]
#![allow(explicit_outlives_requirements)]
#![allow(incomplete_features)]
#![cfg_attr(not(bootstrap), warn(multiple_supertrait_upcastable))]
//
// Library features:
#![feature(const_align_offset)]
Expand Down Expand Up @@ -232,7 +231,6 @@
#![feature(unsized_fn_params)]
#![feature(asm_const)]
#![feature(const_transmute_copy)]
#![cfg_attr(not(bootstrap), feature(multiple_supertrait_upcastable))]
//
// Target features:
#![feature(arm_target_feature)]
Expand Down

This file was deleted.

This file was deleted.

9 changes: 9 additions & 0 deletions src/test/ui/object-safety/issue-106247.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// check-pass

#![deny(where_clauses_object_safety)]

pub trait Trait {
fn method(&self) where Self: Sync;
}

fn main() {}

This file was deleted.

This file was deleted.

0 comments on commit 5b74a33

Please sign in to comment.