Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Compiler panic with trait aliases #56006

Closed

Description

@amesgen

Playing around with the new trait aliases I encountered a compiler panic. This is a minimized example (play.rust-lang.org):

#![feature(trait_alias)]

use std::ops::Neg;

trait Number = Sized + Neg<Output = Self>;

Error message:

internal compiler error: librustc_metadata/encoder.rs:1158: cannot encode info for item Item { name: Number, id: NodeId(17), hir_id: HirId { owner: DefIndex(0:4), local_id: 0 }, attrs: [], node: TraitAlias(Generics { params: [], where_clause: WhereClause { id: NodeId(18), predicates: [] }, span: src/lib.rs:1:1: 1:1 }, [Trait(PolyTraitRef { bound_generic_params: [], trait_ref: TraitRef { path: path(Sized), ref_id: NodeId(19), hir_ref_id: HirId { owner: DefIndex(0:4), local_id: 3 } }, span: src/lib.rs:5:16: 5:21 }, None), Trait(PolyTraitRef { bound_generic_params: [], trait_ref: TraitRef { path: path(Neg<Output = Self>), ref_id: NodeId(21), hir_ref_id: HirId { owner: DefIndex(0:4), local_id: 8 } }, span: src/lib.rs:5:24: 5:42 }, None)]), vis: Spanned { node: Inherited, span: src/lib.rs:5:1: 5:1 }, span: src/lib.rs:5:1: 5:43 }

Update: even smaller repro case
Another update: see here (even more minimal)

Meta

$ rustc --version --verbose
rustc 1.32.0-nightly (f37247f88 2018-11-17)
binary: rustc
commit-hash: f37247f885026d29bf26fd4aed6e9135e4f32ebf
commit-date: 2018-11-17
host: x86_64-unknown-linux-gnu
release: 1.32.0-nightly
LLVM version: 8.0

Backtrace:

thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:600:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at libstd/sys_common/backtrace.rs:59
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:480
   6: std::panicking::begin_panic
   7: rustc_errors::Handler::bug
   8: rustc::util::bug::opt_span_bug_fmt::{{closure}}
   9: rustc::ty::context::tls::with_opt::{{closure}}
  10: rustc::ty::context::tls::with_context_opt
  11: rustc::ty::context::tls::with_opt
  12: rustc::util::bug::opt_span_bug_fmt
  13: rustc::util::bug::bug_fmt
  14: rustc_metadata::encoder::<impl rustc_metadata::isolated_encoder::IsolatedEncoder<'a, 'b, 'tcx>>::encode_info_for_item
  15: rustc::ty::context::tls::with_context
  16: <rustc_metadata::encoder::EncodeVisitor<'a, 'b, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_item
  17: rustc::hir::Crate::visit_all_item_likes
  18: rustc_metadata::encoder::encode_metadata
  19: rustc_metadata::cstore_impl::<impl rustc::middle::cstore::CrateStore for rustc_metadata::cstore::CStore>::encode_metadata
  20: rustc::ty::context::TyCtxt::encode_metadata
  21: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::ExtraBackendMethods>::write_metadata
  22: rustc::util::common::time
  23: rustc_codegen_ssa::base::codegen_crate
  24: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
  25: rustc::util::common::time
  26: rustc_driver::driver::phase_4_codegen
  27: rustc_driver::driver::compile_input::{{closure}}
  28: rustc::ty::context::tls::enter_context
  29: <std::thread::local::LocalKey<T>>::with
  30: rustc::ty::context::TyCtxt::create_and_enter
  31: rustc_driver::driver::compile_input
  32: rustc_driver::run_compiler_with_pool
  33: <scoped_tls::ScopedKey<T>>::set
  34: rustc_driver::run_compiler
  35: syntax::with_globals
  36: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:102
  37: rustc_driver::run
  38: rustc_driver::main
  39: std::rt::lang_start::{{closure}}
  40: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  41: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:102
  42: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:398
             at libstd/rt.rs:58
  43: main
  44: __libc_start_main
  45: <unknown>
query stack during panic:
end of query stack
error: aborting due to previous error

Activity

  1. added
    I-ICE
    A-metadata
    A-trait-system
    T-compiler
    C-bug
    on Nov 16, 2018
  2. changed the title [-]Compiler panic with trait aliases and num-traits[/-] [+]Compiler panic with trait aliases[/+] on Nov 20, 2018
  3. DutchGhost commented on Nov 22, 2018

    @DutchGhost

    Even more minimal:

    #![feature(trait_alias)]
    
    trait bug = 'static;

    Or:

    #![feature(trait_alias)]
    
    trait bug<'a> = 'a;

    The ICE message for those is the same as posted here.

  4. meh commented on Nov 26, 2018

    @meh
    Contributor

    This is happening to me as well and it's making me very sad 😞

  5. arielb1 commented on Nov 27, 2018

    @arielb1
    Contributor
  6. amesgen commented on Feb 12, 2019

    @amesgen
    Author

    This issue seems to be fixed, thanks! Closing.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-metadataA-trait-systemC-bugI-ICET-compiler

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions