Skip to content

ICE when using the doc alias attribute on expr or local #99777

Closed

Description

Code

pub fn test() {
    #[doc(alias = "test")]
    {
        println!("Hello, world!");
    }
}
pub fn test() {
    #[doc(alias = "test")]
    let num_flags = 0;
}

Meta

Stable rustc --version --verbose:

rustc 1.62.1 (e092d0b6b 2022-07-16)
binary: rustc
commit-hash: e092d0b6b43f2de967af0887873151bb1c0b18d3
commit-date: 2022-07-16
host: x86_64-unknown-linux-gnu
release: 1.62.1
LLVM version: 14.0.5

Nightly rustc --version --verbose:

rustc 1.64.0-nightly (6dbae3ad1 2022-07-25)
binary: rustc
commit-hash: 6dbae3ad19309bb541d9e76638e6aa4b5449f29a
commit-date: 2022-07-25
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6

Error output

Compiling ice-repro v0.1.0 (/home/spideynn/CLionProjects/testing)
warning: unused doc comment
 --> src/lib.rs:2:5
  |
2 |     #[doc(alias = "test")]
  |     ^^^^^^^^^^^^^^^^^^^^^^
3 |     let num_flags = 0;
  |     ---------------------- rustdoc does not generate documentation for statements
  |
  = note: `#[warn(unused_doc_comments)]` on by default
  = help: use `//` for a plain comment

error: internal compiler error: compiler/rustc_middle/src/hir/map/mod.rs:944:21: no name for local let mut num_flags = 0; (hir_id=HirId { owner: DefId(0:3 ~ ice_repro[e526]::test), local_id: 3 })
Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/compiler/rustc_errors/src/lib.rs:1335:9
stack backtrace:
   0:     0x7f61c8f3cfbd - std::backtrace_rs::backtrace::libunwind::trace::h8e036432725b1c57
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f61c8f3cfbd - std::backtrace_rs::backtrace::trace_unsynchronized::h4f83092254c85869
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f61c8f3cfbd - std::sys_common::backtrace::_print_fmt::h9728b5e056a3ece3
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f61c8f3cfbd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h48bb4bd2928827d2
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f61c8f98c4c - core::fmt::write::h909e69a2c24f44cc
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/fmt/mod.rs:1196:17
   5:     0x7f61c8f2e731 - std::io::Write::write_fmt::h7f4b8ab8af89e9ef
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/io/mod.rs:1654:15
   6:     0x7f61c8f3fcd5 - std::sys_common::backtrace::_print::hff4838ebf14a2171
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f61c8f3fcd5 - std::sys_common::backtrace::print::h2499280374189ad9
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f61c8f3fcd5 - std::panicking::default_hook::{{closure}}::h8b270fc55eeb284e
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:295:22
   9:     0x7f61c8f3f949 - std::panicking::default_hook::h3217e229d6e9d13c
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:314:9
  10:     0x7f61c9704571 - rustc_driver[b4654d3c4d4292dd]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f61c8f404a6 - std::panicking::rust_panic_with_hook::h9acb8048b738d2e0
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:702:17
  12:     0x7f61ca77faf1 - std[8996aeeb2a45fe64]::panicking::begin_panic::<rustc_errors[4633ef6e4608f9c1]::ExplicitBug>::{closure#0}
  13:     0x7f61ca77a0d6 - std[8996aeeb2a45fe64]::sys_common::backtrace::__rust_end_short_backtrace::<std[8996aeeb2a45fe64]::panicking::begin_panic<rustc_errors[4633ef6e4608f9c1]::ExplicitBug>::{closure#0}, !>
  14:     0x7f61ca70f2f6 - std[8996aeeb2a45fe64]::panicking::begin_panic::<rustc_errors[4633ef6e4608f9c1]::ExplicitBug>
  15:     0x7f61ca6c3816 - std[8996aeeb2a45fe64]::panic::panic_any::<rustc_errors[4633ef6e4608f9c1]::ExplicitBug>
  16:     0x7f61ca6bfa85 - <rustc_errors[4633ef6e4608f9c1]::HandlerInner>::bug::<&alloc[9c8de9aaaf44fea]::string::String>
  17:     0x7f61ca6bf420 - <rustc_errors[4633ef6e4608f9c1]::Handler>::bug::<&alloc[9c8de9aaaf44fea]::string::String>
  18:     0x7f61ca7884ad - rustc_middle[74ddc95a19f9493f]::ty::context::tls::with_opt::<rustc_middle[74ddc95a19f9493f]::util::bug::opt_span_bug_fmt<rustc_span[1d0b4d44d1f53955]::span_encoding::Span>::{closure#0}, ()>
  19:     0x7f61ca788826 - rustc_middle[74ddc95a19f9493f]::util::bug::opt_span_bug_fmt::<rustc_span[1d0b4d44d1f53955]::span_encoding::Span>
  20:     0x7f61ca7887a3 - rustc_middle[74ddc95a19f9493f]::util::bug::bug_fmt
  21:     0x7f61cb69f8f3 - <rustc_middle[74ddc95a19f9493f]::hir::map::Map>::name
  22:     0x7f61cbae1b06 - <rustc_passes[60f27083e5f41e00]::check_attr::CheckAttrVisitor>::check_doc_alias_value
  23:     0x7f61cadfc774 - <rustc_passes[60f27083e5f41e00]::check_attr::CheckAttrVisitor>::check_attributes
  24:     0x7f61cae01817 - <rustc_passes[60f27083e5f41e00]::check_attr::CheckAttrVisitor as rustc_hir[597a1a56ef61745a]::intravisit::Visitor>::visit_expr
  25:     0x7f61cadf9b3f - <rustc_passes[60f27083e5f41e00]::check_attr::CheckAttrVisitor as rustc_hir[597a1a56ef61745a]::intravisit::Visitor>::visit_fn
  26:     0x7f61cae518b5 - rustc_hir[597a1a56ef61745a]::intravisit::walk_item::<rustc_passes[60f27083e5f41e00]::check_attr::CheckAttrVisitor>
  27:     0x7f61cae26f25 - <rustc_middle[74ddc95a19f9493f]::hir::map::Map>::visit_item_likes_in_module::<rustc_hir[597a1a56ef61745a]::intravisit::DeepVisitor<rustc_passes[60f27083e5f41e00]::check_attr::CheckAttrVisitor>>
  28:     0x7f61cbae2a31 - rustc_passes[60f27083e5f41e00]::check_attr::check_mod_attrs
  29:     0x7f61cb1d0bc0 - rustc_query_system[b4bd2ce220f7e42d]::query::plumbing::try_execute_query::<rustc_query_impl[4e222bcb6a32466d]::plumbing::QueryCtxt, rustc_query_system[b4bd2ce220f7e42d]::query::caches::DefaultCache<rustc_span[1d0b4d44d1f53955]::def_id::LocalDefId, ()>>
  30:     0x7f61cbd1fef3 - rustc_query_system[b4bd2ce220f7e42d]::query::plumbing::get_query::<rustc_query_impl[4e222bcb6a32466d]::queries::check_mod_attrs, rustc_query_impl[4e222bcb6a32466d]::plumbing::QueryCtxt>
  31:     0x7f61cb7bdbbd - <core[dbea6f494faa966e]::panic::unwind_safe::AssertUnwindSafe<rustc_interface[9f664daa3237129]::passes::analysis::{closure#0}::{closure#1}> as core[dbea6f494faa966e]::ops::function::FnOnce<()>>::call_once
  32:     0x7f61cb7a72f7 - <rustc_session[a2f3190f51a45935]::session::Session>::time::<(), rustc_interface[9f664daa3237129]::passes::analysis::{closure#0}>
  33:     0x7f61cb7a1f7e - rustc_interface[9f664daa3237129]::passes::analysis
  34:     0x7f61cbcf3334 - rustc_query_system[b4bd2ce220f7e42d]::query::plumbing::try_execute_query::<rustc_query_impl[4e222bcb6a32466d]::plumbing::QueryCtxt, rustc_query_system[b4bd2ce220f7e42d]::query::caches::DefaultCache<(), core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>>>
  35:     0x7f61cbd348ce - rustc_query_system[b4bd2ce220f7e42d]::query::plumbing::get_query::<rustc_query_impl[4e222bcb6a32466d]::queries::analysis, rustc_query_impl[4e222bcb6a32466d]::plumbing::QueryCtxt>
  36:     0x7f61cb782777 - <rustc_interface[9f664daa3237129]::passes::QueryContext>::enter::<rustc_driver[b4654d3c4d4292dd]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>>
  37:     0x7f61cb76d708 - <rustc_interface[9f664daa3237129]::interface::Compiler>::enter::<rustc_driver[b4654d3c4d4292dd]::run_compiler::{closure#1}::{closure#2}, core[dbea6f494faa966e]::result::Result<core[dbea6f494faa966e]::option::Option<rustc_interface[9f664daa3237129]::queries::Linker>, rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>>
  38:     0x7f61cb79609f - rustc_span[1d0b4d44d1f53955]::with_source_map::<core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>, rustc_interface[9f664daa3237129]::interface::create_compiler_and_run<core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>, rustc_driver[b4654d3c4d4292dd]::run_compiler::{closure#1}>::{closure#1}>
  39:     0x7f61cb76e374 - rustc_interface[9f664daa3237129]::interface::create_compiler_and_run::<core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>, rustc_driver[b4654d3c4d4292dd]::run_compiler::{closure#1}>
  40:     0x7f61cb76bc12 - <scoped_tls[ab1554bfb6e7ab15]::ScopedKey<rustc_span[1d0b4d44d1f53955]::SessionGlobals>>::set::<rustc_interface[9f664daa3237129]::interface::run_compiler<core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>, rustc_driver[b4654d3c4d4292dd]::run_compiler::{closure#1}>::{closure#0}, core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>>
  41:     0x7f61cb782dff - std[8996aeeb2a45fe64]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[9f664daa3237129]::util::run_in_thread_pool_with_globals<rustc_interface[9f664daa3237129]::interface::run_compiler<core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>, rustc_driver[b4654d3c4d4292dd]::run_compiler::{closure#1}>::{closure#0}, core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>>::{closure#0}, core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>>
  42:     0x7f61cb782f39 - <<std[8996aeeb2a45fe64]::thread::Builder>::spawn_unchecked_<rustc_interface[9f664daa3237129]::util::run_in_thread_pool_with_globals<rustc_interface[9f664daa3237129]::interface::run_compiler<core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>, rustc_driver[b4654d3c4d4292dd]::run_compiler::{closure#1}>::{closure#0}, core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>>::{closure#0}, core[dbea6f494faa966e]::result::Result<(), rustc_errors[4633ef6e4608f9c1]::ErrorGuaranteed>>::{closure#1} as core[dbea6f494faa966e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  43:     0x7f61c8f4a3c3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h191d5c5ea3edb31d
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/alloc/src/boxed.rs:1872:9
  44:     0x7f61c8f4a3c3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h42ef7cb2ae640a31
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/alloc/src/boxed.rs:1872:9
  45:     0x7f61c8f4a3c3 - std::sys::unix::thread::Thread::new::thread_start::he47f7169665dab60
                               at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys/unix/thread.rs:108:17
  46:     0x7f61c8e7a609 - start_thread
  47:     0x7f61c8d93133 - clone
  48:                0x0 - <unknown>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions