These are chat archives for rust-lang/rust

28th
Jul 2017
Tim Siwula
@tcsiwula
Jul 28 2017 06:57
 Compiling ethcore-stratum v1.7.0 (file:///Users/timsiwula/Desktop/consensys/bench_project/parity/stratum)
error: internal compiler error: src/librustc/infer/mod.rs:573: Encountered errors [FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<K as verification::queue::kind::Kind>)),depth=0),Unimplemented)] resolving bounds after type-checking

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: rustc 1.21.0-nightly (599be0d18 2017-07-26) running on x86_64-apple-darwin

thread rustc panicked at Box<Any>, src/librustc_errors/lib.rs:438:8
note: Run with RUST_BACKTRACE=1 for a backtrace.

error: Could not compile ethcore.
warning: build failed, waiting for other jobs to finish...
error: internal compiler error: src/librustc/infer/mod.rs:573: Encountered errors [FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<K as verification::queue::kind::Kind>)),depth=0),Unimplemented)] resolving bounds after type-checking

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: rustc 1.21.0-nightly (599be0d18 2017-07-26) running on x86_64-apple-darwin

thread rustc panicked at Box<Any>, src/librustc_errors/lib.rs:438:8
note: Run with RUST_BACKTRACE=1 for a backtrace.

error: Could not compile ethcore.

To learn more, run the command again with --verbose.
cc @squanto
Joonas Koivunen
@koivunej
Jul 28 2017 08:45
@dualmoon aah, that would make sense (expr instead of statement) if your macro was called like let (roll, count) = die_count!(6, 6); and probably setteles it. so the outer { after => are only for macro_rules! and the next ones are needed to make it an expr.
@tcsiwula looks like a valid bug, and looks like it has already been reported: rust-lang/rust#43391
lemonxah
@lemonxah
Jul 28 2017 09:15
is there a cost effective way of reversing a vecotor
Joonas Koivunen
@koivunej
Jul 28 2017 09:23
@lemonxah in addtion to Vec::reverse(&mut self)? i remember seeing slice reversions getting some optimizations recently, so probably only faster way is to produce it in correct order in the first place, or try to manage with v.into_iter().rev() or v.iter().rev()
lemonxah
@lemonxah
Jul 28 2017 11:17
how do you give a lambda 2 params
lemonxah
@lemonxah
Jul 28 2017 11:22
i was just being stupid :/
i did |a,b| but the function that took that function actaully took 2 params and i only supplied this one so i thought the lambda was saying it only took 1
thank you anyway
lemonxah
@lemonxah
Jul 28 2017 11:30
hi guys i am still new to rust and i am having a hard time with the type system inregards with this sample: https://play.rust-lang.org/?gist=53dea93e09c16cb54cc595b1911ecedc&version=stable
but now i am stuck :/
nvm i got it :)
lemonxah
@lemonxah
Jul 28 2017 11:43
https://play.rust-lang.org/?gist=91bb6c1b65b0ed929fb68fd87f267a6f&version=stable that is what i came up with, if there is any improvements that you guys think i should do please let me know
Tim Siwula
@tcsiwula
Jul 28 2017 17:43
@koivunej thank you for confirming. I was not sure if my macbook was going crazy or if I misunderstood the dynamics of cargo/bench/nightly. Yay!!
Rogach
@Rogach
Jul 28 2017 20:06
Hi! Why can't I pattern match enum inside a tuple?
This works:
rust

Hi! Why can't I pattern match enum reference inside a tuple?
This compiles:

match &ColumnJsonType::Number {
    &ColumnJsonType::Number | &ColumnJsonType::String => 1,
    _ => 2
};

but this does not:

match (1, &ColumnJsonType::Number) {
    (1, &ColumnJsonType::Number | &ColumnJsonType::String) => 1,
    _ => 2
};
Complains about unexpected token "|".
Ilya Bogdanov
@vitvakatu
Jul 28 2017 20:09
You need to use smth like (1, &variant1) | (1, &variant2)
Rogach
@Rogach
Jul 28 2017 20:10
@vitvakatu That works, thanks! Any reason why my version didn't work?
Ilya Bogdanov
@vitvakatu
Jul 28 2017 20:13
To be honest, I don't know how to explain it. It's just pattern-matching syntax feature
Rogach
@Rogach
Jul 28 2017 20:13
@vitvakatu Thanks!