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

Allow variant discriminant initializers to refer to other initializer… #50072

Merged
merged 1 commit into from
Apr 26, 2018

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Apr 19, 2018

…s of the same enum

r? @eddyb

fixes the 2.4 failure of #49765

cc @durka @retep998

@oli-obk oli-obk added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Apr 19, 2018
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 of 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:24:46]    Compiling rustc_errors v0.0.0 (file:///checkout/src/librustc_errors)
[00:25:52]    Compiling rustc_const_math v0.0.0 (file:///checkout/src/librustc_const_math)
[00:25:52]    Compiling proc_macro v0.0.0 (file:///checkout/src/libproc_macro)
[00:26:09]    Compiling syntax_ext v0.0.0 (file:///checkout/src/libsyntax_ext)
[00:28:16] thread 'main' panicked at 'bad output type for cast', libcore/option.rs:914:5
[00:28:17] error: Could not compile `rustc`.
[00:28:17] 
[00:28:17] Caused by:
[00:28:17] Caused by:
[00:28:17]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc librustc/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=7c1e997399553280 -C extra-filename=-7c1e997399553280 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/release/deps --extern bitflags=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-9f4c6335ef95c2b7.rlib --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-caf863901ba00d4d.so --extern rustc_back=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_back-24fcd3d511791c40.so --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-4acf4151e5e9c3f9.so --extern tempdir=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libtempdir-aa37d7e421cedb76.rlib --extern flate2=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libflate2-4c92306335233f21.rlib --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-ae4e6f9a0a04fcfd.so --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-e7f38b02feb371ba.so --extern jobserver=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libjobserver-6cd61d4a01d2b3fb.rlib --extern backtrace=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libbacktrace-a0b904f66c93991b.rlib --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-94d776423bcbc65e.rlib --extern fmt_macros=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libfmt_macros-3d30704c9bf94823.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-07d9bc58d0cd25b1.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-07d9bc58d0cd25b1.rlib --extern rustc_apfloat=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_apfloat-30add66c119d2ec6.rlib --extern byteorder=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libbyteorder-77b7f1eec921fd34.rlib --extern graphviz=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libgraphviz-d401bc3652c24ca6.so --extern rustc_errors=/checkout/obj/bu

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:37e12d0f
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 of 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:22:17]    Compiling rustc_errors v0.0.0 (file:///checkout/src/librustc_errors)
[00:23:16]    Compiling proc_macro v0.0.0 (file:///checkout/src/libproc_macro)
[00:23:16]    Compiling rustc_const_math v0.0.0 (file:///checkout/src/librustc_const_math)
[00:23:31]    Compiling syntax_ext v0.0.0 (file:///checkout/src/libsyntax_ext)
[00:25:24] thread 'main' panicked at 'bad output type for cast', libcore/option.rs:914:5
[00:25:24] error: Could not compile `rustc`.
[00:25:24] 
[00:25:24] Caused by:
[00:25:24] Caused by:
[00:25:24]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc librustc/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=7c1e997399553280 -C extra-filename=-7c1e997399553280 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/release/deps --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-4acf4151e5e9c3f9.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-07d9bc58d0cd25b1.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-07d9bc58d0cd25b1.rlib --extern jobserver=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libjobserver-6cd61d4a01d2b3fb.rlib --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-4751eaacfa9b82b1.so --extern rustc_back=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_back-24fcd3d511791c40.so --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-e7f38b02feb371ba.so --extern graphviz=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libgraphviz-d401bc3652c24ca6.so --extern rustc_const_math=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_const_math-c4c7b11d5784a197.so --extern flate2=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libflate2-4c92306335233f21.rlib --extern proc_macro=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libproc_macro-2aaace06ba339c38.so --extern tempdir=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libtempdir-aa37d7e421cedb76.rlib --extern bitflags=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-9f4c6335ef95c2b7.rlib --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-ae4e6f9a0a04fcfd.so --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-caf863901ba00d4d.so --extern rustc_apfloat=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_apfloat-30add66c119d2ec6.rlib --extern lazy_static=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/liblazy_static-09b95d7d6a834aae.rlib --extern fmt_macros=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libfmt_macros-3d30704c9bf94823.so --extern byteorder=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libbyteorder-77b7f1eec921fd34.rlib --extern backtrace=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libbacktrace-a0b904f66c93991b.rlib --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-94d776423bcbc65e.rlib -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-306b41e2ad232afa/out/.libs -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-21ebc33766ad71e1/out` (exit code: 101)
[00:25:24] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "--release" "--locked" "--color" "always" "--features" " jemalloc" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:25:24] expected success, got: exit code: 101
[00:25:24] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1091:9
[00:25:24] travis_fold:end:stage1-rustc

[00:25:24] travis_time:end:stage1-rustc:start=1524140604661055290,finish=1524140821035303793,duration=216374248503

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)

explicit_value.checked_add(tcx, offset as u128).0
}

/// Yields a DefId for the discriminant, an offset to add to it and an initial discriminant
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this was cut off (missing "and"?).

.cast_kinds()
.get(source.hir_id) {
// Convert the lexpr to a vexpr.
ExprKind::Use { source: source.to_ref() }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-reminder that this check should always apply (i.e. be higher up than the variant check) because of things like Enum::Variant as Enum.

@durka
Copy link
Contributor

durka commented Apr 20, 2018

So this basically narrowly allows referring to other variants, as long as you cast it to an int?

@oli-obk
Copy link
Contributor Author

oli-obk commented Apr 20, 2018

Yes. This is what was happening before, too.

@oli-obk oli-obk force-pushed the discriminants branch 2 times, most recently from 9c9793a to 3e35d77 Compare April 20, 2018 07:25
@oli-obk
Copy link
Contributor Author

oli-obk commented Apr 20, 2018

@eddyb done

@oli-obk oli-obk added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 20, 2018
@pietroalbini pietroalbini added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 20, 2018
@oli-obk
Copy link
Contributor Author

oli-obk commented Apr 23, 2018

Ping @eddyb

ExprKind::Cast { source: source.to_ref() }
// check whether this is casting an enum variant discriminant
// to prevent cycles, we refer to the discriminant initializer
// which is probably `isize` and thus doesn't need to know the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/probably isize and thus doesn't need to know/always an integer and (hopefully) doesn't need to know

};
ExprKind::Cast { source: source.to_ref() }
} else {
ExprKind::Cast { source: source.to_ref() }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this line be deduplicated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the source binding is of different type

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the result of calling .to_ref()?

},
None => mk_const(
cx.tcx(),
ConstVal::Value(Value::ByVal(PrimVal::Bytes(offset as u128))),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this mk_const be deduplicated between the two match arms?

None
};
if let Some((did, offset, ty)) = var {
let mk_const = |tcx: ty::TyCtxt<'a, 'gcx, 'tcx>, val| Expr {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to take tcx? It should have cx in scope - worst case, you do a let tcx = cx.tcx(); before the closure.

@@ -664,10 +664,11 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
},
None => offset,
};
ExprKind::Cast { source: source.to_ref() }
source.to_ref()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, if I think more about this, mk_const should also call .to_ref(), to reduce the number of calls further (and to avoid having an inner source variable too.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 of 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:06:36]    Compiling proc_macro v0.0.0 (file:///checkout/src/libproc_macro)
[00:06:59]    Compiling syntax_ext v0.0.0 (file:///checkout/src/libsyntax_ext)
[00:13:00]    Compiling rustc_mir v0.0.0 (file:///checkout/src/librustc_mir)
[00:13:00]    Compiling rustc_typeck v0.0.0 (file:///checkout/src/librustc_typeck)
[00:13:02] error[E0425]: cannot find value `base` in this scope
[00:13:02]    --> librustc_mir/hair/cx/expr.rs:652:45
[00:13:02]     |
[00:13:02] 652 |                             trace!("{:#?}", base);
[00:13:02] 
[00:13:13] error: aborting due to previous error
[00:13:13] 
[00:13:13] For more information about this error, try `rustc --explain E0425`.
[00:13:13] For more information about this error, try `rustc --explain E0425`.
[00:13:13] error: Could not compile `rustc_mir`.
[00:13:13] 
[00:13:13] Caused by:
[00:13:13]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_mir librustc_mir/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=809b6518a044b653 -C extra-filename=-809b6518a044b653 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern rustc_back=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_back-861dba9fe03aa669.so --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-93cb1ddd29ab61a4.so --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-609e2421d03f9c9a.so --extern graphviz=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libgraphviz-0bde40de32995f14.so --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-dd80e21b25e89693.so --extern byteorder=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbyteorder-ca61dfec7c40c4d4.rlib --extern log_settings=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog_settings-70f7ed359bd54256.rlib --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-3e9ac89279d9d9fd.so --extern rustc_const_math=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_const_math-895f7ddc4467bb8d.so --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-3e35efb9e5bc7a9a.rlib --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-9f3518d56a01456f.so --extern bitflags=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-9866e194db82a141.rlib --extern rustc_apfloat=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_apfloat-1299638d641ea770.rlib --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-d3b6fcf798f7d22a.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-c04ded78717d5d67.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-c04ded78717d5d67.rlib -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-22398a187b4139a2/out/.libs -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-4a7fffed6b170d5b/out` (exit code: 101)

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)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 of 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:06:38]    Compiling proc_macro v0.0.0 (file:///checkout/src/libproc_macro)
[00:07:01]    Compiling syntax_ext v0.0.0 (file:///checkout/src/libsyntax_ext)
[00:13:00]    Compiling rustc_typeck v0.0.0 (file:///checkout/src/librustc_typeck)
[00:13:00]    Compiling rustc_mir v0.0.0 (file:///checkout/src/librustc_mir)
[00:13:08] error[E0308]: match arms have incompatible types
[00:13:08]    --> librustc_mir/hair/cx/expr.rs:646:21
[00:13:08] 646 | /                     match did {
[00:13:08] 646 | /                     match did {
[00:13:08] 647 | |                         Some(did) => {
[00:13:08] 648 | |                             // in case we are offsetting from a computed discriminant
[00:13:08] 649 | |                             // and not the beginning of discriminants (which is always `0`)
[00:13:08] ...   |
[00:13:08] 664 | |                         None => offset,
[00:13:08]     | |                                 ------ match arm with an incompatible type
[00:13:08] 665 | |                     }
[00:13:08]     | |_____________________^ expected struct `hair::Expr`, found enum `hair::ExprRef`
[00:13:08]     |
[00:13:08]     = note: expected type `hair::Expr<'_>`
[00:13:08]                found type `hair::ExprRef<'_>`
[00:13:13] error: aborting due to previous error
[00:13:13] 
[00:13:13] For more information about this error, try `rustc --explain E0308`.
[00:13:13] error: Could not compile `rustc_mir`.
[00:13:13] error: Could not compile `rustc_mir`.
[00:13:13] 
[00:13:13] Caused by:
[00:13:13]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_mir librustc_mir/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=809b6518a044b653 -C extra-filename=-809b6518a044b653 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-3e9ac89279d9d9fd.so --extern log_settings=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog_settings-70f7ed359bd54256.rlib --extern byteorder=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbyteorder-ca61dfec7c40c4d4.rlib --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-93cb1ddd29ab61a4.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-c04ded78717d5d67.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-c04ded78717d5d67.rlib --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-9f3518d56a01456f.so --extern rustc_const_math=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_const_math-895f7ddc4467bb8d.so --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-609e2421d03f9c9a.so --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-3e35efb9e5bc7a9a.rlib --extern bitflags=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-9866e194db82a141.rlib --extern rustc_apfloat=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_apfloat-1299638d641ea770.rlib --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-d3b6fcf798f7d22a.so --extern rustc_back=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_back-861dba9fe03aa669.so --extern graphviz=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libgraphviz-0bde40de32995f14.so --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-dd80e21b25e89693.so -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-22398a187b4139a2/out/.libs -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-4a7fffed6b170d5b/out` (exit code: 101)
[00:14:50] error: build failed
[00:14:50] error: build failed
[00:14:50] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "--release" "--locked" "--color" "always" "--features" " jemalloc" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:14:50] expected success, got: exit code: 101
[00:14:50] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1091:9
[00:14:50] travis_fold:end:stage0-rustc

[00:14:50] travis_time:end:stage0-rustc:start=1524651203586423494,finish=1524651814846263294,duration=611259839800


[00:14:50] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:14:50] Build completed unsuccessfully in 0:10:23
[00:14:50] Makefile:28: recipe for target 'all' failed
[00:14:50] make: *** [all] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0a482a92
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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)

@eddyb
Copy link
Member

eddyb commented Apr 25, 2018

@bors r+ p=5

@bors
Copy link
Contributor

bors commented Apr 25, 2018

📌 Commit 33f9c7e has been approved by eddyb

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 25, 2018
@bors
Copy link
Contributor

bors commented Apr 25, 2018

⌛ Testing commit 33f9c7e6fe684883c0e54149245d7fc189940768 with merge dc769e14f23510fff06476b4a31bc9b27ec4e4fb...

@eddyb
Copy link
Member

eddyb commented Apr 25, 2018

Oops, I was hoping @oli-obk would get to fix it in time and didn't cancel my r+ 😞.

@bors
Copy link
Contributor

bors commented Apr 25, 2018

💔 Test failed - status-travis

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-debug of 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:06:18]    Compiling rustc_allocator v0.0.0 (file:///checkout/src/librustc_allocator)
[00:06:18]    Compiling rustc_resolve v0.0.0 (file:///checkout/src/librustc_resolve)
[00:06:21]    Compiling rustc_traits v0.0.0 (file:///checkout/src/librustc_traits)
[00:06:23]    Compiling rustc_plugin v0.0.0 (file:///checkout/src/librustc_plugin)
[00:06:24] error[E0308]: match arms have incompatible types
[00:06:24]    --> librustc_mir/hair/cx/expr.rs:646:21
[00:06:24] 646 | /                     match did {
[00:06:24] 646 | /                     match did {
[00:06:24] 647 | |                         Some(did) => {
[00:06:24] 648 | |                             // in case we are offsetting from a computed discriminant
[00:06:24] 649 | |                             // and not the beginning of discriminants (which is always `0`)
[00:06:24] ...   |
[00:06:24] 664 | |                         None => offset,
[00:06:24]     | |                                 ------ match arm with an incompatible type
[00:06:24] 665 | |                     }
[00:06:24]     | |_____________________^ expected struct `hair::Expr`, found enum `hair::ExprRef`
[00:06:24]     |
[00:06:24]     = note: expected type `hair::Expr<'_>`
[00:06:24]                found type `hair::ExprRef<'_>`
[00:06:28] error: aborting due to previous error
[00:06:28] 
[00:06:28] For more information about this error, try `rustc --explain E0308`.
[00:06:28] error: Could not compile `rustc_mir`.
[00:06:28] error: Could not compile `rustc_mir`.
[00:06:28] 
[00:06:28] Caused by:
[00:06:28]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_mir librustc_mir/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,metadata -C prefer-dynamic -C debug-assertions=off -C overflow-checks=on -C metadata=4a095d98bf09b735 -C extra-filename=-4a095d98bf09b735 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C incremental=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/incremental -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-44651fb323089e23.rmeta --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-c43c75e6fa38c52c.rmeta --extern rustc_apfloat=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_apfloat-4779ef091a9cf2d0.rmeta --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-5726b7c8b62bc86c.rmeta --extern byteorder=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbyteorder-558590efb5478820.rmeta --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-42e2b3d79b612245.rmeta --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-b90d1b4d1642a393.rmeta --extern graphviz=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libgraphviz-e790766762a27d5b.rmeta --extern rustc_const_math=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_const_math-2bde2a5e13686daa.rmeta --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-75f2b25c19b6a07d.rmeta --extern rustc_back=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_back-dab4dcedeb876e0f.rmeta --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-90283f9e250487de.rmeta --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-ee064adeca477563.rmeta --extern log_settings=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog_settings-1641cbd4836aff89.rmeta --extern bitflags=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-1dffe97d0651361b.rmeta -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-22398a187b4139a2/out/.libs -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-4a7fffed6b170d5b/out` (exit code: 101)
[00:06:34] error: build failed
[00:06:34] error: build failed
[00:06:34] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--color" "always" "--features" " jemalloc" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:06:34] expected success, got: exit code: 101
[00:06:34] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1091:9
[00:06:34] travis_fold:end:stage0-rustc

[00:06:34] travis_time:end:stage0-rustc:start=1524656124701754019,finish=1524656303500906554,duration=178799152535

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 bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 25, 2018
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-debug of 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:06:18]    Compiling rustc_allocator v0.0.0 (file:///checkout/src/librustc_allocator)
[00:06:18]    Compiling rustc_resolve v0.0.0 (file:///checkout/src/librustc_resolve)
[00:06:21]    Compiling rustc_traits v0.0.0 (file:///checkout/src/librustc_traits)
[00:06:23]    Compiling rustc_plugin v0.0.0 (file:///checkout/src/librustc_plugin)
[00:06:24] error[E0308]: match arms have incompatible types
[00:06:24]    --> librustc_mir/hair/cx/expr.rs:646:21
[00:06:24] 646 | /                     match did {
[00:06:24] 646 | /                     match did {
[00:06:24] 647 | |                         Some(did) => {
[00:06:24] 648 | |                             // in case we are offsetting from a computed discriminant
[00:06:24] 649 | |                             // and not the beginning of discriminants (which is always `0`)
[00:06:24] ...   |
[00:06:24] 664 | |                         None => offset,
[00:06:24]     | |                                 ------ match arm with an incompatible type
[00:06:24] 665 | |                     }
[00:06:24]     | |_____________________^ expected struct `hair::Expr`, found enum `hair::ExprRef`
[00:06:24]     |
[00:06:24]     = note: expected type `hair::Expr<'_>`
[00:06:24]                found type `hair::ExprRef<'_>`
[00:06:28] error: aborting due to previous error
[00:06:28] 
[00:06:28] For more information about this error, try `rustc --explain E0308`.
[00:06:28] error: Could not compile `rustc_mir`.
[00:06:28] error: Could not compile `rustc_mir`.
[00:06:28] 
[00:06:28] Caused by:
[00:06:28]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_mir librustc_mir/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,metadata -C prefer-dynamic -C debug-assertions=off -C overflow-checks=on -C metadata=4a095d98bf09b735 -C extra-filename=-4a095d98bf09b735 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C incremental=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/incremental -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-44651fb323089e23.rmeta --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-c43c75e6fa38c52c.rmeta --extern rustc_apfloat=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_apfloat-4779ef091a9cf2d0.rmeta --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-5726b7c8b62bc86c.rmeta --extern byteorder=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbyteorder-558590efb5478820.rmeta --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-42e2b3d79b612245.rmeta --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-b90d1b4d1642a393.rmeta --extern graphviz=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libgraphviz-e790766762a27d5b.rmeta --extern rustc_const_math=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_const_math-2bde2a5e13686daa.rmeta --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-75f2b25c19b6a07d.rmeta --extern rustc_back=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_back-dab4dcedeb876e0f.rmeta --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-90283f9e250487de.rmeta --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-ee064adeca477563.rmeta --extern log_settings=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog_settings-1641cbd4836aff89.rmeta --extern bitflags=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-1dffe97d0651361b.rmeta -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-22398a187b4139a2/out/.libs -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-4a7fffed6b170d5b/out` (exit code: 101)
[00:06:34] error: build failed
[00:06:34] error: build failed
[00:06:34] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--color" "always" "--features" " jemalloc" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:06:34] expected success, got: exit code: 101
[00:06:34] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1091:9
[00:06:34] travis_fold:end:stage0-rustc

[00:06:34] travis_time:end:stage0-rustc:start=1524656124701754019,finish=1524656303500906554,duration=178799152535

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)

@pietroalbini pietroalbini added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 25, 2018
@nikomatsakis nikomatsakis added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Apr 25, 2018
@oli-obk
Copy link
Contributor Author

oli-obk commented Apr 26, 2018

@bors r=eddyb p=5

sorry about that. Yesterday I had no PC available to me to actually check stuff.

@bors
Copy link
Contributor

bors commented Apr 26, 2018

📌 Commit 195c9f4 has been approved by eddyb

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 26, 2018
@bors
Copy link
Contributor

bors commented Apr 26, 2018

⌛ Testing commit 195c9f4 with merge 3eca70a...

bors added a commit that referenced this pull request Apr 26, 2018
Allow variant discriminant initializers to refer to other initializer…

…s of the same enum

r? @eddyb

fixes the 2.4 failure of #49765

cc @durka @retep998
@bors
Copy link
Contributor

bors commented Apr 26, 2018

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

@bors bors merged commit 195c9f4 into rust-lang:master Apr 26, 2018
@oli-obk oli-obk deleted the discriminants branch April 26, 2018 12:45
bors added a commit that referenced this pull request Apr 26, 2018
[beta] Backport #50072

* #50072: Allow variant discriminant initializers to refer to other initializers of the same enum
@pietroalbini pietroalbini removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Apr 26, 2018
Centril added a commit to Centril/rust that referenced this pull request Jul 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants