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 with an @mut ~[T] vec #5275

Closed
alexcrichton opened this issue Mar 8, 2013 · 5 comments
Closed

ICE with an @mut ~[T] vec #5275

alexcrichton opened this issue Mar 8, 2013 · 5 comments
Labels
A-codegen Area: Code generation E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@alexcrichton
Copy link
Member

This program:

struct A {
  bar: @mut ~[int],
}

impl A {
  fn foo(&self) -> int {
    match 3 {
      _ => if true {
        fail!()
      } else {
        *self.bar.last() // bug is from this line
      }
    }
  }
}

fn main() {}

Causes this output:

$ rustc foo.rs        
error: internal compiler error: no enclosing scope with id 31

I tried minimizing it further, but I was unable to get it any smaller.

@alexcrichton
Copy link
Member Author

I managed to get it a little smaller without relying on vec::last

fn foo(self: &A) -> int {           
    if true {                       
        fail!()                     
    } else {                        
        *bar(self.bar)              
    }                               
}                                   

pub fn main() {}                    

fn bar(_: &'r mut int) -> &'r int {   
    fail!()                         
}                                   

struct A {                          
  bar: @mut int,                    
}                                   

@iansharkey
Copy link

Got the same error with this testcase:

enum A {
 L(@mut [A]),
//L(@ [A]),  <-- this compiles
}

impl Eq for A {
  fn eq(&self, other: &A) -> bool {
    match (self, other) {
      (&L(x), &L(y)) => (x == y)
    }
  }

  fn ne(&self, _: &A) -> bool {
    return false;
  }
}

fn main() {}

@emberian
Copy link
Member

Updated testcase:

fn foo(self_: &A) -> int {           
    if true {                       
        fail!()                     
    } else {                        
        *bar(self_.bar)              
    }                               
}                                   

pub fn main() {}                    

fn bar<'r>(_: &'r mut int) -> &'r int {   
    fail!()                         
}                                   

struct A {                          
  bar: @mut int,                    
}                                   

@alexcrichton
Copy link
Member Author

This has been fixed somewhere in the interim. Not quite sure where, but there were lots of changes to borrowck between when I opened this issue and now.

@emberian
Copy link
Member

Needstest

@emberian emberian reopened this Jul 19, 2013
Sawyer47 added a commit to Sawyer47/rust that referenced this issue Jun 18, 2014
Issue rust-lang#5275 was closed, but there still was a FIXME for it.
alexcrichton pushed a commit to alexcrichton/rust that referenced this issue Jun 19, 2014
Issue rust-lang#5275 was closed, but there still was a FIXME for it.
alexcrichton added a commit to alexcrichton/rust that referenced this issue Jun 19, 2014
Closes rust-lang#14480 (vim: Add :RustRun and associated commands)
Closes rust-lang#14917 (Deprecate free-standing endian conversions in favor of methods on Int. Merge Bitwise into Int and add more bit operations.)
Closes rust-lang#14981 (librustc: Use expr_ty_adjusted in trans_overloaded_call.)
Closes rust-lang#14989 (std::task - Revamp TaskBuilder API)
Closes rust-lang#14997 (Reject double moves out of array elements)
Closes rust-lang#14998 (Vim: highlight escapes for byte literals.)
Closes rust-lang#15002 (Fix FIXME rust-lang#5275)
Closes rust-lang#15004 (Fix rust-lang#14865)
Closes rust-lang#15007 (debuginfo: Add test case for issue rust-lang#14411.)
Closes rust-lang#15012 ((doc) Change search placeholder text.)
Closes rust-lang#15013 (Update compiler-rt.)
Closes rust-lang#15017 (Deprecate the bytes!() macro.)
flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 23, 2020
Macro use sugg

changelog: Add auto applicable suggstion to macro_use_imports

fixes rust-lang#5275

<s>Where exactly is the `wildcard_imports_helper` I haven't been able to import anything ex.
`use lazy_static;` or something like for that I get version/compiler conflicts?</s>
Found it.

Should we also check for `#[macro_use] extern crate`, although this is still depended on for stuff like `rustc_private`?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants