-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trait Trait: Send
: upcasting from dyn Trait
to dyn Send
does not work
#126313
Labels
C-bug
Category: This is a bug.
F-trait_upcasting
`#![feature(trait_upcasting)]`
T-types
Relevant to the types team, which will review and decide on the PR/issue.
Comments
rustbot
added
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
Jun 12, 2024
lcnr
changed the title
cannot upcast from
Jun 12, 2024
dyn TraitWithSendSuper
to dyn Send
trait Trait: Send
: upcasting from dyn Trait
to dyn Send
does not work
lcnr
added
F-trait_upcasting
`#![feature(trait_upcasting)]`
T-types
Relevant to the types team, which will review and decide on the PR/issue.
labels
Jun 12, 2024
I had a separate PR to upcast dropping the principal but I think I never FCPd it because I was too lazy: #114679 (comment) |
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this issue
Jun 12, 2024
fix RELEASES: we do not support upcasting to auto traits rust-lang#119338 does not actually support casts from `dyn Trait` to `dyn Auto`, only from `dyn Trait` to `dyn Trait + Auto`. The following test does not compile ```rust trait Trait: Send {} impl<T: Send> Trait for T {} fn foo() { let x: &i32 = &1; let y = x as &dyn Trait as &dyn Send; } ``` it actually also doesn't compile with `feature(trait_upcasting)`, opened rust-lang#126313 for that r? `@Mark-Simulacrum` `@cuviper`
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jun 12, 2024
Rollup merge of rust-lang#126314 - lcnr:fix-relnotes, r=pietroalbini fix RELEASES: we do not support upcasting to auto traits rust-lang#119338 does not actually support casts from `dyn Trait` to `dyn Auto`, only from `dyn Trait` to `dyn Trait + Auto`. The following test does not compile ```rust trait Trait: Send {} impl<T: Send> Trait for T {} fn foo() { let x: &i32 = &1; let y = x as &dyn Trait as &dyn Send; } ``` it actually also doesn't compile with `feature(trait_upcasting)`, opened rust-lang#126313 for that r? `@Mark-Simulacrum` `@cuviper`
saethlin
added
C-bug
Category: This is a bug.
and removed
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
labels
Jun 13, 2024
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Oct 18, 2024
Rollup merge of rust-lang#131857 - WaffleLapkin:dyn-drop-principal-3, r=compiler-errors Allow dropping dyn principal Revival of rust-lang#126660, which was a revival of rust-lang#114679. Fixes rust-lang#126313. Allows dropping principal when coercing trait objects, e.g. `dyn Debug + Send` -> `dyn Send`. cc `@compiler-errors` `@Jules-Bertholet` r? `@lcnr`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: This is a bug.
F-trait_upcasting
`#![feature(trait_upcasting)]`
T-types
Relevant to the types team, which will review and decide on the PR/issue.
The following compiles:
while this does not:
cc @compiler-errors I thought we actually had a PR for that at some point 🤔 I think that's actually not the case though. It wasn't part of #119338
The text was updated successfully, but these errors were encountered: