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

breaking on unknown lifetime #43591

Closed
sampersand opened this issue Aug 1, 2017 · 1 comment
Closed

breaking on unknown lifetime #43591

sampersand opened this issue Aug 1, 2017 · 1 comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@sampersand
Copy link

sampersand commented Aug 1, 2017

I was poking around with lifetimes and break statements when I came across this bug:

fn main() {
   loop {
      break 'a ()
   }
}

I just expected it to complain that 'a was an undeclared liftime. However, it spit out an internal compiler error:

   Compiling test v0.4.0 (file:///tests/src/main.rs)
error[E0426]: use of undeclared label `'a`
  --> src/main.rs:3:13
  |
3 |       break 'a ()
  |             ^^ undeclared label `'a`

error: internal compiler error: src/librustc_typeck/check/mod.rs:1984: no type for node 8: expr () (id=8) in fcx 0x700006bdab28

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.20.0-nightly (b2c070787 2017-07-13) running on x86_64-apple-darwin

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:489:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: Could not compile `tests`.

Version

rustc --version --verbose yields:

rustc 1.20.0-nightly (b2c070787 2017-07-13)
binary: rustc
commit-hash: b2c0707872082c890f332178f59fd02eea5b98f3
commit-date: 2017-07-13
host: x86_64-apple-darwin
release: 1.20.0-nightly
LLVM version: 4.0

Backtrace

   Compiling test v0.4.0 (file:///tests/src/main.rs)
error[E0426]: use of undeclared label `'a`
  --> src/main.rs:3:13
  |
3 |       break 'a ()
  |             ^^ undeclared label `'a`

error: internal compiler error: src/librustc_typeck/check/mod.rs:1984: no type for node 8: expr () (id=8) in fcx 0x70000fd92b28

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.20.0-nightly (b2c070787 2017-07-13) running on x86_64-apple-darwin

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

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:489:8
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
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic_new
   5: rustc_errors::Handler::bug
   6: rustc::session::opt_span_bug_fmt::{{closure}}
   7: rustc::session::opt_span_bug_fmt
   8: rustc::session::bug_fmt
   9: rustc_typeck::check::FnCtxt::node_ty
  10: <rustc_typeck::check::regionck::RegionCtxt<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr
  11: <rustc_typeck::check::regionck::RegionCtxt<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr
  12: <rustc_typeck::check::regionck::RegionCtxt<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr
  13: <rustc_typeck::check::regionck::RegionCtxt<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr
  14: rustc_typeck::check::regionck::RegionCtxt::visit_fn_body
  15: rustc_typeck::check::typeck_tables_of::{{closure}}
  16: rustc_typeck::check::typeck_tables_of
  17: rustc::dep_graph::graph::DepGraph::with_task
  18: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get
  19: rustc::ty::maps::TyCtxtAt::typeck_tables_of
  20: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_tables_of
  21: rustc_typeck::check::typeck_item_bodies
  22: rustc::dep_graph::graph::DepGraph::with_task
  23: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get
  24: rustc::ty::maps::TyCtxtAt::typeck_item_bodies
  25: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_item_bodies
  26: rustc_typeck::check_crate
  27: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}
  28: rustc_driver::driver::phase_3_run_analysis_passes
  29: rustc_driver::driver::compile_input
  30: rustc_driver::run_compiler

error: Could not compile `tests`.
@sfackler sfackler added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Aug 1, 2017
@Mark-Simulacrum Mark-Simulacrum added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 3, 2017
@kennytm
Copy link
Member

kennytm commented Aug 13, 2017

No longer ICE on latest nightly, probably fixed by #43745 as well.

   Compiling playground v0.0.1 (file:///playground)
error[E0426]: use of undeclared label `'a`
 --> src/main.rs:3:13
  |
3 |       break 'a ()
  |             ^^ undeclared label `'a`

error: aborting due to previous error

error: Could not compile `playground`.

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

@arielb1 arielb1 closed this as completed Aug 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants