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

Constant-folding error with negative constant on RHS of shift #26210

Closed
eefriedman opened this issue Jun 11, 2015 · 0 comments
Closed

Constant-folding error with negative constant on RHS of shift #26210

eefriedman opened this issue Jun 11, 2015 · 0 comments

Comments

@eefriedman
Copy link
Contributor

fn main() {
    let a = -1+2isize;
    let _b = a<<(1isize-1);
    let _c = a<<(a+-1);
    let _d = a<<(1isize+-1);
}

Produces:

<anon>:5:25: 5:27 error: unary negation of unsigned integers may be removed in the future
<anon>:5     let _d = a<<(1isize+-1);
                                 ^~
error: aborting due to previous error

I would expect no error.

I think the error message is coming out of eval_const_expr_with_substs.

eefriedman added a commit to eefriedman/rust that referenced this issue Jul 18, 2015
The "hint" mechanism is essentially used as a workaround to compute
types for expressions which have not yet been type-checked. This
commit clarifies that usage, and limits the effects to the places
where it is currently necessary.

Fixes rust-lang#26210.
bors added a commit that referenced this issue Jul 22, 2015
The "hint" mechanism is essentially used as a workaround to compute
types for expressions which have not yet been type-checked. This
commit clarifies that usage, and limits the effects to the places
where it is currently necessary.

Fixes #26210.
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

No branches or pull requests

1 participant