Skip to content

Handle inference variables in CollectAllMismatches correctly #106322

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged

Conversation

compiler-errors
Copy link
Member

  1. Fix ICE, regression from stable/beta -> nightly: var types encountered in super_relate_consts when trait bound not satisfied #106240
  2. Treat int/float type variables correctly (see src/test/ui/iterators/invalid-iterator-chain-with-int-infer.rs), so we can point out things like "Iterator::Item changed to {integer} here"

@rustbot
Copy link
Collaborator

rustbot commented Dec 31, 2022

r? @wesleywiser

(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 Dec 31, 2022
@rust-log-analyzer

This comment has been minimized.

@compiler-errors compiler-errors force-pushed the CollectAllMismatches-infer-vars branch from 78127ed to 7691071 Compare January 1, 2023 22:50
@compiler-errors
Copy link
Member Author

r? types

This bug happens because #105985 made the diagnostics code use the substituted (0c09e2b) version of predicates, which means we introduced a new ct var which CollectAllMismatches needs to handle gracefully

@rustbot rustbot assigned oli-obk and unassigned wesleywiser Jan 9, 2023
@oli-obk
Copy link
Contributor

oli-obk commented Jan 10, 2023

@bors r+

seems like is_ty_infer is a footgun. Since it's almost exclusively used for diagnostics, should we remove it and require the users to manually match on ty::Infer(_) if that's what they meant (or use is_ty_var instead where applicable)?

@bors
Copy link
Collaborator

bors commented Jan 10, 2023

📌 Commit 7691071b79c016e7bc5c300768a9de66e893063c has been approved by oli-obk

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 Jan 10, 2023
@Noratrieb
Copy link
Member

Tests moved from src/tests to the tests directory in the root, can you rebase and move them?
@bors r-
@rustbot author

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 11, 2023
@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 11, 2023
@compiler-errors compiler-errors force-pushed the CollectAllMismatches-infer-vars branch from 7691071 to 959616e Compare January 11, 2023 20:01
@compiler-errors
Copy link
Member Author

rebased

@bors r=oli-obk

@bors
Copy link
Collaborator

bors commented Jan 11, 2023

📌 Commit 959616e has been approved by oli-obk

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 11, 2023
Noratrieb added a commit to Noratrieb/rust that referenced this pull request Jan 12, 2023
…es-infer-vars, r=oli-obk

Handle inference variables in `CollectAllMismatches` correctly

1. Fix rust-lang#106240
2. Treat int/float type variables correctly (see `src/test/ui/iterators/invalid-iterator-chain-with-int-infer.rs`), so we can point out things like "`Iterator::Item` changed to `{integer}` here"
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 12, 2023
Rollup of 6 pull requests

Successful merges:

 - rust-lang#105806 (Support eager subdiagnostics again)
 - rust-lang#106322 (Handle inference variables in `CollectAllMismatches` correctly)
 - rust-lang#106579 (Suggest making private tuple struct field public)
 - rust-lang#106714 (remove unreachable error code `E0490`)
 - rust-lang#106751 (Fix rendering 'const' in header for intrinsics)
 - rust-lang#106761 (Add `WaffleLapkin` to compiler reviewers)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 35cf81d into rust-lang:master Jan 12, 2023
@rustbot rustbot added this to the 1.68.0 milestone Jan 12, 2023
JohnTitor pushed a commit to JohnTitor/rust that referenced this pull request Jan 13, 2023
…-confusing, r=lcnr

Rename `Ty::is_ty_infer` -> `Ty::is_ty_or_numeric_infer`

Makes sure people are aware that they may have a type variable *or* an int/float variable.

r? `@oli-obk` rust-lang#106322 (comment) but I could instead implement your solution, let me know.

(This will conflict with rust-lang#106322 for now, ignore that 😄)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 13, 2023
…-confusing, r=lcnr

Rename `Ty::is_ty_infer` -> `Ty::is_ty_or_numeric_infer`

Makes sure people are aware that they may have a type variable *or* an int/float variable.

r? ``@oli-obk`` rust-lang#106322 (comment) but I could instead implement your solution, let me know.

(This will conflict with rust-lang#106322 for now, ignore that 😄)
@compiler-errors compiler-errors deleted the CollectAllMismatches-infer-vars branch August 11, 2023 19:54
# for free to join this conversation on GitHub. Already have an account? # 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
7 participants