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 checked failed for singly linked list #18

Closed
henry40408 opened this issue Dec 14, 2018 · 1 comment
Closed

cargo checked failed for singly linked list #18

henry40408 opened this issue Dec 14, 2018 · 1 comment

Comments

@henry40408
Copy link
Contributor

henry40408 commented Dec 14, 2018

OS: macOS 10.14.1
rustc version: 1.28.0

    Checking rust-algorithm-club v0.0.1 (file:///Users/henry/Develop/rust-algorithm-club)
error[E0309]: the parameter type `T` may not live long enough
  --> src/collections/singly_linked_list/mod.rs:31:5
   |
30 | pub struct Iter<'a, T> {
   |                     - help: consider adding an explicit lifetime bound `T: 'a`...
31 |     next: Option<&'a Node<T>>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: ...so that the reference type `&'a collections::singly_linked_list::Node<T>` does not outlive the data it points at
  --> src/collections/singly_linked_list/mod.rs:31:5
   |
31 |     next: Option<&'a Node<T>>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0309]: the parameter type `T` may not live long enough
  --> src/collections/singly_linked_list/mod.rs:38:5
   |
37 | pub struct IterMut<'a, T> {
   |                        - help: consider adding an explicit lifetime bound `T: 'a`...
38 |     next: Option<&'a mut Node<T>>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: ...so that the reference type `&'a mut collections::singly_linked_list::Node<T>` does not outlive the data it points at
  --> src/collections/singly_linked_list/mod.rs:38:5
   |
38 |     next: Option<&'a mut Node<T>>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0309]: the parameter type `T` may not live long enough
   --> src/collections/singly_linked_list/mod.rs:229:5
    |
228 | impl<'a, T> Iterator for Iter<'a, T> {
    |          - help: consider adding an explicit lifetime bound `T: 'a`...
229 |     type Item = &'a T;
    |     ^^^^^^^^^^^^^^^^^^
    |
note: ...so that the reference type `&'a T` does not outlive the data it points at
   --> src/collections/singly_linked_list/mod.rs:229:5
    |
229 |     type Item = &'a T;
    |     ^^^^^^^^^^^^^^^^^^

error[E0309]: the parameter type `T` may not live long enough
   --> src/collections/singly_linked_list/mod.rs:242:5
    |
241 | impl<'a, T> Iterator for IterMut<'a, T> {
    |          - help: consider adding an explicit lifetime bound `T: 'a`...
242 |     type Item = &'a mut T;
    |     ^^^^^^^^^^^^^^^^^^^^^^
    |
note: ...so that the reference type `&'a mut T` does not outlive the data it points at
   --> src/collections/singly_linked_list/mod.rs:242:5
    |
242 |     type Item = &'a mut T;
    |     ^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0309`.
error: Could not compile `rust-algorithm-club`.

To learn more, run the command again with --verbose.
@weihanglo
Copy link
Owner

weihanglo commented Dec 14, 2018

Same as #17. Update to 2018 edition may help.
Ref #2

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