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

[Docs] Fix fold explanation in the guide #18139

Merged
merged 1 commit into from
Oct 19, 2014
Merged

Conversation

JelteF
Copy link
Contributor

@JelteF JelteF commented Oct 18, 2014

The explanation of fold talks about three elements that should be summed, but it uses different values in the provided code.

The explanation of fold talks about three elements that should be summed, but it uses different values in the provided code.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon.

@steveklabnik
Copy link
Member

this is a nice catch, thank you!

bors added a commit that referenced this pull request Oct 19, 2014
The explanation of fold talks about three elements that should be summed, but it uses different values in the provided code.
@bors bors closed this Oct 19, 2014
@bors bors merged commit 2a66814 into rust-lang:master Oct 19, 2014
lnicola pushed a commit to lnicola/rust that referenced this pull request Sep 25, 2024
fix: Extend `type_variable_table` when modifying index is larger than the table size

Fixes rust-lang#18109

Whenever we create an inference variable in r-a, we extend `type_variable_table` to matching size here;

https://github.com/rust-lang/rust-analyzer/blob/f4aca78c92e03354327c8f6c7fefaef9f45ab166/crates/hir-ty/src/infer/unify.rs#L378-L381

But sometimes, an inference variable is [created from chalk](https://github.com/rust-lang/chalk/blob/ab710e0c9b455403b138ef72a2fb90967a58eff3/chalk-solve/src/infer/unify.rs#L743) and passed to r-a as a type of an expression or a pattern.
If r-a set diverging flag to this before the table is extended to a sufficient size, it panics here;

https://github.com/rust-lang/rust-analyzer/blob/f4aca78c92e03354327c8f6c7fefaef9f45ab166/crates/hir-ty/src/infer/unify.rs#L275-L277

I think that extending table when setting diverging flag is reasonable becase we are already doing such extending to a size that covers the inference vars created from chalk and this change only covers the order-dependent random cases that this might fail
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.

5 participants