rust/src/librustdoc
Guillaume Gomez dda74fe8c9
Rollup merge of #99710 - davidtwco:internal-lint-opts, r=lcnr
lint: add bad opt access internal lint

Prompted by [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/sess.2Ecrate_types.28.29.20vs.20sess.2Eopts.2Ecrate_types/near/290682847).

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.

**Leave a comment if there's an option I should add this to.**
2022-07-27 17:55:05 +02:00
..
clean Rollup merge of #99783 - notriddle:notriddle/clean-trait-removal, r=GuillaumeGomez 2022-07-27 19:05:35 +09:00
doctest Rename TestOptions to GlobalTestOptions 2021-12-12 17:46:19 -08:00
formats Remove unused field in ItemKind::KeywordItem 2022-07-21 16:05:17 +02:00
html Rollup merge of #99700 - est31:rustdoc_layout_heading, r=GuillaumeGomez 2022-07-27 11:52:54 +09:00
json Auto merge of #99598 - GuillaumeGomez:clean-trait-fields-on-demand, r=notriddle 2022-07-22 16:52:10 +00:00
passes Rollup merge of #99559 - GuillaumeGomez:rm-unused-field-keyword, r=notriddle 2022-07-21 18:42:12 +02:00
theme Update minifier version to 0.2.1 2022-06-07 11:38:51 +02:00
askama.toml Move back templates into html folder 2022-01-19 11:13:24 +01:00
Cargo.toml Update pulldown-cmark version 2022-07-26 20:36:20 +02:00
config.rs Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
core.rs Make some clean::Trait fields computation on demand 2022-07-22 14:26:05 +02:00
docfs.rs Remove crate visibility modifier in libs, tests 2022-05-21 00:32:47 -04:00
doctest.rs Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
error.rs Remove crate visibility modifier in libs, tests 2022-05-21 00:32:47 -04:00
externalfiles.rs Remove crate visibility modifier in libs, tests 2022-05-21 00:32:47 -04:00
fold.rs Remove unused field in ItemKind::KeywordItem 2022-07-21 16:05:17 +02:00
lib.rs session: disable internal lints for rustdoc 2022-07-27 11:24:27 +01:00
lint.rs Move/rename lazy::Sync{OnceCell,Lazy} to sync::{Once,Lazy}Lock 2022-06-16 19:54:42 +04:00
markdown.rs Remove crate visibility modifier in libs, tests 2022-05-21 00:32:47 -04:00
README.md rust-lang.github.io/rustc-dev-guide -> rustc-dev-guide.rust-lang.org 2020-03-10 17:08:18 -03:00
scrape_examples.rs Reword comments and rename HIR visiting methods. 2022-07-07 16:01:43 +02:00
theme.rs Update minifier version to 0.2.1 2022-06-07 11:38:51 +02:00
visit.rs Remove unused field in ItemKind::KeywordItem 2022-07-21 16:05:17 +02:00
visit_ast.rs Fix rustdoc JSON inline 2022-07-16 13:39:38 +02:00
visit_lib.rs Remove crate visibility modifier in libs, tests 2022-05-21 00:32:47 -04:00

For more information about how librustdoc works, see the rustc dev guide.