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

ICE: 'rustc' panicked at 'assertion failed: *start <= *end' in slice.rs:396 #18490

Closed
mitchmindtree opened this issue Oct 31, 2014 · 13 comments · Fixed by #18527
Closed

ICE: 'rustc' panicked at 'assertion failed: *start <= *end' in slice.rs:396 #18490

mitchmindtree opened this issue Oct 31, 2014 · 13 comments · Fixed by #18527

Comments

@mitchmindtree
Copy link
Contributor

I'm getting the following ICE

mindTree:RustyJen Mitch$ cargo build                                                                               
   Compiling jen v0.0.0 (file:///Users/Mitch/Programming/Rust/RustyJen)                                            
error: internal compiler error: unexpected panic                                                                   
note: the compiler unexpectedly panicked. this is a bug.                                                           
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html                         
note: run with `RUST_BACKTRACE=1` for a backtrace                                                                  
task 'rustc' panicked at 'assertion failed: *start <= *end', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/b
uild/src/libcore/slice.rs:396                                                                                      

when compiling my project against the latest OSX nightly rustc 0.13.0-nightly (221fc1e3c 2014-10-31 02:27:15 +0000).

@msiemens
Copy link
Contributor

Could you run cargo build again with RUST_BACKTRACE=1 (= RUST_BACKTRACE=1 cargo build) and post the backtrace here?

@mitchmindtree
Copy link
Contributor Author

oh, of course!

   Compiling jen v0.0.0 (file:///Users/Mitch/Programming/Rust/RustyJen)                                                    
error: internal compiler error: unexpected panic                                                                           
note: the compiler unexpectedly panicked. this is a bug.                                                                   
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html                                 
note: run with `RUST_BACKTRACE=1` for a backtrace                                                                          
task 'rustc' panicked at 'assertion failed: *start <= *end', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src
/libcore/slice.rs:396                                                                                                      

stack backtrace:                                                                                                           
   1:        0x10d976929 - rt::backtrace::imp::write::hfe87245730e40e498nq                                                 
   2:        0x10d979b6c - failure::on_fail::h250240fc1d2cc13cHEq                                                          
   3:        0x10dbdb395 - unwind::begin_unwind_inner::h629bbfd5c5c7ad4bSJd                                                
   4:        0x10dbdb02f - unwind::begin_unwind_fmt::h26eed6b8c9614d01kHd                                                  
   5:        0x10dbdad82 - rust_begin_unwind                                                                               
   6:        0x10dc315dc - panicking::panic_fmt::h9773bd98fc91f575h7j                                                      
   7:        0x10dc2806f - panicking::panic::hf2209879fd0a6385l4j                                                          
   8:        0x10aaee5eb - middle::typeck::check::vtable::check_object_safety::hd2ef41a3d3297642CBN                        
   9:        0x10ab588db - middle::typeck::check::FnCtxt<'a, 'tcx>::register_unsize_obligations::h93da532586d1f760GhX      
  10:        0x10ab58770 - middle::typeck::check::FnCtxt<'a, 'tcx>::register_autoref_obligations::hdcb3d01fc6bc2a0bEgX     
  11:        0x10ab58791 - middle::typeck::check::FnCtxt<'a, 'tcx>::register_autoref_obligations::hdcb3d01fc6bc2a0bEgX     
  12:        0x10ab345b7 - middle::typeck::check::FnCtxt<'a, 'tcx>::write_adjustment::h559300c55596d0cbIdX                 
  13:        0x10ab255fb - middle::typeck::check::FnCtxt<'a, 'tcx>::mk_assignty::h495121b0f62037e0xvX                      
  14:        0x10ab253c5 - middle::typeck::check::demand::coerce::h94b3644e227f71a2RPR                                     
  15:        0x10ab85f09 - middle::typeck::check::check_expr_coercable_to_type::closure.132412                             
  16:        0x10ab7ded6 - middle::typeck::check::check_expr_with_unifier::h69de001b4060f90bdJY                            
  17:        0x10abce4d3 - middle::typeck::check::check_decl_local::h0cae6d84e687454cWJ0                                   
  18:        0x10abce647 - middle::typeck::check::check_stmt::h46c2f90bba03a179WL0                                         
  19:        0x10ab49acf - middle::typeck::check::check_block_with_expected::hde19a8324d3b35305P0                          
  20:        0x10ab45862 - middle::typeck::check::check_fn::h6804afcefd6fc458pvV                                           
  21:        0x10ab44d8f - middle::typeck::check::check_bare_fn::hb7e7210980026133EkV                                      
  22:        0x10ab4c530 - middle::typeck::check::check_method_body::h36c9acd490135be6xPV                                  
  23:        0x10ab41d58 - middle::typeck::check::check_item::h39bec44c2e37ec07NEV                                         
  24:        0x10ab44462 - visit::Visitor::visit_mod::h8897482306723449792                                                 
  25:        0x10ab42fb0 - visit::walk_item::h18177613619592010200                                                         
  26:        0x10ab4446d - visit::Visitor::visit_mod::h8897482306723449792                                                 
  27:        0x10ab42fb0 - visit::walk_item::h18177613619592010200                                                         
  28:        0x10ab44bea - middle::typeck::check::check_item_types::h232f3854bb5459bfOjV                                   
  29:        0x10a6571a6 - util::common::time::h13516290540542203264                                                       
  30:        0x10ae04d7e - middle::typeck::check_crate::h6b2f140055619821A3n                                               
  31:        0x10ae6dadf - driver::driver::phase_3_run_analysis_passes::h9af5661d865aaa0elNA                               
  32:        0x10ae683a8 - driver::driver::compile_input::h64933a02c4abd95e6tA                                             
  33:        0x10aee5b88 - driver::run_compiler::h37c520fe594ec038KgE                                                      
  34:        0x10aee3dae - driver::run::closure.145405                                                                     
  35:        0x10a66f64b - task::TaskBuilder<S>::try_future::closure.103660                                                
  36:        0x10a66f543 - task::TaskBuilder<S>::spawn_internal::closure.103631                                            
  37:        0x10d69ba4d - task::NativeSpawner.Spawner::spawn::closure.8535                                                
  38:        0x10dc4124c - rust_try_inner                                                                                  
  39:        0x10dc41236 - rust_try                                                                                        
  40:        0x10dbd8a17 - unwind::try::h554e9d30ab8d9725cyd                                                               
  41:        0x10dbd88ac - task::Task::run::h39093ecd59554b49ZJc                                                           
  42:        0x10d69b873 - task::NativeSpawner.Spawner::spawn::closure.8472                                                
  43:        0x10dbda1c7 - thread::thread_start::h589be8c0a398d299e5c                                                      
  44:     0x7fff981f52fc - _pthread_body                                                                                   
  45:     0x7fff981f5279 - _pthread_body                                                                                   

@UberLambda
Copy link

I'm getting this too, on Linux x64:

error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'assertion failed: *start <= *end', /build/rust-git/src/rust/src/libcore/slice.rs:396

stack backtrace:
   1:     0x7fc07401d550 - rt::backtrace::imp::write::h6d7b51dbe08c7a90Weq
   2:     0x7fc074020650 - <unknown>
   3:     0x7fc078371330 - unwind::begin_unwind_inner::ha369021e3864117bdSd
   4:     0x7fc078370e50 - unwind::begin_unwind_fmt::h6c1ae8b41766cb91FPd
   5:     0x7fc078370e10 - rust_begin_unwind
   6:     0x7fc0783b4d60 - panicking::panic_fmt::h1f4102d9dbcc2a5dh7j
   7:     0x7fc0783b0610 - panicking::panic::h68bf04de05fcd341l4j
   8:     0x7fc078de3300 - middle::typeck::check::vtable::check_object_safety::h5e858634fb68b05e6zN
   9:     0x7fc078de2c40 - middle::typeck::check::vtable::check_object_cast::h76abd899d5e17912cqN
  10:     0x7fc078e3ae20 - <unknown>
  11:     0x7fc078e617a0 - <unknown>
  12:     0x7fc078e5fb30 - <unknown>
  13:     0x7fc078e5e7a0 - <unknown>
  14:     0x7fc078e617a0 - <unknown>
  15:     0x7fc078eaeba0 - middle::typeck::check::check_stmt::hd0a4ef48c8f354dcjI0
  16:     0x7fc078e2f060 - <unknown>
  17:     0x7fc078e617a0 - <unknown>
  18:     0x7fc078ddbf10 - middle::typeck::check::_match::check_match::haa2decc95e3c7268D2M
  19:     0x7fc078e617a0 - <unknown>
  20:     0x7fc078e2f060 - <unknown>
  21:     0x7fc078e2b0a0 - <unknown>
  22:     0x7fc078e2ade0 - <unknown>
  23:     0x7fc078e31d00 - <unknown>
  24:     0x7fc078e270c0 - middle::typeck::check::check_item::h9547b3316e8784c0aBV
  25:     0x7fc078e290e0 - <unknown>
  26:     0x7fc078e2a8b0 - middle::typeck::check::check_item_types::h88799901145244c6bgV
  27:     0x7fc0789b2a50 - <unknown>
  28:     0x7fc0790bed90 - middle::typeck::check_crate::h62ec16fdebb5bcbeQZn
  29:     0x7fc079122330 - driver::driver::phase_3_run_analysis_passes::h9af115960c945947BJA
  30:     0x7fc07911d0a0 - driver::driver::compile_input::h7fc95caa4ba569b2mqA
  31:     0x7fc0791a0660 - <unknown>
  32:     0x7fc0791a0550 - <unknown>
  33:     0x7fc0789cb380 - <unknown>
  34:     0x7fc0789cb170 - <unknown>
  35:     0x7fc0786b3a80 - <unknown>
  36:     0x7fc0783c29f0 - <unknown>
  37:     0x7fc0783c29e0 - rust_try
  38:     0x7fc07836eae0 - unwind::try::hca7256b355f2fe07xGd
  39:     0x7fc07836e970 - task::Task::run::hf4a989e4dbd46d6cnMc
  40:     0x7fc0786b37c0 - <unknown>
  41:     0x7fc0783701d0 - <unknown>
  42:     0x7fc0733ce250 - start_thread
  43:     0x7fc07804b3b9 - clone
  44:                0x0 - <unknown>

(Link to the full RUST_LOG=debug RUST_BACKTRACE=1 cargo build --verbose)


Rustc's version (installed from thestinger's Arch repos:

rustc 0.13.0-dev (fd5365748 2014-10-30 20:17:15 +0000)
binary: rustc
commit-hash: fd53657484d78d0b7c00ce3264d99c051cf07d26
commit-date: 2014-10-30 20:17:15 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-dev

@parbo
Copy link

parbo commented Oct 31, 2014

Same here:

$ RUST_BACKTRACE=1 cargo build
Compiling protobuf v0.0.1 (https://github.com/stepancheg/rust-protobuf.git#cd5c700d)
Compiling rust-crypto v0.1.0 (https://github.com/DaGenix/rust-crypto.git#bd9f0970)
Compiling nix v0.0.1 (https://github.com/carllerche/nix-rust#69437208)
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with RUST_BACKTRACE=1 for a backtrace
task 'rustc' panicked at 'assertion failed: *start <= *end', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libcore/slice.rs:396

stack backtrace:
1: 0x7fb85e59daf0 - rt::backtrace::imp::write::h78410bf389422bb4Afq
2: 0x7fb85e5a0bf0 - failure::on_fail::h3d7a049ab1da182dXAq
3: 0x7fb862adfe30 - unwind::begin_unwind_inner::ha5ca26286b78bd8fdSd
4: 0x7fb862adf950 - unwind::begin_unwind_fmt::h9ff359c82ebbcec0FPd
5: 0x7fb862adf910 - rust_begin_unwind
6: 0x7fb862b2b1a0 - panicking::panic_fmt::h6d1e7e05d89e9577h7j
7: 0x7fb862b26a50 - panicking::panic::h9595095b841fe7bal4j
8: 0x7fb8635f2050 - middle::typeck::check::vtable::check_object_safety::h909babbc174b8351CBN
9: 0x7fb86365f600 - middle::typeck::check::FnCtxt<'a, 'tcx>::register_unsize_obligations::h7602815ae022d228GhX
10: 0x7fb86365f570 - middle::typeck::check::FnCtxt<'a, 'tcx>::register_autoref_obligations::h0590f015c52acbc0EgX
11: 0x7fb86365f570 - middle::typeck::check::FnCtxt<'a, 'tcx>::register_autoref_obligations::h0590f015c52acbc0EgX
12: 0x7fb86363aa80 - middle::typeck::check::FnCtxt<'a, 'tcx>::write_adjustment::h1396e48fc524a05dIdX
13: 0x7fb86362b520 - middle::typeck::check::FnCtxt<'a, 'tcx>::mk_assignty::ha58af6f758d897bdxvX
14: 0x7fb86362b210 - middle::typeck::check::demand::coerce::h48183cae82ca7869RPR
15: 0x7fb86368e000 - middle::typeck::check::check_expr_coercable_to_type::closure.132386
16: 0x7fb863684970 - middle::typeck::check::check_expr_with_unifier::h9021eb76dad51ef5dJY
17: 0x7fb863682dd0 - middle::typeck::check::check_argument_types::h1928dcb07649510889X
18: 0x7fb863684970 - middle::typeck::check::check_expr_with_unifier::h9021eb76dad51ef5dJY
19: 0x7fb8636501a0 - middle::typeck::check::check_block_with_expected::hbcf547bf91ace5705P0
20: 0x7fb86364b770 - middle::typeck::check::check_fn::hc80418f404e5c598pvV
21: 0x7fb86364b4b0 - middle::typeck::check::check_bare_fn::h1dd0be1cd95d0c63EkV
22: 0x7fb863652ca0 - middle::typeck::check::check_method_body::h131e48693ec30c1axPV
23: 0x7fb8636471c0 - middle::typeck::check::check_item::hfa9ed324eb120d1cNEV
24: 0x7fb86364ac30 - visit::Visitor::visit_mod::h4776340902026008023
25: 0x7fb863649760 - visit::walk_item::h1837381033057518270
26: 0x7fb86364af80 - middle::typeck::check::check_item_types::h7314688a92a7a43fOjV
27: 0x7fb863146590 - util::common::time::h1086293170624038403
28: 0x7fb86391db90 - middle::typeck::check_crate::h707090d761adfc72A3n
29: 0x7fb863987950 - driver::driver::phase_3_run_analysis_passes::h2dc7f682b53f78f9lNA
30: 0x7fb863982200 - driver::driver::compile_input::hb25c14dfa369b7d96tA
31: 0x7fb863a048b0 - driver::run_compiler::h3e5318d61e864690KgE
32: 0x7fb863a047a0 - driver::run::closure.145379
33: 0x7fb86315f370 - task::TaskBuilder::try_future::closure.103636
34: 0x7fb86315f160 - task::TaskBuilder::spawn_internal::closure.103607
35: 0x7fb862e2a1a0 - task::NativeSpawner.Spawner::spawn::closure.8435
36: 0x7fb862b38e30 - rust_try_inner
37: 0x7fb862b38e20 - rust_try
38: 0x7fb862add5e0 - unwind::try::h8c75b93d8c87f5c4xGd
39: 0x7fb862add470 - task::Task::run::h3855d187b4c0788fnMc
40: 0x7fb862e29ee0 - task::NativeSpawner.Spawner::spawn::closure.8373
41: 0x7fb862adecd0 - thread::thread_start::he45c6d58df77cc88C7c
42: 0x7fb85d949fe0 - start_thread
43: 0x7fb8627a9819 - __clone
44: 0x0 -

$ rustc --version=verbose
rustc 0.13.0-nightly (221fc1e 2014-10-31 02:27:15 +0000)
binary: rustc
commit-hash: 221fc1e
commit-date: 2014-10-31 02:27:15 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-nightly

@alexcrichton
Copy link
Member

cc @nick29581

@nrc
Copy link
Member

nrc commented Oct 31, 2014

@mitchmindtree @UberLambda @parbo would one of you mind posting the code that caused the ICE please? Even better would be if you could narrow down the code to a minimal test case which causes the crash. Thanks!

@parbo
Copy link

parbo commented Oct 31, 2014

For me, it's just a new empty project (cargo new --git) which I added some dependencies to:

Cargo.toml:

[package]

name = "sprs"
version = "0.0.1"
authors = ["bohrarper@spotify.com>"]

[dependencies.protobuf]

git = "https://github.com/stepancheg/rust-protobuf.git"

[dependencies.rust-crypto]

git = "https://github.com/DaGenix/rust-crypto.git"

[dependencies.mio]

git = "https://github.com/carllerche/mio.git"

lib.rs:

extern crate crypto
extern crate mio
extern crate rust-protobuf

#[test]
fn it_works() {
}

@waterlink
Copy link

I have the same problem, but this happens only when I compile my tests/* code. So the problem is probably somewhere there. Code is available here: https://github.com/johnmq/raft-rs/tree/master/tests

And here is my backtrace:

RUST_BACKTRACE=1 cargo test
   Compiling raft_rs v0.0.1 (file:///home/user/github/waterlink/johnmq/raft-rs)
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'assertion failed: *start <= *end', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libcore/slice.rs:396

stack backtrace:
   1:     0x7f8136dd9af0 - rt::backtrace::imp::write::h78410bf389422bb4Afq
   2:     0x7f8136ddcbf0 - failure::on_fail::h3d7a049ab1da182dXAq
   3:     0x7f813b31ee30 - unwind::begin_unwind_inner::ha5ca26286b78bd8fdSd
   4:     0x7f813b31e950 - unwind::begin_unwind_fmt::h9ff359c82ebbcec0FPd
   5:     0x7f813b31e910 - rust_begin_unwind
   6:     0x7f813b36a1a0 - panicking::panic_fmt::h6d1e7e05d89e9577h7j
   7:     0x7f813b365a50 - panicking::panic::h9595095b841fe7bal4j
   8:     0x7f813be31050 - middle::typeck::check::vtable::check_object_safety::h909babbc174b8351CBN
   9:     0x7f813be9e600 - middle::typeck::check::FnCtxt<'a, 'tcx>::register_unsize_obligations::h7602815ae022d228GhX
  10:     0x7f813be9e570 - middle::typeck::check::FnCtxt<'a, 'tcx>::register_autoref_obligations::h0590f015c52acbc0EgX
  11:     0x7f813be9e570 - middle::typeck::check::FnCtxt<'a, 'tcx>::register_autoref_obligations::h0590f015c52acbc0EgX
  12:     0x7f813be79a80 - middle::typeck::check::FnCtxt<'a, 'tcx>::write_adjustment::h1396e48fc524a05dIdX
  13:     0x7f813be6a520 - middle::typeck::check::FnCtxt<'a, 'tcx>::mk_assignty::ha58af6f758d897bdxvX
  14:     0x7f813be6a210 - middle::typeck::check::demand::coerce::h48183cae82ca7869RPR
  15:     0x7f813becd000 - middle::typeck::check::check_expr_coercable_to_type::closure.132386
  16:     0x7f813bec3970 - middle::typeck::check::check_expr_with_unifier::h9021eb76dad51ef5dJY
  17:     0x7f813bec1dd0 - middle::typeck::check::check_argument_types::h1928dcb07649510889X
  18:     0x7f813bec1610 - middle::typeck::check::check_method_argument_types::h20978a60653d31e5k8X
  19:     0x7f813bec3970 - middle::typeck::check::check_expr_with_unifier::h9021eb76dad51ef5dJY
  20:     0x7f813bf17500 - middle::typeck::check::check_stmt::h0b590f51bdc43b8bWL0
  21:     0x7f813be8f1a0 - middle::typeck::check::check_block_with_expected::hbcf547bf91ace5705P0
  22:     0x7f813bec3970 - middle::typeck::check::check_expr_with_unifier::h9021eb76dad51ef5dJY
  23:     0x7f813be8f1a0 - middle::typeck::check::check_block_with_expected::hbcf547bf91ace5705P0
  24:     0x7f813be8a770 - middle::typeck::check::check_fn::hc80418f404e5c598pvV
  25:     0x7f813bece970 - middle::typeck::check::check_expr_with_unifier::check_expr_fn::h2ca30ae5f2e571b43dZ
  26:     0x7f813bec3970 - middle::typeck::check::check_expr_with_unifier::h9021eb76dad51ef5dJY
  27:     0x7f813bec1dd0 - middle::typeck::check::check_argument_types::h1928dcb07649510889X
  28:     0x7f813bec3970 - middle::typeck::check::check_expr_with_unifier::h9021eb76dad51ef5dJY
  29:     0x7f813be8f1a0 - middle::typeck::check::check_block_with_expected::hbcf547bf91ace5705P0
  30:     0x7f813be8a770 - middle::typeck::check::check_fn::hc80418f404e5c598pvV
  31:     0x7f813be8a4b0 - middle::typeck::check::check_bare_fn::h1dd0be1cd95d0c63EkV
  32:     0x7f813be861c0 - middle::typeck::check::check_item::hfa9ed324eb120d1cNEV
  33:     0x7f813be89c30 - visit::Visitor::visit_mod::h4776340902026008023
  34:     0x7f813be88760 - visit::walk_item::h1837381033057518270
  35:     0x7f813be89f80 - middle::typeck::check::check_item_types::h7314688a92a7a43fOjV
  36:     0x7f813b985590 - util::common::time::h1086293170624038403
  37:     0x7f813c15cb90 - middle::typeck::check_crate::h707090d761adfc72A3n
  38:     0x7f813c1c6950 - driver::driver::phase_3_run_analysis_passes::h2dc7f682b53f78f9lNA
  39:     0x7f813c1c1200 - driver::driver::compile_input::hb25c14dfa369b7d96tA
  40:     0x7f813c2438b0 - driver::run_compiler::h3e5318d61e864690KgE
  41:     0x7f813c2437a0 - driver::run::closure.145379
  42:     0x7f813b99e370 - task::TaskBuilder<S>::try_future::closure.103636
  43:     0x7f813b99e160 - task::TaskBuilder<S>::spawn_internal::closure.103607
  44:     0x7f813b6691a0 - task::NativeSpawner.Spawner::spawn::closure.8435
  45:     0x7f813b377e30 - rust_try_inner
  46:     0x7f813b377e20 - rust_try
  47:     0x7f813b31c5e0 - unwind::try::h8c75b93d8c87f5c4xGd
  48:     0x7f813b31c470 - task::Task::run::h3855d187b4c0788fnMc
  49:     0x7f813b668ee0 - task::NativeSpawner.Spawner::spawn::closure.8373
  50:     0x7f813b31dcd0 - thread::thread_start::he45c6d58df77cc88C7c
  51:     0x7f8136189ea0 - start_thread
  52:     0x7f813afe5999 - __clone
  53:                0x0 - <unknown>

Could not compile `raft_rs`.

To learn more, run the command again with --verbose.
rustc --version=verbose
rustc 0.13.0-nightly (221fc1e3c 2014-10-31 02:27:15 +0000)
binary: rustc
commit-hash: 221fc1e3cdcc208e1bb7debcc2de27d47c847747
commit-date: 2014-10-31 02:27:15 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-nightly

waterlink added a commit to johnmq/raft-rs that referenced this issue Oct 31, 2014
@waterlink
Copy link

I have done a bit of narrowing and got this:

Compiler fails when trying to understand this https://github.com/johnmq/raft-rs/blob/398307167cd7263e6e4a10fb9be287d415c0b902/tests/node.rs#L46

and this line calls this method: https://github.com/johnmq/raft-rs/blob/398307167cd7263e6e4a10fb9be287d415c0b902/src/node.rs#L133-L141

@waterlink
Copy link

And after playing around with my suspect code I was able to avoid this bug by replacing type annotations of my arguments with parametric types instead of traits. This commit shows it: johnmq/raft-rs@6ba292f .

Basically that means that this bug is related somehow to trait rules changes. If this helps somehow..

@bkoropoff bkoropoff mentioned this issue Nov 2, 2014
@stepancheg
Copy link
Contributor

Minimal example:

use std::default::Default;

pub trait Message {
    fn new() -> Self { panic!(); }
}

fn new_instance<M : 'static + Message>() -> Box<Message + 'static> {
    let m: M = Default::default();
    box m as Box<Message>
}

fn main() {}

bkoropoff added a commit to bkoropoff/rust that referenced this issue Nov 2, 2014
This also fixes rust-lang#18490 as a side-effect by avoiding a later
out-of-bounds slice.
@hotgloupi
Copy link

Same issue here:

trait Command { fn name() -> &'static str; }
struct Init;
impl Command for Init { fn name() -> &'static str { "init" } }
fn main() {  let cmd = box Init as Box<Command>; }

with the backtrace:

task 'rustc' panicked at 'assertion failed: *start <= *end', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libcore/slice.rs:396

stack backtrace:
   1:        0x10d65d619 - rt::backtrace::imp::write::h03fee16d4a0b6b41moq
   2:        0x10d66085c - failure::on_fail::h3e0f6b3c6c4bbcc3VEq
   3:        0x10d8c4f05 - unwind::begin_unwind_inner::h6c7f4532e72658d7SJd
   4:        0x10d8c4b9f - unwind::begin_unwind_fmt::h9863b25c438d6314kHd
   5:        0x10d8c48f2 - rust_begin_unwind
   6:        0x10d91b53c - panicking::panic_fmt::hc53a414d3d53805bi7j
   7:        0x10d911f6f - panicking::panic::h5cf45d77d6cb56acm4j
   8:        0x10a84c83b - middle::typeck::check::vtable::check_object_safety::h3ee32f70bc2a6910cvN
   9:        0x10a84bab4 - middle::typeck::check::vtable::check_object_cast::ha17cfa6c915c29failN
  10:        0x10a8b4954 - middle::typeck::check::check_cast::h212d4526506e607bdwW
  11:        0x10a8dcae4 - middle::typeck::check::check_expr_with_unifier::h153e2ccf9b0cb061XCY
  12:        0x10a92c583 - middle::typeck::check::check_decl_local::h4f8f86e796500762GD0
  13:        0x10a92c6f7 - middle::typeck::check::check_stmt::h7691c17f92d0623eGF0
  14:        0x10a8a7faf - middle::typeck::check::check_block_with_expected::heb9a0fb2300c4559PJ0
  15:        0x10a8a3d42 - middle::typeck::check::check_fn::h0449d63e5b4f3e3a9oV
  16:        0x10a8a326f - middle::typeck::check::check_bare_fn::hf2de12c52654551eoeV
  17:        0x10a89f18d - middle::typeck::check::check_item::hfaeea23703d7dd28xyV
  18:        0x10a8a30bf - middle::typeck::check::check_item_types::haaff85b74e988d92ydV
  19:        0x10a3b9556 - util::common::time::h11920059333862041717
  20:        0x10ab6359e - middle::typeck::check_crate::h50fcc5c8b39993f4LVn
  21:        0x10abcbbcf - driver::driver::phase_3_run_analysis_passes::h1425a4ca465c7b097DA
  22:        0x10abc62b8 - driver::driver::compile_input::h60bc42ef7fabbfd4SkA
  23:        0x10ac43ca8 - driver::run_compiler::h4031243f49082a9fw7D
  24:        0x10ac41ece - driver::run::closure.145349
  25:        0x10a3d181b - task::TaskBuilder<S>::try_future::closure.103709
  26:        0x10a3d1713 - task::TaskBuilder<S>::spawn_internal::closure.103680
  27:        0x10a35198d - task::NativeSpawner.Spawner::spawn::closure.8526
  28:        0x10d92b20c - rust_try_inner
  29:        0x10d92b1f6 - rust_try
  30:        0x10d8c2677 - unwind::try::hab84862d0081b274cyd
  31:        0x10d8c250c - task::Task::run::h39093ecd59554b49ZJc
  32:        0x10a3517b3 - task::NativeSpawner.Spawner::spawn::closure.8463
  33:        0x10d8c3d37 - thread::thread_start::h589be8c0a398d299e5c
  34:     0x7fff8bbe7899 - _pthread_body
  35:     0x7fff8bbe772a - _pthread_struct_init

@hotgloupi
Copy link

Is the example I gave unrelated ? Because it's still give me the same backtrace :/
It might be a good idea to add the above crashing snippets to rust test suite (If they are well formed).

Side question: Is the online compiler up-to-date (as a nightly build is) ?

lnicola added a commit to lnicola/rust that referenced this issue Nov 12, 2024
minor: Rename `dyn compatible` to `dyn-compatible`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants