Skip to content

Remove rlib crate-type so that it works with Miri #4

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

Closed
wants to merge 1 commit into from

Conversation

danielhenrymantilla
Copy link
Owner

Having

[lib]
crate-type = ["rlib"]

breaks compilation with miri (cc @RalfJung, maybe that should be mentioned in the README.md).

  • repro
    cd $(mktemp -d)
    
    cargo init --lib --name foo
    
    cargo new --lib bar && cargo add --path bar{,}  # cargo-edit
    
    cat >>bar/Cargo.toml<<\#\ END
    [lib]
    crate-type = ["rlib"]
    # END
    
    echo 'use ::bar;' >> src/lib.rs
    
    cargo miri test

Now, I cannot remember why I put that "rlib" thing to begin with, but after looking in more detail into what it does, I think it's doing do more harm than any potential good (or, at least, I should be using ["rlib", "lib"] to avoid removing "lib" when with some compiler (such as miri's?) it isn't an alias for "rlib". And until somebody observes some breakage from replacing "rlib" back with the default "lib", I will be favoring the default setting).

@danielhenrymantilla danielhenrymantilla self-assigned this Jan 26, 2021
@RalfJung
Copy link

maybe that should be mentioned in the README.md

At first sight this sounds like a bug, though depending on how cargo handles this the bug might be hard to fix. Could you open an issue in the Miri issue tracker, together with your reproducible example?

@danielhenrymantilla
Copy link
Owner Author

Since rust-lang/miri#1709 has been merged, which solves rust-lang/miri#1691, the issue tracking the limitation that motivated this very PR, the PR is no longer needed and can be dismissed.

@danielhenrymantilla danielhenrymantilla deleted the fix/crate-type-rlib-for-miri branch April 19, 2021 12:06
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