We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
// seq.rs use std::collections::HashMap; use std::hash::Hash; pub trait Seq<T> { #[cfg(ice)] fn add_elem(&mut self, T); #[cfg(not(ice))] fn add_elem(&mut Self, T); fn new() -> Self; } impl<K, V> Seq<(K, V)> for HashMap<K, V> where K: Eq + Hash { #[cfg(ice)] fn add_elem(&mut self, (key, value): (K, V)) { self.insert(key, value); } #[cfg(not(ice))] fn add_elem(m: &mut HashMap<K, V>, (key, value): (K, V)) { m.insert(key, value); } fn new() -> HashMap<K, V> { HashMap::new() } }
// app.rs extern crate seq; use std::collections::HashMap; fn main() { let _: HashMap<char, String> = { let mut temp = ::seq::Seq::new(); ::seq::Seq::add_elem(&mut temp, ('a', "apple".to_string())); temp }; }
$ rustc --cfg ice --crate-type=lib seq.rs $ rustc -L . app.rs
If you omit the --cfg ice flag, compiling app.rs doesn't ICE. In that case UFCS is not used at all.
--cfg ice
app.rs
error: internal compiler error: unexpected failure note: the compiler hit an unexpected failure path. 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' failed at 'assertion failed: `(left == right) && (right == left)` (left: `11`, right: `0`)', /var/tmp/paludis/build/dev-lang-rust-scm/work/rust-scm/src/librustc/middle/trans/callee.rs:504 stack backtrace: 1: 0x7f8c4420a530 - rt::backtrace::imp::write::hc0bea45eeb94b4f2gDq 2: 0x7f8c4420d660 - <unknown> 3: 0x7f8c449ac890 - unwind::begin_unwind_inner::h7a44b117581e2f74Gxd 4: 0x7f8c449ac3d0 - unwind::begin_unwind_fmt::h45039a117ffe43968ud 5: 0x7f8c4518e740 - middle::trans::callee::trans_fn_ref_with_substs::h5c6fbb3c911b1c9bsm2 6: 0x7f8c4518bd60 - middle::trans::callee::trans_fn_ref::h76d352f707b079480a2 7: 0x7f8c45194650 - <unknown> 8: 0x7f8c4516c1b0 - middle::trans::callee::trans_call_inner::h1363a864f6bb88c0aI2 9: 0x7f8c451943a0 - middle::trans::callee::trans_call::hdf5a1e27fb88e0bavC2 10: 0x7f8c451a3530 - <unknown> 11: 0x7f8c45164440 - middle::trans::expr::trans_into::h51830a680129f037ss3 12: 0x7f8c45163830 - middle::trans::controlflow::trans_stmt_semi::h4f58c2f4320d1330KEZ 13: 0x7f8c45162de0 - middle::trans::controlflow::trans_stmt::h46e53ff7f38da11cxAZ 14: 0x7f8c45164860 - middle::trans::controlflow::trans_block::ha4ca6acf3ba4f0c5DFZ 15: 0x7f8c451a3530 - <unknown> 16: 0x7f8c451a2170 - <unknown> 17: 0x7f8c45165990 - middle::trans::expr::trans::h1177439ad486cf5emw3 18: 0x7f8c4520b8f0 - middle::trans::_match::store_local::hde75dbf3d187178beZi 19: 0x7f8c45163a20 - middle::trans::base::init_local::h9df9f875fba43791YJe 20: 0x7f8c45162de0 - middle::trans::controlflow::trans_stmt::h46e53ff7f38da11cxAZ 21: 0x7f8c45164860 - middle::trans::controlflow::trans_block::ha4ca6acf3ba4f0c5DFZ 22: 0x7f8c452150f0 - middle::trans::base::trans_closure::h56e66481b064a22boBf 23: 0x7f8c45156370 - middle::trans::base::trans_fn::hcc6c7d7c981b98c0MMf 24: 0x7f8c451539d0 - middle::trans::base::trans_item::h1fa8cc7bd69d090855f 25: 0x7f8c452206b0 - middle::trans::base::trans_crate::he0691a6f7c0f1264B4g 26: 0x7f8c45671e10 - driver::driver::phase_4_translate_to_llvm::hfb1745881244cd9ayEx 27: 0x7f8c45668110 - driver::driver::compile_input::hc2b446e7823ca44dtbx 28: 0x7f8c456f3980 - <unknown> 29: 0x7f8c456f3830 - <unknown> 30: 0x7f8c44db9d80 - <unknown> 31: 0x7f8c44db9b60 - <unknown> 32: 0x7f8c45f65980 - <unknown> 33: 0x7f8c449fd4b0 - <unknown> 34: 0x7f8c449fd4a0 - rust_try 35: 0x7f8c449aa150 - unwind::try::h18af68ce3545f05domd 36: 0x7f8c449a9fd0 - task::Task::run::he7074020ac841b032Bc 37: 0x7f8c45f656c0 - <unknown> 38: 0x7f8c449ab8a0 - <unknown> 39: 0x7f8c43cd21d0 - start_thread 40: 0x7f8c446851b9 - clone 41: 0x0 - <unknown>
rustc 0.13.0-dev (e4761c85b 2014-10-15 09:57:18 +0000)
cc @nick29581
The text was updated successfully, but these errors were encountered:
(left == right) && (right == left)…
Resolve methods called as functions and...
4e7d86c
...defined in another crate. Fixes rust-lang#18061
auto merge of #18177 : nick29581/rust/ufcs2, r=nikomatsakis
88b6e93
r? closes #18061
nrc
Successfully merging a pull request may close this issue.
STR
If you omit the
--cfg ice
flag, compilingapp.rs
doesn't ICE. In that case UFCS is not used at all.Backtrace
Version
cc @nick29581
The text was updated successfully, but these errors were encountered: