Skip to content

ICE when using nalgebra type in impl Trait type alias. #74244

@connerebbinghaus

Description

@connerebbinghaus

Code

src/lib.rs

#![feature(type_alias_impl_trait)] use nalgebra::Vector3; pub type A = impl Fn(Vector3<f64>); pub fn foo() -> A { |_| () }

Cargo.toml

[package] name = "bug" version = "0.1.0" edition = "2018" [dependencies] nalgebra = "0.21"

Meta

rustc --version --verbose:

rustc 1.46.0-nightly (daecab3a7 2020-07-10) binary: rustc commit-hash: daecab3a784f28082df90cebb204998051f3557d commit-date: 2020-07-10 host: x86_64-unknown-linux-gnu release: 1.46.0-nightly LLVM version: 10.0 

Error output

error: internal compiler error: src/librustc_mir/borrow_check/type_check/free_region_relations.rs:324:33: failed to compute implied bounds impl std::ops::Fn<(nalgebra::Matrix<f64, nalgebra::U3, nalgebra::U1, <nalgebra::DefaultAllocator as nalgebra::allocator::Allocator<f64, nalgebra::U3>>::Buffer>,)> thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:916:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace 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.46.0-nightly (daecab3a7 2020-07-10) running on x86_64-unknown-linux-gnu note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib note: some of the compiler flags provided by cargo are hidden error: aborting due to previous error error: could not compile `bug`. To learn more, run the command again with --verbose. 
Backtrace

error: internal compiler error: src/librustc_mir/borrow_check/type_check/free_region_relations.rs:324:33: failed to compute implied bounds impl std::ops::Fn<(nalgebra::Matrix<f64, nalgebra::U3, nalgebra::U1, <nalgebra::DefaultAllocator as nalgebra::allocator::Allocator<f64, nalgebra::U3>>::Buffer>,)> thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:916:9 stack backtrace: 0: backtrace::backtrace::libunwind::trace at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86 1: backtrace::backtrace::trace_unsynchronized at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66 2: std::sys_common::backtrace::_print_fmt at src/libstd/sys_common/backtrace.rs:78 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:1076 5: std::io::Write::write_fmt at src/libstd/io/mod.rs:1537 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:198 9: std::panicking::default_hook at src/libstd/panicking.rs:217 10: rustc_driver::report_ice 11: std::panicking::rust_panic_with_hook at src/libstd/panicking.rs:530 12: std::panicking::begin_panic 13: rustc_errors::HandlerInner::bug 14: rustc_errors::Handler::bug 15: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}} 16: rustc_middle::ty::context::tls::with_opt::{{closure}} 17: rustc_middle::ty::context::tls::with_opt 18: rustc_middle::util::bug::opt_span_bug_fmt 19: rustc_middle::util::bug::bug_fmt 20: rustc_mir::borrow_check::type_check::free_region_relations::UniversalRegionRelationsBuilder::add_implied_bounds::{{closure}} 21: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once 22: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::next 23: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter 24: rustc_mir::borrow_check::type_check::free_region_relations::create 25: rustc_mir::borrow_check::type_check::type_check 26: rustc_mir::borrow_check::nll::compute_regions 27: rustc_mir::borrow_check::do_mir_borrowck 28: rustc_infer::infer::InferCtxtBuilder::enter 29: rustc_mir::borrow_check::mir_borrowck 30: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_borrowck>::compute 31: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps 32: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl 33: rustc_data_structures::stack::ensure_sufficient_stack 34: rustc_query_system::query::plumbing::get_query_impl 35: rustc_typeck::collect::type_of::find_opaque_ty_constraints::ConstraintLocator::check 36: rustc_hir::intravisit::Visitor::visit_nested_item 37: rustc_typeck::collect::type_of::type_of 38: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::type_of>::compute 39: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps 40: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl 41: rustc_data_structures::stack::ensure_sufficient_stack 42: rustc_query_system::query::plumbing::get_query_impl 43: rustc_query_system::query::plumbing::ensure_query_impl 44: <rustc_typeck::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_item 45: rustc_middle::hir::map::Map::visit_item_likes_in_module 46: rustc_typeck::collect::collect_mod_item_types 47: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::collect_mod_item_types>::compute 48: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps 49: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl 50: rustc_data_structures::stack::ensure_sufficient_stack 51: rustc_query_system::query::plumbing::get_query_impl 52: rustc_query_system::query::plumbing::ensure_query_impl 53: rustc_session::session::Session::track_errors 54: rustc_typeck::check_crate 55: rustc_interface::passes::analysis 56: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute 57: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps 58: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl 59: rustc_query_system::query::plumbing::get_query_impl 60: rustc_middle::ty::context::tls::enter_global 61: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter 62: rustc_span::with_source_map 63: rustc_interface::interface::run_compiler_in_existing_thread_pool 64: scoped_tls::ScopedKey<T>::set note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. 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.46.0-nightly (daecab3a7 2020-07-10) running on x86_64-unknown-linux-gnu note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [mir_borrowck] borrow-checking `foo` #1 [type_of] computing type of `A::{{opaque}}#0` #2 [collect_mod_item_types] collecting item types in top-level module #3 [analysis] running analysis passes on this crate end of query stack error: aborting due to previous error error: could not compile `bug`. To learn more, run the command again with --verbose. 

Bisection

searched nightlies: from nightly-2019-10-03 to nightly-2020-07-05
regressed nightly: nightly-2020-02-16
searched commits: from 433aae9 to 61d9231
regressed commit: 19288dd

bisected with cargo-bisect-rustc v0.5.1

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start 2019-10-03 --end 2020-07-05 --with-cargo --prompt -- check 

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`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.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions