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

Feature-gating on closures is broken #97073

Open
JohnTitor opened this issue May 16, 2022 · 0 comments
Open

Feature-gating on closures is broken #97073

JohnTitor opened this issue May 16, 2022 · 0 comments
Labels
A-closures Area: closures (`|args| { .. }`) C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@JohnTitor
Copy link
Member

If we try to apply #[track_caller] on closures, like:

    pub fn expect_non_local<OtherId>(self) -> Res<OtherId> {
        self.map_id(
            #[track_caller]
            |_| panic!("unexpected `Res::Local`"),
        )
    }

This needs an #![feature(closure_track_caller)], which is normal, but it also needs the feature attributes on the crates that have a caller of that method.

See #96894 (comment) and #96894 (comment) for more details.

TL;DR: In the above PR's situation, that method belongs to rustc_hir but we also have to add the feature attributes to rustc_resolve and librustdoc.

I expected to see this happen: compiles fine with one feature attribute

Instead, this happened: compilation error

@JohnTitor JohnTitor added C-bug Category: This is a bug. A-closures Area: closures (`|args| { .. }`) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: closures (`|args| { .. }`) C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant