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

Internal Compiler Error running cargo doc #34222

Closed
AdamNiederer opened this issue Jun 11, 2016 · 7 comments
Closed

Internal Compiler Error running cargo doc #34222

AdamNiederer opened this issue Jun 11, 2016 · 7 comments
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

@AdamNiederer
Copy link

AdamNiederer commented Jun 11, 2016

Hey, I'm trying to learn Rust. I have this code. It's not valid Rust, but it causes the compiler to throw an ICE.

struct Square {
    xcoord :i32,
    ycoord :i32,
    len :i32
}

impl Square {
    fn area() {
        len * len
    }
    fn diag() {
        len * 2.sqrt()
    }
    fn quadr() {
        match (xcoord, ycoord) {
            -_ =>
        }
    }
}

fn main() {
    /// Causes a crash
    /// Example usage:
    /// ```
    /// main() #-> Causes crash
    /// ```
    let q = vec!(3, 2, 1);
    let x = 5_000_000_i32;
    let y = &x;
    println!("Hello, world! {}", q.len());
    assert_eq!(q, [3, 2, 2]) // crashes
}

I ran cargo doc on it, and was told to file a bug report. Running cargo build or rustc main.rs does not cause the panic.

[adam@AdamsPC src]$ RUST_BACKTRACE=1 cargo doc
 Documenting kek v0.1.0 (file:///home/adam/kek)
main.rs:16:14: 16:15 error: unexpected token: `_`
main.rs:16             -_ =>
                        ^
main.rs:22:5: 22:37 error: attributes on non-item statements and expressions are experimental. (see issue #15701)
main.rs:22     /// Causes you to crash and shit
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.rs:23:5: 23:23 error: attributes on non-item statements and expressions are experimental. (see issue #15701)
main.rs:23     /// Example usage:
               ^~~~~~~~~~~~~~~~~~
main.rs:24:5: 24:12 error: attributes on non-item statements and expressions are experimental. (see issue #15701)
main.rs:24     /// ```
               ^~~~~~~
main.rs:25:5: 25:32 error: attributes on non-item statements and expressions are experimental. (see issue #15701)
main.rs:25     /// main() #-> Causes crash
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
main.rs:26:5: 26:12 error: attributes on non-item statements and expressions are experimental. (see issue #15701)
main.rs:26     /// ```
               ^~~~~~~
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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'phase_2_configure_and_expand aborted in rustdoc!: 5', src/libcore/result.rs:746
stack backtrace:
   1:     0x7efe3d4fa4e0 - std::sys::backtrace::tracing::imp::write::h4c73fcd3363076f5
   2:     0x7efe3d507bdb - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::h0422dbb3077e6747
   3:     0x7efe3d50777c - std::panicking::default_hook::haac48fa641db8fa2
   4:     0x7efe3d4cc70f - std::sys_common::unwind::begin_unwind_inner::h39d40f52add53ef7
   5:     0x7efe3d4ce7f8 - std::sys_common::unwind::begin_unwind_fmt::h64c0ff793199cc1b
   6:     0x7efe3d4f7cf1 - rust_begin_unwind
   7:     0x7efe3d5481af - core::panicking::panic_fmt::h73bf9d7e8e891a73
   8:     0x7efe3da9b42b - core::result::unwrap_failed::h52d645c697d2a555
   9:     0x7efe3da3637d - rustdoc::core::run_core::h5d51993c037675df
  10:     0x7efe3da31c08 - std::sys_common::unwind::try::try_fn::he5d0ca3afe34ca3c
  11:     0x7efe3d4f7c7b - __rust_try
  12:     0x7efe3d4f7c0d - std::sys_common::unwind::inner_try::h9eebd8dc83f388a6
  13:     0x7efe3da338ff - _<F as std..boxed..FnBox<A>>::call_box::h871bc6bfba8a323f
  14:     0x7efe3d505d74 - std::sys::thread::Thread::new::thread_start::h471ad90789353b5b
  15:     0x7efe36288473 - start_thread
  16:     0x7efe3d15d69c - clone
  17:                0x0 - <unknown>

error: Could not document `kek`.

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

Here's the rustc version. I pulled it down from the Arch repositories yesterday.

rustc 1.9.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.9.0
@est31
Copy link
Member

est31 commented Jun 12, 2016

I've been able to create two minimized examples:

fn main() {
    ///
    match (()) {
        -_ =>
    }
}

And second:

struct Square();

impl Square {
    fn quadr() {
        match (()) {
            -_ =>
        }
    }
}

@kennytm
Copy link
Member

kennytm commented Jun 12, 2016

@est31 The two minimized examples don't cause ICE in nightly, while OP's does.

And the following ICE on both stable and nightly:

fn a() {
    /// crash
    let q = 1;
}

@apasel422 apasel422 added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jun 17, 2016
@adelarsq
Copy link

This code also crashes on both stable and nightly:

fn main() {
///
}

@zackmdavis
Copy link
Member

This looks like it might be fixed now (ordinary error instead of ICE)?

$ cat src/main.rs 
fn main() {
    /// crash
    println!("{}", "Hello, world!");
}
$ cargo build
   Compiling example_project v0.1.0 (file:///home/ubuntu/example_project)
error: attributes on non-item statements and expressions are experimental. (see issue #15701)
 --> src/main.rs:2:5
  |
2 |     /// crash
  |     ^^^^^^^^^

error: aborting due to previous error

error: Could not compile `example_project`.

To learn more, run the command again with --verbose.
$ cargo doc
 Documenting example_project v0.1.0 (file:///home/ubuntu/example_project)
error: attributes on non-item statements and expressions are experimental. (see issue #15701)
 --> src/main.rs:2:5
  |
2 |     /// crash
  |     ^^^^^^^^^

error: Compilation failed, aborting rustdoc

error: Could not document `example_project`.

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

@nodakai
Copy link
Contributor

nodakai commented Feb 22, 2017

@steveklabnik What does your glacier say about this?

@steveklabnik
Copy link
Member

@nodakai it's not currently being tracked in glacier, sounds like it should be!

There's a ton of new ICEs that we haven't moved into glacier.

@Mark-Simulacrum
Copy link
Member

This no longer ICEs today. E-needstest.

@Mark-Simulacrum Mark-Simulacrum added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label May 24, 2017
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jun 22, 2017
Add tests for a few issues.

Fixes rust-lang#41998
Fixes rust-lang#38381
Fixes rust-lang#37515
Fixes rust-lang#37510
Fixes rust-lang#37508
Fixes rust-lang#37366
Fixes rust-lang#37323
Fixes rust-lang#37051
Fixes rust-lang#36839
Fixes rust-lang#35570
Fixes rust-lang#34373
Fixes rust-lang#34222

Certainly not all of the E-needstest issues right now, but I started to get bored.
bors added a commit that referenced this issue Jun 24, 2017
Add tests for a few issues.

Fixes #41998
Fixes #38381
Fixes #37515
Fixes #37510
Fixes #37366
Fixes #37323
Fixes #37051
Fixes #36839
Fixes #35570
Fixes #34373
Fixes #34222

Certainly not all of the E-needstest issues right now, but I started to get bored.
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

No branches or pull requests

9 participants