Commit graph

80 commits

Author SHA1 Message Date
cole
f3d93b6c62 Allow unstable items to be re-exported unstably without requiring the feature be enabled 2022-06-04 17:05:33 -05:00
Jacob Pratt
f0620c9503 Proper const stability check, default to unstable
Rather than deferring to const eval for checking if a trait is const, we
now check up-front. This allows the error to be emitted earlier, notably
at the same time as other stability checks.

Also included in this commit is a change of the default const stability
level to UNstable. Previously, an item that was `const` but did not
explicitly state it was unstable was implicitly stable.
2022-05-19 12:21:45 +00:00
Jacob Pratt
0b3db4e4ee
Use native duplicate attribute check 2022-04-14 21:19:48 -04:00
Jacob Pratt
38478ea0cd
Permit #[deprecated] in stdlib 2022-03-09 16:32:47 -05:00
Jacob Pratt
6efc8e34d8
Change rustc_deprecated to use note
This keeps `reason` around for the time being. This is necessary to
avoid breakage during the bootstrap process. This change, as a whole,
brings `#[rustc_deprecated]` more in line with `#[deprecated]`.
2022-03-04 18:15:49 -05:00
Camille GILLOT
27d8cd7db0 Cleanup feature gates. 2022-03-03 18:50:28 +01:00
Camille GILLOT
3c7947ee43 Gate stability attrs with other attributes. 2022-03-03 18:50:26 +01:00
Camille GILLOT
969f8735dc Bless test. 2022-03-03 18:22:31 +01:00
lcnr
ae45e8a638 don't special case DefKind::Ctor in encoding 2022-02-24 14:46:11 +01:00
Jacob Pratt
1911eb8b61
Add missing const stability attributes 2022-02-03 19:15:57 -05:00
Jacob Pratt
41f84c258a
Require const stability on all stable const items
This was supposed to be the case previously, but a missed method call
meant that trait impls were not checked.
2022-02-03 19:15:56 -05:00
Camille GILLOT
441c1a6c50 Bless tests. 2022-01-12 23:41:28 +01:00
Matthias Krüger
68a44c8228
Rollup merge of #90856 - ken-matsui:suggestion-to-wrap-vec-allocator-api-in-tuple, r=davidtwco
Suggestion to wrap inner types using 'allocator_api' in tuple

This PR provides a suggestion to wrap the inner types in tuple when being along with 'allocator_api'.

Closes https://github.com/rust-lang/rust/issues/83250

```rust
fn main() {
    let _vec: Vec<u8, _> = vec![]; //~ ERROR use of unstable library feature 'allocator_api'
}
```

```diff
 error[E0658]: use of unstable library feature 'allocator_api'
   --> $DIR/suggest-vec-allocator-api.rs:2:23
    |
 LL |     let _vec: Vec<u8, _> = vec![];
-   |                       ^
+   |                   ----^
+   |                   |
+   |                   help: consider wrapping the inner types in tuple: `(u8, _)`
    |
    = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information
    = help: add `#![feature(allocator_api)]` to the crate attributes to enable
```
2021-11-23 19:28:06 +01:00
Ken Matsui
57494f7c75
Suggestion to wrap inner types using allocator_api in tuple 2021-11-24 00:24:13 +09:00
Caio
41d9abd76c Move some tests to more reasonable directories 2021-11-18 12:09:34 -03:00
Joshua Nelson
0ac13bd430 Don't abort compilation after giving a lint error
The only reason to use `abort_if_errors` is when the program is so broken that either:
1. later passes get confused and ICE
2. any diagnostics from later passes would be noise

This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints.
So it can continue to lint and compile even if there are lint errors.
2021-11-08 01:22:28 +00:00
Chris Midgley
b21024f7b9 Add long explanation for E0544. 2021-07-26 22:59:16 +01:00
hi-rustin
8c5938d049 Use last segment 2021-06-15 19:35:03 +08:00
hi-rustin
636d872452 shrinking the deprecated method span 2021-06-15 16:21:58 +08:00
Rich Kadel
2a6dd25265
Revert "shrinking the deprecated method span" 2021-06-04 12:26:36 -07:00
hi-rustin
3efe0174a2 shrinking the deprecated method span 2021-05-24 11:41:39 +08:00
Ralf Jung
bafc51e01a remove const_fn feature gate 2021-05-09 14:29:31 +02:00
Simon Jakobi
3ea62cb5d1 Remove redundant ignore-tidy-linelength annotations
This is step 2 towards fixing #77548.

In the codegen and codegen-units test suites, the `//` comment markers
were kept in order not to affect any source locations. This is because
these tests cannot be automatically `--bless`ed.
2021-04-03 22:30:20 +02:00
Vadim Petrochenkov
7e66e9d6b0 More precise spans for HIR paths 2021-03-15 22:13:45 +03:00
bors
a0d66b54fb Auto merge of #71481 - estebank:inherit-stability, r=nikomatsakis
Inherit `#[stable(..)]` annotations in enum variants and fields from its item

Lint changes for #65515. The stdlib will have to be updated once this lands in beta and that version is promoted in master.
2021-03-05 05:28:07 +00:00
Jesus Rubio
5ae392f3c6 Add long explanation for E0549 2021-02-18 06:53:01 +01:00
Jesus Rubio
c80b737394 Add long explanation for E0543 2021-02-17 18:08:30 +01:00
Jesus Rubio
8192793d50 Add long explanation for E0545 2021-02-15 19:16:39 +01:00
Esteban Küber
19806e4514 Tweak stability attribute diagnostic output 2021-02-10 21:35:27 -08:00
Esteban Küber
4cb089bb54 Inherit #[stable(..)] annotations in enum variants and fields from its item 2021-02-10 19:10:14 -08:00
Jesus Rubio
4d33d41ef3 Add long explanation for E0547 2021-02-08 18:25:05 +01:00
Jesus Rubio
be159379f6 Add long error explanation for E0542 2021-02-06 16:42:34 +01:00
Joshua Nelson
c819a4c025 Don't mark ineffective_unstable_trait_impl as an internal lint
It's not an internal lint:
- It's not in the rustc::internal lint group
- It's on unconditionally, because it actually lints `staged_api`, not
  the compiler

This fixes a bug where `#[deny(rustc::internal)]` would warn that
`rustc::internal` was an unknown lint.
2021-01-15 17:31:10 -05:00
bstrie
1e1ca28f39 Allow since="TBD" for rustc_deprecated 2020-12-16 13:21:24 -05:00
Vadim Petrochenkov
4eb9da3b17 Move some tests to subdirectories 2020-12-07 02:25:09 +03:00
Daiki Ihara
ea5aff4565 bless stability-attribute-sanity ui test 2020-12-02 00:18:36 +09:00
Mara Bos
9c647d1021 Improve deprecation attribute diagnostic messages.
(From the PR feedback.)

Co-authored-by: Esteban Küber <esteban@kuber.com.ar>
2020-11-02 13:21:18 +01:00
Mara Bos
706bc33651 Use the right span for errors about #[deprecated] attributes. 2020-11-01 20:48:58 +01:00
Jonas Schievink
9f086fcb00
Rollup merge of #77203 - ecstatic-morse:const-stability-attr-checks, r=oli-obk
Check for missing const-stability attributes in `rustc_passes`

Currently, this happens as a side effect of `is_min_const_fn`, which is non-obvious. Also adds a test for this case, since we didn't seem to have one before.
2020-09-27 18:37:21 +02:00
Dylan MacKenzie
6ce178f60e Test for missing const-stability attributes 2020-09-25 14:31:32 -07:00
Jacob Hughes
98eab09cf4 Add enum and type alias tests for generic default stability 2020-09-23 02:14:42 -04:00
Jacob Hughes
3f1b4b39e3 Fix compilation & test failures 2020-09-22 22:54:52 -04:00
Avi Dessauer
d281620d8f Test removing unstable default parameter 2020-09-22 21:55:50 -04:00
Avi Dessauer
a73e7d0a4d Test unstable Alloc param on Box 2020-09-22 21:55:47 -04:00
Avi Dessauer
7616b30bff Add unstable default feature enabled test 2020-09-22 21:55:44 -04:00
Avi Dessauer
af19d44921 Add test case demonstrating leak 2020-09-22 21:55:41 -04:00
Avi Dessauer
a1892f1a79 Test stability on default parameter of deprecated 2020-09-22 21:54:13 -04:00
Avi Dessauer
f665ccd3a2 Add more tests 2020-09-22 21:54:10 -04:00
Avi Dessauer
cb7264b22a Fix tests 2020-09-22 21:54:07 -04:00
Avi Dessauer
eb7abb9e32 Unstable default types leak in public fields 2020-09-22 21:54:04 -04:00