rust/compiler
Jonas Schievink 8825942e86
Rollup merge of #77802 - jyn514:bootstrap-specific, r=nikomatsakis
Allow making `RUSTC_BOOTSTRAP` conditional on the crate name

Motivation: This came up in the [Zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Require.20users.20to.20confirm.20they.20know.20RUSTC_.E2.80.A6.20compiler-team.23350/near/208403962) for https://github.com/rust-lang/compiler-team/issues/350.
See also https://github.com/rust-lang/cargo/pull/6608#issuecomment-458546258; this implements https://github.com/rust-lang/cargo/issues/6627.
The goal is for this to eventually allow prohibiting setting `RUSTC_BOOTSTRAP` in build.rs (https://github.com/rust-lang/cargo/issues/7088).

## User-facing changes

- `RUSTC_BOOTSTRAP=1` still works; there is no current plan to remove this.
- Things like `RUSTC_BOOTSTRAP=0` no longer activate nightly features. In practice this shouldn't be a big deal, since `RUSTC_BOOTSTRAP` is the opposite of stable and everyone uses `RUSTC_BOOTSTRAP=1` anyway.
- `RUSTC_BOOTSTRAP=x` will enable nightly features only for crate `x`.
- `RUSTC_BOOTSTRAP=x,y` will enable nightly features only for crates `x` and `y`.

## Implementation changes

The main change is that `UnstableOptions::from_environment` now requires
an (optional) crate name. If the crate name is unknown (`None`), then the new feature is not available and you still have to use `RUSTC_BOOTSTRAP=1`. In practice this means the feature is only available for `--crate-name`, not for `#![crate_name]`; I'm interested in supporting the second but I'm not sure how.

Other major changes:

- Added `Session::is_nightly_build()`, which uses the `crate_name` of
the session
- Added `nightly_options::match_is_nightly_build`, a convenience method
for looking up `--crate-name` from CLI arguments.
`Session::is_nightly_build()`should be preferred where possible, since
it will take into account `#![crate_name]` (I think).
- Added `unstable_features` to `rustdoc::RenderOptions`

I'm not sure whether this counts as T-compiler or T-lang; _technically_ RUSTC_BOOTSTRAP is an implementation detail, but it's been used so much it seems like this counts as a language change too.

r? `@joshtriplett`
cc `@Mark-Simulacrum` `@hsivonen`
2020-11-15 13:39:43 +01:00
..
rustc
rustc_apfloat Backport another LLVM commit to rustc_apfloat 2020-10-04 02:02:25 +02:00
rustc_arena Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_ast Reserve space in advance 2020-11-13 11:19:25 +01:00
rustc_ast_lowering Rollup merge of #77802 - jyn514:bootstrap-specific, r=nikomatsakis 2020-11-15 13:39:43 +01:00
rustc_ast_passes Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkov 2020-11-12 19:46:09 +01:00
rustc_ast_pretty Rollup merge of #78980 - thiolliere:gui-fix-qpath, r=estebank 2020-11-15 03:02:53 +01:00
rustc_attr Improve deprecation attribute diagnostic messages. 2020-11-02 13:21:18 +01:00
rustc_builtin_macros Reserve space in advance 2020-11-13 11:19:25 +01:00
rustc_codegen_cranelift Changed unwrap_or to unwrap_or_else in some places. 2020-11-10 20:07:47 -08:00
rustc_codegen_llvm Rollup merge of #77802 - jyn514:bootstrap-specific, r=nikomatsakis 2020-11-15 13:39:43 +01:00
rustc_codegen_ssa rustc_target: Mark UEFI targets as is_like_windows/is_like_msvc 2020-11-12 19:40:41 +03:00
rustc_data_structures Move post order walk to iterative approach 2020-10-31 18:52:00 +01:00
rustc_driver Rollup merge of #77802 - jyn514:bootstrap-specific, r=nikomatsakis 2020-11-15 13:39:43 +01:00
rustc_error_codes deny(invalid_codeblock_attributes) 2020-11-05 12:13:28 -05:00
rustc_errors Auto merge of #76931 - oli-obk:const_prop_inline_lint_madness, r=wesleywiser 2020-11-03 16:32:34 +00:00
rustc_expand Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkov 2020-11-12 19:46:09 +01:00
rustc_feature Rollup merge of #77802 - jyn514:bootstrap-specific, r=nikomatsakis 2020-11-15 13:39:43 +01:00
rustc_fs_util Remove unused code from remaining compiler crates 2020-10-14 04:14:32 +02:00
rustc_graphviz Rust coverage before splitting instrument_coverage.rs 2020-11-05 18:24:12 -08:00
rustc_hir Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkov 2020-11-12 19:46:09 +01:00
rustc_hir_pretty Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_incremental Allow making RUSTC_BOOTSTRAP conditional on the crate name 2020-11-07 13:45:11 -05:00
rustc_index
rustc_infer Rollup merge of #78463 - varkor:placeholder-const, r=nikomatsakis 2020-11-13 15:26:14 +01:00
rustc_interface Add flags customizing behaviour of MIR inlining 2020-11-10 00:00:00 +00:00
rustc_lexer Add back missing comments 2020-10-30 10:13:41 -04:00
rustc_lint Reserve space in advance 2020-11-13 11:19:25 +01:00
rustc_lint_defs Rollup merge of #78114 - jyn514:private, r=oli-obk 2020-11-09 01:13:31 +01:00
rustc_llvm fully exploited the dropped support of LLVM 8 2020-11-12 14:39:47 +01:00
rustc_macros Small cleanup in TypeFoldable derive macro 2020-11-07 18:20:42 +01:00
rustc_metadata Push to result vector instead of allocating 2020-11-13 11:19:25 +01:00
rustc_middle Rollup merge of #78963 - richkadel:llvm-coverage-counters-2.0.4, r=tmandry 2020-11-15 03:02:46 +01:00
rustc_mir Rollup merge of #77802 - jyn514:bootstrap-specific, r=nikomatsakis 2020-11-15 13:39:43 +01:00
rustc_mir_build Rollup merge of #77802 - jyn514:bootstrap-specific, r=nikomatsakis 2020-11-15 13:39:43 +01:00
rustc_parse Auto merge of #78736 - petrochenkov:lazyenum, r=Aaron1011 2020-11-14 04:21:56 +00:00
rustc_parse_format /nightly/nightly-rustc 2020-09-23 21:51:56 +02:00
rustc_passes Rollup merge of #77802 - jyn514:bootstrap-specific, r=nikomatsakis 2020-11-15 13:39:43 +01:00
rustc_plugin_impl /nightly/nightly-rustc 2020-09-23 21:51:56 +02:00
rustc_privacy Fix even more URLs 2020-11-05 20:11:29 +01:00
rustc_query_system Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_resolve Rollup merge of #77802 - jyn514:bootstrap-specific, r=nikomatsakis 2020-11-15 13:39:43 +01:00
rustc_save_analysis Rollup merge of #78352 - JohnTitor:issue-75229, r=Dylan-DPC 2020-11-15 03:02:34 +01:00
rustc_serialize Replace absolute paths with relative ones 2020-10-13 14:16:45 +02:00
rustc_session Rollup merge of #77802 - jyn514:bootstrap-specific, r=nikomatsakis 2020-11-15 13:39:43 +01:00
rustc_span Auto merge of #76256 - tgnottingham:issue-74890, r=nikomatsakis 2020-11-12 15:34:09 +00:00
rustc_symbol_mangling u128 truncation and sign extension are not just interpreter related 2020-11-04 13:41:58 +00:00
rustc_target Rollup merge of #78993 - petrochenkov:specdash, r=oli-obk 2020-11-15 03:02:59 +01:00
rustc_trait_selection Rollup merge of #77802 - jyn514:bootstrap-specific, r=nikomatsakis 2020-11-15 13:39:43 +01:00
rustc_traits Rollup merge of #78502 - matthewjasper:chalkup, r=nikomatsakis 2020-11-09 19:06:46 +01:00
rustc_ty Calculate visibilities once in resolve 2020-10-19 11:57:50 +03:00
rustc_typeck Rollup merge of #77802 - jyn514:bootstrap-specific, r=nikomatsakis 2020-11-15 13:39:43 +01:00