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

ICE when updating tuples #8856

Closed
gavinb opened this issue Aug 29, 2013 · 4 comments
Closed

ICE when updating tuples #8856

gavinb opened this issue Aug 29, 2013 · 4 comments

Comments

@gavinb
Copy link
Contributor

gavinb commented Aug 29, 2013

Playing around with some simple code which is clearly wrong:

fn gcd(n: uint, m: uint) -> uint {
    while m > 0 {
        (m, n) = (n, n%m)
    }
    n
}

fn main() {
    let a = 75;
    let b = 15;
    println!("gcd({}, {}) = {}", a, b, gcd(a, b));
}

This triggered an internal compiler error:

test.rs:4:8: 4:14 error: internal compiler error: trans_lvalue reached fall-through case: expr_tup(~[@{id: 15, node: expr_path({span: {lo: {__field__: 63}, hi: {__field__: 64}, expn_info: None}, global: false, idents: ~[{name: 70, ctxt: 0}], rp: None, types: ~[]}), span: {lo: {__field__: 63}, hi: {__field__: 64}, expn_info: None}}, @{id: 16, node: expr_path({span: {lo: {__field__: 66}, hi: {__field__: 67}, expn_info: None}, global: false, idents: ~[{name: 68, ctxt: 0}], rp: None, types: ~[]}), span: {lo: {__field__: 66}, hi: {__field__: 67}, expn_info: None}}])
test.rs:4         (m, n) = (n, n%m)
                  ^~~~~~

This is running Rust 1ac7d80 on Mac OS X 10.8.4.

Incidentally, when trying to check the version, I noticed this error:

$ rust --version
rust 0.8-pre (1ac7d80 2013-08-26 15:51:15 -0700)
host: x86_64-apple-darwin
pthread_mutex_lock(&_mutex) failed in /Users/abcdef/src/rust/src/rt/sync/lock_and_signal.cpp at line 79, result = 22 (Invalid argument) 
Abort trap: 6
@alexcrichton
Copy link
Member

Huh, that's an odd ICE. I was under the impression that rust didn't support destructuring assignment into existing locals.

@gavinb
Copy link
Contributor Author

gavinb commented Aug 30, 2013

It doesn't. :) I should say, that's why I mentioned that the code was wrong in attempting to mutate the immutable parameters (it was converted from Python code where this would be fine). I fixed it by declaring two local mutable shadow vars.

The pthread failure is a bit of a worry, too. Haven't had a chance to dig into that yet.

@alexcrichton
Copy link
Member

Opened #8870 to continue discussion about the pthreads failure, that is disturbing...

@alexcrichton
Copy link
Member

For the original issue, closing this as a dupe of #7507

xFrednet pushed a commit to xFrednet/rust that referenced this issue May 21, 2022
Rustup

`@rust-lang/clippy,` `@Jarcho,` `@dswij,` `@Alexendoo.` Could someone review this? It should be pretty straight forward since it's just a sync. I think it's also fine if either one of `@Jarcho,` `@dswij,` `@Alexendoo` approves this, as these are usually not reviewed. I just want to make sure that I didn't break something obvious 🙃

It should be enough to look at the merge commit 🙃

changelog: none
changelog: move [`significant_drop_in_scrutinee`] to `suspicious`
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

2 participants