Skip to content

Default to --cap-lints=warn #12

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

Merged
merged 1 commit into from
Jan 7, 2024
Merged

Conversation

saethlin
Copy link
Contributor

@saethlin saethlin commented Jan 6, 2024

It took me a long time to figure out why we need to or should do this. Thanks @Nemo157 and @Nilstrieb for telling me to keep looking.

What confused me is that the backtrace crate is actually turned into a module inside std, and the sysroot depends on std via path dependency, so we have no lint capping by default when we build backtrace.

I think lint capping is a prudent thing to do here to make things smoother in the future, even though I'm also going to try to fix the sources of warnings that come out of cargo miri setup.

@RalfJung
Copy link
Owner

RalfJung commented Jan 7, 2024

Sounds good! Unfortunately as_encoded_bytes doesn't build on older nightlies...

Also this seems worth documenting somewhere, it might cause some unexpected interactions.

src/lib.rs Outdated
// roots. If we do not cap lints, we can get lint failures outside core or std.
// We cannot set --cap-lints=allow because Cargo needs to parse warnings to understand the
// output of --print=file-names for crate-types that the target does not support.
if !self.rustflags.iter().any(|flag| flag.as_encoded_bytes().starts_with(b"--cap-lints")) {
Copy link
Owner

Choose a reason for hiding this comment

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

You could use to_string_lossy with a FIXME suggesting to move to as_encoded_bytes once we drop support for older nightlies.

@saethlin
Copy link
Contributor Author

saethlin commented Jan 7, 2024

Sounds good! Unfortunately as_encoded_bytes doesn't build on older nightlies...

Why are we supporting older nightlies? as_encoded_bytes was stabilized in 1.74, which is now the previous stable release. I'll admit I didn't check the CI setup for this repo, but I assumed that a stabilized API was old enough for a nightly-only tool.

@RalfJung RalfJung merged commit f3cd89c into RalfJung:master Jan 7, 2024
@saethlin saethlin deleted the cap-lints branch January 7, 2024 16:21
@RalfJung
Copy link
Owner

RalfJung commented Jan 7, 2024

Fair question. In xargo times I always made sure we supported older nightlies as well since not everyone always tracks the very latest nightly, and I carried that over to this library. Maybe supporting one year old nightlies is a bit too much, though I would like to support a few months worth of nightlies.

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