Closed
Description
I've got a (closed source) crate that builds in under two minutes on rustc 1.55, and won't complete (top measured 67 minutes before I killed it) with rustc 1.56.
All the dependencies built fine. I captured the command to build the final binary with cargo build -v, and then ran that command under perf, and got the following output from perf report
:
13.56% rustc librustc_driver-d767902d1c6d74c6.so [.] <rustc_middle::traits::ObligationCauseCode as core::hash::Hash>::hash
5.17% rustc librustc_driver-d767902d1c6d74c6.so [.] hashbrown::map::RawEntryBuilderMut<K,V,S,A>::from_hash
4.55% rustc librustc_driver-d767902d1c6d74c6.so [.] rustc_middle::ty::context::TyCtxt::_intern_substs
3.12% rustc librustc_driver-d767902d1c6d74c6.so [.] hashbrown::map::RawEntryBuilderMut<K,V,S,A>::from_hash
2.31% rustc librustc_driver-d767902d1c6d74c6.so [.] rustc_trait_selection::traits::project::opt_normalize_projection_type
1.76% rustc librustc_driver-d767902d1c6d74c6.so [.] hashbrown::map::HashMap<K,V,S,A>::insert
1.70% rustc librustc_driver-d767902d1c6d74c6.so [.] rustc_trait_selection::traits::select::SelectionContext::impl_or_trait_obligations
1.67% rustc librustc_driver-d767902d1c6d74c6.so [.] hashbrown::map::HashMap<K,V,S,A>::insert
1.66% rustc librustc_driver-d767902d1c6d74c6.so [.] rustc_middle::ty::context::CtxtInterners::intern_ty
1.55% rustc librustc_driver-d767902d1c6d74c6.so [.] hashbrown::raw::RawTable<T,A>::reserve_rehash
1.49% rustc librustc_driver-d767902d1c6d74c6.so [.] hashbrown::map::HashMap<K,V,S,A>::insert
1.38% rustc librustc_driver-d767902d1c6d74c6.so [.] rustc_trait_selection::traits::select::SelectionContext::match_impl
1.31% rustc librustc_driver-d767902d1c6d74c6.so [.] <rustc_middle::ty::sty::TyKind as core::hash::Hash>::hash
1.15% rustc librustc_driver-d767902d1c6d74c6.so [.] <rustc_infer::infer::freshen::TypeFreshener as rustc_middle::ty::fold::TypeFolder>::fold_ty
1.03% rustc librustc_driver-d767902d1c6d74c6.so [.] rustc_query_system::cache::Cache<Key,Value>::get
1.02% rustc librustc_driver-d767902d1c6d74c6.so [.] rustc_trait_selection::traits::project::assoc_ty_def
0.98% rustc librustc_driver-d767902d1c6d74c6.so [.] rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
0.95% rustc rustc [.] free
0.87% rustc rustc [.] malloc
By contrast, the perf report for 1.55.0 has no lines above 3.1%, most of which are in ld, and the top lines in rustc are
1.40% rustc librustc_driver-2d8919e595cbef4e.so [.] rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_green_and_read
0.67% rustc librustc_driver-2d8919e595cbef4e.so [.] rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
0.51% rustc librustc_driver-2d8919e595cbef4e.so [.] hashbrown::map::RawEntryBuilderMut<K,V,S,A>::from_hash
Code
Not shareable. Some possibly interesting things:
- We use a build.rs file that generates some simple code (Creates a module with a few
static FOO: &[u8]
variables that getsinclude!()
ed) and sets a couple environment variables. - The problem occurs regardless of whether we use edition = "2018" or edition = "2021".
- We have two versions of the same dependency loaded in cargo.toml from two separate local paths:
They are brought in as git submodules. The copies of the crates have different versions in their Cargo.toml files ("0.2.3" and "0.3.0").
[dependencies] package_old = { package = "package", path = "package_old" } package = { path = "package" }
Version it worked on
It most recently worked on:1.55.0
Version with regression
rustc --version --verbose
:
rustc 1.56.0 (09c42c458 2021-10-18)
binary: rustc
commit-hash: 09c42c45858d5f3aedfa670698275303a3d19afa
commit-date: 2021-10-18
host: x86_64-unknown-linux-gnu
release: 1.56.0
LLVM version: 13.0.0
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged