-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.F-trait_upcasting`#![feature(trait_upcasting)]``#![feature(trait_upcasting)]`P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language teamregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
Code
I tried this code:
#![allow(dead_code)]
use core::ops::Deref;
trait A {}
trait B: A {}
impl<'a> Deref for dyn 'a + B {
type Target = dyn A;
fn deref(&self) -> &Self::Target {
todo!()
}
}
fn take_a(_: &dyn A) { }
fn whoops(b: &dyn B) {
take_a(b) // <-- Regression here.
}
I expected to see this happen: This should probably continue to compile as before, unless proven to be equivalent.
Instead, this happened: The detection for #65991 seems to be a little too aggressive, so it's flagging the coercion as feature-gated in beta even though a deref coercion is available:
Compiling playground v0.0.1 (/playground)
error[E0658]: trait upcasting coercion is experimental
--> src/lib.rs:17:12
|
17 | take_a(b)
| ^
|
= note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information
For more information about this error, try `rustc --explain E0658`.
error: could not compile `playground` due to previous error
Version it worked on
It most recently worked on: 1.55.0
rustc +stable --version --verbose
:
rustc 1.55.0 (c8dfcfe04 2021-09-06)
binary: rustc
commit-hash: c8dfcfe046a7680554bf4eb612bad840e7631c4b
commit-date: 2021-09-06
host: x86_64-unknown-linux-gnu
release: 1.55.0
LLVM version: 12.0.1
Version with regression
rustc +beta --version --verbose
:
rustc 1.56.0-beta.3 (deef86610 2021-09-17)
binary: rustc
commit-hash: deef866109022248b2506587b377c6b1c881d963
commit-date: 2021-09-17
host: x86_64-unknown-linux-gnu
release: 1.56.0-beta.3
LLVM version: 13.0.0
Backtrace
(not applicable)
@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged
crlf0710
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.F-trait_upcasting`#![feature(trait_upcasting)]``#![feature(trait_upcasting)]`P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language teamregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.