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
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`.
The text was updated successfully, but these errors were encountered:
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.
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.
The text was updated successfully, but these errors were encountered: