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

make Sized predicates coinductive #83647

Closed
wants to merge 2 commits into from
Closed

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Mar 29, 2021

🤷

needs either an MCP/RFC and wg-traits signoff. While I think this is sound, I am not too knowledgeable about coinduction so I might be wrong here.

r? @nikomatsakis

@lcnr lcnr added T-lang Relevant to the language team, which will review and decide on the PR/issue. S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Mar 29, 2021
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 29, 2021
@nikomatsakis
Copy link
Contributor

I'm going to want to talk about the motivation =)

@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 18, 2021
@lcnr
Copy link
Contributor Author

lcnr commented Apr 23, 2021

I still want to add this as a test, so that I don't forget. I expect the error here to change from a predicate cycle to "recursive type Foo<()> has infinite size"

trait A { type Assoc; }

impl A for () {
    type Assoc = Foo<()>;
}
struct Foo<T: A>(T::Assoc);

fn main() {}

@lcnr
Copy link
Contributor Author

lcnr commented Apr 23, 2021

also

trait A { type Assoc: ?Sized; }

impl A for () {
    type Assoc = Foo<()>;
}
struct Foo<T: A>(T::Assoc);

fn main() {
    let x: Foo<()>;
}

@bstrie bstrie added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 12, 2021
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 31, 2021
@JohnCSimon
Copy link
Member

triage: @lcnr - is this still blocked?

@nikomatsakis
Copy link
Contributor

@lcnr is taking a bit of a break from Rust at the moment -- we could close this, but it's also ok to leave it open.

@crlf0710 crlf0710 removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 26, 2021
@lcnr
Copy link
Contributor Author

lcnr commented Jul 8, 2021

don't have the capacity to work on this rn

@marmeladema
Copy link
Contributor

marmeladema commented Aug 9, 2022

Would this allow to compile:

use std::borrow::Cow;

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

?

@compiler-errors

This comment was marked as duplicate.

@marmeladema

This comment was marked as outdated.

Manishearth added a commit to Manishearth/rust that referenced this pull request Nov 11, 2022
…redux, r=lcnr

Make `Sized` coinductive, again

A revival of rust-lang#83647

---

What exactly makes co-induction sound? Better question: are there any unsoundness risks from this? `Sized` can't be implemented by custom `impl` blocks, nor can it be conditionally implemented based on anything other than child fields being `Sized`, right?

r? `@nikomatsakis` for whenever he gets back from vacation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants