Skip to content
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

overflow evaluating the requirement <[Test<'a>] as std::borrow::ToOwned>::Owned #67197

Closed
steveklabnik opened this issue Dec 10, 2019 · 2 comments

Comments

@steveklabnik
Copy link
Member

This code does not compile:

use std::borrow::Cow;

enum Test <'a> {
    Int(u8),
    Bytes(Cow<'a, [u8]>),
    Array(Cow<'a, [Test<'a>]>),
}

I would expect it to be the same as this code, which does compile:

use std::borrow::Cow;

enum Test <'a> {
    Int(u8),
    Bytes(Cow<'a, [u8]>),
    Array(VecOrSlice<'a>),
}

enum VecOrSlice<'a> {
    Vec(Vec<Test<'a>>),
    Slice(&'a [Test<'a>]),
}

I am not sure if this is a reasonable expectation or not, though.

@jonas-schievink
Copy link
Contributor

Duplicate of #23714

@jonas-schievink jonas-schievink marked this as a duplicate of #23714 Dec 10, 2019
@Arnavion
Copy link

This is more closely related to #38962 and #47032 than #23714 , since #23714 is doing shenanigans with a custom ToOwned impl that breaks for a different reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants