Skip to content

Conversation

@ShoyuVanilla
Copy link
Member

The panic here: #20443 (comment) originates from the "multiple instances" of lang items.

We can verify this running on analysis-stats to the following code:

use std::{ptr, sync::atomic::AtomicPtr};

#[lang = "pointee_trait"]
pub trait Pointee {
    #[lang = "metadata_type"]
    type Metadata;
}

static HOOK: AtomicPtr<()> = AtomicPtr::new(ptr::null_mut())

So, depending on the "starting crate" of lang items query, it sometimes resolved as crate::Pointee::Metadata but core::ptr::metadata::Pointee::Metadata otherwise, and if we try to compare those items, 💥

This thing is happening in when we are running analysis-stats on std.
Though std has #![no_std] and core has #![no_core], we always insert sysroots dependencies no matter they are and they are dropped/overwritten on nameless, especially in the following lines

dropping sysroots on no_std or no_core:

for (name, dep) in &self.deps {
// Add all
if dep.is_prelude() {
// This is a bit confusing but the gist is that `no_core` and `no_std` remove the
// sysroot dependence on `core` and `std` respectively. Our `CrateGraph` is eagerly
// constructed with them in place no matter what though, since at that point we
// don't do pre-configured attribute resolution yet.
// So here check if we are no_core / no_std and we are trying to add the
// corresponding dep from the sysroot
// Depending on the crate data of a dependency seems bad for incrementality, but
// we only do that for sysroot crates (this is why the order of the `&&` is important)
// - which are normally standard library crate, which realistically aren't going
// to have their crate ID invalidated, because they stay on the same root file and
// they're dependencies of everything else, so if some collision miraculously occurs
// we will resolve it by disambiguating the other crate.
let skip = dep.is_sysroot()
&& match dep.crate_id.data(self.db).origin {
CrateOrigin::Lang(LangCrateOrigin::Core) => crate_data.no_core,
CrateOrigin::Lang(LangCrateOrigin::Std) => crate_data.no_std,
_ => false,
};
if skip {
continue;
}
self.local_def_map
.extern_prelude
.insert(name.clone(), (CrateRootModuleId { krate: dep.crate_id }, None));
}
}

overwriting sysroots when we have dependencies.std.path = ".."

for dep in &krate.dependencies {
tracing::debug!("crate dep {:?} -> {:?}", dep.name, dep.crate_id);
deps.insert(dep.as_name(), dep.clone());
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 17, 2025
@ShoyuVanilla ShoyuVanilla changed the title fix: Consider non-sysroot dependencies first when querying lang items fix: Make lang items query properly filter out overwritten/excluded sysroots Aug 17, 2025
@ChayimFriedman2
Copy link
Contributor

I think it will be better, if we're accessing the def map anyway, to iterate over local_def_map.extern_prelude.

...although this will be weird given in other places we iterate over the Crate::dependencies (e.g. impl collection, BTW could this theoretically cause a cycle?)

Also I suppose conducting a test for this will be difficult?

@ShoyuVanilla
Copy link
Member Author

I think it will be better, if we're accessing the def map anyway, to iterate over local_def_map.extern_prelude.

Sounds fair. I'll try with that

Also I suppose conducting a test for this will be difficult?

I'm not sure if I could manage to but I'll try that

@ChayimFriedman2
Copy link
Contributor

Actually, I don't see how this will solve the problem - if the solver is expecting a single lang item across the crate graph, won't we still produce twice, one for core and one for std, and the order will depend on which crate come first in the dependencies? What is the conflicting lang item?

@ShoyuVanilla
Copy link
Member Author

Re-exported things would end up into the same item, I guess? At least that's what happened when I tried analysis-stats on local. Basically, we cannot have duplicated lang-items in Rust, otherwise blocked by E0152.

@ChayimFriedman2
Copy link
Contributor

Reepxorts definitely aren't considered for lang_items, we consider only declarations.

@ShoyuVanilla
Copy link
Member Author

Then how would we produce duplicates?

@ChayimFriedman2
Copy link
Contributor

If there are actual duplicates? I don't know. What is the duplicated lang item in std?

@ShoyuVanilla
Copy link
Member Author

ShoyuVanilla commented Aug 17, 2025

It is duplicated by the following manner. If we try to analyze something like rust-lang/rust/library/proc-macro, it has dependencies.std.path = "../std", so the pre-built std is replaced by local std.
But we still insert sysroot std along with local std in rust-analyzer and that makes the duplicates.

Edit) More precisely, the duplicates here are in core and it's also duplicated via sysroot core and local core from std's dependencies

@ChayimFriedman2
Copy link
Contributor

...Oh. That does explain it.

But please add a comment linking to this issue, that's pretty subtle!

@ShoyuVanilla
Copy link
Member Author

Okay, I'll add some explanations and links once I'm finished

crate_local_def_map: Option<&'db LocalDefMap>,
// The dependencies of the current crate, including optional deps like `test`.
deps: FxHashMap<Name, BuiltDependency>,
deps: FxIndexMap<Name, BuiltDependency>,
Copy link
Member Author

@ShoyuVanilla ShoyuVanilla Aug 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that the test and analysis-stats randomly succeeds before this fix due to non-determinism here 🤣

}
//- /lib.rs crate:r#std deps:core
#[no_std]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#![no_std]

Forgot the !.

CrateOrigin::Lang(LangCrateOrigin::Std) => crate_data.no_std,
CrateOrigin::Lang(LangCrateOrigin::Std) => {
crate_data.no_core || crate_data.no_std
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no_core implies no_std

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our project-model inserts sysroot deps before the other deps. The changes on this file is to match with that behavior to test the issue.

CrateOrigin::Library { repo, name }
} else {
CrateOrigin::Local { repo, name: Some(name) }
let origin = if force_non_lang_origin == ForceNoneLangOrigin::Yes {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, our test suite considers crates with names std, core, alloc, ... as CrateOrigin::Lang. I made a bit ugly escape hatch to evade this like r#std

Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! That must've been a hassle to debug 😨

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Aug 17, 2025
Merged via the queue into rust-lang:master with commit 484db3a Aug 17, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 17, 2025
@ShoyuVanilla ShoyuVanilla deleted the analysis-std-panic branch August 17, 2025 14:05
@RoloEdits
Copy link

Testing a panic I had found running analysis-stats on the helix repo, and this seems to have fixed that as well.

For extra context, this was the panic:

Database loaded:     635.46ms, 579minstr, 84kb (metadata 354.97ms, 6481kinstr, 13kb; build 158.45ms, 3529kinstr, 0b)
  item trees: 245
  dependency lines of code: 3_306_841, item trees: 6_906
  dependency item stats: traits: 1_685, impl: 30_180, mods: 8_228, macro calls: 8_766, macro rules: 2_110
Item Tree Collection: 4.63s, 54ginstr, 0b
  Total Statistics:
    crates: 25, mods: 300, decls: 9694, bodies: 8773, adts: 1069, consts: 1950
  Workspace:
    traits: 20, macro_rules macros: 22, proc_macros: 0
    lines of code: 101_848, item trees: 245
    usages: traits: 20, impl: 792, mods: 297, macro calls: 64, macro rules: 45
  Dependencies:
    lines of code: 3_306_841, item trees: 6_906
    declarations: traits: 1_685, impl: 30_180, mods: 8_228, macro calls: 8_766, macro rules: 2_110
Item Collection:     6.97s, 57ginstr, 0b
84/8773 0% processing: helix_term::handlers::completion::request::request_completions_from_language_5/8773 0% processing: helix_term::handlers::completion::request::request_completions_from_language_s634/8773 7% processing: helix_term::config::tests::should_fail_to_deserialize_custom_command_with_ma5/8773 7% processing: helix_term::config::tests::should_fail_to_deserialize_custom_command_with_macr1707/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_max_line_width_of_1_double8/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_max_line_width_of_1_double_wi13/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_double_width_ch4/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_double_width_cha6/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta7/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta8/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta9/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta2137/8773 24% processing: helix_view::view::tests::test_text_pos_at_screen_coords_without_line_numbe8/8773 24% processing: helix_view::view::tests::test_text_pos_at_screen_coords_without_line_numbers_851/8773 32% processing: helix_view::graphics::tests::combined_patch_gives_same_result_as_individual2/8773 32% processing: helix_view::graphics::tests::combined_patch_gives_same_result_as_individual_p5472/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_seri3/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_seriali4/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_deseria5/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_deseria6/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_edit_support_de7/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_edit_support_se7703/8773 87% processing: helix_core::surround::test::test_get_surround_pos_bail_different_surround_4/8773 87% processing: helix_core::surround::test::test_get_surround_pos_bail_different_surround_cha5/8773 87% processing: helix_core::surround::test::test_get_surround_pos_bail_overlapping_surround_c10/8773 87% processing: helix_core::surround::test::test_find_nth_closest_pairs_pos_index_range_pani968/8773 90% processing: helix_core::position::test::test_char_idx_at_visual_row_offset_inline_annot9/8773 90% processing: helix_core::position::test::test_char_idx_at_visual_row_offset_inline_annotat8039/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_forward_movement_a40/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_forward_movement_att1/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_forward_to_end_moveme2/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_backwards_movement_at3/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_nextsub_wo4/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_next_sub_w5/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_next_sub_wor6/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_next_long_7/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_previous_w8/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_previous_s9/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_previous_l50/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_previous_wo1/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_previous_wor2/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_previous_sub3/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_next_long_wo4/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_prev_long_wo5/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_prev_paragraph_sing6/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_prev_paragraph_doub7/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_prev_paragraph_exte8/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_next_paragraph_sing9/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_next_paragraph_doub60/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_next_paragraph_ext80/8773 92% processing: helix_core::match_brackets::tests::test_find_matching_bracket_current_line_p1/8773 92% processing: helix_core::match_brackets::tests::test_find_matching_bracket_current_line_pl173/8773 93% processing: helix_core::increment::integer::test::test_increment_basic_hexadecimal_numb4/8773 93% processing: helix_core::increment::integer::test::test_increment_basic_hexadecimal_number7/8773 93% processing: helix_core::increment::integer::test::test_leading_and_trailing_separators_ar8/8773 93% processing: helix_core::increment::integer::test::test_leading_and_trailing_separators_ar44/8773 96% processing: helix_core::comment::test::toggle_line_comment::uncomment_0_margin_comments_5/8773 96% processing: helix_core::comment::test::toggle_line_comment::uncomment_0_margin_comments_wBody lowering:       2.50s, 19ginstr, 0b
84/8773 0% processing: helix_term::handlers::completion::request::request_completions_from_language_5/8773 0% processing: helix_term::handlers::completion::request::request_completions_from_language_s356/8773 4% processing: helix_term::ui::picker::get_preview
thread 'main' panicked at /home/ryan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/chalk-ir-0.104.0/src/lib.rs:1457:33:
called `Option::unwrap()` on a `None` value
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
infer panicked for helix_term::ui::picker::get_preview: called `Option::unwrap()` on a `None` value
634/8773 7% processing: helix_term::config::tests::should_fail_to_deserialize_custom_command_with_ma5/8773 7% processing: helix_term::config::tests::should_fail_to_deserialize_custom_command_with_macr1694/8773 19% processing: helix_tui::widgets::reflow::next_line
thread 'main' panicked at /home/ryan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/chalk-ir-0.104.0/src/lib.rs:2732:10:
index out of bounds: the len is 1 but the index is 1
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
infer panicked for helix_tui::widgets::reflow::next_line: index out of bounds: the len is 1 but the index is 1
7/8773 19% processing: helix_tui::widgets::reflow::next_line
thread 'main' panicked at /home/ryan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/chalk-ir-0.104.0/src/lib.rs:2732:10:
index out of bounds: the len is 1 but the index is 1
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
infer panicked for helix_tui::widgets::reflow::next_line: index out of bounds: the len is 1 but the index is 1
707/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_max_line_width_of_1_double_8/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_max_line_width_of_1_double_wi13/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_double_width_ch4/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_double_width_cha6/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta7/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta8/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta9/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta2137/8773 24% processing: helix_view::view::tests::test_text_pos_at_screen_coords_without_line_numbe8/8773 24% processing: helix_view::view::tests::test_text_pos_at_screen_coords_without_line_numbers_851/8773 32% processing: helix_view::graphics::tests::combined_patch_gives_same_result_as_individual2/8773 32% processing: helix_view::graphics::tests::combined_patch_gives_same_result_as_individual_p5472/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_seri3/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_seriali4/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_deseria5/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_deseria6/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_edit_support_de7/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_edit_support_se7703/8773 87% processing: helix_core::surround::test::test_get_surround_pos_bail_different_surround_4/8773 87% processing: helix_core::surround::test::test_get_surround_pos_bail_different_surround_cha5/8773 87% processing: helix_core::surround::test::test_get_surround_pos_bail_overlapping_surround_c10/8773 87% processing: helix_core::surround::test::test_find_nth_closest_pairs_pos_index_range_pani968/8773 90% processing: helix_core::position::test::test_char_idx_at_visual_row_offset_inline_annot9/8773 90% processing: helix_core::position::test::test_char_idx_at_visual_row_offset_inline_annotat8039/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_forward_movement_a40/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_forward_movement_att1/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_forward_to_end_moveme2/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_backwards_movement_at3/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_nextsub_wo4/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_next_sub_w5/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_next_sub_wor6/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_next_long_7/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_previous_w8/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_previous_s9/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_previous_l50/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_previous_wo1/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_previous_wor2/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_previous_sub3/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_next_long_wo4/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_prev_long_wo5/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_prev_paragraph_sing6/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_prev_paragraph_doub7/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_prev_paragraph_exte8/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_next_paragraph_sing9/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_next_paragraph_doub60/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_next_paragraph_ext80/8773 92% processing: helix_core::match_brackets::tests::test_find_matching_bracket_current_line_p1/8773 92% processing: helix_core::match_brackets::tests::test_find_matching_bracket_current_line_pl173/8773 93% processing: helix_core::increment::integer::test::test_increment_basic_hexadecimal_numb4/8773 93% processing: helix_core::increment::integer::test::test_increment_basic_hexadecimal_number7/8773 93% processing: helix_core::increment::integer::test::test_leading_and_trailing_separators_ar8/8773 93% processing: helix_core::increment::integer::test::test_leading_and_trailing_separators_ar44/8773 96% processing: helix_core::comment::test::toggle_line_comment::uncomment_0_margin_comments_5/8773 96% processing: helix_core::comment::test::toggle_line_comment::uncomment_0_margin_comments_w  exprs: 286408, ??ty: 134 (0%), ?ty: 36 (0%), !ty: 2
  pats: 56483, ??ty: 16 (0%), ?ty: 14 (0%), !ty: 0
  panics: 3
Inference:           24.63s, 171ginstr, 32b
0/8773 0%
thread 'main' panicked at /home/ryan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/chalk-ir-0.104.0/src/lib.rs:1457:33:
called `Option::unwrap()` on a `None` value
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@ShoyuVanilla
Copy link
Member Author

Testing a panic I had found running analysis-stats on the helix repo, and this seems to have fixed that as well.

For extra context, this was the panic:

Database loaded:     635.46ms, 579minstr, 84kb (metadata 354.97ms, 6481kinstr, 13kb; build 158.45ms, 3529kinstr, 0b)
  item trees: 245
  dependency lines of code: 3_306_841, item trees: 6_906
  dependency item stats: traits: 1_685, impl: 30_180, mods: 8_228, macro calls: 8_766, macro rules: 2_110
Item Tree Collection: 4.63s, 54ginstr, 0b
  Total Statistics:
    crates: 25, mods: 300, decls: 9694, bodies: 8773, adts: 1069, consts: 1950
  Workspace:
    traits: 20, macro_rules macros: 22, proc_macros: 0
    lines of code: 101_848, item trees: 245
    usages: traits: 20, impl: 792, mods: 297, macro calls: 64, macro rules: 45
  Dependencies:
    lines of code: 3_306_841, item trees: 6_906
    declarations: traits: 1_685, impl: 30_180, mods: 8_228, macro calls: 8_766, macro rules: 2_110
Item Collection:     6.97s, 57ginstr, 0b
84/8773 0% processing: helix_term::handlers::completion::request::request_completions_from_language_5/8773 0% processing: helix_term::handlers::completion::request::request_completions_from_language_s634/8773 7% processing: helix_term::config::tests::should_fail_to_deserialize_custom_command_with_ma5/8773 7% processing: helix_term::config::tests::should_fail_to_deserialize_custom_command_with_macr1707/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_max_line_width_of_1_double8/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_max_line_width_of_1_double_wi13/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_double_width_ch4/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_double_width_cha6/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta7/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta8/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta9/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta2137/8773 24% processing: helix_view::view::tests::test_text_pos_at_screen_coords_without_line_numbe8/8773 24% processing: helix_view::view::tests::test_text_pos_at_screen_coords_without_line_numbers_851/8773 32% processing: helix_view::graphics::tests::combined_patch_gives_same_result_as_individual2/8773 32% processing: helix_view::graphics::tests::combined_patch_gives_same_result_as_individual_p5472/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_seri3/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_seriali4/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_deseria5/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_deseria6/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_edit_support_de7/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_edit_support_se7703/8773 87% processing: helix_core::surround::test::test_get_surround_pos_bail_different_surround_4/8773 87% processing: helix_core::surround::test::test_get_surround_pos_bail_different_surround_cha5/8773 87% processing: helix_core::surround::test::test_get_surround_pos_bail_overlapping_surround_c10/8773 87% processing: helix_core::surround::test::test_find_nth_closest_pairs_pos_index_range_pani968/8773 90% processing: helix_core::position::test::test_char_idx_at_visual_row_offset_inline_annot9/8773 90% processing: helix_core::position::test::test_char_idx_at_visual_row_offset_inline_annotat8039/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_forward_movement_a40/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_forward_movement_att1/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_forward_to_end_moveme2/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_backwards_movement_at3/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_nextsub_wo4/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_next_sub_w5/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_next_sub_wor6/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_next_long_7/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_previous_w8/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_previous_s9/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_previous_l50/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_previous_wo1/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_previous_wor2/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_previous_sub3/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_next_long_wo4/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_prev_long_wo5/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_prev_paragraph_sing6/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_prev_paragraph_doub7/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_prev_paragraph_exte8/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_next_paragraph_sing9/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_next_paragraph_doub60/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_next_paragraph_ext80/8773 92% processing: helix_core::match_brackets::tests::test_find_matching_bracket_current_line_p1/8773 92% processing: helix_core::match_brackets::tests::test_find_matching_bracket_current_line_pl173/8773 93% processing: helix_core::increment::integer::test::test_increment_basic_hexadecimal_numb4/8773 93% processing: helix_core::increment::integer::test::test_increment_basic_hexadecimal_number7/8773 93% processing: helix_core::increment::integer::test::test_leading_and_trailing_separators_ar8/8773 93% processing: helix_core::increment::integer::test::test_leading_and_trailing_separators_ar44/8773 96% processing: helix_core::comment::test::toggle_line_comment::uncomment_0_margin_comments_5/8773 96% processing: helix_core::comment::test::toggle_line_comment::uncomment_0_margin_comments_wBody lowering:       2.50s, 19ginstr, 0b
84/8773 0% processing: helix_term::handlers::completion::request::request_completions_from_language_5/8773 0% processing: helix_term::handlers::completion::request::request_completions_from_language_s356/8773 4% processing: helix_term::ui::picker::get_preview
thread 'main' panicked at /home/ryan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/chalk-ir-0.104.0/src/lib.rs:1457:33:
called `Option::unwrap()` on a `None` value
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
infer panicked for helix_term::ui::picker::get_preview: called `Option::unwrap()` on a `None` value
634/8773 7% processing: helix_term::config::tests::should_fail_to_deserialize_custom_command_with_ma5/8773 7% processing: helix_term::config::tests::should_fail_to_deserialize_custom_command_with_macr1694/8773 19% processing: helix_tui::widgets::reflow::next_line
thread 'main' panicked at /home/ryan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/chalk-ir-0.104.0/src/lib.rs:2732:10:
index out of bounds: the len is 1 but the index is 1
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
infer panicked for helix_tui::widgets::reflow::next_line: index out of bounds: the len is 1 but the index is 1
7/8773 19% processing: helix_tui::widgets::reflow::next_line
thread 'main' panicked at /home/ryan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/chalk-ir-0.104.0/src/lib.rs:2732:10:
index out of bounds: the len is 1 but the index is 1
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
infer panicked for helix_tui::widgets::reflow::next_line: index out of bounds: the len is 1 but the index is 1
707/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_max_line_width_of_1_double_8/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_max_line_width_of_1_double_wi13/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_double_width_ch4/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_double_width_cha6/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta7/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta8/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta9/8773 19% processing: helix_tui::widgets::reflow::test::line_composer_word_wrapper_preserve_indenta2137/8773 24% processing: helix_view::view::tests::test_text_pos_at_screen_coords_without_line_numbe8/8773 24% processing: helix_view::view::tests::test_text_pos_at_screen_coords_without_line_numbers_851/8773 32% processing: helix_view::graphics::tests::combined_patch_gives_same_result_as_individual2/8773 32% processing: helix_view::graphics::tests::combined_patch_gives_same_result_as_individual_p5472/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_seri3/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_seriali4/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_deseria5/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_support_deseria6/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_edit_support_de7/8773 62% processing: helix_lsp_types::semantic_tokens::tests::test_semantic_tokens_edit_support_se7703/8773 87% processing: helix_core::surround::test::test_get_surround_pos_bail_different_surround_4/8773 87% processing: helix_core::surround::test::test_get_surround_pos_bail_different_surround_cha5/8773 87% processing: helix_core::surround::test::test_get_surround_pos_bail_overlapping_surround_c10/8773 87% processing: helix_core::surround::test::test_find_nth_closest_pairs_pos_index_range_pani968/8773 90% processing: helix_core::position::test::test_char_idx_at_visual_row_offset_inline_annot9/8773 90% processing: helix_core::position::test::test_char_idx_at_visual_row_offset_inline_annotat8039/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_forward_movement_a40/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_forward_movement_att1/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_forward_to_end_moveme2/8773 91% processing: helix_core::movement::test::nonsensical_ranges_panic_on_backwards_movement_at3/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_nextsub_wo4/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_next_sub_w5/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_next_sub_wor6/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_next_long_7/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_previous_w8/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_previous_s9/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_start_of_previous_l50/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_previous_wo1/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_previous_wor2/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_previous_sub3/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_next_long_wo4/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_end_of_prev_long_wo5/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_prev_paragraph_sing6/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_prev_paragraph_doub7/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_prev_paragraph_exte8/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_next_paragraph_sing9/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_next_paragraph_doub60/8773 91% processing: helix_core::movement::test::test_behaviour_when_moving_to_next_paragraph_ext80/8773 92% processing: helix_core::match_brackets::tests::test_find_matching_bracket_current_line_p1/8773 92% processing: helix_core::match_brackets::tests::test_find_matching_bracket_current_line_pl173/8773 93% processing: helix_core::increment::integer::test::test_increment_basic_hexadecimal_numb4/8773 93% processing: helix_core::increment::integer::test::test_increment_basic_hexadecimal_number7/8773 93% processing: helix_core::increment::integer::test::test_leading_and_trailing_separators_ar8/8773 93% processing: helix_core::increment::integer::test::test_leading_and_trailing_separators_ar44/8773 96% processing: helix_core::comment::test::toggle_line_comment::uncomment_0_margin_comments_5/8773 96% processing: helix_core::comment::test::toggle_line_comment::uncomment_0_margin_comments_w  exprs: 286408, ??ty: 134 (0%), ?ty: 36 (0%), !ty: 2
  pats: 56483, ??ty: 16 (0%), ?ty: 14 (0%), !ty: 0
  panics: 3
Inference:           24.63s, 171ginstr, 32b
0/8773 0%
thread 'main' panicked at /home/ryan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/chalk-ir-0.104.0/src/lib.rs:1457:33:
called `Option::unwrap()` on a `None` value
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I guess that improvement is from #20454 ?
This PR only effects codebases that using no_std or overriding std (or other sysroot dependencies) and helix seems not

@RoloEdits
Copy link

How weird.

image I had seen the panic on the bottom commit, and after checking out the changes here: image

it didnt panic anymore. It didnt seem like anything in-between would have affected this either. I may have misunderstood those other changes and they could have fixed whatever was causing the panic? Sorry for the noise.

@ShoyuVanilla
Copy link
Member Author

ShoyuVanilla commented Aug 18, 2025

Oh, it's not a noise but a valuable test report on a sizable real world project.
And yes, your revision doesn't contain any later changes than this PR for sure. As I stated, this PR only affects codebases playing around std in direct, so I guess
#20475 (comment)
this subtle change that introduced deterministic order of iteration might have caused the change. If so, the panics on helix is not gone, but what previously randomly failed or succeeded depending on the iteration order of hashmap is now hidden by determinism. I think I should investigate helix with previous revisions. Thanks for letting me know this!

@ShoyuVanilla
Copy link
Member Author

ShoyuVanilla commented Aug 18, 2025

I haven't bisected yet but I guess the panics on helix was fixed with #20453 ?
The panicked lines look similar to those of webrender-2022

@RoloEdits
Copy link

Ah, yep, that was the one. I thought it was something specific to the webrender that it was fixing, but I guess the dyn handling was the root issue? Names are a bit hard to follow in the commit history for all this stuff. Sorry once again.

@ShoyuVanilla
Copy link
Member Author

No worries! It still worth a lot to check how rust-analyzer runs on large projects.

@lnicola lnicola changed the title fix: Make lang items query properly filter out overwritten/excluded sysroots fix: don't duplicate lang items with overridden sysroot crates Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants