rust/compiler
Dylan DPC cb787bea46
Rollup merge of #97495 - clarfonthey:e0788-no-coverage, r=nagisa
Add E0788 for improper #[no_coverage] usage

Essentially, this adds proper checking for the attribute (tracking issue #84605) and throws errors when it's put in obviously-wrong places, like on struct or const definitions. Most of the code is taken directly from the checks for the `#[inline]` attribute, since it's very similar.

Right now, the code only checks at the function level, but it seems reasonable to allow adding `#[no_coverage]` to individual blocks or expressions, so, for now those just throw `unused_attributes` warnings. Similarly, since there was a lot of desire to eventually allow recursive definitions as well on modules and impl blocks, these also throw `unused_attributes` instead of an error.

I'm not sure if anything has to be done since this error is technically for an unstable feature, but since an error for using unstable features will show up anyway, I think it's okay.

This is the first big piece needed for stabilising this attribute, although I personally would like to explore renaming it to `#[coverage(never)]` on a separate PR, which I will offer soon. There's a lot of discussion still to be had about that, which is why it will be kept separate.

I don't think much is needed besides adding this simple check and a UI test, but let me know if there's something else that should be added to make this happen.
2022-06-06 14:34:56 +02:00
..
rustc Auto merge of #96737 - ChrisDenton:win-manifest, r=wesleywiser 2022-06-02 07:58:29 +00:00
rustc_apfloat Addressed comments by @compiler-errors and @bjorn3 2022-03-30 17:04:46 -04:00
rustc_arena mark FIXMES for all the places found that are probably offset_from 2022-03-29 20:18:28 -04:00
rustc_ast Remove emit_unit 2022-06-03 17:02:14 +00:00
rustc_ast_lowering Compute lifetimes in scope at diagnostic time. 2022-06-04 15:28:15 +02:00
rustc_ast_passes Support the #[expect] attribute on fn parameters (RFC-2383) 2022-06-04 00:50:45 +02:00
rustc_ast_pretty Revert #96682. 2022-06-02 11:22:16 +10:00
rustc_attr RFC3239: Implement compact cfg(target(..)) 2022-05-24 13:51:36 +02:00
rustc_borrowck Rollup merge of #97415 - cjgillot:is-late-bound-solo, r=estebank 2022-06-03 17:10:51 +02:00
rustc_builtin_macros Basic compiler infra 2022-06-02 09:00:04 -03:00
rustc_codegen_cranelift add cast kind of from_exposed_addr (int-to-ptr casts) 2022-06-02 10:46:13 -04:00
rustc_codegen_gcc Finish bumping stage0 2022-05-27 07:36:17 -04:00
rustc_codegen_llvm Auto merge of #97214 - Mark-Simulacrum:stage0-bump, r=pietroalbini 2022-05-29 16:28:21 +00:00
rustc_codegen_ssa Fix emscripten linker invocation 2022-06-03 17:02:14 +00:00
rustc_const_eval Rollup merge of #97663 - RalfJung:keine-halben-sachen, r=oli-obk 2022-06-03 11:18:25 +02:00
rustc_data_structures Fix stacked borrows invalidation in rustc_data_structures sip128 2022-06-04 17:46:36 +02:00
rustc_driver typo: -Zcodegen-backend=llvm -Cpasses=list should work now 2022-06-05 07:02:32 +03:00
rustc_error_codes Rollup merge of #97495 - clarfonthey:e0788-no-coverage, r=nagisa 2022-06-06 14:34:56 +02:00
rustc_error_messages migrate check_for_for_in_in_typo diagnostic 2022-05-31 16:28:05 -05:00
rustc_errors Auto merge of #97697 - WaffleLapkin:no_ref_vec, r=WaffleLapkin 2022-06-05 09:30:53 +00:00
rustc_expand Basic compiler infra 2022-06-02 09:00:04 -03:00
rustc_feature Auto merge of #97654 - Dylan-DPC:rollup-w6zrzxf, r=Dylan-DPC 2022-06-02 16:04:42 +00:00
rustc_fs_util
rustc_graphviz update graphviz links 2022-05-12 18:31:42 +09:00
rustc_hir Rollup merge of #97312 - cjgillot:no-path-in-scope, r=compiler-errors 2022-06-06 14:34:55 +02:00
rustc_hir_pretty Compute lifetimes in scope at diagnostic time. 2022-06-04 15:28:15 +02:00
rustc_incremental rename visit item-like methods 2022-05-13 11:46:06 -04:00
rustc_index Auto merge of #95418 - cjgillot:more-disk, r=davidtwco 2022-05-20 20:49:55 +00:00
rustc_infer Replace &Vec<_>s with &[_]s 2022-06-03 20:42:42 +04:00
rustc_interface Remove support for -Zast-json and -Zast-json-noexpand 2022-06-03 16:46:20 +00:00
rustc_lexer Reduce max hash in raw strings from u16 to u8 2022-03-23 22:13:55 +01:00
rustc_lint Fix TyKind lint, make consts no longer fn, etc 2022-05-28 11:38:22 -07:00
rustc_lint_defs Use serde_json for json error messages 2022-06-03 16:46:19 +00:00
rustc_llvm Add LLVM based mingw-w64 targets 2022-05-13 20:14:15 +02:00
rustc_log clippy::complexity fixes 2022-05-26 13:14:24 +02:00
rustc_macros Inline many methods of Encoder 2022-06-03 17:01:53 +00:00
rustc_metadata Remove emit_unit 2022-06-03 17:02:14 +00:00
rustc_middle Rollup merge of #97312 - cjgillot:no-path-in-scope, r=compiler-errors 2022-06-06 14:34:55 +02:00
rustc_mir_build Replace &Vec<_>s with &[_]s 2022-06-03 20:42:42 +04:00
rustc_mir_dataflow Add a pointer to address cast kind 2022-05-31 00:00:00 +00:00
rustc_mir_transform Auto merge of #97697 - WaffleLapkin:no_ref_vec, r=WaffleLapkin 2022-06-05 09:30:53 +00:00
rustc_monomorphize Auto merge of #97168 - SparrowLii:accesses, r=cjgillot 2022-05-26 11:15:15 +00:00
rustc_parse Add spaces before and after expr in add {} suggestion 2022-06-06 01:40:52 +04:00
rustc_parse_format Make rustc_parse_format compile on stable 2022-05-03 11:26:58 +02:00
rustc_passes Rollup merge of #97495 - clarfonthey:e0788-no-coverage, r=nagisa 2022-06-06 14:34:56 +02:00
rustc_plugin_impl replace dynamic library module with libloading 2021-12-06 12:03:47 -05:00
rustc_privacy Rollup merge of #97096 - tmiasko:reachable-constructor, r=petrochenkov 2022-05-18 07:40:58 +09:00
rustc_query_impl Remove emit_unit 2022-06-03 17:02:14 +00:00
rustc_query_system Address review comments. 2022-06-02 12:22:04 +10:00
rustc_resolve Rollup merge of #97312 - cjgillot:no-path-in-scope, r=compiler-errors 2022-06-06 14:34:55 +02:00
rustc_save_analysis [save-analysis] Reference the variant not enum at struct-literal construction. 2022-05-12 16:34:02 -07:00
rustc_serialize Remove emit_unit 2022-06-03 17:02:14 +00:00
rustc_session Remove support for -Zast-json and -Zast-json-noexpand 2022-06-03 16:46:20 +00:00
rustc_span Inline many methods of Encoder 2022-06-03 17:01:53 +00:00
rustc_symbol_mangling Auto merge of #96883 - jackh726:early-binder-2, r=oli-obk 2022-05-14 23:53:11 +00:00
rustc_target Auto merge of #97577 - betrusted-io:add-xous-target, r=nagisa 2022-06-05 07:03:50 +00:00
rustc_trait_selection Rollup merge of #97721 - compiler-errors:issue-97704, r=jackh726 2022-06-06 08:37:01 +02:00
rustc_traits Remove crate visibility usage in compiler 2022-05-20 20:04:54 -04:00
rustc_ty_utils Auto merge of #96964 - oli-obk:const_trait_mvp, r=compiler-errors 2022-05-30 09:19:03 +00:00
rustc_type_ir Inline many methods of Encoder 2022-06-03 17:01:53 +00:00
rustc_typeck Rollup merge of #97312 - cjgillot:no-path-in-scope, r=compiler-errors 2022-06-06 14:34:55 +02:00