You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code gives an ICE. It worked fine before PR #8519 landed. Note that the trait object is parametrized by A2, which is the second type parameter of the structure Impl. The fact that is is the second type parameter is important: there is no ICE when it is the first (see the two last examples).
pubtraitTrait<A>{fndoit(&self);}pubstructImpl<A1,A2,A3>{/* * With A2 we get the ICE: * task <unnamed> failed at 'index out of bounds: the len is 1 but the index is 1', /home/tortue/rust_compiler_newest/src/librustc/middle/subst.rs:58 */t: ~Trait<A2>}impl<A1,A2,A3>Impl<A1,A2,A3>{pubfnstep(&self){self.t.doit()}}fnmain(){}
The following fails too, but this time the out of bound index is 2, and the trait object is parametrized by the third parameter of the structure Impl:
pubtraitTrait<A>{fndoit(&self);}pubstructImpl<A1,A2,A3>{/* * With A3 we get the ICE: * task <unnamed> failed at 'index out of bounds: the len is 1 but the index is 2', /home/tortue/rust_compiler_newest/src/librustc/middle/subst.rs:58 */t: ~Trait<A3>}impl<A1,A2,A3>Impl<A1,A2,A3>{pubfnstep(&self){self.t.doit()}}fnmain(){}
This one works fine, as the first parameter is used:
pubtraitTrait<A>{fndoit(&self);}pubstructImpl<A1,A2,A3>{// With A1, it works fine.t: ~Trait<A1>}impl<A1,A2,A3>Impl<A1,A2,A3>{pubfnstep(&self){self.t.doit()}}fnmain(){}
I guess the struct type parameter position affects something on trait method call resolution. Here is a backtrace of rust_begin_unwind (provided by @huonw) for the first example:
#0 rust_begin_unwind (token=839147) at /home/huon/rust/src/rt/rust_builtin.cpp:561
#1 0x00007ffff7831648 in rt::task::__extensions__::meth_25362::begin_unwind::_7c12263797ed078::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#2 0x00007ffff7830a43 in sys::begin_unwind_::_89e154cd0915671::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#3 0x00007ffff77a658e in unstable::lang::fail_::_89e154cd0915671::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#4 0x00007ffff77aef47 in unstable::lang::fail_bounds_check::_7112ff25e39642a2::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#5 0x00007ffff632abc5 in middle::subst::__extensions__::meth_47604::effectfulSubst::_8d15b09d6d1feaa7::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#6 0x00007ffff632b09b in middle::subst::__extensions__::effectfulSubst::anon::expr_fn_47615 () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#7 0x00007ffff6150bf2 in vec::__extensions__::map_24158::_af9d6bbe4c97e84::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#8 0x00007ffff6307c11 in middle::ty::fold_regions_and_ty::fold_substs::_f87632aa5a6bf38c::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#9 0x00007ffff6306d34 in middle::ty::fold_regions_and_ty::_eec113fb083f535::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#10 0x00007ffff632aada in middle::subst::__extensions__::meth_47604::effectfulSubst::_8d15b09d6d1feaa7::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#11 0x00007ffff6308f6f in middle::subst::__extensions__::meth_45441::subst::_8d15b09d6d1feaa7::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#12 0x00007ffff61ad3e3 in middle::ty::subst::_3eca2167a74aedda::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#13 0x00007ffff6416265 in middle::typeck::check::method::__extensions__::meth_55388::consider_candidates::_434c75b2fd612a1c::_0$x2e8$x2dpre ()
from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#14 0x00007ffff641105f in middle::typeck::check::method::__extensions__::meth_55337::search_for_method::_4d1e96ca73d452a3::_0$x2e8$x2dpre ()
from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#15 0x00007ffff6411e16 in middle::typeck::check::method::__extensions__::meth_55351::search_for_some_kind_of_autorefd_method::_bcb6f7e4b367e548::_0$x2e8$x2dpre ()
from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#16 0x00007ffff640ab18 in middle::typeck::check::method::__extensions__::meth_55207::search::_4d1e96ca73d452a3::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#17 0x00007ffff6408824 in middle::typeck::check::method::lookup::_4b77c03a44123db0::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#18 0x00007ffff644c625 in middle::typeck::check::check_expr_with_unifier::check_method_call::_b1665ac8f3af21dd::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#19 0x00007ffff643fc98 in middle::typeck::check::check_expr_with_unifier::_954efbe3785ec583::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#20 0x00007ffff644976d in middle::typeck::check::check_expr_with_opt_hint::_ebadc6b67a7a724::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#21 0x00007ffff645e94f in middle::typeck::check::check_block_with_expected::anon::expr_fn_57414 () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#22 0x00007ffff6421d50 in middle::typeck::check::__extensions__::with_region_lb_55877::_116d8e3dbf7558d8::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#23 0x00007ffff6422aad in middle::typeck::check::check_block_with_expected::_d9a834828355583::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#24 0x00007ffff641f12c in middle::typeck::check::check_fn::_82b74e20bdb3c03d::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#25 0x00007ffff641e581 in middle::typeck::check::check_bare_fn::_cb394ca6cb630bf::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#26 0x00007ffff64231aa in middle::typeck::check::check_method::_7c2fbbeb61a180d6::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#27 0x00007ffff641be7f in middle::typeck::check::check_item::_a8862943ecd2909a::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#28 0x00007ffff641af23 in middle::typeck::check::__extensions__::meth_55693::visit_item::_7941de97d3394078::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#29 0x00007ffff641e34e in middle::typeck::check::check_item_types::_4079c2c77b544bea::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#30 0x00007ffff6530701 in util::common::time_63654::_c4d0513e54dc658e::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#31 0x00007ffff6530197 in middle::typeck::check_crate::_cd4774fc30e32eb3::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#32 0x00007ffff6795f95 in driver::driver::phase_3_run_analysis_passes::_c49682fbf209272::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#33 0x00007ffff6798a28 in driver::driver::compile_input::_995b2797bc6e6f9::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#34 0x00007ffff67c3d11 in run_compiler::_ab6ccab0bc93e7d::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#35 0x00007ffff67d53de in main::anon::expr_fn_96265 () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#36 0x00007ffff67d38d5 in monitor::anon::expr_fn_96139 () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#37 0x00007ffff67d104e in task::__extensions__::try_95621::anon::expr_fn_95821 () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#38 0x00007ffff7805bb5 in task::spawn::spawn_raw_newsched::anon::expr_fn_21475 () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#39 0x00007ffff784d23e in rt::task::__extensions__::build_start_wrapper::anon::anon::expr_fn_28759 () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#40 0x00007ffff784c0bd in rt::task::__extensions__::run::anon::expr_fn_28681 () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#41 0x00007ffff784d53d in rt::task::__extensions__::try_fn::_4edaa01d4dd56e2::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#42 0x00007ffff432bf84 in rust_try (f=<optimized out>, fptr=<optimized out>, env=<optimized out>) at /home/huon/rust/src/rt/rust_builtin.cpp:552
#43 0x00007ffff784bf74 in rt::task::__extensions__::meth_28679::try::_199ab8d6eb226980::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#44 0x00007ffff784be55 in rt::task::__extensions__::meth_28677::run::_199ab8d6eb226980::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#45 0x00007ffff784cf7c in rt::task::__extensions__::build_start_wrapper::anon::expr_fn_28743 () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#46 0x00007ffff7883349 in rt::context::__extensions__::task_start_wrapper::_d625afdc49afb93::_0$x2e8$x2dpre () from /home/huon/rust/x86_64-unknown-linux-gnu/stage1/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
The text was updated successfully, but these errors were encountered:
Allow passing `--remove` to `cargo dev setup <SUBCOMMAND>`
changelog: none
Allows passing `--remove` to `cargo dev setup <SUBCOMMAND>` as an alternative to `cargo dev remove ...`
Fixesrust-lang/rust-clippy#8663
The following code gives an ICE. It worked fine before PR #8519 landed. Note that the trait object is parametrized by
A2
, which is the second type parameter of the structureImpl
. The fact that is is the second type parameter is important: there is no ICE when it is the first (see the two last examples).The following fails too, but this time the out of bound index is 2, and the trait object is parametrized by the third parameter of the structure
Impl
:This one works fine, as the first parameter is used:
I guess the struct type parameter position affects something on trait method call resolution. Here is a backtrace of
rust_begin_unwind
(provided by @huonw) for the first example:The text was updated successfully, but these errors were encountered: