Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Make error_chain with default-features = false work with Rust 1.10 #103

Merged
merged 2 commits into from
Dec 25, 2016

Conversation

joshtriplett
Copy link
Contributor

error_chain uses attributes on statements, stablized in Rust 1.13.
Factor them out of functions in the non-backtrace codepath, making it
possible to build a crate that uses error_chain with Rust 1.10.

The backtrace feature still requires Rust 1.13 for attributes on
statements, due to the impl_extract_backtrace macro, which needs to emit
a function with one block for each linked error type, some of which may
have attributes on them. And any code using compile-time conditionals
in attributes on variants within an error_chain! invocation (which
includes many of the tests and examples) will produce an error due to
rust-lang/rust#22250 (fixed in Rust 1.11).
But a crate using error_chain with default-features = false and avoiding
such compile-time conditionals will now compile.

error_chain uses attributes on statements, stablized in Rust 1.13.
Factor them out of functions in the non-backtrace codepath, making it
possible to build a crate that uses error_chain with Rust 1.10.

The backtrace feature still requires Rust 1.13 for attributes on
statements, due to the impl_extract_backtrace macro, which needs to emit
a function with one block for each linked error type, some of which may
have attributes on them.  And any code using compile-time conditionals
in attributes on variants within an error_chain! invocation (which
includes many of the tests and examples) will produce an error due to
rust-lang/rust#22250 (fixed in Rust 1.11).
But a crate using error_chain with default-features = false and avoiding
such compile-time conditionals will now compile.
@joshtriplett
Copy link
Contributor Author

If it's not too much trouble, would you mind putting out an 0.7.2 with this included, so I can use that from another crate?

@Yamakaky
Copy link
Contributor

That's better than nothing. Could you update the README?

@joshtriplett
Copy link
Contributor Author

joshtriplett commented Dec 25, 2016

@Yamakaky Sure, will do. I'll also try to make Travis build-test the bits that work on 1.10.

@joshtriplett
Copy link
Contributor Author

joshtriplett commented Dec 25, 2016

@Yamakaky Done.

The Travis bits aren't perfect, since they still declare two builds for 1.10 and skip one at build time, but they do work correctly. Working on that.

Document the distinction between full support and minimum support in
README.md.
@joshtriplett
Copy link
Contributor Author

OK, this now tests 1.10 properly with Travis.

@Yamakaky
Copy link
Contributor

Thanks!

@Yamakaky Yamakaky merged commit 98c1a5d into rust-lang-deprecated:master Dec 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants