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
A source file containing a question mark ? operator leads to a parsing error and therefore to an invalid build, e.g. re-writing the example from Macro std::try works fine:
use std::io;use std::fs::File;use std::io::prelude::*;enumMyError{FileWriteError}implFrom<io::Error>forMyError{fnfrom(e: io::Error) -> MyError{MyError::FileWriteError}}fnwrite_to_file_using_try() -> Result<(),MyError>{letmut file = try!(File::create("my_best_friends.txt"));
try!(file.write_all(b"This is a list of my best friends."));println!("I wrote to the file");Ok(())}
But adding the following function leads to a build error if cheddar is active for the build.
fnwrite_to_file_using_qm() -> Result<(),MyError>{letmut file = File::create("my_best_friends.txt")?;
file.write_all(b"This is a list of my best friends.")?;println!("I wrote to the file");Ok(())}
The error is the following:
cargo build
Compiling tmp v0.1.0 (file://~/tmp)
error: failed to run custom build command for `tmp v0.1.0 (file://~/tmp)`
process didn't exit successfully: `~/tmp/target/debug/build/tmp-61d2999a3a4c1c18/build-script-build` (exit code: 101)
--- stderr
src/lib.rs:25:55: 25:56 error: expected one of `.`, `;`, or an operator, found `?`
src/lib.rs:25 let mut file = File::create("my_best_friends.txt")?;
^
thread 'main' panicked at 'Box<Any>', ~/.cargo/registry/src/github.com-1ecc6299db9ec823/syntex_syntax-0.24.0/src/parse/mod.rs:79
note: Run with `RUST_BACKTRACE=1` for a backtrace.
The text was updated successfully, but these errors were encountered:
A source file containing a question mark
?
operator leads to a parsing error and therefore to an invalid build, e.g. re-writing the example from Macrostd::try
works fine:But adding the following function leads to a build error if cheddar is active for the build.
The error is the following:
The text was updated successfully, but these errors were encountered: