Implementation is not general enough error with no context
Open
Nobody has claimed this yet.
A-async-await
A-diagnostics
A-type-system
C-bug
D-terse
fixed-by-higher-ranked-assumptions
T-compiler
T-types
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
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.5
Anything else?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the minimized example in src/main.rs with rustc 1.93.0-nightly and inspect the emitted “implementation ... not general enough” diagnostic. Trace the compiler entry point responsible for this diagnostic and determine what context is available for this case. Done means the same example produces a more informative diagnostic or an explicitly improved result, with regression coverage added where the compiler tests permit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100