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

Added testcase for ignore() unsafety #25

Merged
merged 1 commit into from
Feb 8, 2022

Conversation

mitsuhiko
Copy link
Contributor

@mitsuhiko mitsuhiko commented Feb 7, 2022

I noticed that there were miri tests and I was curious why #24 was not failing. I managed to reproduce this by actually trying to make a test that uses ignore. The test is failing locally.

test regression::issue24::main ... error: Undefined Behavior: pointer to alloc63740 was dereferenced after this allocation got freed
  --> /Users/mitsuhiko/Development/miniserde/src/ignore.rs:7:18
   |
7  |         unsafe { extend_lifetime!(&mut Ignore as &mut Ignore) }
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer to alloc63740 was dereferenced after this allocation got freed
   |
   = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
   = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dtolnay dtolnay merged commit d42d122 into dtolnay:master Feb 8, 2022
@mitsuhiko mitsuhiko deleted the feature/issue24-test branch February 8, 2022 00:20
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 this pull request may close these issues.

2 participants