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

"cargo test" fails on 1.5.0+ #27

Closed
diwic opened this issue Dec 30, 2015 · 4 comments
Closed

"cargo test" fails on 1.5.0+ #27

diwic opened this issue Dec 30, 2015 · 4 comments

Comments

@diwic
Copy link
Owner

diwic commented Dec 30, 2015

It runs just fine on 1.4.0-nightly, but fails on 1.5.0-stable and 1.7.0-nightly.

src/methoddisp.rs:793:88: 797:6 error: `count` does not live long enough
src/methoddisp.rs:793     let _setme = i.add_p_ref(f.property("setme", 0u8).access(Access::ReadWrite).on_set(|_,_,_| {
src/methoddisp.rs:794         let v: i32 = count.get_value().inner().unwrap();
src/methoddisp.rs:795         count.set_value((v + 1).into()).unwrap();
src/methoddisp.rs:796         Ok(vec!())
src/methoddisp.rs:797     }));
src/methoddisp.rs:787:27: 798:2 note: reference must be valid for the block at 787:26...
src/methoddisp.rs:787 fn prop_lifetime_simple() {
src/methoddisp.rs:788     let count;
src/methoddisp.rs:789     let f = Factory::new_fnmut();
src/methoddisp.rs:790     let mut i = f.interface("com.example.dbus.rs");
src/methoddisp.rs:791     count = i.add_p_ref(f.property("changes", 0i32));
src/methoddisp.rs:792 
                  ...
src/methoddisp.rs:788:15: 798:2 note: ...but borrowed value is only valid for the block suffix following statement 0 at 788:14
src/methoddisp.rs:788     let count;
src/methoddisp.rs:789     let f = Factory::new_fnmut();
src/methoddisp.rs:790     let mut i = f.interface("com.example.dbus.rs");
src/methoddisp.rs:791     count = i.add_p_ref(f.property("changes", 0i32));
src/methoddisp.rs:792 
src/methoddisp.rs:793     let _setme = i.add_p_ref(f.property("setme", 0u8).access(Access::ReadWrite).on_set(|_,_,_| {
@diwic
Copy link
Owner Author

diwic commented Dec 30, 2015

In addition, at least the note line looks broken:

src/methoddisp.rs:793:88: 797:6 error: `count` does not live long enough
src/methoddisp.rs:788:34: 798:2 note: reference must be valid for the block suffix following statement 0 at 788:33...
src/methoddisp.rs:789:15: 798:2 note: ...but borrowed value is only valid for the block suffix following statement 1 at 789:14

...but moving let count above let f = Factory::new_fnmut() just moves the error too:

src/methoddisp.rs:793:88: 797:6 error: `count` does not live long enough
src/methoddisp.rs:787:27: 798:2 note: reference must be valid for the block at 787:26...
src/methoddisp.rs:788:15: 798:2 note: ...but borrowed value is only valid for the block suffix following statement 0 at 788:14

Related issue that might have caused this: rust-lang/rust#29106

@diwic
Copy link
Owner Author

diwic commented Dec 30, 2015

@apasel422, since you wrote the code for fixing rust-lang/rust#29106 , if it's not too much to ask, would you mind seeing if it's Rust that's overly conservative here? It looks so to me.

@apasel422
Copy link

@diwic I'm looking at this now, and don't have a sure answer, but I think it's unlikely that Rust is being overly conservative. I have a hunch that it's variance-related.

diwic pushed a commit that referenced this issue Jan 17, 2016
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
@diwic
Copy link
Owner Author

diwic commented Jul 31, 2016

Fixed as part of tree rewrite.

@diwic diwic closed this as completed Jul 31, 2016
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

2 participants