-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Recursive type with Cow
, 'static
and slice triggers "overflow evaluating the requirement"
#47032
Comments
This is related to #34260 |
triage: P-medium @sgrif and I are working on this a bit =) |
Is there a workaround for this? It has me completely stumped |
@nikomatsakis any update on this? |
Same, ran into this too and unsure how to resolve this. It seems it's a regression from 2016? |
I believe I found a workaround until this is fixed. The trick is to put the #[derive(Clone)]
pub struct DummyHolder<T> {
pub data: T,
}
#[derive(Clone)]
pub struct Node {
pub children: DummyHolder<Cow<'static, [Node]>>,
} |
I just made an interesting discovery. The following does not compile: #[derive(Clone)]
pub struct DummyHolder<T: ?Sized> { // <-- Triggers the error
pub data: T,
}
#[derive(Clone)]
pub struct Node {
pub children: DummyHolder<Cow<'static, [Node]>>,
} So it seems that enforcing a |
Cow
, 'static
and slice triggers "overflow evaluating the requirement"
Triage: This began to compile in 1.79 and was retroactively stabilized via FCP. See #129541 for details. Regression test added via https://github.com/rust-lang/rust/pull/133473/files which I bet is equivalent to the code in this issue. Closing as duplicate of #100347 although it should probably be the other way around since this issue is much older. |
The following compiles with rustc 1.7.0 and earlier, but not in 1.8.0 and later:
The errors:
Since it compiles fine with the first two members (reference to slice, and Vec), I'd expect a Cow of a slice to also work. Is this a regression, or is this supposed to not compile?
The text was updated successfully, but these errors were encountered: