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

LLVM assertion failure with pattern matching and references #4653

Closed
alexcrichton opened this issue Jan 27, 2013 · 3 comments
Closed

LLVM assertion failure with pattern matching and references #4653

alexcrichton opened this issue Jan 27, 2013 · 3 comments
Labels
A-codegen Area: Code generation I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@alexcrichton
Copy link
Member

This program:

fn main() {
  let &(ref x, _) = &(1, 1);
}

Produces the output:

$ rustc --test bug3.rs
bug3.rs:2:8: 2:14 warning: unused variable: `x`
bug3.rs:2   let &(ref x, _) = &(1, 1);
                  ^~~~~~
Assertion failed: (getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer
 to Val type!"), function AssertOK, file /Users/alex/code/rust2/src/llvm/lib/VMCore/Instructions.cpp, line 1062.

@alexcrichton
Copy link
Member Author

I get the same assertion failure for this program as well:

struct A {                                    
  val: ~str                                   
}                                             

fn main() {                                   
  macro_rules! check_set (                    
    ($set:expr, $id:expr) => {                
      match &$id {                            
        _ => io::println(fmt!("%s", $id.val)) 
      }                                       
    }                                         
  );                                          
  let a = @A{ val: ~"" };                     
  check_set!(set, a);                         
}                                             

If it's not in a macro, it doesn't trip an assertion, however, oddly enough.

@bblum
Copy link
Contributor

bblum commented Jun 6, 2013

is this a dup of #3874 ?

@alexcrichton
Copy link
Member Author

This particular bug was closed by #7262, but I'll open another because this still doesn't compile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants