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 const generics to the HIR #58503

Merged
merged 13 commits into from
Feb 19, 2019
Merged

Add const generics to the HIR #58503

merged 13 commits into from
Feb 19, 2019

Conversation

varkor
Copy link
Member

@varkor varkor commented Feb 15, 2019

Split out from #53645. This work is a collaborative effort with @yodaldevoid.

r? @eddyb

varkor and others added 9 commits February 15, 2019 22:28
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 15, 2019
@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct ConstArg {
pub value: AnonConst,
pub span: Span,
Copy link
Contributor

Choose a reason for hiding this comment

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

This span is identical to the span in body of AnonConst, is it viable to use it instead?
Other AnonConsts don't create extra spans during lowering as far as can I see.

Copy link
Contributor

Choose a reason for hiding this comment

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

(The whole ConstArg could be refactored away in that case.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ugh, I see GenericArg::span wants to work in isolation without any contexts.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, we went through the same thought process when this was implemented. If you can see a way to refactor this, I'd be all ears.

@petrochenkov
Copy link
Contributor

LGTM, r=me modulo removing abort / adding lint test (#58503 (comment)).

I'll keep @eddyb assigned in case he wants to look.

@petrochenkov petrochenkov removed their assignment Feb 16, 2019
@varkor
Copy link
Member Author

varkor commented Feb 16, 2019

@bors r=petrochenkov p=1

(Increasing priority because this unblocks other work.)

@bors
Copy link
Contributor

bors commented Feb 16, 2019

📌 Commit 727e204 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 16, 2019
@bors
Copy link
Contributor

bors commented Feb 17, 2019

⌛ Testing commit 727e204 with merge 3cdf81e0294cfe7414af2cae07bd3e82d1975058...

@Centril
Copy link
Contributor

Centril commented Feb 17, 2019

@bors retry

@@ -1684,6 +1707,11 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> {
let encode_info = IsolatedEncoder::encode_info_for_ty_param;
self.record(def_id, encode_info, (def_id, has_default));
}
hir::GenericParamKind::Const { .. } => {
let def_id = self.tcx.hir().local_def_id(param.id);
let encode_info = IsolatedEncoder::encode_info_for_const_param;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe open an issue about unifying the param encoding in metadata, the same way GenericParamDef has common fields?

Copy link
Member Author

Choose a reason for hiding this comment

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

Opened #58581.

@bors
Copy link
Contributor

bors commented Feb 19, 2019

⌛ Testing commit 727e204 with merge 32471f7...

bors added a commit that referenced this pull request Feb 19, 2019
Add const generics to the HIR

Split out from #53645.

cc @yodaldevoid

r? @eddyb
@bors
Copy link
Contributor

bors commented Feb 19, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: petrochenkov
Pushing 32471f7 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 19, 2019
@bors bors merged commit 727e204 into rust-lang:master Feb 19, 2019
@varkor varkor deleted the const-generics-hir branch February 19, 2019 20:21
Centril added a commit to Centril/rust that referenced this pull request Mar 27, 2019
…tor, r=eddyb

Refactor generic parameter encoder functions

Addresses rust-lang#58503 (comment).

r? @eddyb
Centril added a commit to Centril/rust that referenced this pull request Mar 28, 2019
…tor, r=eddyb

Refactor generic parameter encoder functions

Addresses rust-lang#58503 (comment).

r? @eddyb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants