-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.T-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-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.fixed-by-higher-ranked-assumptionsFixed by `-Zhigher-ranked-assumptions`Fixed by `-Zhigher-ranked-assumptions`
Description
Code
use std::{any::Any, marker::PhantomData};
pub struct HasDropImpl;
impl core::ops::Drop for HasDropImpl {
fn drop(&mut self) {}
}
pub struct Wrapper<Context = dyn Any>
where
Context: ObjectMarker + ?Sized,
{
raw: HasDropImpl,
_param: PhantomData<Context>,
}
unsafe impl<C> Send for Wrapper<C> where C: ObjectMarker + ?Sized {}
pub(crate) trait ObjectMarker {}
impl ObjectMarker for dyn Any {}
fn fails() -> Result<(), Wrapper> {
Ok(())
}
async fn fut1() {}
fn main() {
let fut = async {
let _across_await = fails();
fut1().await;
};
require_send(fut);
}
fn require_send<F>(_: F)
where
F: Future + Send,
{
}Current output
error: implementation of `ObjectMarker` is not general enough
--> src/main.rs:33:5
|
33 | require_send(fut);
| ^^^^^^^^^^^^^^^^^ implementation of `ObjectMarker` is not general enough
|
= note: `(dyn Any + '0)` must implement `ObjectMarker`, for any lifetime `'0`...
= note: ...but `ObjectMarker` is actually implemented for the type `(dyn Any + 'static)`Desired output
Rationale and extra context
This is a minimization from the rootcause library. The original error was exactly the same, with no more information than this.
Other cases
Rust Version
rustc 1.93.0-nightly (27b076af7 2025-11-21)
binary: rustc
commit-hash: 27b076af7e3e7a363975443d81dfa9ecee5a74ec
commit-date: 2025-11-21
host: x86_64-unknown-linux-gnu
release: 1.93.0-nightly
LLVM version: 21.1.5Anything else?
No response
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.T-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-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.fixed-by-higher-ranked-assumptionsFixed by `-Zhigher-ranked-assumptions`Fixed by `-Zhigher-ranked-assumptions`