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

Use our own release profile to insulate from custom release profiles #17

Merged
merged 2 commits into from
Apr 14, 2024

Conversation

RossSmyth
Copy link
Contributor

Ok this should actually fix the issue with rust-lang/miri#3313 in a nice way.

It also allows people to override the profile, since profiles are at the lowest precedence. So if someone wants to build a sysroot with -Cdebug-assertions=true they still can and it will override the profile.

@RossSmyth
Copy link
Contributor Author

I was not able to run the tests on my computer so lets see how CI feels

@RossSmyth
Copy link
Contributor Author

ok that is what I saw on my computer so it's not just a Windows moment.

@RalfJung
Copy link
Owner

We have Windows on CI so I'd hope that on master, tests work for you? If not, please open an issue.

@RossSmyth
Copy link
Contributor Author

Yeah they work I just was dumb and didn't check

Copy link
Owner

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

Thanks, the general direction looks good!

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
@RossSmyth
Copy link
Contributor Author

Was wondering if this could be moved forward at all as I think this is a good change (which is mainly to say I still hit this issue).

The options are

  1. Override all keys

I chose this as I think it is the safest option. This allows the sysroot to be built by default exactly how we describe it, with known safe configuration options.

  1. Only override the "known problematic" keys. Which is to say, at this point in time that I know of, the panic strategy.

But there may be other weird configurations I do now know of that could break things in the future because all other potentially custom keys would be inherited.

The biggest risk is that when Cargo stabilizes new profile keys, these will automatically be inherited from the release profile. Which means a potential custom release profile. For the almost all of the unstable keys I am aware of this isn't a big deal. But the rustflags key could effect this.

To me, the second option seems to have more risk because it has all the risk of option 1 (potential future weird profiles), as well as more risk of inheriting possible current weird profiles.

@RalfJung
Copy link
Owner

Option 1 has the extra risk that cargo may change the defaults and we fail to reflect that. I'm not happy about the prospect of having to maintain a copy of https://doc.rust-lang.org/cargo/reference/profiles.html#release. We also don't know why people override these things, and which problems could be caused by overwriting them back. That's why I prefer option 2.

@RossSmyth
Copy link
Contributor Author

RossSmyth commented Apr 13, 2024

As a person who overwrites them, I do it so that my default release profile system wide is what I want it to be. Primarily because cargo install uses release by default, and I don't use release anywhere else.

I'm not sure what you mean by "overwriting them back" as nothing is being overwritten. Just setting the default values for a custom sysroot build. Since it seems sysroots are sensitive to these settings, as that is why I even have had to do this, having safe defaults that need to be explicitly overridden by the user seems like the best bet. For example Cargo has been kicking around turning thin LTO on by default for release. I'm not sure how that could effect this project and/or miri sysroots, but it might.

wrt maintaining a copy, I don't really see that as a huge maintenance burden as profiles are changed so slowly.

Anyways I'll just change it to option 2 since getting this out the door is more important since currently I have to delete my cargo config file every time miri builds a new sysroot which is annoying.

src/lib.rs Outdated Show resolved Hide resolved
@RalfJung RalfJung enabled auto-merge April 14, 2024 09:57
@RalfJung
Copy link
Owner

Thanks!

@RalfJung RalfJung merged commit 2761aae into RalfJung:master Apr 14, 2024
7 checks passed
@RossSmyth RossSmyth deleted the custom-release branch April 14, 2024 15:37
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