Skip to content

Error on constant pointer dereference #6991

Closed
@huonw

Description

@huonw

After #6990 lands the following fails with an error message. (It currently ICEs.)

static x: &'static uint = &'static 1;
static y: uint = *x;
fn main(){
    match 1 {
        y => {}
        _ => {}
    }
}
const.rs:2:17: 2:19 error: Unsupported constant expr
const.rs:2 static y: uint = *x;
                            ^~

I'm not sure whether this is correctly not-constant, or whether it should compile fine. In the former case, is this something that should be handled in check_const.rs rather than const_eval.rs (where it is handled currently (0d0c004))?

That testcase requires the match with the y.

(This is filed because I wasn't sure about whether this is a valid testcase for #6990 or whether it shouldn't be triggering this code path at all.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions