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

None.unwrap() in FnCtxt::instantiate_anon_types #44437

Closed
Arnavion opened this Issue Sep 8, 2017 · 5 comments

Comments

Projects
None yet
6 participants
@Arnavion
Copy link

Arnavion commented Sep 8, 2017

rustc 1.22.0-nightly (d93036a04 2017-09-07)
binary: rustc
commit-hash: d93036a043dbd19f394ad320313bdbe81644f121
commit-date: 2017-09-07
host: x86_64-pc-windows-msvc
release: 1.22.0-nightly
LLVM version: 4.0
  • foo/src/main.rs

     extern crate bar;
    
     fn main() {
     	let quux = ::bar::baz();
     	let r = Ok::<_, ()>(quux);
     	r.or_else(|err| Err(err));
     }
  • bar/src/lib.rs

     #![feature(conservative_impl_trait)]
    
     pub trait Stream { }
    
     pub fn baz() -> impl Stream {
     	Baz
     }
    
     pub struct Baz;
    
     impl Stream for Baz { }

Edit: Removed useless stack trace. Better stack trace in second comment.

@Zoxc

This comment has been minimized.

Copy link
Contributor

Zoxc commented Oct 14, 2017

Looks like your stack trace is useless and the unwrap isn't in the stack trace even with debug information (this is were we need rust-lang/rfcs#2091 (comment)) . I think the following code is the unwrap which failed, however I can't be sure without doing a debug build of rustc. This is definitely not related to generators though.

let id = self.tcx.hir.as_local_node_id(def_id).unwrap();

@Arnavion

This comment has been minimized.

Copy link
Author

Arnavion commented Oct 14, 2017

rustc 1.22.0-nightly (02a24dbdd 2017-10-13)
binary: rustc
commit-hash: 02a24dbdd8c3a5daa6578af72116020de75b5f93
commit-date: 2017-10-13
host: x86_64-unknown-linux-gnu
release: 1.22.0-nightly
LLVM version: 4.0
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:335:20
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:69
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:58
             at /checkout/src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:391
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:577
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:538
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:522
   7: rust_begin_unwind
             at /checkout/src/libstd/panicking.rs:498
   8: core::panicking::panic_fmt
             at /checkout/src/libcore/panicking.rs:71
   9: core::panicking::panic
             at /checkout/src/libcore/panicking.rs:51
  10: <rustc::ty::fold::BottomUpFolder<'a, 'gcx, 'tcx, F> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
  11: rustc::ty::subst::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::Slice<rustc::ty::subst::Kind<'tcx>>>::super_fold_with
  12: <rustc::ty::fold::BottomUpFolder<'a, 'gcx, 'tcx, F> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
  13: rustc_typeck::check::check_fn
  14: rustc_typeck::check::closure::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_closure
  15: rustc_typeck::check::FnCtxt::check_expr_kind
  16: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref
  17: rustc_typeck::check::FnCtxt::check_argument_types
  18: rustc_typeck::check::FnCtxt::check_method_argument_types
  19: rustc_typeck::check::FnCtxt::check_expr_kind
  20: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref
  21: rustc_typeck::check::FnCtxt::check_block_with_expected::{{closure}}
  22: rustc_typeck::check::FnCtxt::check_block_with_expected
  23: rustc_typeck::check::FnCtxt::check_expr_kind
  24: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref
  25: rustc_typeck::check::FnCtxt::check_return_expr
  26: rustc_typeck::check::check_fn
  27: rustc_typeck::check::typeck_tables_of::{{closure}}
  28: rustc_typeck::check::typeck_tables_of
  29: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::force
  30: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get
  31: rustc::ty::maps::TyCtxtAt::typeck_tables_of
  32: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_tables_of
  33: rustc_typeck::check::typeck_item_bodies
  34: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::force
  35: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get
  36: rustc::ty::maps::TyCtxtAt::typeck_item_bodies
  37: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_item_bodies
  38: rustc_typeck::check_crate
  39: rustc::ty::context::TyCtxt::create_and_enter
  40: rustc_driver::driver::compile_input
  41: rustc_driver::run_compiler

@Arnavion Arnavion changed the title None.unwrap() in rustc_typeck::check::generator_interior::InteriorVisitor::visit_body None.unwrap() in FnCtxt::instantiate_anon_types Oct 14, 2017

@arielb1

This comment has been minimized.

Copy link
Contributor

arielb1 commented Oct 15, 2017

