Skip to content

Some internal compiler error during playing with rust-by-example (doc.rs) #80370

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

Closed
vni opened this issue Dec 25, 2020 · 1 comment
Closed

Some internal compiler error during playing with rust-by-example (doc.rs) #80370

vni opened this issue Dec 25, 2020 · 1 comment
Labels
A-resolve Area: Name/path resolution done by `rustc_resolve` specifically C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@vni
Copy link

vni commented Dec 25, 2020

Hi! I'm reading rust-by-example.
https://doc.rust-lang.org/rust-by-example/meta/doc.html

with this doc.rs I get the next error.
Sorry if this bug report isn't filled as it should be.

The example below runs pretty well with (as in rust-by-example)

rustdoc --test  --extern doc="libdoc.rlib" doc.rs

and fails with

rustdoc  --extern doc="libdoc.rlib" doc.rs

Code

#![crate_name = "doc"]

/// A human being is represented here
pub struct Person {
  /// A person must have a name, no matter how much Juliet may hate it
  name: String
}

impl Person {
  /// Returns a person with the name given them
  ///
  /// # Arguments
  ///
  /// * `name` - A string slice that holds the name of the person
  ///
  /// # Examples
  /// ```
  /// // You can have rust code ...
  /// // if you pass --test to `rustdoc`, it will even test it for you!
  /// use doc::Person;
  /// let person = Person::new("name");
  /// ```
  pub fn new(name: &str) -> Person {
    Person {
      name: name.to_string()
    }
  }

  /// Gives a friendly hello!
  ///
  /// Says "Hello, [name]" to the `Person` it is called on.
  pub fn hello(&self) {
    println!("Hello, {}!", self.name);
  }
}

fn main() {
  let john = Person::new("John");
  john.hello();
}

Meta

rustc --version --verbose:

rustc 1.50.0-nightly (0edce6f4b 2020-12-24)

Error output

rustdoc  --extern doc="libdoc.rlib" doc.rs
thread 'rustc' panicked at 'Unable to resolve external crate doc', src/librustdoc/core.rs:439:25
stack backtrace:
   0: rust_begin_unwind
             at /rustc/0edce6f4bbb4514482537f569f0b8ef48e71e0a0/library/std/src/panicking.rs:493:5
   1: std::panicking::begin_panic_fmt
             at /rustc/0edce6f4bbb4514482537f569f0b8ef48e71e0a0/library/std/src/panicking.rs:435:5
   2: rustdoc::core::create_resolver::{{closure}}::{{closure}}::{{closure}}
   3: rustc_session::utils::<impl rustc_session::session::Session>::time
   4: rustc_interface::passes::BoxedResolver::access::{{closure}}
   5: rustc_interface::passes::configure_and_expand::{{closure}}
   6: rustdoc::core::create_resolver
   7: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
   8: rustc_span::with_source_map
   9: rustdoc::main_options
  10: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.50.0-nightly (0edce6f4b 2020-12-24) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
Backtrace

0: rust_begin_unwind
             at /rustc/0edce6f4bbb4514482537f569f0b8ef48e71e0a0/library/std/src/panicking.rs:493:5
   1: std::panicking::begin_panic_fmt
             at /rustc/0edce6f4bbb4514482537f569f0b8ef48e71e0a0/library/std/src/panicking.rs:435:5
   2: rustdoc::core::create_resolver::{{closure}}::{{closure}}::{{closure}}
   3: rustc_session::utils::<impl rustc_session::session::Session>::time
   4: rustc_interface::passes::BoxedResolver::access::{{closure}}
   5: rustc_interface::passes::configure_and_expand::{{closure}}
   6: rustdoc::core::create_resolver
   7: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
   8: rustc_span::with_source_map
   9: rustdoc::main_options
  10: scoped_tls::ScopedKey<T>::set

@vni vni added 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. labels Dec 25, 2020
@jyn514 jyn514 added A-resolve Area: Name/path resolution done by `rustc_resolve` specifically T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 25, 2020
@jyn514
Copy link
Member

jyn514 commented Dec 25, 2020

Duplicate of #72381

@jyn514 jyn514 marked this as a duplicate of #72381 Dec 25, 2020
@jyn514 jyn514 closed this as completed Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name/path resolution done by `rustc_resolve` specifically C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants