Skip to content

Generalize with variance #673

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

Merged
merged 2 commits into from
Jan 19, 2021
Merged

Conversation

jackh726
Copy link
Member

@jackh726 jackh726 commented Jan 5, 2021

Closes #667

@@ -660,7 +740,9 @@ impl<'t, I: Interner> Unifier<'t, I> {
if matches!(kind, TyVariableKind::Integer | TyVariableKind::Float) {
ty.clone()
} else if let Some(ty) = self.table.normalize_ty_shallow(interner, ty) {
self.generalize_ty(&ty, universe_index)
self.generalize_ty(&ty, universe_index, variance)
} else if matches!(variance, Variance::Invariant) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The rustc code here also checks that this variable can name universe_index here, although that's maybe only for error messages.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm. So should I change this here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that we can keep the simpler code for now.

@matthewjasper
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 19, 2021

📌 Commit 9bf2ba0 has been approved by matthewjasper

@bors
Copy link
Contributor

bors commented Jan 19, 2021

⌛ Testing commit 9bf2ba0 with merge 1e096f6...

@bors
Copy link
Contributor

bors commented Jan 19, 2021

☀️ Test successful - checks-actions
Approved by: matthewjasper
Pushing 1e096f6 to master...

@bors bors merged commit 1e096f6 into rust-lang:master Jan 19, 2021
@jackh726 jackh726 deleted the generalize-variance branch January 19, 2021 23:29
@lnicola
Copy link
Member

lnicola commented Jan 20, 2021

If it's not too much of a hassle, would it be possible to publish a new version to crates.io? There's one or two rust-analyzer that this should fix and while I can use a git dependency to test, it wouldn't hurt to let it bake a little until the next release.

@jackh726
Copy link
Member Author

@lnicola just kicked off a publish

@lnicola
Copy link
Member

lnicola commented Jan 20, 2021

Note to self: we should do chalk upgrades on Monday.

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.

Endless loop in recursive solver
4 participants