Rollup merge of #120233 - oli-obk:revert_trait_obj_upcast_stabilization, r=lcnr
Revert stabilization of trait_upcasting feature Reverts #118133 This reverts commit6d2b84b3ed
, reversing changes made to73bc12199e
. The feature has a soundness bug: * #120222 It is unclear to me whether we'll actually want to destabilize, but I thought it was still prudent to open the PR for easy destabilization once we get there.
This commit is contained in:
commit
a787232abb
72 changed files with 437 additions and 112 deletions
|
@ -5,6 +5,7 @@ use crate::{
|
|||
|
||||
use rustc_hir as hir;
|
||||
use rustc_middle::ty;
|
||||
use rustc_session::lint::FutureIncompatibilityReason;
|
||||
use rustc_span::sym;
|
||||
use rustc_trait_selection::traits::supertraits;
|
||||
|
||||
|
@ -12,6 +13,9 @@ declare_lint! {
|
|||
/// The `deref_into_dyn_supertrait` lint is output whenever there is a use of the
|
||||
/// `Deref` implementation with a `dyn SuperTrait` type as `Output`.
|
||||
///
|
||||
/// These implementations will become shadowed when the `trait_upcasting` feature is stabilized.
|
||||
/// The `deref` functions will no longer be called implicitly, so there might be behavior change.
|
||||
///
|
||||
/// ### Example
|
||||
///
|
||||
/// ```rust,compile_fail
|
||||
|
@ -40,10 +44,15 @@ declare_lint! {
|
|||
///
|
||||
/// ### Explanation
|
||||
///
|
||||
/// The implicit dyn upcasting coercion take priority over those `Deref` impls.
|
||||
/// The dyn upcasting coercion feature adds new coercion rules, taking priority
|
||||
/// over certain other coercion rules, which will cause some behavior change.
|
||||
pub DEREF_INTO_DYN_SUPERTRAIT,
|
||||
Warn,
|
||||
"`Deref` implementation usage with a supertrait trait object for output are shadow by implicit coercion",
|
||||
"`Deref` implementation usage with a supertrait trait object for output might be shadowed in the future",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseSemanticsChange,
|
||||
reference: "issue #89460 <https://github.com/rust-lang/rust/issues/89460>",
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint_pass!(DerefIntoDynSupertrait => [DEREF_INTO_DYN_SUPERTRAIT]);
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#![feature(iter_intersperse)]
|
||||
#![feature(iter_order_by)]
|
||||
#![feature(let_chains)]
|
||||
#![cfg_attr(not(bootstrap), feature(trait_upcasting))]
|
||||
#![feature(min_specialization)]
|
||||
#![feature(never_type)]
|
||||
#![feature(rustc_attrs)]
|
||||
|
|
|
@ -532,7 +532,6 @@ pub enum BuiltinSpecialModuleNameUsed {
|
|||
// deref_into_dyn_supertrait.rs
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_supertrait_as_deref_target)]
|
||||
#[help]
|
||||
pub struct SupertraitAsDerefTarget<'a> {
|
||||
pub self_ty: Ty<'a>,
|
||||
pub supertrait_principal: PolyExistentialTraitRef<'a>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue