Skip to content

assertion failed: !bcx.ccx().maps.moves_map.contains(&arg_expr.id) #6609

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

Closed
ssbr opened this issue May 19, 2013 · 4 comments
Closed

assertion failed: !bcx.ccx().maps.moves_map.contains(&arg_expr.id) #6609

ssbr opened this issue May 19, 2013 · 4 comments

Comments

@ssbr
Copy link
Contributor

ssbr commented May 19, 2013

Sorry, since I don't know what causes this, can't be more specific, and don't know if the other bug reports (currently 4 others) are related or have distinct causes.

Other issues with the same error:

This is as small as I can get the code:

use core::num::Zero;

pub trait MyTrait {
    pub fn method(&mut self);
}

pub struct MyStruct<U> {
    pub attr: U,
}

pub impl<U: Num> MyStruct<U> {
    pub fn other_method(&mut self) {
        self.attr += Zero::zero();
    }
}

impl MyTrait for MyStruct<f64> {
    pub fn method(&mut self) {
        self.other_method();
    }
}

fn main() {
    let x = MyStruct {attr: 0.0f64};
    let _ = ~x as ~MyTrait;
}
@osaut
Copy link
Contributor

osaut commented Jun 20, 2013

The ICE seems to be related to the line

self.attr+= Zero::zero();

as replacing it with

self.attr=self.attr+Zero::zero();

works.

The code no longer compiles on recent master, here is an updated version

use std::num::Zero;

pub trait MyTrait {
    pub fn method(&mut self);
}

pub struct MyStruct<U> {
    pub attr: U,
}

impl<U: Num> MyStruct<U> {
   pub fn other_method(&mut self) {
        self.attr = self.attr+ Zero::zero();
   }
}

impl MyTrait for MyStruct<f64> {
   pub fn method(&mut self) {
        self.other_method();
    }
}

fn main() {
    let x = MyStruct {attr: 0.0f64};
    let _ = ~x as ~MyTrait;
}

@huonw
Copy link
Member

huonw commented Jun 20, 2013

This and #6000 both seem to have the common property of evaluating a generic/non-implicitly-copiable value twice (if I understand how += currently works). I don't know the details, but, in both cases, I'd guess the problem is because the things should be duplicated (with new id's and so) to be legally evaluated twice, and this isn't happening.

@emberian
Copy link
Member

emberian commented Aug 5, 2013

@osaut's updated version compiles and runs, and since then += has been removed

@pnkfelix
Copy link
Member

it seems like this bug is no longer actionable, since the original test case relies on +=, and the updated version does not exhibit the bug according to @cmr. Closing.

flip1995 pushed a commit to flip1995/rust that referenced this issue Jan 30, 2021
…in_deref, r=llogiq

Fix a wrong suggestion of `ref_in_deref`

Fix rust-lang#6358.

changelog: Fix a wrong suggestion of `ref_in_deref`
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

5 participants