Skip to content

Commit

Permalink
fix(docs): change old 0.14.0 (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeertmans committed Aug 2, 2024
1 parent 976b2a4 commit feb8406
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion book/src/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```toml
[dependencies]
logos = "0.14.0"
logos = "0.14.1"
```

Then, you can automatically derive the [`Logos`](https://docs.rs/logos/latest/logos/trait.Logos.html) trait on your `enum` using the `Logos` derive macro:
Expand Down
4 changes: 2 additions & 2 deletions tests/tests/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn test_clone_ub() {
let mut lexer = Token::lexer("a");
assert_eq!(lexer.next(), Some(Ok(Token::Evil(Evil::default()))));

// In logos 0.14.0, this causes use-after-free (UB),
// In logos 0.14.1, this causes use-after-free (UB),
// because `Clone` dereferences the value returned by the last call to `lexer.next()`,
// which got deallocated.
// A real-life example where this could happen is with `Rc`.
Expand All @@ -51,7 +51,7 @@ fn test_clone_leak() {
};
assert_eq!(evil.0.get(), 0);

// In logos 0.14.0, this causes a memory leak because `evil` is cloned with `lexer`.
// In logos 0.14.1, this causes a memory leak because `evil` is cloned with `lexer`.
// This produces `evil.0.get() == 1`. It will fail even on `cargo test`.
let mut lexer2 = lexer.clone();
assert_eq!(evil.0.get(), 0);
Expand Down

0 comments on commit feb8406

Please sign in to comment.