rust/compiler
bors b202532608 Auto merge of #75534 - Aaron1011:feature/new-future-breakage, r=pnkfelix
Implement rustc side of report-future-incompat

cc https://github.com/rust-lang/rust/issues/71249

This is an alternative to `@pnkfelix's` initial implementation in https://github.com/pnkfelix/rust/commits/prototype-rustc-side-of-report-future-incompat (mainly because I started working before seeing that branch 😄 ).

My approach outputs the entire original `Diagnostic`, in a way that is compatible with incremental compilation. This is not yet integrated with compiletest, but can be used manually by passing `-Z emit-future-incompat-report` to `rustc`.

Several changes are made to support this feature:
* The `librustc_session/lint` module is moved to a new crate `librustc_lint_defs` (name bikesheddable). This allows accessing lint definitions from `librustc_errors`.
* The `Lint` struct is extended with an `Option<FutureBreakage>`. When present, it indicates that we should display a lint in the future-compat report. `FutureBreakage` contains additional information that we may want to display in the report (currently, a `date` field indicating when the crate will stop compiling).
* A new variant `rustc_error::Level::Allow` is added. This is used when constructing a diagnostic for a future-breakage lint that is marked as allowed (via `#[allow]` or `--cap-lints`). This allows us to capture any future-breakage diagnostics in one place, while still discarding them before they are passed to the `Emitter`.
* `DiagnosticId::Lint` is extended with a `has_future_breakage` field, indicating whether or not the `Lint` has future breakage information (and should therefore show up in the report).
* `Session` is given access to the `LintStore` via a new `SessionLintStore` trait (since `librustc_session` cannot directly reference `LintStore` without a cyclic dependency). We use this to turn a string `DiagnosticId::Lint` back into a `Lint`, to retrieve the `FutureBreakage` data.

Currently, `FutureBreakage.date` is always set to `None`. However, this could potentially be interpreted by Cargo in the future.

I've enabled the future-breakage report for the `ARRAY_INTO_ITER` lint, which can be used to test out this PR. The intent is to use the field to allow Cargo to determine the date of future breakage (as described in [RFC 2834](https://github.com/rust-lang/rfcs/blob/master/text/2834-cargo-report-future-incompat.md)) without needing to parse the diagnostic itself.

cc `@pnkfelix`
2020-11-01 16:52:28 +00:00
..
rustc
rustc_apfloat
rustc_arena Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_ast parser: Cleanup LazyTokenStream and avoid some clones 2020-10-31 01:56:34 +03:00
rustc_ast_lowering Implement rustc side of report-future-incompat 2020-10-30 20:02:14 -04:00
rustc_ast_passes Fix typos 2020-10-29 16:51:46 +01:00
rustc_ast_pretty Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_attr Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_builtin_macros
rustc_codegen_cranelift
rustc_codegen_llvm Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_codegen_ssa Rollup merge of #78396 - josephlr:ermsb, r=petrochenkov 2020-10-27 08:45:24 +09:00
rustc_data_structures Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_driver Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_error_codes Rollup merge of #78332 - PoignardAzur:doc_E0308, r=camelid 2020-10-27 08:44:54 +09:00
rustc_errors Some work 2020-10-30 20:02:14 -04:00
rustc_expand Rollup merge of #78603 - petrochenkov:fourdigits, r=matthewjasper 2020-11-01 11:53:37 +01:00
rustc_feature Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_fs_util
rustc_graphviz
rustc_hir Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_hir_pretty Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_incremental
rustc_index
rustc_infer Remove implicit Continue type 2020-10-30 12:27:47 +01:00
rustc_interface Auto merge of #75534 - Aaron1011:feature/new-future-breakage, r=pnkfelix 2020-11-01 16:52:28 +00:00
rustc_lexer Add back missing comments 2020-10-30 10:13:41 -04:00
rustc_lint Auto merge of #75534 - Aaron1011:feature/new-future-breakage, r=pnkfelix 2020-11-01 16:52:28 +00:00
rustc_lint_defs Implement rustc side of report-future-incompat 2020-10-30 20:02:14 -04:00
rustc_llvm Auto merge of #78531 - cuviper:unwrap-metadata, r=tmandry 2020-11-01 09:30:11 +00:00
rustc_macros Remove implicit Continue type 2020-10-30 12:27:47 +01:00
rustc_metadata Fix some more clippy warnings 2020-10-30 10:12:56 -04:00
rustc_middle Auto merge of #75534 - Aaron1011:feature/new-future-breakage, r=pnkfelix 2020-11-01 16:52:28 +00:00
rustc_mir Assert that locals have storage when used 2020-10-31 21:06:29 +01:00
rustc_mir_build Auto merge of #78553 - Nadrieril:fix-78549, r=varkor 2020-11-01 14:37:50 +00:00
rustc_parse parser: Cleanup LazyTokenStream and avoid some clones 2020-10-31 01:56:34 +03:00
rustc_parse_format
rustc_passes
rustc_plugin_impl
rustc_privacy Auto merge of #78182 - LeSeulArtichaut:ty-visitor-contolflow, r=lcnr,oli-obk 2020-10-30 22:53:55 +00:00
rustc_query_system Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_resolve Auto merge of #78420 - estebank:suggest-assoc-fn, r=petrochenkov 2020-11-01 06:49:16 +00:00
rustc_save_analysis Rollup merge of #78349 - JohnTitor:issue-75962, r=davidtwco 2020-10-27 08:45:07 +09:00
rustc_serialize
rustc_session Some work 2020-10-30 20:02:14 -04:00
rustc_span Rollup merge of #78524 - tmiasko:source-files-borrow, r=Aaron1011 2020-10-30 18:00:54 +09:00
rustc_symbol_mangling Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_target Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_trait_selection Remove implicit Continue type 2020-10-30 12:27:47 +01:00
rustc_traits Auto merge of #78182 - LeSeulArtichaut:ty-visitor-contolflow, r=lcnr,oli-obk 2020-10-30 22:53:55 +00:00
rustc_ty
rustc_typeck Auto merge of #78182 - LeSeulArtichaut:ty-visitor-contolflow, r=lcnr,oli-obk 2020-10-30 22:53:55 +00:00