-
Notifications
You must be signed in to change notification settings - Fork 13.4k
ICE when yield
is used as an argument to println!
#69017
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Hmm, const promotion seems to mistakenly think it can promote |
cc @rust-lang/wg-const-eval |
searched nightlies: from nightly-2020-02-01 to nightly-2020-02-08 Instructions
ErrorCOLLAPSIBLE ERROR STACKTRACE
Compiling playground v0.0.1 (/playground)
error: internal compiler error: src/librustc_mir/transform/promote_consts.rs:467: _1 = suspend(move _21) -> [resume: bb2, drop: bb3] not promotable
--> src/lib.rs:8:27
|
8 | println!("-> {}", yield);
| ^^^^^
thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:77
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
at src/libcore/fmt/mod.rs:1052
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1428
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:62
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:204
9: std::panicking::default_hook
at src/libstd/panicking.rs:224
10: rustc_driver::report_ice
11: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:474
12: std::panicking::begin_panic
13: rustc_errors::HandlerInner::span_bug
14: rustc_errors::Handler::span_bug
15: rustc::util::bug::opt_span_bug_fmt::{{closure}}
16: rustc::ty::context::tls::with_opt::{{closure}}
17: rustc::ty::context::tls::with_opt
18: rustc::util::bug::opt_span_bug_fmt
19: rustc::util::bug::span_bug_fmt
20: rustc_mir::transform::promote_consts::Validator::validate_local
21: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
22: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
23: <rustc_mir::transform::promote_consts::PromoteTemps as rustc_mir::transform::MirPass>::run_pass
24: rustc_mir::transform::run_passes
25: rustc_mir::transform::mir_validated
26: rustc::ty::query::__query_compute::mir_validated
27: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
28: rustc_mir::borrow_check::mir_borrowck
29: rustc::ty::query::__query_compute::mir_borrowck
30: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
31: rustc_mir::borrow_check::type_check::TypeChecker::check_rvalue
32: rustc_mir::borrow_check::type_check::TypeChecker::typeck_mir
33: rustc_mir::borrow_check::type_check::type_check
34: rustc_mir::borrow_check::nll::compute_regions
35: rustc_mir::borrow_check::do_mir_borrowck
36: rustc::ty::context::GlobalCtxt::enter_local
37: rustc_mir::borrow_check::mir_borrowck
38: rustc::ty::query::__query_compute::mir_borrowck
39: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::mir_borrowck>::compute
40: rustc::dep_graph::graph::DepGraph::with_task_impl
41: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
42: rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners
43: rustc_interface::passes::analysis
44: rustc::ty::query::__query_compute::analysis
45: rustc::dep_graph::graph::DepGraph::with_task_impl
46: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
47: rustc::ty::context::tls::enter_global
48: rustc_interface::interface::run_compiler_in_existing_thread_pool
49: scoped_tls::ScopedKey<T>::set
50: syntax::attr::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.43.0-nightly (71c7e149e 2020-02-09) running on x86_64-unknown-linux-gnu
note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [mir_validated] processing `gen::{{closure}}#0`
#1 [mir_borrowck] processing `gen::{{closure}}#0`
#2 [mir_borrowck] processing `gen`
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error
error: could not compile `playground`.
To learn more, run the command again with --verbose. |
@chrissimpkins yeah this is caused by resume arguments |
In the given rollup I'd guess it's caused by #68524 Essentially the issue is that we didn't know there were terminators other than The fix should be as trivial as making https://github.com/rust-lang/rust/blob/master/src/librustc_mir/transform/promote_consts.rs#L465-L468 handle |
Maybe even simple enough for me :) I took a stab at it. Looks like this does address it. |
@rustbot claim |
…t-lang#69017, r=petrochenkov ICE in nightly-2020-02-08: handle TerminatorKind::Yield in librustc_mir::transform::promote_consts::Validator method IR: rust-lang#69017 regressed commit: rust-lang@f8fd462 Source: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=55e65a869e1f5fef64cc4462b1a5a087 Addresses ICE reported in rust-lang#69017 by handling `TerminatorKind::Yield` in https://github.com/rust-lang/rust/blob/4d1241f5158ffd66730e094d8f199ed654ed52ae/src/librustc_mir/transform/promote_consts.rs#L465-L468. <details><summary>Nightly build</summary> <p> ``` $ cargo +nightly build Compiling yielder v0.1.0 (/Users/chris/Desktop/tests/rustlang-tests/yielder) error: internal compiler error: src/librustc_mir/transform/promote_consts.rs:467: _1 = suspend(move _21) -> [resume: bb2, drop: bb3] not promotable --> src/main.rs:8:27 | 8 | println!("-> {}", yield); | ^^^^^ thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports note: rustc 1.43.0-nightly (71c7e14 2020-02-09) running on x86_64-apple-darwin note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin note: some of the compiler flags provided by cargo are hidden error: aborting due to previous error error: could not compile `yielder`. To learn more, run the command again with --verbose. ``` </p> </details> <details><summary>Stage 1 dev build</summary> <p> ``` $ cargo +stage1 build Compiling yielder v0.1.0 (/Users/chris/Desktop/tests/rustlang-tests/yielder) warning: function is never used: `gen` --> src/main.rs:6:4 | 6 | fn gen() -> impl Generator<usize> { | ^^^ | = note: `#[warn(dead_code)]` on by default Finished dev [unoptimized + debuginfo] target(s) in 0.53s ``` </p> </details> @jonas-schievink @oli-obk
…t-lang#69017, r=petrochenkov ICE in nightly-2020-02-08: handle TerminatorKind::Yield in librustc_mir::transform::promote_consts::Validator method IR: rust-lang#69017 regressed commit: rust-lang@f8fd462 Source: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=55e65a869e1f5fef64cc4462b1a5a087 Addresses ICE reported in rust-lang#69017 by handling `TerminatorKind::Yield` in https://github.com/rust-lang/rust/blob/4d1241f5158ffd66730e094d8f199ed654ed52ae/src/librustc_mir/transform/promote_consts.rs#L465-L468. <details><summary>Nightly build</summary> <p> ``` $ cargo +nightly build Compiling yielder v0.1.0 (/Users/chris/Desktop/tests/rustlang-tests/yielder) error: internal compiler error: src/librustc_mir/transform/promote_consts.rs:467: _1 = suspend(move _21) -> [resume: bb2, drop: bb3] not promotable --> src/main.rs:8:27 | 8 | println!("-> {}", yield); | ^^^^^ thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports note: rustc 1.43.0-nightly (71c7e14 2020-02-09) running on x86_64-apple-darwin note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin note: some of the compiler flags provided by cargo are hidden error: aborting due to previous error error: could not compile `yielder`. To learn more, run the command again with --verbose. ``` </p> </details> <details><summary>Stage 1 dev build</summary> <p> ``` $ cargo +stage1 build Compiling yielder v0.1.0 (/Users/chris/Desktop/tests/rustlang-tests/yielder) warning: function is never used: `gen` --> src/main.rs:6:4 | 6 | fn gen() -> impl Generator<usize> { | ^^^ | = note: `#[warn(dead_code)]` on by default Finished dev [unoptimized + debuginfo] target(s) in 0.53s ``` </p> </details> @jonas-schievink @oli-obk
merged to master in #69094 |
Thanks for fixing this! |
Thanks to you and Oliver for helping me! |
Uh oh!
There was an error while loading. Please reload this page.
Hi,
playground link
ICEs, on today's nightly, with:
backtrace
This issue has been assigned to @chrissimpkins via this comment.
The text was updated successfully, but these errors were encountered: