Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #69914

Merged
merged 38 commits into from
Mar 11, 2020
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d15a98b
Stabilize const for integer {to,from}_{be,le,ne}_bytes methods
tspiteri Feb 22, 2020
87f0dc6
use unions instead of transmute and add const safety comments
tspiteri Feb 26, 2020
503026b
mem::zeroed/uninit: panic on types that do not permit zero-initializa…
RalfJung Nov 3, 2019
6fd909b
reference tracking issue
RalfJung Nov 6, 2019
d78c4aa
use valid_range_exclusive for correct overflow handling
RalfJung Nov 9, 2019
df6a3a0
test some more things that should not panic
RalfJung Nov 9, 2019
b133d67
make it even more conservative, and note some FIXMEs
RalfJung Nov 13, 2019
6e66f58
fmt
RalfJung Feb 16, 2020
729f4cd
we cannot short-circuit just becuase the Abi seems harmless
RalfJung Feb 17, 2020
bfe593e
clarify a comment in the test
RalfJung Feb 29, 2020
7c84e45
move panic intrinsic codegen to helper function
RalfJung Feb 29, 2020
a09c33e
move pattern to fn argument
RalfJung Feb 29, 2020
cbf5f7d
Use TypeRelating for instantiating query responses
matthewjasper Feb 29, 2020
85cbabb
Implement nth, last, and count for iter::Copied
Stebalien Mar 1, 2020
011fa91
const forget tests
DutchGhost Mar 2, 2020
5f4af54
An enter as last character pleases tidy it seems
DutchGhost Mar 2, 2020
a674e1c
remove unused mut, restructure the test
DutchGhost Mar 2, 2020
6d03bbd
constify `mem::discriminant`
lcnr Mar 8, 2020
22f2385
prevent potential promotion in const_discriminant
lcnr Mar 8, 2020
6bbb9b8
test discriminant of enum with uninhabited variant
lcnr Mar 8, 2020
4b724e8
allow dead code in discriminant test
lcnr Mar 8, 2020
314da73
discrimant test must not be inlined!
lcnr Mar 9, 2020
906bb8d
fix #62456
contrun Mar 9, 2020
0a0c850
fix test failure due to earlier emitted error
contrun Mar 10, 2020
7b3e3ff
explain the use of a custom identity function
lcnr Mar 10, 2020
4d16c21
Matrix::push: recursively expand or-patterns
Centril Mar 10, 2020
69aaed8
Make Point `Copy` in arithmetic documentation
skade Mar 6, 2020
6b27e8d
parse: Tweak the function parameter edition check
petrochenkov Mar 10, 2020
a7c2eef
Rollup merge of #66059 - RalfJung:panic-on-non-zero, r=eddyb
Centril Mar 11, 2020
4307914
Rollup merge of #69373 - tspiteri:const_int_conversion, r=oli-obk
Centril Mar 11, 2020
d7f0b88
Rollup merge of #69591 - matthewjasper:query-response-relate, r=nikom…
Centril Mar 11, 2020
25091ed
Rollup merge of #69625 - Stebalien:feat/iter-copy-specialize, r=KodrAus
Centril Mar 11, 2020
ae12272
Rollup merge of #69645 - DutchGhost:const-forget-tests, r=Dylan-DPC
Centril Mar 11, 2020
452c147
Rollup merge of #69766 - skade:make-point-copy-in-add-documentation, …
Centril Mar 11, 2020
dfbbd5d
Rollup merge of #69825 - lcnr:discriminant, r=oli-obk
Centril Mar 11, 2020
62e3dae
Rollup merge of #69859 - contrun:fix-62456, r=matthewjasper
Centril Mar 11, 2020
a05bab5
Rollup merge of #69891 - Centril:fix-69875, r=varkor
Centril Mar 11, 2020
6a8683f
Rollup merge of #69896 - petrochenkov:reqname2, r=Centril
Centril Mar 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
prevent potential promotion in const_discriminant
  • Loading branch information
lcnr committed Mar 8, 2020
commit 22f2385a738827fb682bc72bb9e1d794bb436672
8 changes: 5 additions & 3 deletions src/test/ui/consts/const_discriminant.rs
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@

use std::mem::{discriminant, Discriminant};

fn identity<T>(x: T) -> T { x }

enum Test {
A(u8),
B,
@@ -15,8 +17,8 @@ const TEST_B: Discriminant<Test> = discriminant(&Test::B);

fn main() {
assert_eq!(TEST_A, TEST_A_OTHER);
assert_eq!(TEST_A, discriminant(&Test::A(17)));
assert_eq!(TEST_B, discriminant(&Test::B));
assert_eq!(TEST_A, discriminant(identity(&Test::A(17))));
assert_eq!(TEST_B, discriminant(identity(&Test::B)));
assert_ne!(TEST_A, TEST_B);
assert_ne!(TEST_B, discriminant(&Test::C { a: 42, b: 7 }));
assert_ne!(TEST_B, discriminant(identity(&Test::C { a: 42, b: 7 })));
}