Commit graph

31 commits

Author SHA1 Message Date
Gary Guo
f7ef1c9f41 Disallow non-c-like but "fieldless" ADTs from being casted to integer...
... if they use arbitrary enum discriminant. Code like

```rust
enum Enum {
    Foo = 1,
    Bar(),
    Baz{}
}
```

seems to be unintentionally allowed so we couldn't disallow them now,
but we could disallow them if arbitrary enum discriminant is used before
1.56 hits stable.
2021-12-01 19:59:15 +00:00
bors
d212d902ae Auto merge of #89551 - jhpratt:stabilize-const_raw_ptr_deref, r=oli-obk
Stabilize `const_raw_ptr_deref` for `*const T`

This stabilizes dereferencing immutable raw pointers in const contexts.
It does not stabilize `*mut T` dereferencing. This is behind the
same feature gate as mutable references.

closes https://github.com/rust-lang/rust/issues/51911
2021-11-13 17:10:15 +00:00
Jacob Pratt
0cdbeaa2a3
Stabilize const_raw_ptr_deref for *const T
This stabilizes dereferencing immutable raw pointers in const contexts.
It does not stabilize `*mut T` dereferencing. This is placed behind the
`const_raw_mut_ptr_deref` feature gate.
2021-11-06 17:05:15 -04:00
Caio
7fd15f0900 Move some tests to more reasonable directories 2021-11-06 15:35:20 -03:00
Gary Guo
7dbd5bb0bd Fix issue 90038 2021-10-19 06:43:33 +01:00
Mark Rousskov
8485e6fdec Revert "Stabilize arbitrary_enum_discriminant"
This reverts commit 7a62f29f31.
2021-10-14 10:57:56 -04:00
Flying-Toast
59b186d99a
Add enum_intrinsics_non_enums lint 2021-10-11 09:46:27 +02:00
Jacob Pratt
bce8621983
Stabilize const_panic 2021-10-04 02:33:33 -04:00
Andreas Liljeqvist
4d66fbc4b9 enum niche allocation grows toward zero if possible 2021-09-13 21:55:14 +02:00
lcnr
0c28e028b6 feature(const_generics) -> feature(const_param_types) 2021-08-30 11:00:21 +02:00
Ellen
fcc2badf9b rename const_evaluatable_checked to generic_const_exprs
2021-08-30 11:00:21 +02:00
Deadbeef
7a62f29f31
Stabilize arbitrary_enum_discriminant 2021-07-28 18:08:34 +08:00
kadmin
50c86db4fa Add help message for unused type param 2021-05-01 21:58:06 +00:00
Caio
ad35979c50 Move some tests to more reasonable directories - 2
Address comments

Update limits
2021-01-16 19:46:54 -03:00
Bastian Kauschke
c4ba60a191 update tests 2020-12-26 18:24:10 +01:00
varkor
e0b61111f8 Mark repr128 as incomplete_features 2020-10-21 23:41:26 +01:00
Bastian Kauschke
1dd00e60b9 add tracking issue, fix rebase 2020-09-08 16:39:12 +02:00
Bastian Kauschke
ef6100e846 convert to future compat lint 2020-09-08 16:39:12 +02:00
Bastian Kauschke
c81935e6df make ConstEvaluatable more strict 2020-09-08 16:39:12 +02:00
Dan Aloni
07e7823c01 pretty: trim paths of unique symbols
If a symbol name can only be imported from one place for a type, and
as long as it was not glob-imported anywhere in the current crate, we
can trim its printed path and print only the name.

This has wide implications on error messages with types, for example,
shortening `std::vec::Vec` to just `Vec`, as long as there is no other
`Vec` importable anywhere.

This adds a new '-Z trim-diagnostic-paths=false' option to control this
feature.

On the good path, with no diagnosis printed, we should try to avoid
issuing this query, so we need to prevent trimmed_def_paths query on
several cases.

This change also relies on a previous commit that differentiates
between `Debug` and `Display` on various rustc types, where the latter
is trimmed and presented to the user and the former is not.
2020-09-02 22:26:37 +03:00
Dylan MacKenzie
d6139f76c0 Update tests 2020-06-28 10:08:10 -07:00
Lzu Tao
fff822fead Migrate to numeric associated consts 2020-06-10 01:35:47 +00:00
Bastian Kauschke
08b9b97c53 add test for repr(128) enum derives 2020-05-19 10:55:12 +02:00
Bastian Kauschke
d6cb5405dd add tests for enum discriminants 2020-05-19 10:55:12 +02:00
Bastian Kauschke
ff2940a9f4 update discriminant_value usage in tests 2020-05-19 10:55:12 +02:00
Eduard-Mihai Burtescu
926c7a298d typeck: always expose explicit enum discriminant AnonConsts' parent in generics_of. 2020-05-02 19:51:44 +03:00
Matthias Prechtl
7b555178ae --bless --compare-mode=nll 2020-02-09 20:43:49 +01:00
Dylan MacKenzie
5c377f37e4 Reorganize, bless and add tests for const control flow
This creates a new test directory, `ui/consts/control-flow` to hold
tests related to control flow in a const context. It also blesses all
existing tests with the new error messages, and adds new tests for the
`const_if_match` feature.
2019-11-21 16:55:13 -08:00
Oliver Scherer
34f7fcb862 Rebase fallout 2019-11-06 11:04:42 +01:00
Samy Kacimi
41e71b0c93
normalize use of backticks in compiler messages for libsyntax/feature_gate
https://github.com/rust-lang/rust/issues/60532
2019-07-09 14:13:28 +02:00
John Wrenn
ac98342e84 Implement arbitrary_enum_discriminant 2019-06-21 11:00:10 -04:00