with lines:


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.22.0-dev running on x86_64-unknown-linux-gnu

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', source://rust/src/libcore/option.rs:335:20
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at source://rust/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at source://rust/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at source://rust/src/libstd/sys_common/backtrace.rs:60
             at source://rust/src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at source://rust/src/libstd/panicking.rs:391
   4: std::panicking::rust_panic_with_hook
             at source://rust/src/libstd/panicking.rs:577
   5: std::panicking::begin_panic
             at source://rust/src/libstd/panicking.rs:538
   6: std::panicking::begin_panic_fmt
             at source://rust/src/libstd/panicking.rs:522
   7: rust_begin_unwind
             at source://rust/src/libstd/panicking.rs:498
   8: core::panicking::panic_fmt
             at source://rust/src/libcore/panicking.rs:71
   9: core::panicking::panic
             at source://rust/src/libcore/panicking.rs:51
  10: <rustc::ty::fold::BottomUpFolder<'a, 'gcx, 'tcx, F> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
             at source://rust/src/libcore/macros.rs:20
             at source://rust/src/librustc_typeck/check/mod.rs:1925
             at source://rust/src/librustc/ty/fold.rs:184
  11: rustc::ty::subst::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::Slice<rustc::ty::subst::Kind<'tcx>>>::super_fold_with
             at source://rust/src/librustc/ty/structural_impls.rs:690
             at source://rust/src/librustc/ty/subst.rs:113
             at source://rust/src/librustc/ty/fold.rs:53
             at source://rust/src/librustc/ty/subst.rs:312
             at source://rust/src/libcore/ops/function.rs:271
             at source://rust/src/libcore/option.rs:398
             at source://rust/src/libcore/iter/mod.rs:1123
             at source://rust/src/librustc_data_structures/array_vec.rs:197
             at source://rust/src/librustc_data_structures/accumulate_vec.rs:114
             at source://rust/src/libcore/iter/iterator.rs:1298
             at source://rust/src/librustc/ty/subst.rs:312
  12: <rustc::ty::fold::BottomUpFolder<'a, 'gcx, 'tcx, F> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
             at source://rust/src/librustc/ty/fold.rs:53
             at source://rust/src/librustc/ty/structural_impls.rs:660
             at source://rust/src/librustc/ty/fold.rs:183
  13: rustc_typeck::check::check_fn
             at source://rust/src/librustc/ty/structural_impls.rs:690
             at source://rust/src/librustc_typeck/check/mod.rs:1921
             at source://rust/src/librustc_typeck/check/mod.rs:1019
  14: rustc_typeck::check::closure::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_closure
             at source://rust/src/librustc_typeck/check/closure.rs:84
  15: rustc_typeck::check::FnCtxt::check_expr_kind
             at source://rust/src/librustc_typeck/check/closure.rs:44
             at source://rust/src/librustc_typeck/check/mod.rs:3836
  16: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref
             at source://rust/src/librustc_typeck/check/mod.rs:3465
  17: rustc_typeck::check::FnCtxt::check_argument_types
             at source://rust/src/librustc_typeck/check/mod.rs:2745
             at source://rust/src/librustc_typeck/check/mod.rs:2573
  18: rustc_typeck::check::FnCtxt::check_method_argument_types
             at source://rust/src/librustc_typeck/check/mod.rs:2384
  19: rustc_typeck::check::FnCtxt::check_expr_kind
             at source://rust/src/librustc_typeck/check/mod.rs:2866
             at source://rust/src/librustc_typeck/check/mod.rs:3845
  20: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref
             at source://rust/src/librustc_typeck/check/mod.rs:3465
  21: rustc_typeck::check::FnCtxt::check_block_with_expected::{{closure}}
             at source://rust/src/librustc_typeck/check/mod.rs:2745
             at source://rust/src/librustc_typeck/check/mod.rs:2749
             at source://rust/src/librustc_typeck/check/mod.rs:4208
             at source://rust/src/librustc_typeck/check/mod.rs:4272
  22: rustc_typeck::check::FnCtxt::check_block_with_expected
             at source://rust/src/librustc_typeck/check/mod.rs:4950
             at source://rust/src/librustc_typeck/check/mod.rs:4270
  23: rustc_typeck::check::FnCtxt::check_expr_kind
             at source://rust/src/librustc_typeck/check/mod.rs:3839
  24: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref
             at source://rust/src/librustc_typeck/check/mod.rs:3465
  25: rustc_typeck::check::FnCtxt::check_return_expr
             at source://rust/src/librustc_typeck/check/mod.rs:2745
             at source://rust/src/librustc_typeck/check/mod.rs:2739
             at source://rust/src/librustc_typeck/check/mod.rs:2880
  26: rustc_typeck::check::check_fn
             at source://rust/src/librustc_typeck/check/mod.rs:1074
  27: rustc_typeck::check::typeck_tables_of::{{closure}}
             at source://rust/src/librustc_typeck/check/mod.rs:882
  28: rustc_typeck::check::typeck_tables_of
             at source://rust/src/librustc_typeck/check/mod.rs:598
             at source://rust/src/librustc/infer/mod.rs:375
             at source://rust/src/librustc/ty/context.rs:1477
             at source://rust/src/libstd/thread/local.rs:379
             at source://rust/src/libstd/thread/local.rs:293
             at source://rust/src/librustc/ty/context.rs:1474
             at source://rust/src/librustc/ty/context.rs:1285
             at source://rust/src/librustc/infer/mod.rs:375
             at source://rust/src/librustc_typeck/check/mod.rs:598
             at source://rust/src/librustc_typeck/check/mod.rs:866
  29: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::force
             at source://rust/src/librustc/ty/maps/plumbing.rs:349
             at source://rust/src/librustc/dep_graph/graph.rs:272
             at source://rust/src/librustc/ty/maps/plumbing.rs:395
             at source://rust/src/librustc_errors/lib.rs:555
             at source://rust/src/librustc/ty/maps/plumbing.rs:394
             at source://rust/src/librustc/ty/maps/plumbing.rs:130
             at source://rust/src/librustc/ty/maps/plumbing.rs:393
  30: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get
             at source://rust/src/librustc/ty/maps/plumbing.rs:279
             at source://rust/src/librustc/ty/maps/plumbing.rs:423
  31: rustc::ty::maps::TyCtxtAt::typeck_tables_of
             at source://rust/src/librustc/ty/maps/plumbing.rs:462
  32: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_tables_of
             at source://rust/src/librustc/ty/maps/plumbing.rs:455
  33: rustc_typeck::check::typeck_item_bodies
             at source://rust/src/librustc_typeck/check/mod.rs:731
             at source://rust/src/librustc/session/mod.rs:268
             at source://rust/src/librustc_typeck/check/mod.rs:729
  34: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::force
             at source://rust/src/librustc/ty/maps/plumbing.rs:349
             at source://rust/src/librustc/dep_graph/graph.rs:272
             at source://rust/src/librustc/ty/maps/plumbing.rs:395
             at source://rust/src/librustc_errors/lib.rs:555
             at source://rust/src/librustc/ty/maps/plumbing.rs:394
             at source://rust/src/librustc/ty/maps/plumbing.rs:130
             at source://rust/src/librustc/ty/maps/plumbing.rs:393
  35: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get
             at source://rust/src/librustc/ty/maps/plumbing.rs:279
             at source://rust/src/librustc/ty/maps/plumbing.rs:423
  36: rustc::ty::maps::TyCtxtAt::typeck_item_bodies
             at source://rust/src/librustc/ty/maps/plumbing.rs:462
  37: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_item_bodies
             at source://rust/src/librustc/ty/maps/plumbing.rs:455
  38: rustc_typeck::check_crate
             at source://rust/src/librustc_typeck/check/mod.rs:722
             at source://rust/src/librustc_typeck/lib.rs:322
             at source://rust/src/librustc/util/common.rs:120
             at source://rust/src/librustc_typeck/lib.rs:322
  39: rustc::ty::context::TyCtxt::create_and_enter
             at source://rust/src/librustc_driver/driver.rs:1068
             at source://rust/src/librustc/ty/context.rs:1477
             at source://rust/src/libstd/thread/local.rs:379
             at source://rust/src/libstd/thread/local.rs:293
             at source://rust/src/librustc/ty/context.rs:1474
             at source://rust/src/librustc/ty/context.rs:1461
             at source://rust/src/libstd/thread/local.rs:379
             at source://rust/src/libstd/thread/local.rs:293
             at source://rust/src/librustc/ty/context.rs:1458
             at source://rust/src/librustc/ty/context.rs:1118
  40: rustc_driver::driver::compile_input
             at source://rust/src/librustc_driver/driver.rs:1045
             at source://rust/src/librustc_driver/driver.rs:211
  41: rustc_driver::run_compiler
             at source://rust/src/librustc_driver/lib.rs:250
@cramertj

This comment has been minimized.

Copy link
Member

cramertj commented Jan 5, 2018

@Arnavion I believe this has been fixed. Can you try on the latest nightly and confirm?

@Arnavion

This comment has been minimized.

Copy link
Author

Arnavion commented Jan 5, 2018

Yes, looks like it. I don't have the original code that I produced the reduced case from, so I'll close this. Thanks.

@Arnavion Arnavion closed this Jan 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment