Skip to content

ICE "record_region_bounds: non free region" with 'static in where clause #22863

Closed
@rprichard

Description

@rprichard

This test case:

fn dummy<'a>(x: &'a u8) where 'a : 'static {}
fn main() {}

yields:

error: internal compiler error: record_region_bounds: non free region: ReFree(DestructionScopeData { node_id: 4 }, BrNamed(DefId { krate: 0, node: 10 }, 'a)) / ReStatic

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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:189

stack backtrace:
   1:         0xe78055f0 - sys::backtrace::write::h36f27d57607c02a1zfA
   2:         0xe782da50 - panicking::on_panic::h9138d9a94c738b62F9I
   3:         0xe776db40 - rt::unwind::begin_unwind_inner::ha129cf244cc26e118PI
   4:         0xe4a7b260 - rt::unwind::begin_unwind::h8503740203120745658
   5:         0xe4a7ba20 - diagnostic::Handler::bug::h33b6d245a4ecceb6AHD
   6:         0xe59a4200 - middle::ty::construct_parameter_environment::hf762b521f971fe85el8
   7:         0xe6f11060 - check::wf::CheckTypeWellFormedVisitor<'ccx, 'tcx>::check_item_type::h31e3f40c5ae1aab1EUk
   8:         0xe6f0c6d0 - check::wf::CheckTypeWellFormedVisitor<'ccx, 'tcx>::check_item_well_formed::h930e75674954407e2Ik
   9:         0xe6ffded0 - check_crate::closure.36034
  10:         0xe6ff8980 - check_crate::h3a6c8c67391b713fiXB
  11:         0xe7e7fac0 - driver::phase_3_run_analysis_passes::h76ae066733cd0ec2wFa
  12:         0xe7e660c0 - driver::compile_input::h81a28b31b910052cHba
  13:         0xe7f30d90 - run_compiler::hb4ff729c1da7f9f4E5b
  14:         0xe7f2f690 - thunk::F.Invoke<A, R>::invoke::h13625549205562984270
  15:         0xe7f2e580 - rt::unwind::try::try_fn::h7513244287633735039
  16:         0xe7899610 - rust_try_inner
  17:         0xe7899600 - rust_try
  18:         0xe7f2e880 - thunk::F.Invoke<A, R>::invoke::h16925114451325500728
  19:         0xe7819860 - sys::thread::thread_start::h2dbc6c2ca1c4aa4dCDE
  20:         0xe173f0c0 - start_thread
  21:         0xe73e5fd9 - __clone
  22:                0x0 - <unknown>

Version:

$ rustc --version --verbose
rustc 1.0.0-nightly (4db0b3246 2015-02-25) (built 2015-02-26)
binary: rustc
commit-hash: 4db0b32467535d718d6474de7ae8d1007d900818
commit-date: 2015-02-25
build-date: 2015-02-26
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly

Swapping the 'a and 'static in the where clause swaps the order of the items in the region:

'a : 'static  ==>  ReFree(DestructionScopeData { node_id: 4 }, BrNamed(DefId { krate: 0, node: 10 }, 'a)) / ReStatic
'static : 'a  ==>  ReStatic / ReFree(DestructionScopeData { node_id: 4 }, BrNamed(DefId { krate: 0, node: 10 }, 'a))

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions