Repository navigation
declare_tool_lint: allow use without default_field_values feature - #164990
Conversation
|
r? @tiif rustbot has assigned @tiif. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| if !(self.tcx.features().default_field_values() | ||
| || span.allows_unstable(sym::default_field_values)) | ||
| { |
There was a problem hiding this comment.
The idea that I get from this diff is whenever we use #[allow_internal_unstable(default_field_values)]], we always execute the if path below that suggests adding #![feature(default_field_values)]? I feel I am missing something 🤔
There was a problem hiding this comment.
We are allowed to write trailing .. in a struct expression if either the feature has been enabled or if the span allows it. If not, we emit an error.
There was a problem hiding this comment.
In that case, it should be
if !(self.tcx.features().default_field_values()
&& !span.allows_unstable(sym::default_field_values))The reasoning behind this is,
TRUE means allow writing trailing ``..``
FALSE means don't allow writing trailing ``..``
(feature enabled) OR (span allows) = TRUE
negate both side then we get...
!((feature enabled) OR (span allows)) = NOT TRUE
according to De Morgan's law
!(feature enabled) AND !(span allows) = FALSE
There was a problem hiding this comment.
That doesn't look correct to me, did you mean
if !self.tcx.features().default_field_values()
&& !span.allows_unstable(sym::default_field_values)There was a problem hiding this comment.
Oh wait, I see it wrongly, your original one is correct!
There was a problem hiding this comment.
Actually, most code in the compiler uses the form I just mentioned, I'll switch it over to use it instead.
@bors r-
a7682d7 to
540d5f4
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot ready |
|
Unknown command "r+rollup". Run |
|
@bors r+ rollup |
|
This pull request was unapproved. |
540d5f4 to
7159e13
Compare
7159e13 to
f007482
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors r=tiif |
Rollup merge of #164990 - mejrs:tool_lint_allow_internal_unstable, r=tiif declare_tool_lint: allow use without `default_field_values` feature Followup to #164329 It's somewhat inconvenient, for 3rd party lint tool authors, to have to enable a feature that's really an implementation detail of the macro.
Rollup of 3 pull requests Successful merges: - rust-lang/rust#164990 (declare_tool_lint: allow use without `default_field_values` feature) - rust-lang/rust#165420 (Do not suggest deriving Clone on foreign types in noop_method_call) - rust-lang/rust#165640 (Avoid Terminator:None in coroutine transform)
Followup to #164329
It's somewhat inconvenient, for 3rd party lint tool authors, to have to enable a feature that's really an implementation detail of the macro.