rust/src/test
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
..
assembly adapt assembly/static-relocation-model test for LLVM change 2022-07-20 12:56:42 +00:00
auxiliary
codegen codegen: use new {re,de,}allocator annotations in llvm 2022-07-26 09:43:28 -04:00
codegen-units Fix/bless tests broken by DSE 2022-05-24 22:50:21 -04:00
debuginfo Use revision support to remove near identical debuginfo test. 2022-07-20 00:23:38 -07:00
incremental Rollup merge of #98901 - davidtwco:split-dwarf-incr-workproduct, r=michaelwoerister 2022-07-07 18:06:52 +05:30
mir-opt ignore wasm=32 & bless 2022-07-12 16:02:17 +03:00
pretty Add pp-exact test involving where T: 2022-06-16 17:03:47 -07:00
run-make Auto merge of #98989 - dpaoliello:rawdylibbin, r=michaelwoerister 2022-07-26 01:47:34 +00:00
run-make-fulldeps Auto merge of #99745 - JohnTitor:rollup-lvrie64, r=JohnTitor 2022-07-26 04:28:41 +00:00
run-pass-valgrind Change enum->int casts to not go through MIR casts. 2022-06-30 07:47:07 +00:00
rustdoc Rollup merge of #99700 - est31:rustdoc_layout_heading, r=GuillaumeGomez 2022-07-27 11:52:54 +09:00
rustdoc-gui Add GUI test to prevent sidebar background regression 2022-07-25 14:35:06 +02:00
rustdoc-js rustdoc: also index raw pointers 2022-05-31 11:21:55 -07:00
rustdoc-js-std Rollup merge of #96887 - notriddle:notriddle/as-raw-fd, r=jsha 2022-05-11 13:16:31 +09:00
rustdoc-json Add tests for JSON non-inlining 2022-07-16 13:39:38 +02:00
rustdoc-ui feat: impl export-executable-symbols 2022-07-25 05:20:23 +00:00
ui Rollup merge of #99712 - davidtwco:translation-migrate-passes-2, r=compiler-errors 2022-07-27 11:52:55 +09:00
ui-fulldeps lint: add bad opt access internal lint 2022-07-27 11:24:27 +01:00
COMPILER_TESTS.md