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

Error on constant pointer dereference #6991

Closed
huonw opened this issue Jun 7, 2013 · 6 comments · Fixed by #18324
Closed

Error on constant pointer dereference #6991

huonw opened this issue Jun 7, 2013 · 6 comments · Fixed by #18324
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@huonw
Copy link
Member

huonw commented Jun 7, 2013

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.)

@emberian
Copy link
Member

emberian commented Aug 5, 2013

Especially with static mut I don't think it makes sense to support dereferencing in constant expressions.

@graydon?

@huonw
Copy link
Member Author

huonw commented Jan 3, 2014

Triage: still a bug; dereferencing in constant expressions does seem a little peculiar.

@pnkfelix
Copy link
Member

Defining the semantics of constant expressions continues to be something we really should tackle.

See also #5551.

@treeman
Copy link
Contributor

treeman commented Sep 15, 2014

Triage bump, carry on.

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Sep 22, 2014
@mahkoh
Copy link
Contributor

mahkoh commented Oct 10, 2014

No longer valid.

@alexcrichton
Copy link
Member

Flagging as needstest

@alexcrichton alexcrichton added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 11, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue Apr 8, 2021
redundant_pattern_matching: look inside Refs

look inside refs and detect if let &None = ...

Fixes rust-lang/rust-clippy#5396

changelog:  redundant_pattern_matching: look inside Refs to fix FNs with "if let &None = .. "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants