[package]
name = "issue132400"
version = "0.1.0"
edition = "2021"
[dependencies.diesel]
default-features = false
features = ["postgres"]
version = "=2.2.4"
#[macro_use]
extern crate diesel;
use diesel::{Connection, PgConnection};
use diesel::{Identifiable, Insertable};
use crate::diesel::associations::HasTable;
use crate::diesel::RunQueryDsl;
table! {
my_tables (Id) {
Id -> Int4,
_metadata -> Nullable<Int4>, // cargo run once, then comment out this line (1/3) and cargo run again
}
}
#[derive(Queryable, Identifiable, Insertable)]
#[diesel(table_name = my_tables, primary_key(Id))]
pub struct MyStruct {
#[diesel(column_name = Id)]
pub id: i32,
#[diesel(column_name = _metadata)] // cargo run once, then comment out this line (2/3) and cargo run again
pub _metadata: Option<i32>, // cargo run once, then comment out this line (3/3) and cargo run again
}
fn main() {
println!("Hello, world!");
// This never actually works obviously but it'll make the compiler parse the table
let Ok(conn) = &mut PgConnection::establish(&"some_url") else { return; };
let Ok(my_struct): Result<MyStruct, _> = MyStruct::table().first(conn) else { return; };
println!("{}", my_struct.id);
}
thread 'rustc' panicked at compiler/rustc_hir/src/definitions.rs:389:13:
("Failed to extract DefId", def_kind, PackedFingerprint(Fingerprint(6244254518219710122, 13331169420728202915)))
stack backtrace:
<backtrace 1>
error: the compiler unexpectedly panicked. this is a bug.
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.80.1 (3f5fd8dd4 2024-08-06) running on aarch64-apple-darwin
note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -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 `diesel::query_builder::select_statement::SelectStatement<diesel::query_builder::from_clause::FromClause<my_tables::table>>: diesel::associations::HasTable` | = note: this failure-note originates in the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info)
#1 [check_well_formed] checking that `my_tables::<impl at src/main.rs:9:1: 14:2>` is well-formed
end of query stack
there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 representability(2ba116c5b3de895f-3ffc61642ccaeed7)
#1 adt_sized_constraint(thread 'rustc' panicked at compiler/rustc_hir/src/definitions.rs:389:13:
("Failed to extract DefId", adt_sized_constraint, PackedFingerprint(Fingerprint(6244254518219710122, 13331169420728202915)))
stack backtrace:
<backtrace 2>
error: the compiler unexpectedly panicked. this is a bug.
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.80.1 (3f5fd8dd4 2024-08-06) running on aarch64-apple-darwin
note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -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 `diesel::query_builder::select_statement::SelectStatement<diesel::query_builder::from_clause::FromClause<my_tables::table>>: diesel::associations::HasTable` | = note: this failure-note originates in the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info)
#1 [check_well_formed] checking that `my_tables::<impl at src/main.rs:9:1: 14:2>` is well-formed
end of query stack
there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 check_mod_type_wf(issue132400[56a8]::my_tables)
end of try_mark_green dep node stack
error: could not compile `issue132400` (bin "issue132400")
Code
Meta
rustc --version --verbose
:Error output
Backtrace
Backtrace 1 ``` 0: 0x1056e8c1c -::fmt::h41035ce174e31160
1: 0x10572d87c - core::fmt::write::h7e946826fce7616b
2: 0x1056df088 - std::io::Write::write_fmt::he3645adfefb23e4a
3: 0x1056e8a74 - std::sys_common::backtrace::print::h2efe9ae66fda73dc
4: 0x1056eb080 - std::panicking::default_hook::{{closure}}::hd27200b4fbd3bf40
5: 0x1056ead4c - std::panicking::default_hook::hb8656334461229c8
6: 0x10ed6f380 - as core[cec0bd9d2fc86fa9]::ops::function::Fn<(&dyn for<'a, 'b> core[cec0bd9d2fc86fa9]::ops::function::Fn<(&'a core[cec0bd9d2fc86fa9]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[cec0bd9d2fc86fa9]::marker::Sync + core[cec0bd9d2fc86fa9]::marker::Send, &core[cec0bd9d2fc86fa9]::panic::panic_info::PanicInfo)>>::call
7: 0x1056eba6c - std::panicking::rust_panic_with_hook::h10171cf76e1aed15
8: 0x1056eb480 - std::panicking::begin_panic_handler::{{closure}}::h9344de43a47cae21
9: 0x1056e90a0 - std::sys_common::backtrace::__rust_end_short_backtrace::h55013ada3ab9c4e8
10: 0x1056eb1f0 - _rust_begin_unwind
11: 0x105749128 - core::panicking::panic_fmt::h0b16bb09366e1f01
12: 0x112e746b0 - ::local_def_path_hash_to_def_id::err
13: 0x10f7ac008 - ::def_path_hash_to_def_id
14: 0x10ffdafb0 - ::{closure#0} as core[cec0bd9d2fc86fa9]::ops::function::FnOnce<(rustc_middle[2867706b5eb6f7f9]::ty::context::TyCtxt, rustc_query_system[a56a14b00b0e8ff6]::dep_graph::dep_node::DepNode)>>::call_once
15: 0x110106ac8 - >::try_mark_previous_green::
16: 0x110106b0c - >::try_mark_previous_green::
17: 0x110106b0c - >::try_mark_previous_green::
18: 0x110106b0c - >::try_mark_previous_green::
19: 0x110106b0c - >::try_mark_previous_green::
20: 0x110106b0c - >::try_mark_previous_green::
21: 0x110106b0c - >::try_mark_previous_green::
22: 0x110106b0c - >::try_mark_previous_green::
23: 0x11010688c - >::try_mark_green::
24: 0x10ff7c774 - rustc_query_system[a56a14b00b0e8ff6]::query::plumbing::try_execute_query::>, rustc_middle[2867706b5eb6f7f9]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[9b9172b7a4c3de5d]::plumbing::QueryCtxt, true>
25: 0x110198124 - rustc_query_impl[9b9172b7a4c3de5d]::query_impl::evaluate_obligation::get_query_incr::__rust_end_short_backtrace
26: 0x110614030 - ::evaluate_obligation
27: 0x110614520 - ::evaluate_obligation_no_overflow
28: 0x11058f66c - ::process_trait_obligation
29: 0x11058ec30 - ::process_obligation
30: 0x110578c48 - >::process_obligations::
31: 0x110584e90 - as rustc_infer[12dda32e7c8ea680]::traits::engine::TraitEngine>::select_where_possible
32: 0x10ef95a34 - rustc_hir_analysis[eb0b0898efcdc604]::check::compare_impl_item::compare_impl_method
33: 0x10f0c2c6c - rustc_hir_analysis[eb0b0898efcdc604]::check::check::check_impl_items_against_trait
34: 0x10f0be7a0 - rustc_hir_analysis[eb0b0898efcdc604]::check::check::check_item_type
35: 0x10f112710 - rustc_hir_analysis[eb0b0898efcdc604]::check::wfcheck::check_well_formed
36: 0x110005ad4 - rustc_query_impl[9b9172b7a4c3de5d]::plumbing::__rust_begin_short_backtrace::>
37: 0x11004e0b4 - >::call_once
38: 0x10ffbc6d8 - rustc_query_system[a56a14b00b0e8ff6]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[9b9172b7a4c3de5d]::plumbing::QueryCtxt, true>
39: 0x10ff5b68c - rustc_query_system[a56a14b00b0e8ff6]::query::plumbing::force_query::>, false, false, false>, rustc_query_impl[9b9172b7a4c3de5d]::plumbing::QueryCtxt>
40: 0x10ffcd218 - ::{closure#0} as core[cec0bd9d2fc86fa9]::ops::function::FnOnce<(rustc_middle[2867706b5eb6f7f9]::ty::context::TyCtxt, rustc_query_system[a56a14b00b0e8ff6]::dep_graph::dep_node::DepNode)>>::call_once
41: 0x110106ac8 - >::try_mark_previous_green::
42: 0x11010688c - >::try_mark_green::
43: 0x10ff5d204 - rustc_query_system[a56a14b00b0e8ff6]::query::plumbing::ensure_must_run::>, false, false, false>, rustc_query_impl[9b9172b7a4c3de5d]::plumbing::QueryCtxt>
44: 0x11017e2dc - rustc_query_impl[9b9172b7a4c3de5d]::query_impl::check_mod_type_wf::get_query_incr::__rust_end_short_backtrace
45: 0x10ef623bc - std[4ec0ba9e3c6d748b]::panicking::try::<(), core[cec0bd9d2fc86fa9]::panic::unwind_safe::AssertUnwindSafe::par_for_each_module::{closure#0}>::{closure#0}::{closure#0}::{closure#0}>>
46: 0x10f04c184 - rustc_data_structures[961a954d878499e9]::sync::parallel::disabled::par_for_each_in::<&[rustc_hir[370215242720f464]::hir_id::OwnerId], ::par_for_each_module::{closure#0}>
47: 0x10f0a6284 - ::time::<(), rustc_hir_analysis[eb0b0898efcdc604]::check_crate::{closure#1}>
48: 0x10ef7f884 - rustc_hir_analysis[eb0b0898efcdc604]::check_crate
49: 0x10f4d726c - rustc_interface[6917c625c882dc9d]::passes::analysis
50: 0x110008c10 - rustc_query_impl[9b9172b7a4c3de5d]::plumbing::__rust_begin_short_backtrace::>
51: 0x11012ab84 - >::call_once
52: 0x10ff6f690 - rustc_query_system[a56a14b00b0e8ff6]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[9b9172b7a4c3de5d]::plumbing::QueryCtxt, true>
53: 0x110170730 - rustc_query_impl[9b9172b7a4c3de5d]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
54: 0x10ed8c4d8 - ::enter::>
55: 0x10ed775a4 - ::enter::, rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>
56: 0x10ed396b8 - >::set::, rustc_driver_impl[1ef2360f78401c14]::run_compiler::{closure#0}>::{closure#1}, core[cec0bd9d2fc86fa9]::result::Result<(), rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, core[cec0bd9d2fc86fa9]::result::Result<(), rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>
57: 0x10ed76f18 - rustc_span[22cad54eabbc67cf]::create_session_globals_then::, rustc_interface[6917c625c882dc9d]::util::run_in_thread_with_globals, rustc_driver_impl[1ef2360f78401c14]::run_compiler::{closure#0}>::{closure#1}, core[cec0bd9d2fc86fa9]::result::Result<(), rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
58: 0x10ed6dd58 - std[4ec0ba9e3c6d748b]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[1ef2360f78401c14]::run_compiler::{closure#0}>::{closure#1}, core[cec0bd9d2fc86fa9]::result::Result<(), rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cec0bd9d2fc86fa9]::result::Result<(), rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>
59: 0x10ed4459c - <::spawn_unchecked_, rustc_driver_impl[1ef2360f78401c14]::run_compiler::{closure#0}>::{closure#1}, core[cec0bd9d2fc86fa9]::result::Result<(), rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cec0bd9d2fc86fa9]::result::Result<(), rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>::{closure#2} as core[cec0bd9d2fc86fa9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
60: 0x1056f4588 - std::sys::pal::unix::thread::Thread::new::thread_start::hb184f2abd415aef7
61: 0x184fde034 - __pthread_joiner_wake
```
Backtrace 2
```
0: 0x1056e8c1c - ::fmt::h41035ce174e31160
1: 0x10572d87c - core::fmt::write::h7e946826fce7616b
2: 0x1056df088 - std::io::Write::write_fmt::he3645adfefb23e4a
3: 0x1056e8a74 - std::sys_common::backtrace::print::h2efe9ae66fda73dc
4: 0x1056eb080 - std::panicking::default_hook::{{closure}}::hd27200b4fbd3bf40
5: 0x1056ead4c - std::panicking::default_hook::hb8656334461229c8
6: 0x10ed6f380 - as core[cec0bd9d2fc86fa9]::ops::function::Fn<(&dyn for<'a, 'b> core[cec0bd9d2fc86fa9]::ops::function::Fn<(&'a core[cec0bd9d2fc86fa9]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[cec0bd9d2fc86fa9]::marker::Sync + core[cec0bd9d2fc86fa9]::marker::Send, &core[cec0bd9d2fc86fa9]::panic::panic_info::PanicInfo)>>::call
7: 0x1056eba6c - std::panicking::rust_panic_with_hook::h10171cf76e1aed15
8: 0x1056eb480 - std::panicking::begin_panic_handler::{{closure}}::h9344de43a47cae21
9: 0x1056e90a0 - std::sys_common::backtrace::__rust_end_short_backtrace::h55013ada3ab9c4e8
10: 0x1056eb1f0 - _rust_begin_unwind
11: 0x105749128 - core::panicking::panic_fmt::h0b16bb09366e1f01
12: 0x112e746b0 - ::local_def_path_hash_to_def_id::err
13: 0x10f7ac008 - ::def_path_hash_to_def_id
14: 0x10f50a0ac - rustc_interface[6917c625c882dc9d]::callbacks::dep_node_debug
15: 0x1101da228 - ::fmt
16: 0x10572d87c - core::fmt::write::h7e946826fce7616b
17: 0x1056dd2d4 - <&std::io::stdio::Stderr as std::io::Write>::write_fmt::h106b890cac40debb
18: 0x1056ddcd4 - std::io::stdio::_eprint::hf58134ec6abaf37d
19: 0x112f978ac - rustc_query_system[a56a14b00b0e8ff6]::dep_graph::graph::print_markframe_trace::
20: 0x110106b7c - >::try_mark_previous_green::
21: 0x110106b0c - >::try_mark_previous_green::
22: 0x110106b0c - >::try_mark_previous_green::
23: 0x110106b0c - >::try_mark_previous_green::
24: 0x110106b0c - >::try_mark_previous_green::
25: 0x110106b0c - >::try_mark_previous_green::
26: 0x110106b0c - >::try_mark_previous_green::
27: 0x110106b0c - >::try_mark_previous_green::
28: 0x11010688c - >::try_mark_green::
29: 0x10ff7c774 - rustc_query_system[a56a14b00b0e8ff6]::query::plumbing::try_execute_query::>, rustc_middle[2867706b5eb6f7f9]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[9b9172b7a4c3de5d]::plumbing::QueryCtxt, true>
30: 0x110198124 - rustc_query_impl[9b9172b7a4c3de5d]::query_impl::evaluate_obligation::get_query_incr::__rust_end_short_backtrace
31: 0x110614030 - ::evaluate_obligation
32: 0x110614520 - ::evaluate_obligation_no_overflow
33: 0x11058f66c - ::process_trait_obligation
34: 0x11058ec30 - ::process_obligation
35: 0x110578c48 - >::process_obligations::
36: 0x110584e90 - as rustc_infer[12dda32e7c8ea680]::traits::engine::TraitEngine>::select_where_possible
37: 0x10ef95a34 - rustc_hir_analysis[eb0b0898efcdc604]::check::compare_impl_item::compare_impl_method
38: 0x10f0c2c6c - rustc_hir_analysis[eb0b0898efcdc604]::check::check::check_impl_items_against_trait
39: 0x10f0be7a0 - rustc_hir_analysis[eb0b0898efcdc604]::check::check::check_item_type
40: 0x10f112710 - rustc_hir_analysis[eb0b0898efcdc604]::check::wfcheck::check_well_formed
41: 0x110005ad4 - rustc_query_impl[9b9172b7a4c3de5d]::plumbing::__rust_begin_short_backtrace::>
42: 0x11004e0b4 - >::call_once
43: 0x10ffbc6d8 - rustc_query_system[a56a14b00b0e8ff6]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[9b9172b7a4c3de5d]::plumbing::QueryCtxt, true>
44: 0x10ff5b68c - rustc_query_system[a56a14b00b0e8ff6]::query::plumbing::force_query::>, false, false, false>, rustc_query_impl[9b9172b7a4c3de5d]::plumbing::QueryCtxt>
45: 0x10ffcd218 - ::{closure#0} as core[cec0bd9d2fc86fa9]::ops::function::FnOnce<(rustc_middle[2867706b5eb6f7f9]::ty::context::TyCtxt, rustc_query_system[a56a14b00b0e8ff6]::dep_graph::dep_node::DepNode)>>::call_once
46: 0x110106ac8 - >::try_mark_previous_green::
47: 0x11010688c - >::try_mark_green::
48: 0x10ff5d204 - rustc_query_system[a56a14b00b0e8ff6]::query::plumbing::ensure_must_run::>, false, false, false>, rustc_query_impl[9b9172b7a4c3de5d]::plumbing::QueryCtxt>
49: 0x11017e2dc - rustc_query_impl[9b9172b7a4c3de5d]::query_impl::check_mod_type_wf::get_query_incr::__rust_end_short_backtrace
50: 0x10ef623bc - std[4ec0ba9e3c6d748b]::panicking::try::<(), core[cec0bd9d2fc86fa9]::panic::unwind_safe::AssertUnwindSafe::par_for_each_module::{closure#0}>::{closure#0}::{closure#0}::{closure#0}>>
51: 0x10f04c184 - rustc_data_structures[961a954d878499e9]::sync::parallel::disabled::par_for_each_in::<&[rustc_hir[370215242720f464]::hir_id::OwnerId], ::par_for_each_module::{closure#0}>
52: 0x10f0a6284 - ::time::<(), rustc_hir_analysis[eb0b0898efcdc604]::check_crate::{closure#1}>
53: 0x10ef7f884 - rustc_hir_analysis[eb0b0898efcdc604]::check_crate
54: 0x10f4d726c - rustc_interface[6917c625c882dc9d]::passes::analysis
55: 0x110008c10 - rustc_query_impl[9b9172b7a4c3de5d]::plumbing::__rust_begin_short_backtrace::>
56: 0x11012ab84 - >::call_once
57: 0x10ff6f690 - rustc_query_system[a56a14b00b0e8ff6]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[9b9172b7a4c3de5d]::plumbing::QueryCtxt, true>
58: 0x110170730 - rustc_query_impl[9b9172b7a4c3de5d]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
59: 0x10ed8c4d8 - ::enter::>
60: 0x10ed775a4 - ::enter::, rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>
61: 0x10ed396b8 - >::set::, rustc_driver_impl[1ef2360f78401c14]::run_compiler::{closure#0}>::{closure#1}, core[cec0bd9d2fc86fa9]::result::Result<(), rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, core[cec0bd9d2fc86fa9]::result::Result<(), rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>
62: 0x10ed76f18 - rustc_span[22cad54eabbc67cf]::create_session_globals_then::, rustc_interface[6917c625c882dc9d]::util::run_in_thread_with_globals, rustc_driver_impl[1ef2360f78401c14]::run_compiler::{closure#0}>::{closure#1}, core[cec0bd9d2fc86fa9]::result::Result<(), rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
63: 0x10ed6dd58 - std[4ec0ba9e3c6d748b]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[1ef2360f78401c14]::run_compiler::{closure#0}>::{closure#1}, core[cec0bd9d2fc86fa9]::result::Result<(), rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cec0bd9d2fc86fa9]::result::Result<(), rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>
64: 0x10ed4459c - <::spawn_unchecked_, rustc_driver_impl[1ef2360f78401c14]::run_compiler::{closure#0}>::{closure#1}, core[cec0bd9d2fc86fa9]::result::Result<(), rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cec0bd9d2fc86fa9]::result::Result<(), rustc_span[22cad54eabbc67cf]::ErrorGuaranteed>>::{closure#2} as core[cec0bd9d2fc86fa9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
65: 0x1056f4588 - std::sys::pal::unix::thread::Thread::new::thread_start::hb184f2abd415aef7
66: 0x184fde034 - __pthread_joiner_wake
```