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 when missing module specifier #16709

Closed
cgaebel opened this issue Aug 23, 2014 · 3 comments · Fixed by #18099
Closed

ICE when missing module specifier #16709

cgaebel opened this issue Aug 23, 2014 · 3 comments · Fixed by #18099
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

@cgaebel
Copy link
Contributor

cgaebel commented Aug 23, 2014

The following code causes rustc to ICE:

use std::ptr;
use std::raw;

fn main() {
  unsafe {
    let nil: *const u8 = ptr::null();
    let slice: raw::Slice<u8> =
      Slice {
        data: nil,
        len:  0,
      };
  }
}

whereas this will compile just fine:

use std::ptr;
use std::raw;

fn main() {
  unsafe {
    let nil: *const u8 = ptr::null();
    let slice: raw::Slice<u8> =
      raw::Slice {
        data: nil,
        len:  0,
      };
  }
}
@tshepang
Copy link
Member

Compiles fine, but with errors :)

/home/tshepang/tmp/play/src/main.rs:6:24: 6:35 error: mismatched types: expected `*mut u8` but found `*const <generic #2>` (values differ in mutability)
/home/tshepang/tmp/play/src/main.rs:6     let nil: *mut u8 = ptr::null();
                                                             ^~~~~~~~~~~
/home/tshepang/tmp/play/src/main.rs:9:15: 9:18 error: mismatched types: expected `*const <generic #3>` but found `*mut u8` (values differ in mutability)
/home/tshepang/tmp/play/src/main.rs:9         data: nil,
                                                    ^~~
error: aborting due to 2 previous errors
Could not compile `play`.

Details:

$ rustc --version
rustc 0.12.0-pre (471862f40 2014-08-24 09:30:56 +0000)
$ uname --all
Linux thome 3.15-trunk-amd64 #1 SMP Debian 3.15.1-1~exp1 (2014-06-20) x86_64 GNU/Linux

@cgaebel
Copy link
Contributor Author

cgaebel commented Aug 24, 2014

fixed thanks!

@mahkoh
Copy link
Contributor

mahkoh commented Oct 13, 2014

No longer valid.

@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 13, 2014
bors added a commit that referenced this issue Oct 18, 2014
Closes #9249.
Closes #13105.
Closes #13837.
Closes #13847.
Closes #15207.
Closes #15261.
Closes #16048. 
Closes #16098.
Closes #16256.
Closes #16562.
Closes #16596.
Closes #16709.
Closes #16747.
Closes #17025.
Closes #17121.
Closes #17450.
Closes #17636.
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 3, 2024
…ykril

fix: Goto definition for `index_mut`

Mostly same with rust-lang#16696.
https://github.com/rust-lang/rust-analyzer/blob/0ac05c05271f31c43d31017cbd288e8737a0edb0/crates/hir-ty/src/infer/mutability.rs#L103-L133
Thankfully, we are doing similar method resolutions so we can use them like the mentioned PR.
As there are only three `LangItem`s having `Mut` in there names; `FnMut`, `DerefMut` and `IndexMut`, I think that this is the last one 😄
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.

4 participants