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
Without the fix described above, you get the following compilation failure (rustc from commit c202430):
% rustc --lib /tmp/foo3.rs
/tmp/foo3.rs:3:15: 3:16 error: illegal borrow: borrowed value does not live long enough
/tmp/foo3.rs:3 let tail = v.view(1, v.len());
^
/tmp/foo3.rs:1:38: 5:1 note: borrowed pointer must be valid for the lifetime &'r as defined on the block at 1:38...
/tmp/foo3.rs:1 fn vec_peek<T>(v: &'r [T]) -> &'r [T] {
/tmp/foo3.rs:2 // let tail = vec::slice(v, 1, v.len());
/tmp/foo3.rs:3 let tail = v.view(1, v.len());
/tmp/foo3.rs:4 tail
/tmp/foo3.rs:5 }
/tmp/foo3.rs:1:0: 5:1 note: ...but borrowed value is only valid for the function body at 1:0
/tmp/foo3.rs:1 fn vec_peek<T>(v: &'r [T]) -> &'r [T] {
/tmp/foo3.rs:2 // let tail = vec::slice(v, 1, v.len());
/tmp/foo3.rs:3 let tail = v.view(1, v.len());
/tmp/foo3.rs:4 tail
/tmp/foo3.rs:5 }
error: aborting due to previous error
The text was updated successfully, but these errors were encountered:
Extend example for the `unneeded_field_pattern` lint
Current example is incorrect (or pseudo-code) because a struct name is omitted. I have used the code from the tests instead. Perhaps this example can be made less verbose, but I think it is more convenient to see a "real" code as an example.
---
changelog: extend example for the `unneeded_field_pattern` lint
This is spawned off from #3888.
If you swap in the first line below instead of the second, the example will compile.
Without the fix described above, you get the following compilation failure (rustc from commit c202430):
The text was updated successfully, but these errors were encountered: