Skip to content

Instantly share code, notes, and snippets.

System:
rustc 0.11.0-pre-nightly (022a7b3 2014-05-22 01:06:25 -0700)
host: x86_64-apple-darwin
Error:
main.rs:14:2: 14:7 error: mismatched types: expected `Box A` but found `~B` (expected trait A but found box)
main.rs:14 box B
^~~~~
error: aborting due to previous error
@m10e
m10e / gist:15e93b31c6c47a5624d9
Created May 29, 2014 16:53
Rust mod/path question
/*
Everything is in a single crate. The directory structure is as follows:
.
├── b
│   └── mod.rs
├── c
│   └── mod.rs
├── d
│   └── mod.rs
@m10e
m10e / once_entry.rs
Last active December 18, 2015 20:28
rustc disapproves. once_entry.rs:40:16: 40:61 error: mismatched types: expected `~str` but found `&str` (str storage differs: expected ~ but found &) once_entry.rs:40 adj_str = adj_str.slice_chars(1, adj_str.char_len()-1); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pub fn parse(munny: &Munny, day: &time::Tm, tokens: &mut ~[~str]) {
if tokens.len() < 1 {
fail!("Too few arguments!")
}
// Pop adjustment string.
let mut set = false;
let mut adj_str = vec::pop(tokens);
// See if there's a '=' preceding it. If so, note that and slice it.