-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
A-incr-compArea: Incremental compilationArea: Incremental compilationC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.
Description
this error occurs when using the borrowme
crate's attribute macro for a struct that specifically has a collection of both str and any enum which has a lifetime, and when you use borrowme::ToOwned::to_owned
on the struct, but only after making any change and recompiling with cargo build
etc
Code (minimal as possible)
use borrowme::borrowme;
fn main() {
let this = ThisStruct {
enums: vec![ThisEnum::ThisVariant("test")],
strs: vec!["test"],
};
let owned = borrowme::ToOwned::to_owned(&this);
}
#[borrowme]
pub struct ThisStruct<'a> {
pub enums: Vec<ThisEnum<'a>>,
pub strs: Vec<&'a str>,
}
#[borrowme]
pub enum ThisEnum<'a> {
ThisVariant(&'a str),
}
Expanded
#![feature(prelude_import)]
#[prelude_import]
use std::prelude::rust_2024::*;
#[macro_use]
extern crate std;
use borrowme::borrowme;
fn main() {
let this = ThisStruct {
enums: <[_]>::into_vec(::alloc::boxed::box_new([ThisEnum::ThisVariant("test")])),
strs: <[_]>::into_vec(::alloc::boxed::box_new(["test"])),
};
let owned = borrowme::ToOwned::to_owned(&this);
}
pub struct ThisStruct<'a> {
pub enums: Vec<ThisEnum<'a>>,
pub strs: Vec<&'a str>,
}
pub struct OwnedThisStruct {
pub enums: <Vec<ThisEnum<'static>> as ::borrowme::ToOwned>::Owned,
pub strs: <Vec<&'static str> as ::borrowme::ToOwned>::Owned,
}
#[automatically_derived]
impl<'a> ::borrowme::ToOwned for ThisStruct<'a> {
type Owned = OwnedThisStruct;
#[inline]
fn to_owned(&self) -> Self::Owned {
OwnedThisStruct {
enums: ::borrowme::ToOwned::to_owned(&self.enums),
strs: ::borrowme::ToOwned::to_owned(&self.strs),
}
}
}
#[automatically_derived]
impl ::borrowme::Borrow for OwnedThisStruct {
type Target<'this> = ThisStruct<'this>;
#[inline]
fn borrow(&self) -> Self::Target<'_> {
ThisStruct {
enums: ::borrowme::Borrow::borrow(&self.enums),
strs: ::borrowme::Borrow::borrow(&self.strs),
}
}
}
pub enum ThisEnum<'a> {
ThisVariant(&'a str),
}
pub enum OwnedThisEnum {
ThisVariant(<&'static str as ::borrowme::ToOwned>::Owned),
}
#[automatically_derived]
impl<'a> ::borrowme::ToOwned for ThisEnum<'a> {
type Owned = OwnedThisEnum;
#[inline]
fn to_owned(&self) -> Self::Owned {
match self {
ThisEnum::ThisVariant { 0: f0 } => {
OwnedThisEnum::ThisVariant {
0: ::borrowme::ToOwned::to_owned(f0),
}
}
}
}
}
#[automatically_derived]
impl ::borrowme::Borrow for OwnedThisEnum {
type Target<'this> = ThisEnum<'this>;
#[inline]
fn borrow(&self) -> Self::Target<'_> {
match self {
OwnedThisEnum::ThisVariant { 0: f0 } => {
ThisEnum::ThisVariant {
0: ::borrowme::Borrow::borrow(f0),
}
}
}
}
}
Meta
rustc --version --verbose
:
rustc 1.88.0 (6b00bc388 2025-06-23)
binary: rustc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
commit-date: 2025-06-23
host: x86_64-pc-windows-msvc
release: 1.88.0
LLVM version: 20.1.5
Note: this same exact bug occurs in 1.84.0 (rust 2021) and all of the above
Error output
error: internal compiler error: encountered incremental compilation error with evaluate_obligation(88453a1bd78827f5-d56a0ff94d36afa6)
|
= help: This is a known issue with the compiler. Run `cargo clean -p borrowme` or `cargo clean` to allow your project to compile
= note: Please follow the instructions below to create a bug report with the provided information
= note: See <https://github.com/rust-lang/rust/issues/84970> for more information
thread 'rustc' panicked at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc\compiler\rustc_query_system\src\query\plumbing.rs:739:9:
Found unstable fingerprints for evaluate_obligation(88453a1bd78827f5-d56a0ff94d36afa6): Ok(EvaluatedToOk)
Backtrace
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library\std\src\panicking.rs:697
1: core::panicking::panic_fmt
at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library\core\src\panicking.rs:75
2: rustc_query_system::query::plumbing::incremental_verify_ich_failed::<rustc_middle::ty::context::TyCtxt>
3: RINvNtNtCs7IFNuxsOQZH_18rustc_query_system5query8plumbing17try_execute_queryINtCsiSfPmaTe9VX_16rustc_query_impl13DynamicConfigINtNtCsco0OWYSRcIH_21rustc_data_structures9vec_cache8VecCacheNtNtCshkOTHbTNELB_9rustc_hir6hir_id7OwnerIdINtNtNtCs5BYDmTWcnKQ_12rus
4: RINvNtNtCs7IFNuxsOQZH_18rustc_query_system5query8plumbing17try_execute_queryINtCsiSfPmaTe9VX_16rustc_query_impl13DynamicConfigINtNtB4_6caches12DefaultCacheINtNtCshnIBNndEbiu_13rustc_type_ir9canonical19CanonicalQueryInputNtNtNtCs5BYDmTWcnKQ_12rustc_middle2t
5: rustc_query_impl::plumbing::query_key_hash_verify_all
6: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
7: rustc_trait_selection::traits::type_known_to_meet_bound_modulo_regions
8: rustc_ty_utils::common_traits::is_sized_raw
9: RINvNtNtCs7IFNuxsOQZH_18rustc_query_system5query8plumbing17try_execute_queryINtCsiSfPmaTe9VX_16rustc_query_impl13DynamicConfigINtNtCsco0OWYSRcIH_21rustc_data_structures9vec_cache8VecCacheNtNtCs5K2xb0UU2Jw_10rustc_span6def_id8CrateNumINtNtNtCs5BYDmTWcnKQ_12
10: RINvNtNtCs7IFNuxsOQZH_18rustc_query_system5query8plumbing17try_execute_queryINtCsiSfPmaTe9VX_16rustc_query_impl13DynamicConfigINtNtCsco0OWYSRcIH_21rustc_data_structures9vec_cache8VecCacheNtNtCs5K2xb0UU2Jw_10rustc_span6def_id8CrateNumINtNtNtCs5BYDmTWcnKQ_12
11: RINvNtNtCs7IFNuxsOQZH_18rustc_query_system5query8plumbing17try_execute_queryINtCsiSfPmaTe9VX_16rustc_query_impl13DynamicConfigINtNtB4_6caches12DefaultCacheINtNtCs5BYDmTWcnKQ_12rustc_middle2ty20PseudoCanonicalInputNtB2w_2TyEINtNtNtB2y_5query5erase6ErasedAhj
12: rustc_query_impl::query_system
13: <rustc_middle::ty::Ty>::is_unpin
14: RINvNtNtNtNtCs5cb5cxfFw7H_4core5slice4sort6stable9quicksort9quicksortmNCINvMNtCs2ocB3yIIgEv_5alloc5sliceSm11sort_by_keyRINtNtBa_6option6OptionNtNtCs5K2xb0UU2Jw_10rustc_span6symbol6SymbolENCINvXs3_NtNtCsco0OWYSRcIH_21rustc_data_structures10sorted_map9index_
15: rustc_ty_utils::ty::impl_self_is_guaranteed_unsized
16: rustc_ty_utils::abi::fn_abi_of_instance
17: rustc_query_impl::plumbing::query_key_hash_verify_all
18: RINvNtNtCs7IFNuxsOQZH_18rustc_query_system5query8plumbing17try_execute_queryINtCsiSfPmaTe9VX_16rustc_query_impl13DynamicConfigINtNtCsco0OWYSRcIH_21rustc_data_structures9vec_cache8VecCacheNtNtCs5K2xb0UU2Jw_10rustc_span6def_id8CrateNumINtNtNtCs5BYDmTWcnKQ_12
19: RINvNtNtCs7IFNuxsOQZH_18rustc_query_system5query8plumbing17try_execute_queryINtCsiSfPmaTe9VX_16rustc_query_impl13DynamicConfigINtNtB4_6caches12DefaultCacheINtNtCs5BYDmTWcnKQ_12rustc_middle2ty20PseudoCanonicalInputTNtNtB2w_8instance8InstanceRINtNtB2w_4list7
20: rustc_query_impl::plumbing::query_key_hash_verify_all
21: <alloc::raw_vec::RawVec<rustc_codegen_ssa::mir::debuginfo::PerLocalVarDebugInfo<&rustc_codegen_llvm::llvm::ffi::Metadata>>>::grow_one
22: <rustc_codegen_llvm::builder::GenericBuilder<rustc_codegen_llvm::context::FullCx> as rustc_codegen_ssa::traits::builder::BuilderMethods>::call
23: <hashbrown::raw::RawTable<((&rustc_codegen_llvm::llvm::ffi::Metadata, usize), &rustc_codegen_llvm::llvm::ffi::Metadata)>>::reserve_rehash::<hashbrown::map::make_hasher<(&rustc_codegen_llvm::llvm::ffi::Metadata, usize), &rustc_codegen_llvm::llvm::ffi::Metadata, rustc_hash::FxBuildHasher>::{closure#0}>
24: <rustc_target::callconv::FnAbi<rustc_middle::ty::Ty> as rustc_codegen_llvm::abi::FnAbiLlvmExt>::apply_attrs_callsite
25: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit
26: std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Construct_n<std::basic_string<char,std::char_traits<char>,std::allocator<char> > * __
27: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
28: <rustc_interface::queries::Linker>::codegen_and_build_linker
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.88.0 (6b00bc388 2025-06-23) running on x86_64-pc-windows-msvc
note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `alloc::vec::Vec<OwnedThisEnum>: core::marker::Unpin`
#1 [is_unpin_raw] computing whether `alloc::vec::Vec<OwnedThisEnum>` is `Unpin`
#2 [fn_abi_of_instance] computing call ABI of `core::ptr::drop_in_place::<alloc::vec::Vec<OwnedThisEnum>> - shim(Some(alloc::vec::Vec<OwnedThisEnum>))`
end of query stack
temporary fix
adding this to Cargo.toml disables incremental building and prevents the error, but of course as drawbacks and isnt sustainable:
[profile.dev]
incremental = false
[profile.release]
incremental = false
Metadata
Metadata
Assignees
Labels
A-incr-compArea: Incremental compilationArea: Incremental compilationC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.