- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-type-systemArea: Type systemArea: Type system
Milestone
Description
Case 1: Unexpected path error
Input code
const A: (int,int) = (3,4);
fn main() { match 42 { A => () } }expected: type error on line r { }, because type of 0 is not tuple but r is.
result: compile error
log:
rust: task failed at 'Unsupported constant expr', <core-macros>:15
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', <core-macros>:15
rust: domain main @0x7fd30b80c810 root task failedCase 2: Unexpected silence and strange behavior
Input:
fn main() {
    let a_tuple = (1, 2);
    match 0 {
        a_tuple => {
            io::println("A");
        }
    }
}Expected: type error on line r { }, because type of 0 is not tuple but r is.
Result: Unexpected warnings, silence complie and unexpected behavior.
Warnings:
min2.rs:2:8: 2:17 warning: unused variable: `a_tuple`
min2.rs:2     let a_tuple = (1, 2);
                  ^~~~~~~~~
min2.rs:4:8: 4:18 warning: unused variable: `a_tuple`
min2.rs:4         a_tuple => {
                  ^~~~~~~~~~It should not be 'unused variable'
Output with execution:
$ ./min2
A0 looks matched to (1,2)
Even more, trying next:
fn main() {
    let a_tuple = (1, 2);
    match 0 {
        a_tuple => {
            io::println("A");
        }
        _ => {
            io::println("B");
        }
    }
}Unreachable _ error is raised.
min2.rs:7:8: 7:9 error: unreachable pattern
min2.rs:7         _ => {
                  ^
error: aborting due to previous error
rust: task failed at 'explicit failure', <core-macros>:15
rust: task failed at 'explicit failure', <core-macros>:15
rust: domain main @0x7f981b80c810 root task failed
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-type-systemArea: Type systemArea: Type system