os-rust/compiler
David Wood 7bab769b58 lint: add bad opt access internal lint
Some command-line options accessible through `sess.opts` are best
accessed through wrapper functions on `Session`, `TyCtxt` or otherwise,
rather than through field access on the option struct in the `Session`.

Adds a new lint which triggers on those options that should be accessed
through a wrapper function so that this is prohibited. Options are
annotated with a new attribute `rustc_lint_opt_deny_field_access` which
can specify the error message (i.e. "use this other function instead")
to be emitted.

A simpler alternative would be to simply rename the options in the
option type so that it is clear they should not be used, however this
doesn't prevent uses, just discourages them. Another alternative would
be to make the option fields private, and adding accessor functions on
the option types, however the wrapper functions sometimes rely on
additional state from `Session` or `TyCtxt` which wouldn't be available
in an function on the option type, so the accessor would simply make the
field available and its use would be discouraged too.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-27 11:24:27 +01:00
..
rustc Don't rerun the build script for the compiler each time on linux 2022-07-10 23:57:25 -05:00
rustc_apfloat Update smallvec to 1.8.1. 2022-06-27 08:48:55 +10:00
rustc_arena Rollup merge of #97711 - Nilstrieb:rustc-arena-ub, r=wesleywiser 2022-07-07 18:06:49 +05:30
rustc_ast Stabilize let_chains 2022-07-16 20:17:58 -03:00
rustc_ast_lowering Auto merge of #97313 - cjgillot:ast-lifetimes-anon, r=petrochenkov 2022-07-25 20:02:55 +00:00
rustc_ast_passes Allow ~const on super traits 2022-07-23 14:25:55 +00:00
rustc_ast_pretty Parse closure binders 2022-07-12 16:25:16 +04:00
rustc_attr avoid embedding StabilityLevel::Unstable reason string into metadata multiple times 2022-07-21 22:53:02 +03:00
rustc_borrowck Rollup merge of #99748 - compiler-errors:better-impl-trait-printing, r=fee1-dead 2022-07-26 14:27:00 +05:30
rustc_builtin_macros Rollup merge of #99508 - TaKO8Ki:avoid-symbol-to-string-conversion-in-BuiltinLintDiagnostics, r=compiler-errors 2022-07-20 18:58:20 +02:00
rustc_codegen_cranelift Auto merge of #99745 - JohnTitor:rollup-lvrie64, r=JohnTitor 2022-07-26 04:28:41 +00:00
rustc_codegen_gcc Auto merge of #98989 - dpaoliello:rawdylibbin, r=michaelwoerister 2022-07-26 01:47:34 +00:00
rustc_codegen_llvm Rollup merge of #99759 - bjorn3:remove_llvm_dead_code, r=nikic 2022-07-27 11:52:56 +09:00
rustc_codegen_ssa Auto merge of #98989 - dpaoliello:rawdylibbin, r=michaelwoerister 2022-07-26 01:47:34 +00:00
rustc_const_eval Rollup merge of #99692 - RalfJung:too-far, r=oli-obk 2022-07-26 14:26:58 +05:30
rustc_data_structures Auto merge of #99251 - cuviper:hashbrown-0.12, r=Mark-Simulacrum 2022-07-24 04:03:29 +00:00
rustc_driver lint: add bad opt access internal lint 2022-07-27 11:24:27 +01:00
rustc_error_codes region_outlives_predicate no snapshot 2022-07-21 13:09:01 +02:00
rustc_error_messages lint: add bad opt access internal lint 2022-07-27 11:24:27 +01:00
rustc_errors Auto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisa 2022-07-20 22:19:30 +00:00
rustc_expand Auto merge of #99320 - NiklasJonsson:84447/rustc_expand, r=compiler-errors 2022-07-23 07:59:54 +00:00
rustc_feature lint: add bad opt access internal lint 2022-07-27 11:24:27 +01:00
rustc_fs_util
rustc_graphviz Fully stabilize NLL 2022-06-03 17:16:41 -04:00
rustc_hir Auto merge of #97313 - cjgillot:ast-lifetimes-anon, r=petrochenkov 2022-07-25 20:02:55 +00:00
rustc_hir_pretty use rustc_hir_pretty::qpath_to_string to avoid span_to_snippet when rendering path 2022-07-17 04:58:38 +00:00
rustc_incremental Remove unused StableMap and StableSet types from rustc_data_structures 2022-07-20 13:11:39 +02:00
rustc_index Edit rustc_index::vec::IndexVec::pick3_mut docs 2022-07-21 08:52:18 -05:00
rustc_infer Rollup merge of #99729 - cjgillot:rm-unused-tuple, r=michaelwoerister 2022-07-26 16:57:50 +02:00
rustc_interface lint: add bad opt access internal lint 2022-07-27 11:24:27 +01:00
rustc_lexer fix typo in comment 2022-06-28 19:59:09 +05:30
rustc_lint lint: add bad opt access internal lint 2022-07-27 11:24:27 +01:00
rustc_lint_defs avoid a Symbol to String conversion 2022-07-20 18:19:25 +09:00
rustc_llvm Rollup merge of #99759 - bjorn3:remove_llvm_dead_code, r=nikic 2022-07-27 11:52:56 +09:00
rustc_log clippy::complexity fixes 2022-05-26 13:14:24 +02:00
rustc_macros clippy::perf fixes 2022-07-20 11:48:11 +02:00
rustc_metadata Rollup merge of #99698 - compiler-errors:no-doc-hidden, r=cjgillot 2022-07-27 11:52:53 +09:00
rustc_middle Auto merge of #99574 - durin42:allocator-patch-redux, r=nikic 2022-07-26 19:35:57 +00:00
rustc_mir_build avoid &str/Symbol to String conversions 2022-07-25 22:40:00 +09:00
rustc_mir_dataflow Auto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisa 2022-07-20 22:19:30 +00:00
rustc_mir_transform lint: add bad opt access internal lint 2022-07-27 11:24:27 +01:00
rustc_monomorphize Rollup merge of #98868 - tmiasko:unreachable-coverage, r=wesleywiser 2022-07-22 11:53:40 +05:30
rustc_parse Update doc comments that refer to config parameter 2022-07-24 16:40:24 +02:00
rustc_parse_format Add diagnostic width span when '0$' is used as width. 2022-07-20 13:39:56 +01:00
rustc_passes lint: add bad opt access internal lint 2022-07-27 11:24:27 +01:00
rustc_plugin_impl remove currently unused deps 2022-06-13 22:20:51 +03:00
rustc_privacy clippy::perf fixes 2022-07-20 11:48:11 +02:00
rustc_query_impl consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable) 2022-07-20 17:12:07 -04:00
rustc_query_system consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable) 2022-07-20 17:12:07 -04:00
rustc_resolve Rollup merge of #99729 - cjgillot:rm-unused-tuple, r=michaelwoerister 2022-07-26 16:57:50 +02:00
rustc_save_analysis Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot 2022-07-14 14:14:21 +05:30
rustc_serialize Upgrade indexmap and thorin-dwp to use hashbrown 0.12 2022-07-17 07:05:58 -07:00
rustc_session lint: add bad opt access internal lint 2022-07-27 11:24:27 +01:00
rustc_smir Rustfmt 2022-06-02 10:29:00 +00:00
rustc_span lint: add bad opt access internal lint 2022-07-27 11:24:27 +01:00
rustc_symbol_mangling Auto merge of #95548 - rcvalle:rust-cfi-2, r=nagisa 2022-07-24 01:22:36 +00:00
rustc_target Revert "Mark atomics as unsupported on thumbv6m" 2022-07-24 13:12:08 +01:00
rustc_trait_selection Rollup merge of #99666 - compiler-errors:issue-99663, r=lcnr 2022-07-26 14:26:57 +05:30
rustc_traits Remove unused StableMap and StableSet types from rustc_data_structures 2022-07-20 13:11:39 +02:00
rustc_ty_utils Do not resolve associated const when there is no provided value 2022-07-22 18:58:07 +00:00
rustc_type_ir Inline DebruijnIndex methods 2022-07-22 17:00:49 +02:00
rustc_typeck Auto merge of #99574 - durin42:allocator-patch-redux, r=nikic 2022-07-26 19:35:57 +00:00