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

Unsized locals and async ICE #68543

Open
DutchGhost opened this issue Jan 25, 2020 · 1 comment
Open

Unsized locals and async ICE #68543

DutchGhost opened this issue Jan 25, 2020 · 1 comment

Comments

@DutchGhost
Copy link
Contributor

@DutchGhost DutchGhost commented Jan 25, 2020

The following ICE's:

#![feature(unsized_locals)]

use std::future::Future;

async fn bug<T>(mut f: dyn Future<Output = T> + Unpin) -> T {
    (&mut f).await
}
Backtrace:
  Compiling playground v0.0.1 (/playground)
warning: function is never used: `bug`
 --> src/lib.rs:5:10
  |
5 | async fn bug<T>(mut f: dyn Future<Output = T> + Unpin) -> T {
  |          ^^^
  |
  = note: `#[warn(dead_code)]` on by default

thread 'rustc' panicked at 'assertion failed: !field.is_unsized()', src/librustc/ty/layout.rs:719:25
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.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:1426
   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:476
  12: std::panicking::begin_panic
  13: rustc::ty::layout::LayoutCx<rustc::ty::context::TyCtxt>::layout_raw_uncached
  14: rustc::ty::layout::layout_raw
  15: rustc::ty::query::__query_compute::layout_raw
  16: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::layout_raw>::compute
  17: rustc::dep_graph::graph::DepGraph::with_task_impl
  18: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  19: <rustc::ty::layout::LayoutCx<rustc::ty::context::TyCtxt> as rustc_target::abi::LayoutOf>::layout_of
  20: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
  21: <core::iter::adapters::chain::Chain<A,B> as core::iter::traits::iterator::Iterator>::try_fold
  22: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
  23: rustc::ty::layout::LayoutCx<rustc::ty::context::TyCtxt>::layout_raw_uncached
  24: rustc::ty::layout::layout_raw
  25: rustc::ty::query::__query_compute::layout_raw
  26: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::layout_raw>::compute
  27: rustc::dep_graph::graph::DepGraph::with_task_impl
  28: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  29: <rustc::ty::layout::LayoutCx<rustc::ty::context::TyCtxt> as rustc_target::abi::LayoutOf>::layout_of
  30: <core::iter::adapters::ResultShunt<I,E> as core::iter::traits::iterator::Iterator>::next
  31: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
  32: <core::iter::adapters::ResultShunt<I,E> as core::iter::traits::iterator::Iterator>::next
  33: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
  34: core::iter::adapters::process_results
  35: rustc::ty::layout::LayoutCx<rustc::ty::context::TyCtxt>::layout_raw_uncached
  36: rustc::ty::layout::layout_raw
  37: rustc::ty::query::__query_compute::layout_raw
  38: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::layout_raw>::compute
  39: rustc::dep_graph::graph::DepGraph::with_task_impl
  40: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  41: <rustc::ty::layout::LayoutCx<rustc::ty::query::TyCtxtAt> as rustc_target::abi::LayoutOf>::layout_of
  42: <rustc_mir::transform::const_prop::ConstProp as rustc_mir::transform::MirPass>::run_pass
  43: rustc_mir::transform::run_passes
  44: rustc_mir::transform::run_optimization_passes
  45: rustc_mir::transform::optimized_mir
  46: rustc::ty::query::__query_compute::optimized_mir
  47: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::optimized_mir>::compute
  48: rustc::dep_graph::graph::DepGraph::with_task_impl
  49: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  50: rustc_metadata::rmeta::encoder::EncodeContext::encode_optimized_mir
  51: <rustc_metadata::rmeta::encoder::EncodeContext as rustc_hir::intravisit::Visitor>::visit_item
  52: rustc_hir::hir::Crate::visit_all_item_likes
  53: rustc_metadata::rmeta::encoder::EncodeContext::encode_crate_root
  54: rustc::ty::context::tls::with_context::{{closure}}
  55: rustc_metadata::rmeta::encoder::encode_metadata
  56: rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc::middle::cstore::CrateStore for rustc_metadata::creader::CStore>::encode_metadata
  57: rustc::ty::context::TyCtxt::encode_metadata
  58: rustc_interface::passes::QueryContext::enter
  59: rustc_interface::queries::Queries::ongoing_codegen
  60: rustc_interface::interface::run_compiler_in_existing_thread_pool
  61: scoped_tls::ScopedKey<T>::set
  62: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

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.42.0-nightly (c2d141df5 2020-01-24) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C codegen-units=1 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [layout_raw] computing layout of `std::mem::MaybeUninit<dyn std::future::Future<Output = T> + std::marker::Unpin>`
#1 [layout_raw] computing layout of `[static generator@src/lib.rs:5:61: 7:2 __arg0:dyn std::future::Future<Output = T> + std::marker::Unpin for<'r, 's, 't0, 't1, 't2, 't3, 't4> {(dyn std::future::Future<Output = T> + std::marker::Unpin + 'r), (dyn std::future::Future<Output = T> + std::marker::Unpin + 's), (dyn std::future::Future<Output = T> + std::marker::Unpin + 't0), &'t1 mut (dyn std::future::Future<Output = T> + std::marker::Unpin + 't2), &'t3 mut (dyn std::future::Future<Output = T> + std::marker::Unpin + 't4), (), ()}]`
#2 [layout_raw] computing layout of `std::future::GenFuture<[static generator@src/lib.rs:5:61: 7:2 __arg0:dyn std::future::Future<Output = T> + std::marker::Unpin for<'r, 's, 't0, 't1, 't2, 't3, 't4> {(dyn std::future::Future<Output = T> + std::marker::Unpin + 'r), (dyn std::future::Future<Output = T> + std::marker::Unpin + 's), (dyn std::future::Future<Output = T> + std::marker::Unpin + 't0), &'t1 mut (dyn std::future::Future<Output = T> + std::marker::Unpin + 't2), &'t3 mut (dyn std::future::Future<Output = T> + std::marker::Unpin + 't4), (), ()}]>`
#3 [optimized_mir] processing `bug`
end of query stack
error: could not compile `playground`.

To learn more, run the command again with --verbose.
@tmandry

This comment has been minimized.

Copy link
Contributor

@tmandry tmandry commented Jan 28, 2020

Visiting from async/await triage. Not making this a priority at the moment because it depends on an unstable feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.