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

integral variable bindings do not "rollback" like they should #3211

Closed
nikomatsakis opened this issue Aug 16, 2012 · 2 comments
Closed

integral variable bindings do not "rollback" like they should #3211

nikomatsakis opened this issue Aug 16, 2012 · 2 comments
Labels
A-type-system Area: Type system

Comments

@nikomatsakis
Copy link
Contributor

The type inference module includes a "transactional" component that allows unifications to roll back in the case of failure. This is used in various places but one notable place is in the resolution of impls, where we must look for all possible matches. However, integral type variables never roll back. This is simple to fix but it exposes another problem, which is that we are not properly forcing integral type variables to int in method calls. As a side effect, something like this:

5.times { }

yields an error because here 5 could be int, uint, etc.

@Dretch
Copy link
Contributor

Dretch commented Dec 9, 2012

I think I found another manifestation of this bug. The code:

fn main() {
    let mut x = 0;
    for 4096.times {
        x += 1;
    }
    io::println(fmt!("x = %u", x));
}

Prints x = 0 instead of x = 4096 ... because the loop code never gets executed.

@nikomatsakis
Copy link
Contributor Author

Closed now per @graydon's commit

RalfJung pushed a commit to RalfJung/rust that referenced this issue Dec 5, 2023
fix promising a very large alignment

Also make use of rust-lang#118565 to simplify some SIMD intrinsics, while we are at it
jaisnan pushed a commit to jaisnan/rust-dev that referenced this issue Jul 29, 2024
Previously, benchcomp would crash while rendering a scatterplot when
some results had non-numeric values, because those values were being
rounded using a function that doesn't handle non-numeric arguments.

This commit fixes rust-lang#3210.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system
Projects
None yet
Development

No branches or pull requests

2 participants