-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
#[track_caller]
on async fn's was previously a no-op but now produces a compiler error
#104588
Comments
cc: @bryangarza
@anp, that's a good point. it's probably possible to make |
That makes a lot of sense as a way to resolve this. Having the ungated usage produce a warning seems like a great way to avoid confusion about a feature flag silently changing compiled behavior. |
Sounds good, I can put up a PR that does this. I didn't realize that the annotation was already being used on async fn's in the wild |
This patch fixes a regression, in which `#[track_caller]`, which was previously a no-op, was changed to actually turn on the behavior. This should instead only happen behind the `closure_track_caller` feature gate. Also, add a warning for the user to understand how their code will compile depending on the feature gate being turned on or not. Fixes rust-lang#104588
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium |
This patch fixes a regression, in which `#[track_caller]`, which was previously a no-op, was changed to actually turn on the behavior. This should instead only happen behind the `closure_track_caller` feature gate. Also, add a warning for the user to understand how their code will compile depending on the feature gate being turned on or not. Fixes rust-lang#104588
The attribute doesn't actually do anything on `async fn`s, and this may become a warning in the future. See <rust-lang/rust#104588>.
…caller, r=compiler-errors Switch `#[track_caller]` back to a no-op unless feature gate is enabled This patch fixes a regression, in which `#[track_caller]`, which was previously a no-op, was changed to actually turn on the behavior. This should instead only happen behind the `closure_track_caller` feature gate. Also, add a warning for the user to understand how their code will compile depending on the feature gate being turned on or not. Fixes rust-lang#104588
…caller, r=compiler-errors Switch `#[track_caller]` back to a no-op unless feature gate is enabled This patch fixes a regression, in which `#[track_caller]`, which was previously a no-op, was changed to actually turn on the behavior. This should instead only happen behind the `closure_track_caller` feature gate. Also, add a warning for the user to understand how their code will compile depending on the feature gate being turned on or not. Fixes rust-lang#104588
This patch fixes a regression, in which `#[track_caller]`, which was previously a no-op, was changed to actually turn on the behavior. This should instead only happen behind the `closure_track_caller` feature gate. Also, add a warning for the user to understand how their code will compile depending on the feature gate being turned on or not. Fixes rust-lang#104588
This patch fixes a regression, in which `#[track_caller]`, which was previously a no-op, was changed to actually turn on the behavior. This should instead only happen behind the `closure_track_caller` feature gate. Also, add a warning for the user to understand how their code will compile depending on the feature gate being turned on or not. Fixes rust-lang#104588
Code
I tried this code:
I expected to see this happen: a successful build that prints
src/main.rs:3:20
(i.e. the attribute is a no-op)Instead, this happened:
Version it worked on
It most recently worked on: 1.65.0 stable
Version with regression
playground's current nightly:
1.67.0-nightly (2022-11-17 83356b78c4ff3e7d84e9)
I think this compilation failure was introduced by #104219 which adds actual support for track_caller on async fn's, since it was previously a no-op.
TBH, in hindsight I think we probably should have disallowed track_caller on async fn's in the initial implementation so that we could leave room for unstable support in the future. However given that this wasn't considered, it seems like this may now be a stability regression.
The text was updated successfully, but these errors were encountered: