Closed japaric closed 9 years ago
#![crate_type = "lib"] #![feature(optin_builtin_traits)] unsafe trait Trait { fn method(&self) { println!("Hello"); } } unsafe impl Trait for .. {} fn call_method<T: Trait>(x: T) { x.method(); } fn main() { // ICE call_method(()); }
error: internal compiler error: resolved vtable bad vtable VtableDefaultImplData(trait_def_id=DefId { krate: 0, node: 4 }:Trait, nested=[()]) in trans 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 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:189 stack backtrace: 1: 0x7fe3035d6f1f - sys::backtrace::write::hf79a3da4fdecb8a0OBA 2: 0x7fe303601c32 - panicking::on_panic::h9f64f4c69e19f194hHJ 3: 0x7fe303536eda - rt::unwind::begin_unwind_inner::h37f4496c980fe936knJ 4: 0x7fe300989abd - rt::unwind::begin_unwind::h8320268356453106285 5: 0x7fe30098a305 - diagnostic::Handler::bug::h9f10e263d26f6508X5D 6: 0x7fe3013dac2b - session::Session::bug::hd2a7bf49812ce6f80Sp 7: 0x7fe302c93458 - trans::meth::trans_method_callee::h560647f9622b6732N6x 8: 0x7fe302c8f8e9 - trans::callee::trans_call_inner::h3649553240631627052 9: 0x7fe302c99789 - trans::expr::trans_rvalue_dps_unadjusted::hd47de7ac66e018254zi 10: 0x7fe302c4b3f6 - trans::expr::trans_into::h95c6d2681fdd2548znh 11: 0x7fe302c4a594 - trans::controlflow::trans_stmt_semi::h3c27cfa3f0150db6o4d 12: 0x7fe302c4bed0 - trans::controlflow::trans_block::h3e86dfa8c58560e6b5d 13: 0x7fe302d23821 - trans::base::trans_closure::hab3cc3c679d5ff23Kkt 14: 0x7fe302c34b08 - trans::base::trans_fn::he0569b8eb832adf9Dvt 15: 0x7fe302c36136 - trans::monomorphize::monomorphic_fn::hc1b7393dd1dc77f1usd 16: 0x7fe302c7be4e - trans::callee::trans_fn_ref_with_substs::hd01acb4398310d154kg 17: 0x7fe302c7a43e - trans::callee::trans_fn_ref::hb48e614c9b6dd9bcE9f 18: 0x7fe302c7788d - trans::callee::trans::ha56f4fe94448e6baVYf 19: 0x7fe302c8dfbb - trans::callee::trans_call_inner::h9722042290657949952 20: 0x7fe302c9a9e0 - trans::expr::trans_rvalue_dps_unadjusted::hd47de7ac66e018254zi 21: 0x7fe302c4b3f6 - trans::expr::trans_into::h95c6d2681fdd2548znh 22: 0x7fe302c4a594 - trans::controlflow::trans_stmt_semi::h3c27cfa3f0150db6o4d 23: 0x7fe302c4bed0 - trans::controlflow::trans_block::h3e86dfa8c58560e6b5d 24: 0x7fe302d23821 - trans::base::trans_closure::hab3cc3c679d5ff23Kkt 25: 0x7fe302c34b08 - trans::base::trans_fn::he0569b8eb832adf9Dvt 26: 0x7fe302c308a1 - trans::base::trans_item::h48fc370b7d259ac7vTt 27: 0x7fe302d2c7ec - trans::base::trans_crate::hc92be67ede893c70GPu 28: 0x7fe303c0fe83 - driver::phase_4_translate_to_llvm::h9904f5d5fc3fb761rNa 29: 0x7fe303beb83f - driver::compile_input::h3913ff7013f0c056Iba 30: 0x7fe303cb3cb7 - run_compiler::h28a4446bae1034e7H5b 31: 0x7fe303cb1829 - thunk::F.Invoke<A, R>::invoke::h6503055919709693733 32: 0x7fe303cb04a0 - rt::unwind::try::try_fn::h1384674024000742916 33: 0x7fe303671de8 - rust_try_inner 34: 0x7fe303671dd5 - rust_try 35: 0x7fe303cb0c3f - thunk::F.Invoke<A, R>::invoke::h5780663349966142752 36: 0x7fe3035ec965 - sys::thread::thread_start::h4ab695857833a5dar8E 37: 0x7fe2fd469373 - start_thread 38: 0x7fe3031b727c - __clone 39: 0x0 - <unknown>
rustc 1.0.0-nightly (3b3bb0e68 2015-03-04) (built 2015-03-05)
I suppose that traits used in default implementations are not supposed to have any methods, the compiler should raise an error in an early phase (wf?) instead of ICEing in trans.
wf
cc @nikomatsakis @FlaPer87
iiuggh, this is bad. Yeah, they are not supposed to have any methods. I'll take a look at this (hopefully in the next few days).
STR
Backtrace
Version
I suppose that traits used in default implementations are not supposed to have any methods, the compiler should raise an error in an early phase (
wf
?) instead of ICEing in trans.cc @nikomatsakis @FlaPer87