Skip to content

Instantly share code, notes, and snippets.

@taylorsmithgg
Last active April 23, 2017 09:05
Show Gist options
  • Save taylorsmithgg/24f2c842210780bbd35613534b61b387 to your computer and use it in GitHub Desktop.
Save taylorsmithgg/24f2c842210780bbd35613534b61b387 to your computer and use it in GitHub Desktop.
Rust 1.16.0 ? Operator Issue On Result
use std::io;
use std::io::prelude::*;
use std::fs::File;
// error[E0277]: the trait bound `(): std::ops::Carrier` is not satisfied
// --> src/main.rs:43:17
// |
// 43 | let mut f = File::open("foo.txt")?;
// | ----------------------
// | |
// | the trait `std::ops::Carrier` is not implemented for `()`
// | in this macro invocation
// |
// = note: required by `std::ops::Carrier::from_error`
// error[E0277]: the trait bound `(): std::ops::Carrier` is not satisfied
// --> src/main.rs:47:5
// |
// 47 | f.read(&mut buffer)?;
// | --------------------
// | |
// | the trait `std::ops::Carrier` is not implemented for `()`
// | in this macro invocation
// |
// = note: required by `std::ops::Carrier::from_error`
fn main(){
let mut f = File::open("foo.txt")?;
let mut buffer = [0; 10];
// read up to 10 bytes
f.read(&mut buffer)?;
println!("The bytes: {:?}", buffer);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment