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

Prepare for stabilization of sanitizers #376

Merged
merged 11 commits into from
Aug 6, 2024

Conversation

Shnatsel
Copy link
Member

@Shnatsel Shnatsel commented Jul 12, 2024

The stabilization of sanitizers is expected to remove the -Zsanitizer flag we rely on: rust-lang/rust#123617

This PR adds the logic to handle the compiler options required on newer rustc versions, both stable and nightly.

TODO: wait until sanitizers are actually stabilized, and fill in the correct rustc version on which they were stabilized. Hence the draft status - the code is complete otherwise.

@fitzgen
Copy link
Member

fitzgen commented Jul 12, 2024

Let me know when this is ready for review.

@Shnatsel
Copy link
Member Author

It is ready for review now!

The only remaining item is to fill in the actual version when the sanitizers are stabilized, which is not decided by the Rust project yet.

@fitzgen
Copy link
Member

fitzgen commented Jul 12, 2024

Cool, thanks. I'll take a look on Monday.

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Thanks! Couple small comments below.

src/project.rs Outdated
Comment on lines 195 to 197
let rust_version_string = rust_version_string()?;
let rust_version =
RustVersion::from_str(&rust_version_string).map_err(|e| anyhow::anyhow!(e))?;
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: seems like these two steps could be collapsed into a single, fallible RustVersion constructor:

impl RustVersion {
    pub fn discover() -> anyhow::Result<Self> {
        let version_string = rust_version_string()?;
        let me = Self::from_str(&version_string)?;
        Ok(me)
    }
}

No need to make API-consumers do two things when they could do one; just an opportunity for them to mess things up in between or not connect the two interfaces properly.

Copy link
Member Author

@Shnatsel Shnatsel Jul 15, 2024

Choose a reason for hiding this comment

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

The reason these are two separate steps is that we need the version string too, to detect whether the compiler is nightly or not.

I considered adding the version string to the RustVersion struct, but that would make it no longer Copy, and neither API looked obviously better than the other.

If you want me to encapsulate everything, I guess I could turn RustVersion into this:

pub struct RustVersion {
    pub major: u32,
    pub minor: u32,
    // we don't care about the patch version and it's a bit of a pain to parse
    pub nightly: bool,
}

and with the nightly flag being resolved in RustVersion we don't need to expose the string outside the module at all.

src/rustc_version.rs Outdated Show resolved Hide resolved
@Shnatsel Shnatsel marked this pull request as ready for review July 16, 2024 00:24
@Shnatsel
Copy link
Member Author

@fitzgen Thanks for the review! All good points, thank you!

I think I've addressed everything, so I'd appreciate you taking another look.

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Looks good, sorry I forgot to come back to this!

@fitzgen fitzgen merged commit 7b27024 into rust-fuzz:main Aug 6, 2024
1 check passed
@Shnatsel Shnatsel deleted the sanitizers-on-stable branch August 6, 2024 18:30
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