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 array types to TypeName #467

Merged
merged 7 commits into from
May 26, 2020
Merged

Conversation

nathanwhit
Copy link
Member

Addresses part of #368.

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.

Couple things

chalk-parse/src/ast.rs Outdated Show resolved Hide resolved
chalk-solve/src/clauses/builtin_traits/copy.rs Outdated Show resolved Hide resolved
@nathanwhit nathanwhit force-pushed the typename-array branch 3 times, most recently from 3e43431 to 9fb7842 Compare May 22, 2020 00:09
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.

LGTM. I would only say that I would like to see a lowering test for the couple different const scenarios here (with or without id)

@Areredify can you look this over once more? Feel free to merge if it looks good to you and CI is green :)

chalk-integration/src/lowering.rs Outdated Show resolved Hide resolved
chalk-integration/src/lowering.rs Outdated Show resolved Hide resolved
chalk-parse/src/parser.lalrpop Outdated Show resolved Hide resolved
chalk-parse/src/ast.rs Outdated Show resolved Hide resolved
@nathanwhit
Copy link
Member Author

Updated to apply your suggestions @Areredify, and I also added some more lowering tests as suggested by @jackh726 for good measure.

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.

This looks good -- my only nit is the "well-formed" condition -- but I don't think I'd block on this, I think that's something we need to do a review of in a more comprehensive fashion, since I think our current support is fragmented.

chalk-integration/src/lowering.rs Show resolved Hide resolved
chalk-integration/src/lowering.rs Show resolved Hide resolved
TypeName::Never | TypeName::Scalar(_) | TypeName::Raw(_) | TypeName::Ref(_) => {
builder.push_fact(trait_ref.clone())
}
TypeName::Array
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have "WF" condition code somewhere? We'll have to check that the [T;N] requires T: Sized

Copy link
Contributor

Choose a reason for hiding this comment

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

We push WF clauses in match_type_name, and I don't think we had a big discussion about how we want to handle well-formedness of tuples and arrays. IIRC the takeaway was that we rely on rustc to provide well-formed tuples (and, in this case, arrays), but I might be wrong

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess I was thinking of WfSolver -- but yeah I think we probably shouldn't block on this right now, it's something we'll definitely want to think about.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should just file an issue I guess.


goal {
forall<const N, T> {
WellFormed([T; N])
Copy link
Contributor

Choose a reason for hiding this comment

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

This actually shouldn't hold, I suspect, we don't know that T: Sized...

@nikomatsakis nikomatsakis merged commit 1bddc72 into rust-lang:master May 26, 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