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

Record semantic types for all syntactic types in bodies #44633

Merged
merged 3 commits into from
Sep 23, 2017

Conversation

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Sep 16, 2017

... and use recorded types in type privacy checking (types are recorded after inference, so there are no _s left).
Also use hir_ty_to_ty for types in signatures in type privacy checking.

This could also be potentially useful for save-analysis and diagnostics.

Fixes #42125 (comment)
r? @eddyb

}
} else {
// Types in signatures.
if rustc_typeck::hir_ty_to_ty(self.tcx, hir_ty).visit_with(self) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is very ineffective.
What I would actually like is to resurrect global ast_ty_to_ty_cache, but I don't know how to do it in the new query-oriented world.

Copy link
Member

Choose a reason for hiding this comment

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

It wouldn't be global, it would be per-item and it wouldn't be a cache but an eagerly computed map.

Copy link
Contributor

Choose a reason for hiding this comment

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

eagerly computed? do you mean lazilly computed?

Copy link
Contributor

Choose a reason for hiding this comment

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

so .. why can't we put this information into the table? just because the type checker doesn't happen to include it now? It seems like we could begin the type-checking process by invoking hir_ty_to_ty on the argument types in the same way we do here. Not sure if that would be better.

Copy link
Member

Choose a reason for hiding this comment

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

I mean eagerly computed per-item, because you have to return the entire map.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, ok, yes.

@eddyb
Copy link
Member

eddyb commented Sep 16, 2017

r? @nikomatsakis

@rust-highfive rust-highfive assigned nikomatsakis and unassigned eddyb Sep 16, 2017
@carols10cents carols10cents added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 18, 2017
@bors
Copy link
Contributor

bors commented Sep 18, 2017

☔ The latest upstream changes (presumably #44678) made this pull request unmergeable. Please resolve the merge conflicts.

@arielb1 arielb1 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 19, 2017
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 fine as far as it goes; I agree it doesn't feel necessarily very elegant, somehow, although having the information be part of the typeck tables seems... like a pretty reasonable place to put it...

@nikomatsakis
Copy link
Contributor

In case it wasn't clear, r=me -- but needs rebase.

I think maybe we'll revisit this over time and try to find a nicer way to package it up, but this seems like it should work for now!

@petrochenkov
Copy link
Contributor Author

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Sep 22, 2017

📌 Commit 419069d has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Sep 23, 2017

⌛ Testing commit 419069d with merge a6a7dac...

bors added a commit that referenced this pull request Sep 23, 2017
Record semantic types for all syntactic types in bodies

... and use recorded types in type privacy checking (types are recorded after inference, so there are no `_`s left).
Also use `hir_ty_to_ty` for types in signatures in type privacy checking.

This could also be potentially useful for save-analysis and diagnostics.

Fixes #42125 (comment)
r? @eddyb
@petrochenkov petrochenkov 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 23, 2017
@bors
Copy link
Contributor

bors commented Sep 23, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing a6a7dac to master...

@bors bors merged commit 419069d into rust-lang:master Sep 23, 2017
bors added a commit that referenced this pull request Dec 21, 2017
Type privacy polishing

Various preparations before implementing rust-lang/rfcs#2145 containing final minor breaking changes (mostly for unstable code or code using `allow(private_in_public)`).
(Continuation of #42125, #44633 and #41332.)

It would be good to run crater on this.
r? @eddyb
@petrochenkov petrochenkov deleted the priv2 branch June 5, 2019 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

6 participants