Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error[E0432]: unresolved import std::backtrace when building with rustc 1.38.0-dev #20

Closed
strohel opened this issue Oct 13, 2019 · 2 comments · Fixed by #21
Closed

error[E0432]: unresolved import std::backtrace when building with rustc 1.38.0-dev #20

strohel opened this issue Oct 13, 2019 · 2 comments · Fixed by #21

Comments

@strohel
Copy link

strohel commented Oct 13, 2019

Hi,
I get following errors if I try to compile anyhow 1.0.12 with rustc 1.38.0 itself compiled in dev channel:

error[E0432]: unresolved import `std::backtrace`
 --> src/backtrace.rs:2:21
  |
2 | pub(crate) use std::backtrace::Backtrace;
  |                     ^^^^^^^^^ could not find `backtrace` in `std`

error[E0432]: unresolved import `std::backtrace`
 --> src/context.rs:7:10
  |
7 | use std::backtrace::Backtrace;
  |          ^^^^^^^^^ could not find `backtrace` in `std`
strohel@edgy ~/projekty/anyhow $ rustc --version
rustc 1.38.0-dev

It seems to be caused by the fact that cargo:rustc-cfg=backtrace is errorneously enabled in build.rs. If I do a simple change

diff --git a/build.rs b/build.rs
index dcc19c6..65541b4 100644
--- a/build.rs
+++ b/build.rs
@@ -34,6 +34,6 @@ fn rustc_version() -> Option<Compiler> {
     };
 
     Some(Compiler {
-        nightly: version.contains("nightly") || version.contains("dev"),
+        nightly: version.contains("nightly"),
     })
 }

then the crate compiles and tests pass (but that probably isn't the right thing to do).

Perhaps presence of std::backtrace can be tested more directly (maybe even without build.rs?).

@dtolnay
Copy link
Owner

dtolnay commented Oct 13, 2019

Thanks! Should be fixed in anyhow 1.0.13.

@strohel
Copy link
Author

strohel commented Oct 13, 2019

Works indeed, thanks a lot, that was light-speed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants