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

Treat repr(Rust) univariant fieldless enums as ZSTs #49513

Merged
merged 6 commits into from Apr 26, 2018

Conversation

@nox
Contributor

nox commented Mar 30, 2018

This makes all those enums be represented the same way:

enum A1 { B1 }
enum A2 { B2 = 0 }
enum A3 { B3, C3(!) }

Related to #15747.

Cc @rust-lang/wg-codegen @rust-lang/lang

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Mar 30, 2018

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@TimNN

This comment has been minimized.

Contributor

TimNN commented Mar 30, 2018

Your PR failed on Travis. Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
Resolving deltas: 100% (613114/613114), completed with 4852 local objects.
---
[00:00:42] configure: rust.quiet-tests     := True
---
[00:40:59] .........................................................................i..........................
[00:41:05] ................i...................................................................................
[00:41:09] ....................................................................................................
[00:41:13] ....................................................................................................
[00:41:17] ....................................................................................................
[00:41:22] ....................................................................................................
[00:41:28] ..........................................................................F.........................
[00:41:34] ...................F................................................................................
[00:41:41] ............................................................................................i.......
[00:41:48] ................................................................i...................................
---
[00:42:10] - error[E0391]: cyclic dependency detected
[00:42:10] -   --> $DIR/issue-23302-1.rs:14:9
[00:42:10] -    |
[00:42:10] - LL |     A = X::A as isize, //~ ERROR E0391
[00:42:10] -    |         ^^^^^^^^^^^^^ cyclic reference
[00:42:10] -    |
[00:42:10] - note: the cycle begins when const-evaluating `X::A::{{initializer}}`...
[00:42:10] -   --> $DIR/issue-23302-1.rs:14:9
[00:42:10] -    |
[00:42:10] - LL |     A = X::A as isize, //~ ERROR E0391
[00:42:10] -    |         ^^^^^^^^^^^^^
[00:42:10] - note: ...which then requires computing layout of `X`...
[00:42:10] -   --> $DIR/issue-23302-1.rs:14:9
[00:42:10] -    |
[00:42:10] - LL |     A = X::A as isize, //~ ERROR E0391
[00:42:10] -    |         ^^^^
[00:42:10] -    = note: ...which then again requires const-evaluating `X::A::{{initializer}}`, completing the cycle.
[00:42:10] + error: internal compiler error: librustc_mir/interpret/eval_context.rs:1243: primitive read failed for type: X
---
[00:42:10] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'issue-23302-1.rs'
[00:42:10]
[00:42:10] error: 1 errors occurred comparing output.
[00:42:10] status: exit code: 101
[00:42:10] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issue-23302-1.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-23302-1.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-23302-1.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
---
[00:42:10] {"message":"librustc_mir/interpret/eval_context.rs:1243: primitive read failed for type: X","code":null,"level":"error: internal compiler error","spans":[],"children":[],"rendered":"error: internal compiler error: librustc_mir/interpret/eval_context.rs:1243: primitive read failed for type: X\n\n"}
[00:42:10] thread 'rustc' panicked at 'Box<Any>', librustc_errors/lib.rs:543:9
[00:42:10] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:42:10] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:42:10]
[00:42:10] note: the compiler unexpectedly panicked. this is a bug.
[00:42:10]
[00:42:10] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:42:10]
[00:42:10] note: rustc 1.26.0-dev running on x86_64-unknown-linux-gnu
[00:42:10]
[00:42:10] note: compiler flags: -Z ui-testing -Z miri -Z unstable-options -C prefer-dynamic -C rpath
---
[00:42:10] - error[E0391]: cyclic dependency detected
[00:42:10] -   --> $DIR/issue-36163.rs:14:9
[00:42:10] -    |
[00:42:10] - LL |     B = A, //~ ERROR E0391
[00:42:10] -    |         ^ cyclic reference
[00:42:10] -    |
[00:42:10] - note: the cycle begins when const-evaluating `Foo::B::{{initializer}}`...
[00:42:10] -   --> $DIR/issue-36163.rs:14:9
[00:42:10] -    |
[00:42:10] - LL |     B = A, //~ ERROR E0391
[00:42:10] -    |         ^
[00:42:10] - note: ...which then requires processing `Foo::B::{{initializer}}`...
[00:42:10] -   --> $DIR/issue-36163.rs:14:9
[00:42:10] -    |
[00:42:10] - LL |     B = A, //~ ERROR E0391
[00:42:10] -    |  ic -C rpath
---
[00:42:10] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zmiri -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zmiri -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:42:10] expected success, got: exit code: 101
[00:42:10]
[00:42:10]
[00:42:10] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:42:10] Build completed unsuccessfully in 0:02:04
[00:42:10] Makefile:58: recipe for target 'check' failed
[00:42:10] make: *** [check] Error 1

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN.

@eddyb

This comment has been minimized.

Member

eddyb commented Mar 30, 2018

@alexcrichton @nikomatsakis Do you know whether we can just revert the previous decision here?

@alexcrichton

This comment has been minimized.

Member

alexcrichton commented Mar 30, 2018

@eddyb I don't personally know of any instances of this in the wild, so it seems fine to me to land. I might prefer though to land it after the beta branches

@nox

This comment has been minimized.

Contributor

nox commented Mar 31, 2018

The failure is that EvalContext::try_read_value returns Ok(None) for ZST ADTs.

@@ -14,7 +14,7 @@ enum Foo {
}
enum Bar {
A = Foo::A as isize
A = Foo::A as isize //~ ERROR enums without inhabited variants do not have discriminants

This comment has been minimized.

@arielb1

arielb1 Mar 31, 2018

Contributor

This makes the test no longer be a test of what it used to be testing. Could you add another variant before?

@@ -11,7 +11,7 @@
// Check that an enum with recursion in the discriminant throws
// the appropriate error (rather than, say, blowing the stack).
enum X {
A = X::A as isize, //~ ERROR E0391
A = X::A as isize, //~ ERROR enums without inhabited variants do not have discriminants

This comment has been minimized.

@arielb1

arielb1 Mar 31, 2018

Contributor

This makes the test no longer be a test of what it used to be testing. Could you add another variant B = 0 before A?

@@ -11,7 +11,7 @@
// Check that an enum with recursion in the discriminant throws
// the appropriate error (rather than, say, blowing the stack).
enum X {
A = X::A as isize, //~ ERROR E0391
A = X::A as isize, //~ ERROR enums without inhabited variants do not have discriminants
}

This comment has been minimized.

@arielb1

arielb1 Mar 31, 2018

Contributor

Afterwards, you should add a specific test for this.

@TimNN

This comment has been minimized.

Contributor

TimNN commented Mar 31, 2018

Your PR failed on Travis. Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
Receiving objects:  14% (112372/752548), 30.78 MiB | 1001.00 KiB/s
Receiving objects:  15% (112883/752548), 30.78 MiB | 1001.00 KiB/s
Receiving objects:  15% (115232/752548), 31.79 MiB | 974.00 KiB/s
Receiving objects:  15% (117943/752548), 32.86 MiB | 941.00 KiB/s
Receiving objects:  16% (120408/752548), 33.38 MiB | 963.00 KiB/s
Receiving objects:  16% (121728/752548), 33.95 MiB | 1006.00 KiB/s
---
Receiving objects:  21% (160965/752548), 72.90 MiB | 951.00 KiB/s
Receiving objects:  21% (161820/752548), 73.57 MiB | 822.00 KiB/s
Receiving objects:  21% (162671/752548), 74.23 MiB | 767.00 KiB/s
Receiving objects:  21% (163548/752548), 74.96 MiB | 739.00 KiB/s
Receiving objects:  21% (164574/752548), 75.79 MiB | 726.00 KiB/s
Receiving objects:  22% (165561/752548), 76.26 MiB | 748.00 KiB/s
Receiving objects:  22% (165577/752548), 76.73 MiB | 774.00 KiB/s
Receiving objects:  22% (166348/752548), 77.18 MiB | 806.00 KiB/s
Receiving objects:  22% (167290/752548), 78.00 MiB | 841.00 KiB/s
Receiving objects:  22% (168440/752548), 78.75 MiB | 845.00 KiB/s
Receiving objects:  22% (169069/752548), 79.42 MiB | 810.00 KiB/s
Receiving objects:  22% (169419/752548), 79.95 MiB | 719.00 KiB/s
Receiving objects:  22% (170156/752548), 80.53 MiB | 646.00 KiB/s
Receiving objects:  22% (171035/752548), 81.19 MiB | 627.00 KiB/s
Receiving objects:  22% (172980/752548), 81.93 MiB | 632.00 KiB/s
Receiving objects:  23% (173087/752548), 81.93 MiB | 632.00 KiB/s
Receiving objects:  23% (176306/752548), 82.70 MiB | 673.00 KiB/s
Receiving objects:  23% (177925/752548), 83.54 MiB | 743.00 KiB/s
Receiving objects:  23% (179222/752548), 84.50 MiB | 819.00 KiB/s
Receiving objects:  23% (180553/752548), 85.59 MiB | 898.00 KiB/s
Receiving objects:  24% (180612/752548), 85.59 MiB | 898.00 KiB/s
Receiving objects:  24% (182879/752548), 86.86 MiB | 1022.00 KiB/s
Receiving objects:  24% (184782/752548), 88.04 MiB | 1.07 MiB/s
Receiving objects:  24% (186021/752548), 88.88 MiB | 1.07 MiB/s
Receiving objects:  24% (187192/752548), 89.65 MiB | 1.01 MiB/s
Receiving objects:  25% (188137/752548), 90.49 MiB | 958.00 KiB/s
Receiving objects:  25% (188268/752548), 90.49 MiB | 958.00 KiB/s
Receiving objects:  25% (189629/752548), 91.38 MiB | 881.00 KiB/s
Receiving objects:  25% (190773/752548), 92.22 MiB | 830.00 KiB/s
Receiving objects:  25% (191571/752548), 93.16 MiB | 875.00 KiB/s
Receiving objects:  25% (195626/752548), 94.13 MiB | 907.00 KiB/s
Receiving objects:  26% (195663/752548), 94.13 MiB | 907.00 KiB/s
Receiving objects:  27% (203188/752548), 95.23 MiB | 966.00 KiB/s
Receiving objects:  27% (203887/752548), 95.23 MiB | 966.00 KiB/s
Receiving objects:  27% (207920/752548), 96.43 MiB | 1.02 MiB/s
Receiving objects:  27% (209019/752548), 97.32 MiB | 1.01 MiB/s
Receiving objects:  28% (210714/752548), 97.65 MiB | 1005.00 KiB/s
Receiving objects:  28% (211683/752548), 98.02 MiB | 982.00 KiB/s
Receiving objects:  28% (213171/752548), 98.77 MiB | 919.00 KiB/s
Receiving objects:  28% (214535/752548), 99.54 MiB | 828.00 KiB/s
Receiving objects:  28% (215623/752548), 100.36 MiB | 767.00 KiB/s
Receiving objects:  28% (217691/752548), 100.78 MiB | 774.00 KiB/s
Receiving objects:  29% (218239/752548), 101.23 MiB | 800.00 KiB/s
Receiving objects:  29% (222433/752548), 101.63 MiB | 807.00 KiB/s
Receiving objects:  30% (225765/752548), 102.53 MiB | 840.00 KiB/s
Receiving objects:  30% (226685/752548), 102.53 MiB | 840.00 KiB/s
Receiving objects:  30% (231821/752548), 103.46 MiB | 878.00 KiB/s
Receiving objects:  31% (233290/752548), 103.93 MiB | 889.00 KiB/s
Receiving objects:  31% (234192/752548), 104.44 MiB | 911.00 KiB/s
Receiving objects:  31% (235527/752548), 105.54 MiB | 962.00 KiB/s
---
Receiving objects:  48% (367670/752548), 155.64 MiB | 951.00 KiB/s
Receiving objects:  48% (368193/752548), 156.18 MiB | 794.00 KiB/s
Receiving objects:  49% (368749/752548), 156.46 MiB | 726.00 KiB/s
Receiving objects:  49% (368870/752548), 156.79 MiB | 689.00 KiB/s
Receiving objects:  49% (369040/752548), 157.51 MiB | 682.00 KiB/s
Receiving objects:  49% (369102/752548), 158.25 MiB | 663.00 KiB/s
Receiving objects:  49% (369684/752548), 159.12 MiB | 714.00 KiB/s
Receiving objects:  49% (369732/752548), 159.54 MiB | 746.00 KiB/s
Receiving objects:  49% (370124/752548), 160.47 MiB | 822.00 KiB/s
Receiving objects:  49% (370870/752548), 161.51 MiB | 893.00 KiB/s
Receiving objects:  49% (371146/752548), 162.40 MiB | 926.00 KiB/s
Receiving objects:  49% (371798/752548), 163.43 MiB | 961.00 KiB/s
Receiving objects:  49% (371855/752548), 164.46 MiB | 995.00 KiB/s
Receiving objects:  49% (372383/752548), 165.52 MiB | 1009.00 KiB/s
---
Receiving objects:  53% (403560/752548), 176.88 MiB | 989.00 KiB/s
Receiving objects:  53% (405008/752548), 177.82 MiB | 876.00 KiB/s
Receiving objects:  54% (406376/752548), 177.82 MiB | 876.00 KiB/s
Receiving objects:  54% (406874/752548), 178.88 MiB | 929.00 KiB/s
Receiving objects:  54% (407749/752548), 180.00 MiB | 1000.00 KiB/s
---
Receiving objects:  54% (412784/752548), 189.29 MiB | 988.00 KiB/s
Receiving objects:  54% (412824/752548), 190.15 MiB | 870.00 KiB/s
Receiving objects:  54% (412991/752548), 191.04 MiB | 827.00 KiB/s
Receiving objects:  54% (413872/752548), 191.88 MiB | 841.00 KiB/s
Receiving objects:  54% (413893/752548), 192.75 MiB | 857.00 KiB/s
Receiving objects:  55% (413902/752548), 193.16 MiB | 861.00 KiB/s
Receiving objects:  55% (413914/752548), 193.61 MiB | 869.00 KiB/s
Receiving objects:  55% (413939/752548), 194.54 MiB | 871.00 KiB/s
Receiving objects:  55% (413958/752548), 195.38 MiB | 870.00 KiB/s
Receiving objects:  55% (413976/752548), 195.99 MiB | 811.00 KiB/s
Receiving objects:  55% (413999/752548), 196.71 MiB | 791.00 KiB/s
Receiving objects:  55% (414030/752548), 197.51 MiB | 767.00 KiB/s
Receiving objects:  55% (415550/752548), 198.45 MiB | 772.00 KiB/s
Receiving objects:  55% (416241/752548), 199.42 MiB | 836.00 KiB/s
Receiving objects:  55% (417189/752548), 200.48 MiB | 923.00 KiB/s
Receiving objects:  55% (417206/752548), 201.36 MiB | 948.00 KiB/s
Receiving objects:  55% (417230/752548), 202.19 MiB | 944.00 KiB/s
Receiving objects:  55% (417265/752548), 203.12 MiB | 938.00 KiB/s
Receiving objects:  55% (417318/752548), 204.16 MiB | 938.00 KiB/s
Receiving objects:  56% (421427/752548), 204.73 MiB | 949.00 KiB/s
Receiving objects:  56% (422700/752548), 205.32 MiB | 978.00 KiB/s
---
Receiving objects:  61% (461703/752548), 223.36 MiB | 984.00 KiB/s
Receiving objects:  61% (461745/752548), 224.26 MiB | 931.00 KiB/s
Receiving objects:  61% (464616/752548), 225.19 MiB | 885.00 KiB/s
Receiving objects:  62% (466580/752548), 225.66 MiB | 889.00 KiB/s
Receiving objects:  62% (468799/752548), 226.17 MiB | 913.00 KiB/s
Receiving objects:  62% (471064/752548), 227.08 MiB | 922.00 KiB/s
Receiving objects:  63% (474106/752548), 227.93 MiB | 922.00 KiB/s
Receiving objects:  63% (474531/752548), 227.93 MiB | 922.00 KiB/s
Receiving objects:  63% (480024/752548), 228.70 MiB | 881.00 KiB/s
Receiving objects:  64% (481631/752548), 229.10 MiB | 868.00 KiB/s
Receiving objects:  64% (483648/752548), 229.51 MiB | 856.00 KiB/s
Receiving objects:  64% (484782/752548), 229.93 MiB | 834.00 KiB/s
Receiving objects:  64% (489102/752548), 230.76 MiB | 808.00 KiB/s
Receiving objects:  65% (489157/752548), 230.76 MiB | 808.00 KiB/s
Receiving objects:  65% (490030/752548), 231.58 MiB | 803.00 KiB/s
Receiving objects:  65% (490164/752548), 232.42 MiB | 821.00 KiB/s
Receiving objects:  65% (490203/752548), 233.27 MiB | 829.00 KiB/s
Receiving objects:  65% (491093/752548), 234.11 MiB | 831.00 KiB/s
Receiving objects:  65% (493681/752548), 234.98 MiB | 851.00 KiB/s
Receiving objects:  65% (494665/752548), 235.91 MiB | 862.00 KiB/s
Receiving objects:  65% (496042/752548), 236.84 MiB | 895.00 KiB/s
Receiving objects:  66% (496682/752548), 237.33 MiB | 907.00 KiB/s
Receiving objects:  66% (500491/752548), 237.85 MiB | 919.00 KiB/s
Receiving objects:  67% (504208/752548), 238.41 MiB | 959.00 KiB/s
Receiving objects:  67% (507176/752548), 239.05 MiB | 1010.00 KiB/s
---
Receiving objects:  74% (563659/752548), 278.42 MiB | 1001.00 KiB/s
Receiving objects:  75% (564411/752548), 278.42 MiB | 1001.00 KiB/s
Receiving objects:  75% (566727/752548), 279.20 MiB | 924.00 KiB/s
Receiving objects:  75% (567768/752548), 279.80 MiB | 800.00 KiB/s
Receiving objects:  75% (568780/752548), 280.09 MiB | 757.00 KiB/s
Receiving objects:  75% (570091/752548), 280.64 MiB | 665.00 KiB/s
Receiving objects:  75% (571413/752548), 281.26 MiB | 632.00 KiB/s
Receiving objects:  76% (571937/752548), 281.61 MiB | 625.00 KiB/s
Receiving objects:  76% (573367/752548), 281.97 MiB | 616.00 KiB/s
Receiving objects:  76% (574667/752548), 282.71 MiB | 649.00 KiB/s
Receiving objects:  76% (577553/752548), 283.51 MiB | 701.00 KiB/s
Receiving objects:  76% (579163/752548), 284.34 MiB | 757.00 KiB/s
Receiving objects:  77% (579462/752548), 284.34 MiB | 757.00 KiB/s
Receiving objects:  77% (583458/752548), 285.26 MiB | 817.00 KiB/s
Receiving objects:  78% (586988/752548), 286.29 MiB | 878.00 KiB/s
Receiving objects:  78% (587205/752548), 286.29 MiB | 878.00 KiB/s
Receiving objects:  78% (592838/752548), 287.67 MiB | 1022.00 KiB/s
---
Receiving objects:  84% (633701/752548), 302.84 MiB | 924.00 KiB/s
Receiving objects:  84% (633701/752548), 303.22 MiB | 891.00 KiB/s
Receiving objects:  84% (633701/752548), 304.07 MiB | 898.00 KiB/s
Receiving objects:  84% (636400/752548), 304.59 MiB | 913.00 KiB/s
Receiving objects:  84% (639535/752548), 305.54 MiB | 908.00 KiB/s
Receiving objects:  85% (639666/752548), 305.54 MiB | 908.00 KiB/s
Receiving objects:  85% (646075/752548), 306.63 MiB | 939.00 KiB/s
Receiving objects:  86% (647192/752548), 307.20 MiB | 973.00 KiB/s
Receiving objects:  86% (651840/752548), 307.65 MiB | 989.00 KiB/s
Receiving objects:  87% (654717/752548), 308.71 MiB | 1.01 MiB/s
Receiving objects:  87% (657133/752548), 308.71 MiB | 1.01 MiB/s
Receiving objects:  88% (662243/752548), 309.28 MiB | 1.02 MiB/s
Receiving objects:  88% (662779/752548), 309.84 MiB | 1.03 MiB/s
Receiving objects:  88% (665918/752548), 310.77 MiB | 1.02 MiB/s
Receiving objects:  88% (668391/752548), 311.56 MiB | 970.00 KiB/s
Receiving objects:  89% (669768/752548), 311.91 MiB | 948.00 KiB/s
Receiving objects:  89% (670650/752548), 312.33 MiB | 930.00 KiB/s
Receiving objects:  89% (675618/752548), 313.16 MiB | 866.00 KiB/s
Receiving objects:  90% (677294/752548), 313.57 MiB | 833.00 KiB/s
Receiving objects:  90% (680743/752548), 314.02 MiB | 828.00 KiB/s
Receiving objects:  90% (683032/752548), 315.00 MiB | 856.00 KiB/s
Receiving objects:  91% (684819/752548), 315.54 MiB | 889.00 KiB/s
Receiving objects:  91% (688690/752548), 316.07 MiB | 928.00 KiB/s
Receiving objects:  92% (692345/752548), 316.57 MiB | 946.00 KiB/s
Receiving objects:  92% (695586/752548), 317.12 MiB | 977.00 KiB/s
Receiving objects:  92% (697162/752548), 318.08 MiB | 1005.00 KiB/s
Receiving objects:  93% (699870/752548), 318.45 MiB | 987.00 KiB/s
Receiving objects:  93% (700399/752548), 318.76 MiB | 949.00 KiB/s
Receiving objects:  93% (704210/752548), 319.48 MiB | 873.00 KiB/s
Receiving objects:  93% (704401/752548), 320.32 MiB | 832.00 KiB/s
Receiving objects:  93% (706934/752548), 321.28 MiB | 792.00 KiB/s
Receiving objects:  94% (707396/752548), 321.28 MiB | 792.00 KiB/s
Receiving objects:  94% (713116/752548), 322.61 MiB | 924.00 KiB/s
Receiving objects:  95% (714921/752548), 322.61 MiB | 924.00 KiB/s
---
Receiving objects:  99% (752217/752548), 331.57 MiB | 912.00 KiB/s
remote: Total 752548 (delta 613171), reused 746245 (delta 606930), pack-reused 0
Receiving objects: 100% (752548/752548), 331.57 MiB | 912.00 KiB/s
Receiving objects: 100% (752548/752548), 331.80 MiB | 1.15 MiB/s, done.
---
Resolving deltas: 100% (613171/613171), completed with 4860 local objects.
---
[00:00:42] configure: rust.quiet-tests     := True
---
[00:36:25] .........................................................................i..........................
[00:36:31] ................i...................................................................................
---
[00:37:04] ............................................................................................i.......
[00:37:10] ................................................................i...................................
---
[00:38:01] .............................................i......................................................
[00:38:18] ....................................................................................................
[00:38:32] ....................................................................................................
[00:38:46] ..F.................................................................................................
[00:39:06] .....................................................................F..............................
---
[00:40:56] ..................................F...................................F.............................
[00:41:16] ....................................................................................................
[00:41:32] ..............................i.....................................................................
[00:41:45] ..............................................................i.....................................
[00:42:00] ...............................................i....................................................
[00:42:18] .....................................................F..............................................
[00:42:39] ....................................................................................................
[00:42:59] ....................................................................................................
[00:43:22] .i................................................................................................i.
[00:43:51] ............................................................................................test [run-pass] run-pass/mir_heavy_promoted.rs has been running for over 60 seconds
[00:43:55] ........
[00:44:23] ....................................................................................................
[00:44:55] ...............................F...............................ii...................................
[00:45:41] ...................F......i....................................................i.ii.................
[00:46:17] .......................................................................................iiiiiii......
---
[00:47:54] thread '[run-pass] run-pab.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:47:54]
[00:47:54] note: rustc 1.26.0-dev running on x86_64-unknown-linux-gnu
[00:47:54]
[00:47:54] note: compiler flags: -Z miri -Z unstable-options -C prefer-dynamic -C rpath
[00:47:54]
[00:47:54]
[00:47:54] ------------------------------------------
[00:47:54]
[00:47:54] thread '[run-pass] run-pass/enum-vec-initializer.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2901:9
[00:47:54]
[00:47:54] ---- [run-pass] run-pass/issue-23304-2.rs stdout ----
[00:47:54]
[00:47:54] error: compilation failed!
[00:47:54] status: exit code: 101
[00:47:54] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass/issue-23304-2.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass" "--target=x86_64-unknown-linux-gnu" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/issue-23304-2.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/issue-23304-2.stage2-x86_64-unknown-linux-gnu.aux"
---
[00:47:54] error[E0080]: enums without inhabited variants do not have discriminants
[00:47:54]   --> /checkout/src/test/run-pass/issue-23304-2.rs:15:14
---
[00:47:54] thread '[run-pass] run-pass/issue-9837.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2901:9
---
[00:47:54] thread '[run-pass] run-pass/resolve-issue-2428.rs' panicked at 'explicit panic', tools/compiletest/src/runte

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN.

@oli-obk

This comment has been minimized.

Contributor

oli-obk commented Mar 31, 2018

So apparently

enum X { A = 0 as isize }

is now a ZST. I did not expect that, even though it makes sense. And it also explains the other failures we had before.

@oli-obk

This comment has been minimized.

Contributor

oli-obk commented Mar 31, 2018

I can implement this, but I'm getting slightly confused about the exact semantics we want here.

Since

enum X { A = 42 as isize }

is a zst, that means

let x = X::A;

is a zst value (so no value, just type system magic). This raises the question of how

let y = x as isize;

would get the 42 stored inside y.

Casting a ZST is a new concept to me. And I think it's a new concept to rustc, too:

println!("{}", y);

0

@TimNN

This comment has been minimized.

Contributor

TimNN commented Mar 31, 2018

Your PR failed on Travis. Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
Resolving deltas: 100% (613182/613182), completed with 4858 local objects.
---
[00:00:45] configure: rust.quiet-tests     := True
---
[00:35:46] .........................................................................i..........................
[00:35:51] ................i...................................................................................
---
[00:36:24] ............................................................................................i.......
[00:36:30] ................................................................i...................................
---
[00:37:20] .............................................i......................................................
[00:37:37] ....................................................................................................
[00:37:51] ....................................................................................................
[00:38:05] ..F.................................................................................................
[00:38:25] .....................................................................F..............................
---
[00:40:14] ..................................F...................................F.............................
[00:40:33] ....................................................................................................
[00:40:49] .............................i......................................................................
[00:41:02] ..............................................................i.....................................
[00:41:16] ...............................................i....................................................
[00:41:35] .....................................................F..............................................
[00:41:54] ....................................................................................................
[00:42:14] ....................................................................................................
[00:42:36] .i................................................................................................i.
[00:43:06] ...............................................................................................test [run-pass] run-pass/mir_heavy_promoted.rs has been running for over 60 seconds
[00:43:09] .....
[00:43:36] ....................................................................................................
[00:44:08] ...............................F...............................ii...................................
[00:44:52] ...................F......i....................................................i.ii.................
[00:45:28] .......................................................................................iiiiiii......
[00:45:54] ....................................................................................................
[00:46:20] ....................................................................................................
[00:46:46] ....................................................................................................
15 | enum Y { A = X::A as isize }
---
[00:47:02] thread '[run-pass] run-pass/issue-23304-2.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2901:9
---
[00:47:02] thread '[run-pass] run-pass/issue-2428.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2901:9
---
[00:47:02] thread '[run-pass] run-pass/issue-9837.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2901:9
---
[00:47:02] thread '[run-pass] run-pass/resolve-issue-2428.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2901:9
---
[00:47:02]  right: `-3`', /checkout/src/test/run-pass/signed-shift-const-eval.rs:14:5
[00:47:02] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:47:02]
[00:47:02] ------------------------------------------
[00:47:02]
[00:47:02] thread '[run-pass] run-pass/signed-shift-const-eval.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2901:9
---
[00:47:02] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/run-pass" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-pass" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zmiri -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zmiri -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:47:02] expected success, got: exit code: 101
[00:47:02]
[00:47:02]
[00:47:02] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:47:02] Build completed unsuccessfully in 0:12:03
[00:47:02] Makefile:58: recipe for target 'check' failed
[00:47:02] make: *** [check] Error 1
---
56656 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/incremental/syntax-2bjr8lg1wd06d/s-ezowi2ldqn-1rir996-2wvuof4dt3tik
---
33884s/DiagnosticReports/
ls: cannot access /home/travis/Library/Logs/DiagnosticReports/: No such file or directory
travis_time:end:29dce13a:start=1522530481686503910,finish=1522530481693874654,duration=7370744
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0d6f6c82
$ find $HOME/Library/Logs/DiagnosticReports -type f -name '*.crash' -not -name '*.stage2-*.crash' -not -name 'com.apple.CoreSimulator.CoreSimulatorService-*.crash' -exec printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" {} \; -exec head -750 {} \; -exec echo travis_fold":"end:crashlog \; || true
find: `/home/travis/Library/Logs/DiagnosticReports': No such file or directory
travis_time:end:0d6f6c82:start=1522530481699978493,finish=1522530481705910885,duration=5932392
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0a50429c
$ dmesg | grep -i kill
[   10.762138] init: failsafe main process (1094) killed by TERM signal

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN.

@RalfJung

This comment has been minimized.

Member

RalfJung commented Mar 31, 2018

@oli-obk The code for casting has access to the source and target types, right? If the source type is a single-variant fieldless enum, the result of the cast is just always the integer value of that single variant (i.e., it'll codegen a constant). Is there any problem with that?

@TimNN

This comment has been minimized.

Contributor

TimNN commented Mar 31, 2018

Your PR failed on Travis. Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
Resolving deltas: 100% (613174/613174), completed with 4861 local objects.
---
[00:01:04] configure: rust.quiet-tests     := True
---
[00:40:08] .........................................................................i..........................
[00:40:14] ................i...................................................................................
---
[00:40:49] ............................................................................................i.......
[00:40:56] ................................................................i...................................
[00:41:02] ....................................................................................................
[00:41:09] ....................................................................................................
[00:41:17] .......................................................................................FF...........
ptions" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/uninhabited_enum_discriminant1.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
---
[00:41:18] {"message":"constant evaluation of enum discriminant resulted in non-integer","code":{"code":"E0080","explanation":"\nThis error indicates that the compiler was unable to sensibly evaluate an\nconstant expression that had to be evaluated. Attempting to divide by 0\nor causing integer overflow are two ways to induce this error. For example:\n\n```compile_fail,E0080\nenum Enum {\n    X = (1 << 500),\n    Y = (1 / 0)\n}\n```\n\nEnsure that the expressions given can be evaluated as the desired integer type.\nSee the FFI section of the Reference for more information about using a custom\ninteger type:\n\nhttps://doc.rust-lang.org/reference.html#ffi-attributes\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/uninhabited_enum_discriminant1.rs","byte_start":612,"byte_end":625,"line_start":14,"line_end":14,"column_start":9,"column_end":22,"is_primary":true,"text":[{"text":"    A = X::A as isize, //~ ERROR enums without inhabited variants do not have discriminants","highlight_start":9,"highlight_end":22}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0080]: constant evaluation of enum discriminant resulted in non-integer\essfully in 0:02:02
[00:41:18] Makefile:58: recipe for target 'check' failed
[00:41:18] make: *** [check] Error 1
---
$ cat obj/tmp/sccache.log
---
$ ls -lat $HOME/Library/Logs

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN.

@eddyb

This comment has been minimized.

Member

eddyb commented Apr 1, 2018

There might be missing code to get the right discriminant (42) from the variant_index (0).

@scottmcm

This comment has been minimized.

Member

scottmcm commented Apr 1, 2018

how [...] would get the 42 stored inside y.

Hmm, there must be code somewhere for how discriminant_value gets the 1 that's not stored anywhere out of Some(&4). I don't know where that is, but maybe it'd help elucidate?

@TimNN

This comment has been minimized.

Contributor

TimNN commented Apr 1, 2018

Your PR failed on Travis. Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
Resolving deltas: 100% (613183/613183), completed with 4857 local objects.
---
[00:00:42] configure: rust.quiet-tests     := True
---
[00:38:50] .........................................................................i..........................
[00:38:56] ................i...................................................................................
---
[00:39:30] ............................................................................................i.......
[00:39:37] ................................................................i...................................
[00:39:43] ....................................................................................................
[00:39:50] ....................................................................................................
[00:39:58] .......................................................................................FF...........
---
[00:39:58] - error[E0080]: enums without inhabited variants do not have discriminants
[00:39:58] + error[E0080]: constant evaluation of enum discriminant resulted in non-integer
[00:39:58] 2   --> $DIR/uninhabited_enum_discriminant1.rs:14:9
[00:39:58] 3    |
[00:39:58] 4 LL |     A = X::A as isize, //~ ERROR enums without inhabited variants do not have discriminants
[00:39:58]
[00:39:58]
[00:39:58] The actual stderr differed from the expected stderr.
[00:39:58] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/uninhabited_enum_discriminant1.stderr
[00:39:58] To update references, run this command from build directory:
[00:39:58] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'uninhabited_enum_discriminant1.rs'
[00:39:58]
[00:39:58] error: 1 errors occurred comparing output.
[00:39:58] status: exit code: 101
[00:39:58] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/uninhabited_enum_discriminant1.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/uninhabited_enum_discriminant1.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-on  --> /checkout/src/test/ui/uninhabited_enum_discriminant1.rs:14:9\n   |\nLL |     A = X::A as isize, //~ ERROR enums without inhabited variants do not have discriminants\n   |         ^^^^^^^^^^^^^\n\n"}
[00:39:58] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:39:58] {"message":"For more information about this error, try `rustc --explain E0080`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0080`.\n"}
---
[00:39:58] - error[E0080]: enums without inhabited variants do not have discriminants
[00:39:58] + error[E0080]: constant evaluation of enum discriminant resulted in non-integer
[00:39:58] 2   --> $DIR/uninhabited_enum_discriminant2.rs:14:9
[00:39:58] 3    |
[00:39:58] 4 LL |     B = A, //~ ERROR enums without inhabited variants do not have discriminants
[00:39:58]
[00:39:58]
[00:39:58] The actual stderr differed from the expected stderr.
[00:39:58] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/uninhabited_enum_discriminant2.stderr
[00:39:58] To update references, run this command from build directory:
[00:39:58] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'uninhabited_enum_discriminant2.rs'
[00:39:58]
[00:39:58] error: 1 errors occurred comparing output.
[00:39:58] status: exit code: 101
[00:39:58] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/uninhabited_enum_discriminant2.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/uninhabited_enum_discriminant2.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/uninhabited_enum_discriminant2.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
---
[00:39:58] {"message":"constant evaluation of enum discriminant resulted in non-integer","code":{"code":"E0080","explanation":"\nThis error indicates that the compiler was unable to sensibly evaluate an\nconstant expression that had to be evaluated. Attempting to divide by 0\nor causing integer overflow are two ways to induce this error. For example:\n\n```compile_fail,E0080\nenum Enum {\n    X = (1 << 500),\n    Y = (1 / 0)\n}\n```\n\nEnsure that the expressions given can be evaluated as the desired integer type.\nSee the FFI section of the Reference for more information about using a custom\ninteger type:\n\nhttps://doc.rust-lang.org/reference.html#ffi-attributes\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/uninhabited_enum_discriminant2.rs","byte_start":521,"byte_end":522,"line_start":14,"line_end":14,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    B = A, //~ ERROR enums without inhabited variants do not have discriminants","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0080]: constant evaluation of enum discriminant resulted in non-integer\n  --> /checkout/src/test/ui/uninhabited_enum_discriminant2.rs:14:9\n   |\nLL |     B = A, //~ ERROR enums without inhabited variants do not have discriminants\n   |         ^\n\n"}
[00:39:58] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:39:58] {"message":"For more information about this error, try `rustc --explain E0080`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0080`.\n"}
---
[00:39:essfully in 0:01:58
[00:39:58] Makefile:58: recipe for target 'check' failed
[00:39:58] make: *** [check] Error 1
---
56656 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/incremental/syntax-2bjr8lg1wd06d/s-ezpishk4pc-1m7ty9p-2t6tvq8n3uqxw
---
$ cat obj/tmp/sccache.log
---
$ ls -lat $HOME/Library/Logs/DiagnosticReports/
ls: cannot access /home/travis/Library/Logs/DiagnosticReports/: No such file or directory
travis_time:end:282c949e:start=1522578398095573314,finish=1522578398101322510,duration=5749196
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:083d0d38
$ find $HOME/Library/Logs/DiagnosticReports -type f -name '*.crash' -not -name '*.stage2-*.crash' -not -name 'com.apple.CoreSimulator.CoreSimulatorService-*.crash' -exec printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" {} \; -exec head -750 {} \; -exec echo travis_fold":"end:crashlog \; || true
find: `/home/travis/Library/Logs/DiagnosticReports': No such file or directory
travis_time:end:083d0d38:start=1522578398106515779,finish=1522578398111893709,duration=5377930
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:01330c4c
$ dmesg | grep -i kill
[   10.237355] init: failsafe main process (1093) killed by TERM signal

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN.

let x = X::A;
let y = x as isize;
println!("{:?}", x);
println!("{}", y);

This comment has been minimized.

@RalfJung

RalfJung Apr 1, 2018

Member

These printlns are not actually tested for, are they? Could a ui test check them?

This comment has been minimized.

@oli-obk

oli-obk Apr 1, 2018

Contributor

Those should simply be an assert

@nox

This comment has been minimized.

Contributor

nox commented Apr 1, 2018

@oli-obk I feel like my additional commit broke your newly-introduced test uninhabited_enum_discriminant1, sorry for that.

@oli-obk

This comment has been minimized.

Contributor

oli-obk commented Apr 1, 2018

After your change the op isn't true anymore, right? Can you add some size_of assert tests?

@nox

This comment has been minimized.

Contributor

nox commented Apr 1, 2018

If by "the op" you mean the fact that enum E { V = 42 as isize } is a ZST, that is still true, but there should be a test for that anyway. Where should the test go?

@arielb1

This comment has been minimized.

Contributor

arielb1 commented Apr 1, 2018

Somewhere in run-pass. Could you find an existing test?

@arielb1

This comment has been minimized.

Contributor

arielb1 commented Apr 1, 2018

src/test/run-pass/type-sizes.rs

@oli-obk

This comment has been minimized.

Contributor

oli-obk commented Apr 1, 2018

So... I'm confused as to what your latest commit changed. Why isn't the failing test not producing zsts anymore?

@nox

This comment has been minimized.

Contributor

nox commented Apr 1, 2018

It still is, the following program prints two zeroes:

use std::mem;

fn main() {
    enum E { V = 42 as isize }
    let e = E::V;
    println!("{}", mem::size_of::<E>());
    println!("{}", e as isize);
}

The first one because E is still a ZST; the second one because there is a bug somewhere that I'm currently trying to fix.

The change I reverted was an unrelated change that I shouldn't have committed in the first place, because it relates to the niche-filling optim which is orthogonal to what I'm trying to achieve here.

Does that make sense to you @oli-obk?

@oli-obk

This comment has been minimized.

Contributor

oli-obk commented Apr 1, 2018

Yes it does. Thanks for the explanation. I can fix the miri part after the runtime part works

@TimNN

This comment has been minimized.

Contributor

TimNN commented Apr 1, 2018

Your PR failed on Travis. Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
Resolving deltas: 100% (613212/613212), completed with 4857 local objects.
---
[00:00:42] configure: rust.quiet-tests     := True
---
[00:40:36] .........................................................................i..........................
[00:40:42] ................i...................................................................................
---
[00:41:17] ............................................................................................i.......
[00:41:23] ................................................................i...................................
---
[00:41:45] - error[E0080]: enums without inhabited variants do not have discriminants
[00:41:45] + error[E0080]: constant evaluation of enum discriminant resulted in non-integer
[00:41:45] 2   --> $DIR/uninhabited_enum_discriminant1.rs:14:9
[00:41:45] 3    |
[00:41:45] 4 LL |     A = X::A as isize, //~ ERROR enums without inhabited variants do not have discriminants
[00:41:45]
[00:41:45]
[00:41:45] The actual stderr differed from the expected stderr.
[00:41:45] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/uninhabited_enum_discriminant1.stderr
[00:41:45] To update references, run this command from build directory:
[00:41:45] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'uninhabited_enum_discriminant1.rs'
[00:41:45]
[00:41:45] error: 1 errors occurred comparing output.
[00:41:45] status: exit code: 101
[00:41:45] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/uninhabited_enum_discriminant1.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/uninhabited_enum_discriminant1.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/uninhabited_enum_discriminant1.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
---
[00:41:45] {"message":"constant evaluation of enum discriminant resulted in non-integer","code":{"code":"E0080","explanation":"\nThis error indicates that the compiler was unable to sensibly evaluate an\nconstant expression that had to be evaluated. Attempting to divide by 0\nor causing integer overflow are two ways to induce this error. For example:\n\n```compile_fail,E0080\nenum Enum {\n    X = (1 << 500),\n    Y = (1 / 0)\n}\n```\n\nEnsure that the expressions given can be evaluated as the desired integer type.\nSee the FFI section of the Reference for more information about using a custom\ninteger type:\n\nhttps://doc.rust-lang.org/reference.html#ffi-attributes\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/uninhabited_enum_discriminant1.rs","byte_start":612,"byte_end":625,"line_start":14,"line_end":14,"column_start":9,"column_end":22,"is_primary":true,"text":[{"text":"    A = X::A as isize, //~ ERROR enums without inhabited variants do not have discriminants","highlight_start":9,"highlight_end":22}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0080]: constant evaluation of enum discriminant resulted in non-integer\n  --> /checkout/src/test/ui/uninhabited_enum_discriminant1.rs:14:9\n   |\nLL |     A = X::A as isize, //~ ERROR enums without inhabited variants do not have discriminants\n   |         ^^^^^^^^^^^^^\n\n"}
[00:41:45] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:41:45] {"message":"For more information about this error, try `rustc --explain E0080`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0080`.\n"}
---
[00:41:45] - error[E0080]: enums without inhabited variants do not have discriminants
[00:41:45] + error[E0080]: constant evaluation of enum discriminant resulted in non-integer
[00:41:45] 2   --> $DIR/uninhabited_enum_discriminant2.rs:14:9
[00:41:45] 3    |
[00:41:45] 4 LL |     B = A, //~ ERROR enums without inhabited variants do not have discriminants
[00:41:45]
[00:41:45]
[00:41:45] The actual stderr differed from the expected stderr.
[00:41:45] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/uninhabited_enum_discriminant2.stderr
[00:41:45] To update references, run this command from build directory:
[00:41:45] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'uninhabited_enum_discriminant2.rs'
[00:41:45]
[00:41:45] error: 1 errors occurred comparing output.
[00:41:45] status: exit code: 101
[00:41:45] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/uninhabited_enum_discriminant2.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/uninhabited_enum_discriminant2.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zmiri" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/uninhabited_enum_discriminant2.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
---
[00:41:45] {"message":"constant evaluation of enum discriminant resulted in non-integer","code":{"code":"E0080","explanation":"\nThis error indicates that the compiler was unable to sensibly evaluate an\nconstant expression that had to be evaluated. Attempting to divide by 0\nor causing integer overflow are two ways to induce this error. For example:\n\n```compile_fail,E0080\nenum Enum {\n    X = (1 << 500),\n    Y = (1 / 0)\n}\n```\n\nEnsure that the expressions given can be evaluated as the desired integer type.\nSee the FFI section of the Reference for more information about using a custom\ninteger type:\n\nhttps://doc.rust-lang.org/reference.html#ffi-attributes\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/uninhabited_enum_discriminant2.rs","byte_start":521,"byte_end":522,"line_start":14,"line_end":14,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":"    B = A, //~ ERROR enums without inhabited variants do not have discriminants","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":"error[E0080]: constant evaluation of enum discriminant resulted in non-integer\n  --> /checkout/src/test/ui/uninhabited_enum_discriminant2.rs:14:9\n   |\nLL |     B = A, //~ ERROR enums without inhabited variants do not have discriminants\n   |         ^\n\n"}
[00:41:45] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[00:41:45] {"message":"For more information about this error, try `rustc --explain E0080`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0080`.\n"}
---
[00:41:45] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zmiri -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zmiri -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN.

@bors

This comment has been minimized.

Contributor

bors commented Apr 18, 2018

⌛️ Testing commit 98fb286 with merge 77641e5...

bors added a commit that referenced this pull request Apr 18, 2018

Auto merge of #49513 - nox:univariant-fieldless-enum-as-zst, r=eddyb
Treat repr(Rust) univariant fieldless enums as ZSTs

This makes all those enums be represented the same way:

```rust
enum A1 { B1 }
enum A2 { B2 = 0 }
enum A3 { B3, C3(!) }
```

Related to #15747.

Cc @rust-lang/wg-codegen @rust-lang/lang
@bors

This comment has been minimized.

Contributor

bors commented Apr 18, 2018

💔 Test failed - status-travis

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Apr 18, 2018

Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:03:23]       Serial Number (system): VMJm1fzJgRQm
---
[01:25:20] ---- [debuginfo-lldb] debuginfo/c-style-enum.rs stdout ----
[01:25:20]  NOTE: compiletest thinks it is using LLDB version 902
[01:25:20]
[01:25:20] error: line not found in debugger output: [...]$6 = TheOnlyVariant
[01:25:20] status: exit code: 0
[01:25:20] command: "/usr/bin/python" "/Users/travis/build/rust-lang/rust/src/etc/lldb_batchmode.py" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/c-style-enum.stage2-x86_64-apple-darwin" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/c-style-enum.debugger.script"
[01:25:20] stdout:
[01:25:20] ------------------------------------------
[01:25:20] LLDB batch-mode script
[01:25:20] ----------------------
[01:25:20] Debugger commands script is '/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/c-style-enum.debugger.script'.
[01:25:20] Target executable is '/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/c-style-enum.stage2-x86_64-apple-darwin'.
[01:25:20] Current working directory is '/Users/travis/build/rust-lang/rust'
[01:25:20] Creating a target for '/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/c-style-enum.stage2-x86_64-apple-darwin'
[01:25:20] settings set auto-confirm true
[01:25:20]
[01:25:20] version
[01:25:20] lldb-902.0.73.1 Swift-4.1
[01:25:20] command script import /Users/travis/build/rust-lang/rust/./src/etc/lldb_rust_formatters.py
[01:25:20] type summary add --no-value --python-function lldb_rust_formatters.print_val -x ".*" --category Rust
[01:25:20] type category enable Rust
[01:25:20]
[01:25:20] breakpoint set --file 'c-style-enum.rs' --line 188
[01:25:20] Breakpoint 1: where = c-style-enum.stage2-x86_64-apple-darwin`c_style_enum::main::hbb767c5c3f04a105 + 75 at c-style-enum.rs:188, address = 0x0000000100000c2b
[01:25:20] run
[01:25:20] Hit breakpoint 1.1: where = c-style-enum.stage2-x86_64-apple-darwin`c_style_enum::main::hbb767c5c3f04a105 + 75 at c-style-enum.rs:188, address = 0x0000000100000c2b, resolved, hit count = 1
[01:25:20] Process 51604 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 frame #0: 0x0000000100000c2b c-style-enum.stage2-x86_64-apple-darwin`c_style_enum::main::hbb767c5c3f04a105 at c-style-enum.rs:188 185 MANUAL_THREE = OneMillion; 186 }; 187 -> 188 zzz(); // #break 189 190 // Borrow to avoid an eager load of the constant value in the static. 191 let a = &SINGLE_VARIANT; Target 0: (c-style-enum.stage2-x86_64-apple-darwin) stopped. Process 51604 launched: '/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/c-style-enum.stage2-x86_64-apple-darwin' (x86_64)
[01:25:20] print auto_one
[01:25:20] (c_style_enum::AutoDiscriminant) $0 = One
[01:25:20] print auto_two
[01:25:20] (c_style_enum::AutoDiscriminant) $1 = Two
[01:25:20] print auto_three
[01:25:20] (c_style_enum::AutoDiscriminant) $2 = Three
[01:25:20] print manual_one_hundred
[01:25:20] (c_style_enum::ManualDiscriminant) $3 = OneHundred
[01:25:20] print manual_one_thousand
[01:25:20] (c_style_enum::ManualDiscriminant) $4 = OneThousand
[01:25:20] print manual_one_million
[01:25:20] (c_style_enum::ManualDiscriminant) $5 = OneMillion
[01:25:20] print single_variant
[01:25:20] error: The expression could not be prepared to run in the target
---
[01:25:20] Error [IRForTarget]: Size of result type 'union SingleVariant {
[01:25:20]     c_style_enum::TheOnlyVariant;
[01:25:20] }' couldn't be determined
[01:25:20]
[01:25:20] ------------------------------------------
[01:25:20]
[01:25:20] thread '[debuginfo-lldb] debuginfo/c-style-enum.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2930:9
---
[01:25:20] command did not execute successfully: "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage0-tools-bin/compiletest" "--compile-lib-path" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/lib" "--run-lib-path" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/lib/rustlib/x86_64-apple-darwin/lib" "--rustc-path" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/bin/rustc" "--src-base" "/Users/travis/build/rust-lang/rust/src/test/debuginfo" "--build-base" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo" "--stage-id" "stage2-x86_64-apple-darwin" "--mode" "debuginfo-lldb" "--target" "x86_64-apple-darwin" "--host" "x86_64-apple-darwin" "--llvm-filecheck" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/llvm/build/bin/FileCheck" "--nodejs" "/Users/travis/.nvm/versions/node/v6.12.3/bin/node" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/native/rust-test-helpers" "--docck-python" "/usr/local/opt/python/bin/python2.7" "--lldb-python" "/usr/bin/python" "--lldb-version" "lldb-902.0.73.1" "--lldb-python-dir" "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python" "--llvm-version" "6.0.0\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:25:20] expected success, got: exit code: 101
[01:25:20]
[01:25:20]
[01:25:20] failed to run: /Users/travis/build/rust-lang/rust/build/bootstrap/debug/bootstrap test
[01:25:20] Build completed unsuccessfully in 0:22:14
[01:25:20] make: *** [check] Error 1
---
$ ls -lat $HOME/Library/Logs/DiagnosticReports/
total 1248
drwx------  21 travis  staff    714 Apr 18 12:11 .
-rw-------@  1 travis  staff  69158 Apr 18 12:11 stack-probes-lto.stage2-x86_64-apple-darwin_2018-04-18-121122-1_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  41181 Apr 18 12:11 stack-probes-lto.stage2-x86_64-apple-darwin_2018-04-18-121122_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  65181 Apr 18 12:11 stack-probes.stage2-x86_64-apple-darwin_2018-04-18-121115-1_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  39978 Apr 18 12:11 stack-probes.stage2-x86_64-apple-darwin_2018-04-18-121115_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10587 Apr 18 12:10 simd-target-feature-mixup.stage2-x86_64-apple-darwin_2018-04-18-121059_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10240 Apr 18 12:10 signal-exit-status.stage2-x86_64-apple-darwin_2018-04-18-121051_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10299 Apr 18 12:10 segfault-no-out-of-stack.stage2-x86_64-apple-darwin_2018-04-18-121036_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10205 Apr 18 12:10 running-with-no-runtime.stage2-x86_64-apple-darwin_2018-04-18-121035_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10217 Apr 18 12:09 lto-abort.stage2-x86_64-apple-darwin_2018-04-18-120951_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  11317 Apr 18 12:09 abort-link-to-unwinding-crates.stage2-x86_64-apple-darwin_2018-04-18-120944_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10590 Apr 18 12:09 abort.stage2-x86_64-apple-darwin_2018-04-18-120944_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  67834 Apr 18 12:09 out-of-stack.stage2-x86_64-apple-darwin_2018-04-18-120931_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  69155 Apr 18 12:09 out-of-stack.stage2-x86_64-apple-darwin_2018-04-18-120928-1_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  68745 Apr 18 12:09 out-of-stack.stage2-x86_64-apple-darwin_2018-04-18-120928-2_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  69986 Apr 18 12:09 out-of-stack.stage2-x86_64-apple-darwin_2018-04-18-120928_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  12065 Apr 18 12:06 issue-24313.stage2-x86_64-apple-darwin_2018-04-18-120631_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10815 Apr 18 12:02 backtrace.stage2-x86_64-apple-darwin_2018-04-18-120249_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10815 Apr 18 12:02 backtrace.stage2-x86_64-apple-darwin_2018-04-18-120248_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10537 Apr 18 12:02 abort-on-c-abi.stage2-x86_64-apple-darwin_2018-04-18-120242_Traviss-Mac-1044.crash
drwx------+ 15 travis  staff    510 Jan 25 19:20 ..
travis_time:end:03e66b88:start=1524054080113856000,finish=1524054080166426000,duration=52570000
travis_fold:end:after_failure.2
travis_fold:start:after_failure.3
travis_time:start:0c4ac12c
$ find $HOME/Library/Logs/DiagnosticReports -type f -name '*.crash' -not -name '*.stage2-*.crash' -not -name 'com.apple.CoreSimulator.CoreSimulatorService-*.crash' -exec printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" {} \; -exec head -750 {} \; -exec echo travis_fold":"end:crashlog \; || true
travis_time:end:0c4ac12c:start=1524054080192360000,finish=1524054080225226000,duration=32866000
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:18565d1c
$ dmesg | grep -i kill
Unable to obtain kernel buffer: Operation not permitted
usage: sudo dmesg

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

1 similar comment
@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Apr 18, 2018

Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:03:23]       Serial Number (system): VMJm1fzJgRQm
---
[01:25:20] ---- [debuginfo-lldb] debuginfo/c-style-enum.rs stdout ----
[01:25:20]  NOTE: compiletest thinks it is using LLDB version 902
[01:25:20]
[01:25:20] error: line not found in debugger output: [...]$6 = TheOnlyVariant
[01:25:20] status: exit code: 0
[01:25:20] command: "/usr/bin/python" "/Users/travis/build/rust-lang/rust/src/etc/lldb_batchmode.py" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/c-style-enum.stage2-x86_64-apple-darwin" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/c-style-enum.debugger.script"
[01:25:20] stdout:
[01:25:20] ------------------------------------------
[01:25:20] LLDB batch-mode script
[01:25:20] ----------------------
[01:25:20] Debugger commands script is '/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/c-style-enum.debugger.script'.
[01:25:20] Target executable is '/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/c-style-enum.stage2-x86_64-apple-darwin'.
[01:25:20] Current working directory is '/Users/travis/build/rust-lang/rust'
[01:25:20] Creating a target for '/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/c-style-enum.stage2-x86_64-apple-darwin'
[01:25:20] settings set auto-confirm true
[01:25:20]
[01:25:20] version
[01:25:20] lldb-902.0.73.1 Swift-4.1
[01:25:20] command script import /Users/travis/build/rust-lang/rust/./src/etc/lldb_rust_formatters.py
[01:25:20] type summary add --no-value --python-function lldb_rust_formatters.print_val -x ".*" --category Rust
[01:25:20] type category enable Rust
[01:25:20]
[01:25:20] breakpoint set --file 'c-style-enum.rs' --line 188
[01:25:20] Breakpoint 1: where = c-style-enum.stage2-x86_64-apple-darwin`c_style_enum::main::hbb767c5c3f04a105 + 75 at c-style-enum.rs:188, address = 0x0000000100000c2b
[01:25:20] run
[01:25:20] Hit breakpoint 1.1: where = c-style-enum.stage2-x86_64-apple-darwin`c_style_enum::main::hbb767c5c3f04a105 + 75 at c-style-enum.rs:188, address = 0x0000000100000c2b, resolved, hit count = 1
[01:25:20] Process 51604 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 frame #0: 0x0000000100000c2b c-style-enum.stage2-x86_64-apple-darwin`c_style_enum::main::hbb767c5c3f04a105 at c-style-enum.rs:188 185 MANUAL_THREE = OneMillion; 186 }; 187 -> 188 zzz(); // #break 189 190 // Borrow to avoid an eager load of the constant value in the static. 191 let a = &SINGLE_VARIANT; Target 0: (c-style-enum.stage2-x86_64-apple-darwin) stopped. Process 51604 launched: '/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo/c-style-enum.stage2-x86_64-apple-darwin' (x86_64)
[01:25:20] print auto_one
[01:25:20] (c_style_enum::AutoDiscriminant) $0 = One
[01:25:20] print auto_two
[01:25:20] (c_style_enum::AutoDiscriminant) $1 = Two
[01:25:20] print auto_three
[01:25:20] (c_style_enum::AutoDiscriminant) $2 = Three
[01:25:20] print manual_one_hundred
[01:25:20] (c_style_enum::ManualDiscriminant) $3 = OneHundred
[01:25:20] print manual_one_thousand
[01:25:20] (c_style_enum::ManualDiscriminant) $4 = OneThousand
[01:25:20] print manual_one_million
[01:25:20] (c_style_enum::ManualDiscriminant) $5 = OneMillion
[01:25:20] print single_variant
[01:25:20] error: The expression could not be prepared to run in the target
---
[01:25:20] Error [IRForTarget]: Size of result type 'union SingleVariant {
[01:25:20]     c_style_enum::TheOnlyVariant;
[01:25:20] }' couldn't be determined
[01:25:20]
[01:25:20] ------------------------------------------
[01:25:20]
[01:25:20] thread '[debuginfo-lldb] debuginfo/c-style-enum.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2930:9
---
[01:25:20] command did not execute successfully: "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage0-tools-bin/compiletest" "--compile-lib-path" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/lib" "--run-lib-path" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/lib/rustlib/x86_64-apple-darwin/lib" "--rustc-path" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/bin/rustc" "--src-base" "/Users/travis/build/rust-lang/rust/src/test/debuginfo" "--build-base" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/debuginfo" "--stage-id" "stage2-x86_64-apple-darwin" "--mode" "debuginfo-lldb" "--target" "x86_64-apple-darwin" "--host" "x86_64-apple-darwin" "--llvm-filecheck" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/llvm/build/bin/FileCheck" "--nodejs" "/Users/travis/.nvm/versions/node/v6.12.3/bin/node" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/native/rust-test-helpers" "--docck-python" "/usr/local/opt/python/bin/python2.7" "--lldb-python" "/usr/bin/python" "--lldb-version" "lldb-902.0.73.1" "--lldb-python-dir" "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python" "--llvm-version" "6.0.0\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:25:20] expected success, got: exit code: 101
[01:25:20]
[01:25:20]
[01:25:20] failed to run: /Users/travis/build/rust-lang/rust/build/bootstrap/debug/bootstrap test
[01:25:20] Build completed unsuccessfully in 0:22:14
[01:25:20] make: *** [check] Error 1
---
$ ls -lat $HOME/Library/Logs/DiagnosticReports/
total 1248
drwx------  21 travis  staff    714 Apr 18 12:11 .
-rw-------@  1 travis  staff  69158 Apr 18 12:11 stack-probes-lto.stage2-x86_64-apple-darwin_2018-04-18-121122-1_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  41181 Apr 18 12:11 stack-probes-lto.stage2-x86_64-apple-darwin_2018-04-18-121122_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  65181 Apr 18 12:11 stack-probes.stage2-x86_64-apple-darwin_2018-04-18-121115-1_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  39978 Apr 18 12:11 stack-probes.stage2-x86_64-apple-darwin_2018-04-18-121115_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10587 Apr 18 12:10 simd-target-feature-mixup.stage2-x86_64-apple-darwin_2018-04-18-121059_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10240 Apr 18 12:10 signal-exit-status.stage2-x86_64-apple-darwin_2018-04-18-121051_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10299 Apr 18 12:10 segfault-no-out-of-stack.stage2-x86_64-apple-darwin_2018-04-18-121036_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10205 Apr 18 12:10 running-with-no-runtime.stage2-x86_64-apple-darwin_2018-04-18-121035_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10217 Apr 18 12:09 lto-abort.stage2-x86_64-apple-darwin_2018-04-18-120951_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  11317 Apr 18 12:09 abort-link-to-unwinding-crates.stage2-x86_64-apple-darwin_2018-04-18-120944_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10590 Apr 18 12:09 abort.stage2-x86_64-apple-darwin_2018-04-18-120944_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  67834 Apr 18 12:09 out-of-stack.stage2-x86_64-apple-darwin_2018-04-18-120931_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  69155 Apr 18 12:09 out-of-stack.stage2-x86_64-apple-darwin_2018-04-18-120928-1_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  68745 Apr 18 12:09 out-of-stack.stage2-x86_64-apple-darwin_2018-04-18-120928-2_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  69986 Apr 18 12:09 out-of-stack.stage2-x86_64-apple-darwin_2018-04-18-120928_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  12065 Apr 18 12:06 issue-24313.stage2-x86_64-apple-darwin_2018-04-18-120631_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10815 Apr 18 12:02 backtrace.stage2-x86_64-apple-darwin_2018-04-18-120249_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10815 Apr 18 12:02 backtrace.stage2-x86_64-apple-darwin_2018-04-18-120248_Traviss-Mac-1044.crash
-rw-------@  1 travis  staff  10537 Apr 18 12:02 abort-on-c-abi.stage2-x86_64-apple-darwin_2018-04-18-120242_Traviss-Mac-1044.crash
drwx------+ 15 travis  staff    510 Jan 25 19:20 ..
travis_time:end:03e66b88:start=1524054080113856000,finish=1524054080166426000,duration=52570000
travis_fold:end:after_failure.2
travis_fold:start:after_failure.3
travis_time:start:0c4ac12c
$ find $HOME/Library/Logs/DiagnosticReports -type f -name '*.crash' -not -name '*.stage2-*.crash' -not -name 'com.apple.CoreSimulator.CoreSimulatorService-*.crash' -exec printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" {} \; -exec head -750 {} \; -exec echo travis_fold":"end:crashlog \; || true
travis_time:end:0c4ac12c:start=1524054080192360000,finish=1524054080225226000,duration=32866000
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:18565d1c
$ dmesg | grep -i kill
Unable to obtain kernel buffer: Operation not permitted
usage: sudo dmesg

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors

This comment has been minimized.

Contributor

bors commented Apr 24, 2018

☔️ The latest upstream changes (presumably #49933) made this pull request unmergeable. Please resolve the merge conflicts.

@bors

This comment has been minimized.

Contributor

bors commented Apr 26, 2018

☔️ The latest upstream changes (presumably #50072) made this pull request unmergeable. Please resolve the merge conflicts.

oli-obk and others added some commits Mar 31, 2018

Treat repr(Rust) univariant fieldless enums as a ZST (fixes #15747)
This makes all those enums be represented the same way:

```rust
enum A1 { B1 }
enum A2 { B2 = 0 }
enum A3 { B3, C3(!) }
```
Mark SingleVariant as repr(u8) in c-style-enum
I should rather properly fix debuginfo but I have no clue how to do that.
@eddyb

This comment has been minimized.

Member

eddyb commented Apr 26, 2018

@bors r+

@bors

This comment has been minimized.

Contributor

bors commented Apr 26, 2018

📌 Commit 1c09977 has been approved by eddyb

@bors

This comment has been minimized.

Contributor

bors commented Apr 26, 2018

⌛️ Testing commit 1c09977 with merge 7f3444e...

bors added a commit that referenced this pull request Apr 26, 2018

Auto merge of #49513 - nox:univariant-fieldless-enum-as-zst, r=eddyb
Treat repr(Rust) univariant fieldless enums as ZSTs

This makes all those enums be represented the same way:

```rust
enum A1 { B1 }
enum A2 { B2 = 0 }
enum A3 { B3, C3(!) }
```

Related to #15747.

Cc @rust-lang/wg-codegen @rust-lang/lang
@bors

This comment has been minimized.

Contributor

bors commented Apr 26, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: eddyb
Pushing 7f3444e to master...

@bors bors merged commit 1c09977 into rust-lang:master Apr 26, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

kennytm added a commit to kennytm/rust that referenced this pull request May 3, 2018

Rollup merge of rust-lang#50393 - oli-obk:packed_const_panic, r=eddyb
Allow unaligned reads in constants

fixes rust-lang#50356

introduced in rust-lang#49513

kennytm added a commit to kennytm/rust that referenced this pull request May 3, 2018

Rollup merge of rust-lang#50393 - oli-obk:packed_const_panic, r=eddyb
Allow unaligned reads in constants

fixes rust-lang#50356

introduced in rust-lang#49513
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment