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

NLL future-compat warning on nightly #55

Closed
Nemo157 opened this issue Apr 25, 2019 · 0 comments · Fixed by #56
Closed

NLL future-compat warning on nightly #55

Nemo157 opened this issue Apr 25, 2019 · 0 comments · Fixed by #56

Comments

@Nemo157
Copy link

Nemo157 commented Apr 25, 2019

Latest nightly has enabled the NLL migration mode for Edition 2015 code, this is triggering a couple of warnings (that will become errors in the future) in toml_edit 0.1.3:

warning[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable
  --> /home/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/toml_edit-0.1.3/src/index.rs:55:65
   |
44 |       fn index_or_insert<'v>(&self, v: &'v mut Item) -> &'v mut Item {
   |                          -- lifetime `'v` defined here
45 | /         match *v {
46 | |             Item::ArrayOfTables(ref mut vec) => {
47 | |                 vec.values.get_mut(*self).expect("index out of bounds")
48 | |             }
49 | |             Item::Value(ref mut a) if a.is_array() => a
   | |                         --------- mutable borrow occurs here
...  |
55 | |             _ => panic!("cannot access index {} in {:?}", self, v),
   | |                                                                 ^ immutable borrow occurs here
56 | |         }
   | |_________- returning this value requires that `v.0` is borrowed for `'v`
   |
   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future

warning[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable
  --> /home/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/toml_edit-0.1.3/src/index.rs:88:63
   |
70 |       fn index_or_insert<'v>(&self, v: &'v mut Item) -> &'v mut Item {
   |                          -- lifetime `'v` defined here
...
77 | /         match *v {
78 | |             Item::Table(ref mut t) => t.entry(self).or_insert(Item::None),
79 | |             Item::Value(ref mut v) if v.is_inline_table() => {
   | |                         --------- mutable borrow occurs here
80 | |                 &mut v
...  |
88 | |             _ => panic!("cannot access key {} in {:?}", self, v),
   | |                                                               ^ immutable borrow occurs here
89 | |         }
   | |_________- returning this value requires that `v.0` is borrowed for `'v`
   |
   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
@ordian ordian mentioned this issue Apr 25, 2019
bors bot added a commit that referenced this issue Apr 25, 2019
56: Fix for nightly r=ordian a=ordian

Fixes #55.
bors r+

Co-authored-by: Andronik Ordian <write@reusable.software>
bors bot added a commit that referenced this issue Apr 25, 2019
56: Fix for nightly r=ordian a=ordian

Fixes #55.
bors r+

Co-authored-by: Andronik Ordian <write@reusable.software>
bors bot added a commit that referenced this issue Apr 25, 2019
56: Fix for nightly r=ordian a=ordian

Fixes #55.
bors r+

Co-authored-by: Andronik Ordian <write@reusable.software>
bors bot added a commit that referenced this issue Apr 25, 2019
56: Fix for nightly r=ordian a=ordian

Fixes #55.
bors r+

Co-authored-by: Andronik Ordian <write@reusable.software>
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.

1 participant