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 on nightly 2017-11-07: casting *const i64 to *mut _ #45872

Closed
jeehoonkang opened this issue Nov 8, 2017 · 4 comments
Closed

ICE on nightly 2017-11-07: casting *const i64 to *mut _ #45872

jeehoonkang opened this issue Nov 8, 2017 · 4 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jeehoonkang
Copy link
Contributor

jeehoonkang commented Nov 8, 2017

  • meta

    $ rustc --version
    rustc 1.23.0-nightly (ee2286149 2017-11-07)
    
    $ uname -a
    Darwin Jeehoon-Kangs-MacBook-Pro.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
    
  • minimal example: https://play.rust-lang.org/?gist=231bf59b18642fcaba9a939dd43c41d8&version=nightly

    use std::ptr;
    
    fn main() {
        let p1: *const i64 = ptr::null();
        let p2 = p1 as *mut _;
    }
  • error message (from playground)

       Compiling playground v0.0.1 (file:///playground)
    error: internal compiler error: unexpected panic
    
    note: the compiler unexpectedly panicked. this is a bug.
    
    note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
    
    note: rustc 1.23.0-nightly (ee2286149 2017-11-07) running on x86_64-unknown-linux-gnu
    
    thread 'rustc' panicked at 'explicit panic', /checkout/src/librustc_typeck/check/cast.rs:108:17
    note: Run with `RUST_BACKTRACE=1` for a backtrace.
    
    error: Could not compile `playground`.
    
    To learn more, run the command again with --verbose.
    
@jeehoonkang jeehoonkang changed the title ICE on nightly 2017-11-07: casting *const _ to *mut _ ICE on nightly 2017-11-07: casting *const i64 to *mut _ Nov 8, 2017
@est31
Copy link
Member

est31 commented Nov 8, 2017

bisect-rust says the regression is in commit dce604a PR #44295

cc @plietar @arielb1

@pietroalbini pietroalbini added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Jan 23, 2018
@zmt00
Copy link

zmt00 commented Jun 1, 2018

The example on the playground now just reports an error instead of producing an ICE on stable and nightly, which I believe is working as intended.

   Compiling playground v0.0.1 (file:///playground)
error[E0641]: cannot cast to a pointer of an unknown kind
 --> src/main.rs:5:14
  |
5 |     let p2 = p1 as *mut _;
  |              ^^^^^^------
  |                    |
  |                    help: consider giving more type information
  |
  = note: The type information given here is insufficient to check whether the pointer cast is valid

error: aborting due to previous error

For more information about this error, try `rustc --explain E0641`.
error: Could not compile `playground`.

To learn more, run the command again with --verbose.

@jeehoonkang
Copy link
Contributor Author

Thanks!!

@est31
Copy link
Member

est31 commented Jun 1, 2018

Does this need a test? @cramertj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants