Repository navigation
regression: ambiguous outer attributes #125199
Description
Activity
- addedT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
on May 17, 2024 - addedI-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}Issue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on May 17, 2024 - addedA-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)and removedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on May 18, 2024 WG-prioritization assigning priority (Zulip discussion).
My question here is how do we want to handle the changes in #124099. I don't see a mention of it being aware about breaking changes (PR was even rolled up).
@rustbot label -I-prioritize +P-critical
- addedP-criticalCritical priorityCritical priorityand removedI-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}Issue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
on May 21, 2024 I looked into each regression. Most are caused by a dependency on rustrict (versions 0.3.13..0.5.14) which contains the following code (source):
/// TODO: This is untested. #[cfg(feature = "reset_censor")] pub fn reset(&mut self, text: I) { // ... #[cfg(any(feature = "find_false_positives", feature = "trace"))] self.total_matches = 0; // ... }
I assume the author meant to apply the attribute to the whole assignment statement but here it only applies to the expression
self.total_matches. Applying the attribute to the statement would have required wrapping it in braces. Since thestmt_expr_attributesfeature is still unstable, the above code would normally trigger an error. However, because theresetfunction is conditional on the (untested)reset_censorfeature, the unstable feature error was never triggered during normal compilation. In a later commit theresetfunction was removed.Besides rustrict there are three more problematic crates: thoughts_server, leptos_router, and varies.
In all of them, the regression boils down to a pattern similar to rustrict.To summarize, in each case, an attribute is applied to the left-hand side of an assignment, which most likely does not match the authors' intention. This is exactly the kind of mistake that the error introduced in #124099 is meant to prevent.
I'm unclear whether this requires nightly to trigger?
This should probably be reverted and changed to a future compat warning.
Issue was briefly mentioned today in the t-compiler triage meeting (on Zulip).
Seems that given the timeframe leading to the next stable (2024-06-13, in 13 days), a revert would be more appropriate.
Yeah, since
#[something] let foo = bar;is already accepted syntax on stable, we can't change it to be an error even if most of the places in this crater are not using it correctly. I think @riking is correct and this first needs to be made into a future compatibility warning and then a hard error over an edition boundary to preserve backwards compatibility.- added a commit that references this issue
on Jun 7, 2024 Closing since fixes landed on beta/nightly: #126093
Probably #124099 cc @davidtwco