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

add Unsize trait implementation #427

Merged
merged 3 commits into from
Jun 9, 2020
Merged

Conversation

basil-cow
Copy link
Contributor

No description provided.

Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've looked through just a piece of this. Some comments/questions. Not sure how much you can answer @Areredify, they're more for @nikomatsakis.

chalk-solve/src/clauses/builtin_traits/unsize.rs Outdated Show resolved Hide resolved
chalk-solve/src/clauses/builtin_traits/unsize.rs Outdated Show resolved Hide resolved
chalk-solve/src/clauses/builtin_traits/unsize.rs Outdated Show resolved Hide resolved
Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More comments

chalk-solve/src/clauses/builtin_traits/unsize.rs Outdated Show resolved Hide resolved
}
.cast(interner);

// FIXME(areredify) we need a `source_ty: 'lifetime` goal here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's file these FIXMEs in a followup issue so they don't potentially get lost. They're pretty important.

chalk-solve/src/clauses/builtin_traits/unsize.rs Outdated Show resolved Hide resolved
tests/test/builtin_impls.rs Outdated Show resolved Hide resolved
tests/test/builtin_impls.rs Outdated Show resolved Hide resolved
tests/test/builtin_impls.rs Outdated Show resolved Hide resolved
tests/test/builtin_impls.rs Outdated Show resolved Hide resolved
tests/test/builtin_impls.rs Outdated Show resolved Hide resolved
@jackh726
Copy link
Member

jackh726 commented May 3, 2020

The other thing to maybe think about is how this might change based on trait upcasting (see rust-lang/rust#60900)

@jackh726
Copy link
Member

jackh726 commented May 3, 2020

Or (this one is unclear on whether it will be implemented), how this could interact with trait objects of multiple traits: rust-lang/rfcs#2035

@jackh726
Copy link
Member

jackh726 commented May 3, 2020

Also, while going through these rules, I made this playground to help me thing about these rules. Might be helpful for others: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=cb638a1efd849d7dc64a8617eec5c1ab

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I did a first pass,and my first thought is that it would be nice to break this PR up into three PRs.

  1. add dyn Trait + 'x lifetime parameter
  2. add ObjectSafe goal + integration
  3. add the Unsize trait

it would make it much easier to review.

That said, I read everything apart from the details of unsize.rs and it seems good.

chalk-solve/src/lib.rs Outdated Show resolved Hide resolved
@nikomatsakis
Copy link
Contributor

So it safe to conclude that this PR is in "needs rebase" territory to reduce some duplication?

@nikomatsakis
Copy link
Contributor

(I'm still in favor of branching out the lifetime changes as well)

@jackh726
Copy link
Member

Yes, this needs a rebase. And the tests I mentioned.

I'm also in favor of splitting the lifetime changes.

@basil-cow
Copy link
Contributor Author

@nikomatsakis @jackh726 yes, I'll rebase it and split it and all tomorrow (ideally), sorry for the delay

@nikomatsakis
Copy link
Contributor

@Areredify no hurry =) let's land #393 first, it seems almost ready (just needs a few tweaks to the tests?)

@basil-cow
Copy link
Contributor Author

@nikomatsakis that's right, a slight tweak to the tests and a rebase

@jackh726
Copy link
Member

@Areredify Any updates here? Would like to get this in, since it's pretty close.

@basil-cow
Copy link
Contributor Author

Sorry, I prioritized sem-syn lowering, but I plan to get this in before the next design meeting

@basil-cow basil-cow force-pushed the unsize branch 4 times, most recently from 4588fe6 to 1d16b9e Compare June 6, 2020 12:10
@basil-cow
Copy link
Contributor Author

@nikomatsakis @jackh726 Ready for review, I think. I didn't add trait order tests because I feel like supporting it is out of scope of this pr.

Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the trait order is important. If it doesn't work correctly, then I would definitely like to see tests with FIXMEs. I'll do a more extensive review later

@basil-cow basil-cow force-pushed the unsize branch 2 times, most recently from 793348f to 171998f Compare June 6, 2020 15:36
@basil-cow
Copy link
Contributor Author

@jackh726 added

Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple small things, but this looks good to me otherwise. I would like to see some comments on the individual test goals about what they're for (similar to in the Fn PR). I think getting in this habit will be good :) There are a lot of tests here and it can be hard to keep track of what they are for/what they cover.

@Areredify once you've made these changes, feel free to merge unless @nikomatsakis has any comments

tests/test/builtin_impls/unsize.rs Show resolved Hide resolved
tests/test/builtin_impls/unsize.rs Show resolved Hide resolved
chalk-engine/src/logic.rs Show resolved Hide resolved
chalk-ir/src/debug.rs Outdated Show resolved Hide resolved
@jackh726
Copy link
Member

jackh726 commented Jun 8, 2020

Oh, and please file followup issue(s) for the FIXMEs on merge :)

@basil-cow
Copy link
Contributor Author

basil-cow commented Jun 8, 2020

done with the changes 🙂

Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test comment. But other than that, good to merge.

tests/test/builtin_impls/unsize.rs Show resolved Hide resolved
@basil-cow basil-cow changed the title add lifetime to DynTy and Unsize trait implementation add Unsize trait implementation Jun 9, 2020
WhereClause,
};

struct UnsizeParameterCollector<'a, I: Interner> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooof but this file needs some comments. =) But I don't think it has to block landing necessarily. But we should file an issue or something to follow-up and explain what is going on.

@nikomatsakis nikomatsakis merged commit 5b6ef58 into rust-lang:master Jun 9, 2020
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

Successfully merging this pull request may close these issues.

4 participants