]> git.proxmox.com Git - cargo.git/commit
Make try! an extended version of std::try!
authorYehuda Katz <wycats@gmail.com>
Sat, 21 Jun 2014 02:18:06 +0000 (19:18 -0700)
committerYehuda Katz <wycats@gmail.com>
Sat, 21 Jun 2014 02:18:06 +0000 (19:18 -0700)
commit78d8d61ccc24c37d0bf59a5929932dc7e669e2dd
treef04e960a193c74be5ae74615ef94a69cf5c6c28b
parentf137281b986d2897e771858bd0d66d51ca426dcb
Make try! an extended version of std::try!

The only caveat to this is that you cannot use try! inside of a function
that return a Result to another function that expects a totally generic
error.

The primary case of this is Encodable/Decodable, which call into
user-specified methods, expecting an `E` back. In these (extremely
unusual) cases, you can use raw_try!.

Of note:

* Once Error lands in core (optimistic much?), Encodable/Decodable can
  be changed to expect an E: Error + FromError<E>.
* This works fine with concrete error types, since FromError maps things
  like IoError to IoError. The only reason it doesn't work with totally
  generic E is that we can't implement FromError<Box<Error>> for
  impl Error and FromError<E> for E.
src/cargo/core/package_id.rs
src/cargo/lib.rs
src/cargo/ops/cargo_read_manifest.rs
src/cargo/ops/cargo_rustc.rs
src/cargo/sources/git/utils.rs
src/cargo/sources/path.rs
src/cargo/util/config.rs
src/cargo/util/errors.rs
src/cargo/util/paths.rs
src/cargo/util/process_builder.rs
src/cargo/util/toml.rs