Skip to content

Compiler panics after restructuring of project: attempted .def_id() on invalid def: PrimTy(Float(f64)) #60976

Closed
@smukherjee2016

Description

@smukherjee2016

Hello,

I was working on my toy project here:
https://github.com/smukherjee2016/sayo_pbr_rs

The project was compiling and running fine at this commit:
smukherjee2016/sayo_pbr_rs@e8f071c

However, I decided I wanted to move functionality out of src/lib.rs and into src/scene/mod.rs, so I moved all of it except the mod declarations, and then tried to compile. This led to the compiler panic.

The repro commit for this:
smukherjee2016/sayo_pbr_rs@ecf225f

I am using CLion, and the command I run is simply cargo run.

I am pretty new to Rust so it might just be me doing something really wrong, but it'd be great if someone could look into this and advise. Thank you!

With stable-msvc:

C:/Users/aaa/.cargo/bin/cargo.exe run --color=always --verbose
       Fresh autocfg v0.1.2
       Fresh rand_core v0.4.0
       Fresh lazy_static v1.3.0
       Fresh ucd-util v0.1.3
       Fresh cfg-if v0.1.7
       Fresh utf8-ranges v1.0.2
       Fresh glob v0.3.0
       Fresh tobj v0.1.7
       Fresh rand_core v0.3.1
       Fresh winapi v0.3.7
       Fresh thread_local v0.3.6
       Fresh regex-syntax v0.6.6
       Fresh log v0.4.6
       Fresh num-traits v0.2.6
       Fresh memchr v2.2.0
       Fresh libc v0.2.54
       Fresh rand_os v0.1.3
       Fresh rand_isaac v0.1.1
       Fresh rand_jitter v0.1.4
       Fresh rand_xorshift v0.1.1
       Fresh rand_hc v0.1.0
       Fresh num-integer v0.1.39
       Fresh aho-corasick v0.7.3
       Fresh serde v1.0.90
       Fresh approx v0.3.2
       Fresh byteorder v1.3.1
       Fresh rand_chacha v0.1.1
       Fresh time v0.1.42
       Fresh rand_pcg v0.1.2
       Fresh chrono v0.4.6
       Fresh rand v0.6.5
       Fresh regex v1.1.6
       Fresh toml v0.5.0
       Fresh cgmath v0.17.0
       Fresh flexi_logger v0.11.4
   Compiling sayo_pbr_rs v0.1.0 (D:\Projects\sayo_pbr_rs)
     Running `rustc --edition=2018 --crate-name sayo_pbr_rs src\main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=3ffc7db9e0761e27 -C extra-filename=-3ffc7db9e0761e27 --out-dir D:\Projects\sayo_pbr_rs\target\debug\deps -C incremental=D:\Projects\sayo_pbr_rs\target\debug\incremental -L dependency=D:\Projects\sayo_pbr_rs\target\debug\deps --extern byteorder=D:\Projects\sayo_pbr_rs\target\debug\deps\libbyteorder-e8f2bbdead8ba3f8.rlib --extern cgmath=D:\Projects\sayo_pbr_rs\target\debug\deps\libcgmath-2798cd25d5fd5062.rlib --extern flexi_logger=D:\Projects\sayo_pbr_rs\target\debug\deps\libflexi_logger-2b2774cc44427bf5.rlib --extern log=D:\Projects\sayo_pbr_rs\target\debug\deps\liblog-6012325b2cce08de.rlib --extern sayo_pbr_rs=D:\Projects\sayo_pbr_rs\target\debug\deps\libsayo_pbr_rs-5f4f51f2f3ce30dc.rlib --extern tobj=D:\Projects\sayo_pbr_rs\target\debug\deps\libtobj-10b58215fa882cc1.rlib --extern toml=D:\Projects\sayo_pbr_rs\target\debug\deps\libtoml-d1b47d405b8aaba4.rlib`
error: internal compiler error: src\librustc\hir\def.rs:259: attempted .def_id() on invalid def: PrimTy(Float(f64))

thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:620:9
stack backtrace:
   0: std::sys_common::alloc::realloc_fallback
   1: std::panicking::take_hook
   2: std::panicking::take_hook
   3: <rustc::ty::sty::Binder<rustc::ty::ProjectionPredicate<'tcx>> as rustc::ty::ToPredicate<'tcx>>::to_predicate
   4: std::panicking::rust_panic_with_hook
   5: <rustc_errors::emitter::ColorConfig as core::fmt::Debug>::fmt
   6: rustc_errors::Handler::bug
   7: rustc::util::bug::bug_fmt
   8: rustc::ty::wf::object_region_bounds
   9: rustc::ty::wf::object_region_bounds
  10: rustc::ty::wf::object_region_bounds
  11: rustc::util::bug::bug_fmt
  12: rustc::util::bug::bug_fmt
  13: rustc::hir::def::Def::def_id
  14: rustc::hir::def::Def::def_id
  15: rustc_metadata::cstore::CStore::new
  16: rustc::middle::weak_lang_items::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'gcx>>::is_weak_lang_item
  17: rustc::dep_graph::graph::DepGraph::assert_ignored
  18: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
  19: rustc::ty::item_path::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::absolute_item_path_str
  20: rustc::util::ppaux::PrintContext::new
  21: rustc::util::ppaux::<impl core::fmt::Debug for rustc::ty::sty::TraitRef<'tcx>>::fmt
  22: rustc::util::ppaux::<impl core::fmt::Display for rustc::ty::TyS<'tcx>>::fmt
  23: core::fmt::write
  24: alloc::fmt::format
  25: <rustc_lint::builtin::WhileTrue as rustc::lint::LateLintPass<'a, 'tcx>>::check_expr
  26: <rustc_lint::register_builtins::BuiltinCombinedLateLintPass as rustc::lint::LateLintPass<'a, 'tcx>>::check_expr
  27: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
  28: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_body
  29: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_nested_body
  30: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_fn
  31: rustc::hir::intravisit::NestedVisitorMap::inter
  32: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_item
  33: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_mod
  34: rustc::hir::intravisit::NestedVisitorMap::inter
  35: rustc::lint::context::check_crate
  36: rustc_driver::profile::dump
  37: <rustc_driver::CompilationFailure as core::fmt::Debug>::fmt
  38: <env_logger::fmt::WriteStyle as core::default::Default>::default
  39: rustc_driver::driver::compile_input
  40: rustc_driver::run_compiler
  41: <rustc_driver::CompilationFailure as core::fmt::Debug>::fmt
  42: rustc_driver::run_compiler
  43: <rustc_driver::CompilationFailure as core::fmt::Debug>::fmt
  44: _rust_maybe_catch_panic
  45: <rustc_driver::profile::trace::Query as core::fmt::Debug>::fmt
  46: std::sys::windows::thread::Thread::new
  47: BaseThreadInitThunk
  48: RtlUserThreadStart
query stack during panic:
#0 [visible_parent_map] calculating the visible parent map
end of query stack
error: aborting due to previous error


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.34.2 (6c2484dc3 2019-05-13) running on x86_64-pc-windows-msvc

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

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

error: Could not compile `sayo_pbr_rs`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name sayo_pbr_rs src\main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=3ffc7db9e0761e27 -C extra-filename=-3ffc7db9e0761e27 --out-dir D:\Projects\sayo_pbr_rs\target\debug\deps -C incremental=D:\Projects\sayo_pbr_rs\target\debug\incremental -L dependency=D:\Projects\sayo_pbr_rs\target\debug\deps --extern byteorder=D:\Projects\sayo_pbr_rs\target\debug\deps\libbyteorder-e8f2bbdead8ba3f8.rlib --extern cgmath=D:\Projects\sayo_pbr_rs\target\debug\deps\libcgmath-2798cd25d5fd5062.rlib --extern flexi_logger=D:\Projects\sayo_pbr_rs\target\debug\deps\libflexi_logger-2b2774cc44427bf5.rlib --extern log=D:\Projects\sayo_pbr_rs\target\debug\deps\liblog-6012325b2cce08de.rlib --extern sayo_pbr_rs=D:\Projects\sayo_pbr_rs\target\debug\deps\libsayo_pbr_rs-5f4f51f2f3ce30dc.rlib --extern tobj=D:\Projects\sayo_pbr_rs\target\debug\deps\libtobj-10b58215fa882cc1.rlib --extern toml=D:\Projects\sayo_pbr_rs\target\debug\deps\libtoml-d1b47d405b8aaba4.rlib` (exit code: 101)

Process finished with exit code 101

With stable-gnu:

C:/Users/aaa/.cargo/bin/cargo.exe run --color=always --verbose
       Fresh autocfg v0.1.2
       Fresh rand_core v0.4.0
       Fresh lazy_static v1.3.0
       Fresh ucd-util v0.1.3
       Fresh utf8-ranges v1.0.2
       Fresh cfg-if v0.1.7
       Fresh glob v0.3.0
       Fresh tobj v0.1.7
       Fresh winapi-x86_64-pc-windows-gnu v0.4.0
       Fresh rand_core v0.3.1
       Fresh regex-syntax v0.6.6
       Fresh thread_local v0.3.6
       Fresh log v0.4.6
       Fresh memchr v2.2.0
       Fresh winapi v0.3.7
       Fresh libc v0.2.54
       Fresh num-traits v0.2.6
       Fresh rand_xorshift v0.1.1
       Fresh aho-corasick v0.7.3
       Fresh rand_hc v0.1.0
       Fresh rand_isaac v0.1.1
       Fresh rand_pcg v0.1.2
       Fresh serde v1.0.90
       Fresh byteorder v1.3.1
       Fresh rand_jitter v0.1.4
       Fresh time v0.1.42
       Fresh num-integer v0.1.39
       Fresh rand_os v0.1.3
       Fresh approx v0.3.2
       Fresh rand_chacha v0.1.1
       Fresh chrono v0.4.6
       Fresh regex v1.1.6
       Fresh toml v0.5.0
       Fresh rand v0.6.5
       Fresh flexi_logger v0.11.4
       Fresh cgmath v0.17.0
   Compiling sayo_pbr_rs v0.1.0 (D:\Projects\sayo_pbr_rs)
     Running `rustc --edition=2018 --crate-name sayo_pbr_rs src\lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=3e12efdc8c5b8afd -C extra-filename=-3e12efdc8c5b8afd --out-dir D:\Projects\sayo_pbr_rs\target\debug\deps -C incremental=D:\Projects\sayo_pbr_rs\target\debug\incremental -L dependency=D:\Projects\sayo_pbr_rs\target\debug\deps --extern byteorder=D:\Projects\sayo_pbr_rs\target\debug\deps\libbyteorder-1c9417ab32935f79.rlib --extern cgmath=D:\Projects\sayo_pbr_rs\target\debug\deps\libcgmath-fde0a6dc7fd6e47e.rlib --extern flexi_logger=D:\Projects\sayo_pbr_rs\target\debug\deps\libflexi_logger-13585d6e89f99240.rlib --extern log=D:\Projects\sayo_pbr_rs\target\debug\deps\liblog-102d34c518e2a691.rlib --extern tobj=D:\Projects\sayo_pbr_rs\target\debug\deps\libtobj-ddb5172681a9ec8a.rlib --extern toml=D:\Projects\sayo_pbr_rs\target\debug\deps\libtoml-099e41e0be53e63b.rlib -L native=C:\Users\Subham\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-x86_64-pc-windows-gnu-0.4.0\lib`
warning: unused variable: `materials`
  --> src\geometry\triangle.rs:28:22
   |
28 |         let (models, materials) = obj_mesh.unwrap();
   |                      ^^^^^^^^^ help: consider prefixing with an underscore: `_materials`

warning: unused variable: `ray`
  --> src\geometry\triangle.rs:77:57
   |
77 |     fn check_intersection_and_return_closest_hit(&self, ray: Ray) -> Option<IntersectionInfo> {
   |                                                         ^^^ help: consider prefixing with an underscore: `_ray`

     Running `rustc --edition=2018 --crate-name sayo_pbr_rs src\main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=f2bb5465dd356841 -C extra-filename=-f2bb5465dd356841 --out-dir D:\Projects\sayo_pbr_rs\target\debug\deps -C incremental=D:\Projects\sayo_pbr_rs\target\debug\incremental -L dependency=D:\Projects\sayo_pbr_rs\target\debug\deps --extern byteorder=D:\Projects\sayo_pbr_rs\target\debug\deps\libbyteorder-1c9417ab32935f79.rlib --extern cgmath=D:\Projects\sayo_pbr_rs\target\debug\deps\libcgmath-fde0a6dc7fd6e47e.rlib --extern flexi_logger=D:\Projects\sayo_pbr_rs\target\debug\deps\libflexi_logger-13585d6e89f99240.rlib --extern log=D:\Projects\sayo_pbr_rs\target\debug\deps\liblog-102d34c518e2a691.rlib --extern sayo_pbr_rs=D:\Projects\sayo_pbr_rs\target\debug\deps\libsayo_pbr_rs-3e12efdc8c5b8afd.rlib --extern tobj=D:\Projects\sayo_pbr_rs\target\debug\deps\libtobj-ddb5172681a9ec8a.rlib --extern toml=D:\Projects\sayo_pbr_rs\target\debug\deps\libtoml-099e41e0be53e63b.rlib -L native=C:\Users\Subham\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-x86_64-pc-windows-gnu-0.4.0\lib`
error: internal compiler error: src\librustc\hir\def.rs:259: attempted .def_id() on invalid def: PrimTy(Float(f64))

thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:620:9
stack backtrace:
   0: mingw_set_invalid_parameter_handler
   1: mingw_set_invalid_parameter_handler
   2: mingw_set_invalid_parameter_handler
   3: mingw_set_invalid_parameter_handler
   4: mingw_set_invalid_parameter_handler
   5: mingw_set_invalid_parameter_handler
   6: mingw_set_invalid_parameter_handler
   7: mingw_set_invalid_parameter_handler
   8: mingw_set_invalid_parameter_handler
   9: mingw_set_invalid_parameter_handler
  10: mingw_set_invalid_parameter_handler
  11: mingw_set_invalid_parameter_handler
  12: mingw_set_invalid_parameter_handler
  13: mingw_set_invalid_parameter_handler
  14: mingw_set_invalid_parameter_handler
  15: mingw_set_invalid_parameter_handler
  16: mingw_set_invalid_parameter_handler
  17: mingw_set_invalid_parameter_handler
  18: mingw_set_invalid_parameter_handler
  19: mingw_set_invalid_parameter_handler
  20: mingw_set_invalid_parameter_handler
  21: mingw_set_invalid_parameter_handler
  22: mingw_set_invalid_parameter_handler
  23: mingw_set_invalid_parameter_handler
  24: mingw_set_invalid_parameter_handler
  25: mingw_set_invalid_parameter_handler
  26: mingw_set_invalid_parameter_handler
  27: mingw_set_invalid_parameter_handler
  28: mingw_set_invalid_parameter_handler
  29: mingw_set_invalid_parameter_handler
  30: mingw_set_invalid_parameter_handler
  31: mingw_set_invalid_parameter_handler
  32: mingw_set_invalid_parameter_handler
  33: mingw_set_invalid_parameter_handler
  34: mingw_set_invalid_parameter_handler
  35: mingw_set_invalid_parameter_handler
  36: mingw_set_invalid_parameter_handler
  37: mingw_set_invalid_parameter_handler
  38: mingw_set_invalid_parameter_handler
  39: mingw_set_invalid_parameter_handler
  40: mingw_set_invalid_parameter_handler
  41: mingw_set_invalid_parameter_handler
  42: mingw_set_invalid_parameter_handler
  43: mingw_set_invalid_parameter_handler
  44: mingw_set_invalid_parameter_handler
  45: mingw_set_invalid_parameter_handler
  46: mingw_set_invalid_parameter_handler
  47: mingw_set_invalid_parameter_handler
  48: mingw_set_invalid_parameter_handler
query stack during panic:
#0 [visible_parent_map] calculating the visible parent map
end of query stack
error: aborting due to previous error


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.34.1 (fc50f328b 2019-04-24) running on x86_64-pc-windows-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

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

error: Could not compile `sayo_pbr_rs`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name sayo_pbr_rs src\main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=f2bb5465dd356841 -C extra-filename=-f2bb5465dd356841 --out-dir D:\Projects\sayo_pbr_rs\target\debug\deps -C incremental=D:\Projects\sayo_pbr_rs\target\debug\incremental -L dependency=D:\Projects\sayo_pbr_rs\target\debug\deps --extern byteorder=D:\Projects\sayo_pbr_rs\target\debug\deps\libbyteorder-1c9417ab32935f79.rlib --extern cgmath=D:\Projects\sayo_pbr_rs\target\debug\deps\libcgmath-fde0a6dc7fd6e47e.rlib --extern flexi_logger=D:\Projects\sayo_pbr_rs\target\debug\deps\libflexi_logger-13585d6e89f99240.rlib --extern log=D:\Projects\sayo_pbr_rs\target\debug\deps\liblog-102d34c518e2a691.rlib --extern sayo_pbr_rs=D:\Projects\sayo_pbr_rs\target\debug\deps\libsayo_pbr_rs-3e12efdc8c5b8afd.rlib --extern tobj=D:\Projects\sayo_pbr_rs\target\debug\deps\libtobj-ddb5172681a9ec8a.rlib --extern toml=D:\Projects\sayo_pbr_rs\target\debug\deps\libtoml-099e41e0be53e63b.rlib -L native=C:\Users\Subham\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-x86_64-pc-windows-gnu-0.4.0\lib` (exit code: 101)

Process finished with exit code 101

EDIT: Updated with last working commit.
EDIT2: Posted crash message with --verbose flag and clarified IDE.
EDIT3: Added MSVC toolchain error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions