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

Use node_ty_opt to avoid ICE in visit_ty #104514

Merged
merged 1 commit into from
Nov 25, 2022

Conversation

chenyukang
Copy link
Member

Fixes #104513

@rustbot
Copy link
Collaborator

rustbot commented Nov 17, 2022

r? @eholk

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 17, 2022
@compiler-errors compiler-errors changed the title Use node_ty_opt to avoid ICE in visity_ty Use node_ty_opt to avoid ICE in visit_ty Nov 17, 2022
@chenyukang chenyukang force-pushed the yukang/fix-104513-ice branch from 57edc37 to 75915e8 Compare November 18, 2022 16:55
@chenyukang chenyukang changed the title Use node_ty_opt to avoid ICE in visit_ty Delay a span bug if we see generic params with err during writeback Nov 18, 2022
@chenyukang chenyukang marked this pull request as draft November 19, 2022 02:08
@chenyukang chenyukang marked this pull request as ready for review November 19, 2022 15:17
@eholk
Copy link
Contributor

eholk commented Nov 21, 2022

I'm going to assign this over to you, @petrochenkov, since you seem to know this area.

r? @petrochenkov

@rustbot rustbot assigned petrochenkov and unassigned eholk Nov 21, 2022
@petrochenkov
Copy link
Contributor

Last time I touched this code was years ago.
But now I remember why every node should have a type - because type privacy pass retrieves types for all nodes.

Type privacy pass, however, is not run if there are type checking errors (compilation stops after type checking in this case).
If type privacy is run after type checking errors, then it will ICE with both the first and the second version of this PR.

@petrochenkov
Copy link
Contributor

So, if the result is the same and nothing ICEs right now, then I guess the first version was preferable just because it was simpler.

@petrochenkov
Copy link
Contributor

Or alternatively TyKind::Err should be put in to the table instead of delay_span_buging after all.
@rustbot author

@rustbot rustbot 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 Nov 21, 2022
@chenyukang chenyukang force-pushed the yukang/fix-104513-ice branch from 75915e8 to ecea94e Compare November 24, 2022 05:02
@chenyukang chenyukang changed the title Delay a span bug if we see generic params with err during writeback Use node_ty_opt to avoid ICE in visit_ty Nov 24, 2022
@chenyukang
Copy link
Member Author

So, if the result is the same and nothing ICEs right now, then I guess the first version was preferable just because it was simpler.

Yes, I also prefer to the first version, and add some comments.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 24, 2022
@petrochenkov
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 24, 2022

📌 Commit ecea94e has been approved by petrochenkov

It is now in the queue for this repository.

@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 Nov 24, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 24, 2022
…r=petrochenkov

Use node_ty_opt to avoid ICE in visit_ty

Fixes rust-lang#104513
Comment on lines +369 to +370
let ty = self.resolve(ty, &hir_ty.span);
self.write_ty_to_typeck_results(hir_ty.hir_id, ty);
Copy link
Member

Choose a reason for hiding this comment

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

Hm, we probably should write back ty_error or something else here... At least that would also delay a bug in the case we have no node_ty.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, there was a comment above to this effect.

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 24, 2022
…iaskrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#104514 (Use node_ty_opt to avoid ICE in visit_ty)
 - rust-lang#104704 (Allow power10-vector feature in PowerPC)
 - rust-lang#104747 (resolve: Don't use constructor def ids in the map for field names)
 - rust-lang#104773 (OpaqueCast projections are always overlapping, they can't possibly be disjoint)
 - rust-lang#104774 (Document split{_ascii,}_whitespace() for empty strings)
 - rust-lang#104780 (make `error_reported` check for delayed bugs)
 - rust-lang#104782 (Bump the const eval step limit)
 - rust-lang#104792 (rustdoc: simplify `.search-results-title` CSS)
 - rust-lang#104796 (lint: do not warn unused parens around higher-ranked function pointers)
 - rust-lang#104820 (Remove normalize_projection_type)
 - rust-lang#104822 (with_query_mode -> new)

Failed merges:

 - rust-lang#104716 (move 2 candidates into builtin candidate)
 - rust-lang#104841 (Assert that we don't capture escaping bound vars in `Fn` trait selection)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 80dc91c into rust-lang:master Nov 25, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 25, 2022
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE "no type for node"
6 participants