]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Auto merge of #88865 - guswynn:must_not_suspend, r=oli-obk
authorbors <bors@rust-lang.org>
Wed, 22 Sep 2021 06:43:33 +0000 (06:43 +0000)
committerbors <bors@rust-lang.org>
Wed, 22 Sep 2021 06:43:33 +0000 (06:43 +0000)
commitce45663e14dac3f0f58be698cc530bc2e6e21682
treedf12c759560d579029acad20d2df9bbf94178ede
parent77f4143fa26a1434088f532d2ba7ec51e0a392fd
parent08e026675ee38bb4ca81106e766a6456c8b7382e
Auto merge of #88865 - guswynn:must_not_suspend, r=oli-obk

Implement `#[must_not_suspend]`

implements #83310

Some notes on the impl:

1. The code that searches for the attribute on the ADT is basically copied from the `must_use` lint. It's not shared, as the logic did diverge
2. The RFC does specify that the attribute can be placed on fn's (and fn-like objects), like `must_use`. I think this is a direct copy from the `must_use` reference definition. This implementation does NOT support this, as I felt that ADT's (+ `impl Trait` + `dyn Trait`) cover the usecase's people actually want on the RFC, and adding an imp for the fn call case would be significantly harder. The `must_use` impl can do a single check at fn call stmt time, but `must_not_suspend` would need to answer the question: "for some value X with type T, find any fn call that COULD have produced this value". That would require significant changes to `generator_interior.rs`, and I would need mentorship on that. `@eholk` and I are discussing it.
3. `@estebank` do you know a way I can make the user-provided `reason` note pop out? right now it seems quite hidden

Also, I am not sure if we should run perf on this

r? `@nikomatsakis`
compiler/rustc_feature/src/active.rs
compiler/rustc_feature/src/builtin_attrs.rs
compiler/rustc_lint_defs/src/builtin.rs
compiler/rustc_span/src/symbol.rs
compiler/rustc_typeck/src/check/generator_interior.rs