Skip to content

Build error with nightly 10/25 #19

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

Closed
burtonageo opened this issue Oct 26, 2014 · 3 comments
Closed

Build error with nightly 10/25 #19

burtonageo opened this issue Oct 26, 2014 · 3 comments

Comments

@burtonageo
Copy link

Georges-MBP-2:rust-xml georgeburton$ cargo build
    Compiling rust-xml v0.1.0 (file:///Users/georgeburton/Downloads/rust-xml)
src/namespace.rs:41:23: 41:29 error: cannot infer an appropriate lifetime for pattern due to conflicting    requirements
src/namespace.rs:41         let Namespace(ref hm) = *self;
                                          ^~~~~~
src/namespace.rs:43:20: 43:21 note: first, the lifetime cannot outlive the expression at 43:19...
src/namespace.rs:43             match (k.as_ref().map(|k| k.as_slice()), v.as_slice()) {
                                       ^
src/namespace.rs:43:20: 43:21 note: ...so that pointer is not dereferenced outside its lifetime
src/namespace.rs:43             match (k.as_ref().map(|k| k.as_slice()), v.as_slice()) {
                                       ^
src/namespace.rs:42:23: 42:25 note: but, the lifetime must be valid for the expression at 42:22...
src/namespace.rs:42         for (k, v) in hm.iter() {
                                          ^~
src/namespace.rs:42:23: 42:25 note: ...so that pointer is not dereferenced outside its lifetime
src/namespace.rs:42         for (k, v) in hm.iter() {
                                          ^~
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
Could not compile `rust-xml`.
@richard-uk1
Copy link

I'm no expert, but this looks like a bug in rust - rust says it has to be valid in the outside scope - but it doesn't (it's not used there).

@netvl
Copy link
Owner

netvl commented Oct 26, 2014

This is definitely a bug in rustc. I managed to strip down the example to the minimal one, and it seems it is related to static pattern matching. I'm going to file a bug to Rust tracker.

Update
Done, rust-lang/rust#18352

@netvl
Copy link
Owner

netvl commented Oct 26, 2014

I've pushed a temporary workaround which uses if clauses in match to compare values with constants. Hopefully this bug will be fixed and this change could be reverted.

@netvl netvl closed this as completed Oct 26, 2014
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

No branches or pull requests

3 participants