rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.7k stars 12.64k forks source link

Rust 1.17 regression - yamlette 0.0.2 #40964

Closed alexcrichton closed 7 years ago

alexcrichton commented 7 years ago
[~/code/yamlette[master]] $ CARGO_TARGET_DIR=beta cargo +beta build                                                                                                                                                                                    [alex@acrichton-desktop]
   Compiling yamlette v0.0.2 (file:///home/alex/code/yamlette)
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'c in function call due to conflicting requirements
   --> src/orchestra/conductor.rs:635:22
    |
635 |                 self.do_the_music (music, performer_buffers, volumes) ?;
    |                      ^^^^^^^^^^^^
    |
note: first, the lifetime cannot outlive the anonymous lifetime #5 defined on the body at 573:31...
   --> src/orchestra/conductor.rs:573:32
    |
573 |     ) -> Result<(), OrchError> {
    |                                ^
note: ...so that reference does not outlive borrowed content
   --> src/orchestra/conductor.rs:635:62
    |
635 |                 self.do_the_music (music, performer_buffers, volumes) ?;
    |                                                              ^^^^^^^
note: but, the lifetime must be valid for the anonymous lifetime #3 defined on the body at 573:31...
   --> src/orchestra/conductor.rs:573:32
    |
573 |     ) -> Result<(), OrchError> {
    |                                ^
note: ...so that types are compatible (expected &[model::renderer::Node], found &[model::renderer::Node])
   --> src/orchestra/conductor.rs:635:43
    |
635 |                 self.do_the_music (music, performer_buffers, volumes) ?;
    |                                           ^^^^^^^^^^^^^^^^^

error: aborting due to previous error

error: Could not compile `yamlette`.

To learn more, run the command again with --verbose.
[~/code/yamlette[master]] $ git log -1                                                                                                                                                                                                                 [alex@acrichton-desktop]
commit 9bca6d6569afd1b6603c8ecbc3a0c44d530f98d4
Author: dnsl48 <dnsl48@gmail.com>
Date:   Mon Feb 6 17:32:36 2017 +1300

    No debug for Sage anymore
[~/code/yamlette[master]] $ rustc +beta -vV                                                                                                                                                                                                            [alex@acrichton-desktop]
rustc 1.17.0-beta.2 (b7c276653 2017-03-20)
binary: rustc
commit-hash: b7c27665307704a9b158fe242e88e83914029415
commit-date: 2017-03-20
host: x86_64-unknown-linux-gnu
release: 1.17.0-beta.2
LLVM version: 3.9

https://github.com/dnsl48/yamlette

cc @dnsl48

nikomatsakis commented 7 years ago

Possibly related to https://github.com/rust-lang/rust/pull/40319 ? (cc @eddyb -- you think?)

dnsl48 commented 7 years ago

Hi guys, thank you very much for the report, love your work! I have added some explicit lifetimes around. I'm not exactly sure it's related to #40319 however, now it appears that invocation of self.do_the_music borrows volumes for the whole lifetime of performer_buffers (https://travis-ci.org/dnsl48/yamlette/jobs/217654253). I would appreciate if you could confirm this assumption, which frankly seems to be correct behaviour to me now. Feels like I've been using some fault technics to trick the borrow checker there. Probably I'll have to rewrite this place a bit. At the moment I'm doing lots of refactoring all over the library anyways, and I'm glad there's one more place to be rewritten in a more proper way. Cheers

nikomatsakis commented 7 years ago

@dnsl48 looking at those diffs, it's not obvious to me why those patches should be needed. I'll try to build your crate locally and investigate.

nikomatsakis commented 7 years ago

@dnsl48 trying to build the crate, I agree that the current error is correct. As you said, do_the_music() borrows volumes for the whole lifetime of performer_buffers, since data from volumes is put into performer_buffers.

arielb1 commented 7 years ago

This is #40319, which was not marked as relnotes. Marking as relnotes myself.

nikomatsakis commented 7 years ago

Closing, since the PR in question ins tagged as relnotes now. (Thanks @arielb1)