rust/compiler/rustc_passes/src
Dylan DPC d7a24003d8
Rollup merge of #95354 - dtolnay:rustc_const_stable, r=lcnr
Handle rustc_const_stable attribute in library feature collector

The library feature collector in [compiler/rustc_passes/src/lib_features.rs](551b4fa395/compiler/rustc_passes/src/lib_features.rs) has only been looking at `#[stable(…)]`, `#[unstable(…)]`, and `#[rustc_const_unstable(…)]` attributes, while ignoring `#[rustc_const_stable(…)]`. The consequences of this were:

- When any const feature got stabilized (changing one or more `rustc_const_unstable` to `rustc_const_stable`), users who had previously enabled that unstable feature using `#![feature(…)]` would get told "unknown feature", rather than rustc's nicer "the feature … has been stable since … and no longer requires an attribute to enable".

    This can be seen in the way that https://github.com/rust-lang/rust/pull/93957#issuecomment-1079794660 failed after rebase:

    ```console
    error[E0635]: unknown feature `const_ptr_offset`
      --> $DIR/offset_from_ub.rs:1:35
       |
    LL | #![feature(const_ptr_offset_from, const_ptr_offset)]
       |                                   ^^^^^^^^^^^^^^^^
    ```

- We weren't enforcing that a particular feature is either stable everywhere or unstable everywhere, and that a feature that has been stabilized has the same stabilization version everywhere, both of which we enforce for the other stability attributes.

This PR updates the library feature collector to handle `rustc_const_stable`, and fixes places in the standard library and test suite where `rustc_const_stable` was being used in a way that does not meet the rules for a stability attribute.
2022-04-02 03:34:21 +02:00
..
liveness Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
check_attr.rs Merge impl_constness and is_const_fn_raw. 2022-03-31 18:33:46 +02:00
check_const.rs Spellchecking compiler comments 2022-03-30 15:14:15 -04:00
dead.rs Improve AdtDef interning. 2022-03-11 13:31:24 +11:00
diagnostic_items.rs use format-args-capture and remove unnecessary nested if blocks in some parts of rustc_passes 2022-03-22 00:02:18 +09:00
entry.rs use format-args-capture and remove unnecessary nested if blocks in some parts of rustc_passes 2022-03-22 00:02:18 +09:00
hir_id_validator.rs Replace NestedVisitorMap with NestedFilter 2022-01-16 16:02:36 -06:00
hir_stats.rs Auto merge of #87648 - JulianKnodt:const_eq_constrain, r=oli-obk 2022-01-18 09:58:39 +00:00
intrinsicck.rs use format-args-capture and remove unnecessary nested if blocks in some parts of rustc_passes 2022-03-22 00:02:18 +09:00
lang_items.rs Clean up lang_items::extract 2022-01-09 13:41:04 -08:00
layout_test.rs Remove in_band_lifetimes for rustc_passes 2021-12-15 20:12:53 -07:00
lib_features.rs Handle rustc_const_stable attribute in library feature collector 2022-03-31 12:34:46 -07:00
lib.rs 5 - Make more use of let_chains 2022-02-28 15:52:36 -03:00
liveness.rs rustc_error: make ErrorReported impossible to construct 2022-03-16 10:35:24 -05:00
loops.rs Replace NestedVisitorMap with NestedFilter 2022-01-16 16:02:36 -06:00
naked_functions.rs Reject unsupported naked functions 2022-01-21 17:38:21 +01:00
reachable.rs 5 - Make more use of let_chains 2022-02-28 15:52:36 -03:00
region.rs Rollup merge of #95497 - nyurik:compiler-spell-comments, r=compiler-errors 2022-03-31 04:57:28 +02:00
stability.rs Addressed comments by @compiler-errors and @bjorn3 2022-03-30 17:04:46 -04:00
upvars.rs Replace NestedVisitorMap with NestedFilter 2022-01-16 16:02:36 -06:00
weak_lang_items.rs Replace NestedVisitorMap with NestedFilter 2022-01-16 16:02:36 -06:00