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

Must check mutability when instantiating impl &T methods #3261

Closed
bblum opened this issue Aug 23, 2012 · 3 comments
Closed

Must check mutability when instantiating impl &T methods #3261

bblum opened this issue Aug 23, 2012 · 3 comments
Labels
A-lifetimes Area: lifetime related A-typesystem Area: The type system I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Milestone

Comments

@bblum
Copy link
Contributor

bblum commented Aug 23, 2012

Here is some code that segfaults.

If I replace the impl with fn with(x: &X, blk: fn(...)) then the program is correctly rejected.

import either::*;
enum X = Either<(uint,uint),fn()>;
impl &X {
    fn with(blk: fn(x: &Either<(uint,uint),fn()>)) {
        blk(&**self)
    }
}
fn main() {
    let mut x = X(Right(main));
    do (&mut x).with |opt| {  // this should be illegal
        match *opt {
            Right(f) => {
                x = X(Left((0,0)));
                f()
            },
            _ => fail
        }
    }
}
@bblum
Copy link
Contributor Author

bblum commented Sep 4, 2012

I believe @nikomatsakis commented earlier that this is a bug with auto-ref and auto-deref mixing.

@nikomatsakis
Copy link
Contributor

Will be fixed as part of #3443. @bblum are there other issues you know of that seem to be related to autoref?

@bblum
Copy link
Contributor Author

bblum commented Sep 12, 2012

I don't think I found any... but it might pay off to enumerate a bunch of different combinations like this one.

RalfJung pushed a commit to RalfJung/rust that referenced this issue Jan 8, 2024
only use jemalloc on Linux and macOS

hopefully fixes [this](rust-lang#119707 (comment))
jaisnan pushed a commit to jaisnan/rust-dev that referenced this issue Jul 29, 2024
- Enable Kani to use fallback fn body for intrinsics, so they can be
verified.
- Until <rust-lang/project-stable-mir#79> is
implemented, we have to check has_body and must_be_overridden
- Export all kani_macro definitions. Rename `unstable` to avoid conflict
with the Rust standard library one.
  - Dump stable mir body since transformations are made at that level.
    - I just did this as I was debugging things.

Co-authored-by: Michael Tautschnig <tautschn@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: lifetime related A-typesystem Area: The type system I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

2 participants