Skip to content

comptime read files experiments - #165159

Draft
lambinoo wants to merge 6 commits into
rust-lang:mainfrom
lambinoo:feat-comptime-read-files
Draft

lambinoo wants to merge 6 commits into
rust-lang:mainfrom
lambinoo:feat-comptime-read-files

Conversation

@lambinoo

@lambinoo lambinoo commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 29, 2026
@lambinoo
lambinoo force-pushed the feat-comptime-read-files branch from daef30d to 7da399f Compare October 29, 2026 22:48
Comment thread compiler/rustc_middle/src/queries.rs Outdated
}

/// Query data from non-local crates
query experimental_comptime_fetch_file(key: (CrateNum, &'tcx String)) -> Option<&'tcx [u8]> {

@oli-obk oli-obk Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
query experimental_comptime_fetch_file(key: (CrateNum, &'tcx String)) -> Option<&'tcx [u8]> {
query experimental_comptime_fetch_file(key: (CrateNum, Symbol)) -> Option<&'tcx [u8]> {

we usually try to encode such things as symbols to trivially copy them around, I'm not sure that's the right thing here, but we can start with it and optimize later

View changes since the review


specialization_enabled_in: bool,

// LazyTable maybe??

@oli-obk oli-obk Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yea, definitely 😅 if the list gets large for anyone the linear search doesn't seem ideal

View changes since the review

Lock<FxHashMap<(ty::Clauses<'tcx>, &'tcx [ty::GenericArg<'tcx>]), ty::Clauses<'tcx>>>,

/// Cache of files that have been read by the const evaluator
pub experimental_comptime_files: Lock<FxIndexMap<&'tcx String, &'tcx [u8]>>,

@oli-obk oli-obk Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this cache shouldn't be necessary, queries have their result cached automatically

View changes since the review

@lambinoo lambinoo Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Honestly, that was more so I could easily get access to all the read files when encoding the crate metadata. Is it possible to somehow fetch all the cached queries? Or maybe just have a Vec of filepath to re-query with the local crate num?

Edit: ahah, read your comments linearly and literally got the answer to my question two comments down 😆

if let Some(value) = files.get(&key) {
Some(*value)
} else {
let file = std::fs::read(key).ok()?;

@oli-obk oli-obk Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

need to check the file name against the command line argument list

View changes since the review

Comment on lines +774 to +776
let comptime_files = tcx.caches.experimental_comptime_files.borrow();
let comptime_files =
comptime_files.iter().map(|(k, v)| ((*k).clone(), v.to_vec())).collect::<Vec<_>>();

@oli-obk oli-obk Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can iterate the command line list here and call the query on each entry

View changes since the review

let comptime_files =
comptime_files.iter().map(|(k, v)| ((*k).clone(), v.to_vec())).collect::<Vec<_>>();

// Should I somehow sort by filename here in case this does *anything* with the parallel frontend stuff or something?

@oli-obk oli-obk Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if the list comes from the CLI that isn't necessary, unless you wanna do a binary search instead of using a LazyTable (which may be sufficiently fast for small lists, and still ok for long lists, compared to the lazy table hash lookup)

View changes since the review

@rustbot

rustbot commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-aarch64-gnu-llvm-22-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] build_script_build test:false 0.149
[RUSTC-TIMING] cc test:false 0.759
   Compiling compiler_builtins v0.1.160 (/checkout/library/compiler-builtins/compiler-builtins)
[RUSTC-TIMING] build_script_build test:false 0.280
 ERROR rustc_interface::passes {"library/core/src/macros/panic.md", "library/core/src/../../core/src/autodiff.md", "library/core/src/../../core/src/offload.md", "library/core/src/ptr/./docs/offset.md", "library/core/src/ptr/./docs/add.md", "library/core/src/ptr/./docs/sub.md", "library/core/src/ptr/docs/is_null.md", "library/core/src/ptr/./docs/addr.md", "library/core/src/ptr/./docs/as_ref.md", "library/core/src/ptr/./docs/as_uninit_ref.md", "library/core/src/ptr/docs/as_uninit_slice.md", "library/core/src/error.md", "library/core/src/ffi/c_char.md", "library/core/src/ffi/c_schar.md", "library/core/src/ffi/c_uchar.md", "library/core/src/ffi/c_short.md", "library/core/src/ffi/c_ushort.md", "library/core/src/ffi/c_int.md", "library/core/src/ffi/c_uint.md", "library/core/src/ffi/c_long.md", "library/core/src/ffi/c_ulong.md", "library/core/src/ffi/c_longlong.md", "library/core/src/ffi/c_ulonglong.md", "library/core/src/ffi/c_float.md", "library/core/src/ffi/c_double.md", "library/core/src/ffi/c_void.md", "library/core/src/sync/./atomic_load_volatile.md", "library/core/src/sync/./atomic_store_volatile.md", "library/core/src/fmt/fmt_trait_method_doc.md", "library/core/src/../../stdarch/crates/core_arch/src/core_arch_docs.md", "library/core/src/../../portable-simd/crates/core_simd/src/core_simd_docs.md"}
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] core test:false 38.110
   Compiling rustc-std-workspace-core v1.99.0 (/checkout/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/checkout/library/alloc)
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] rustc_std_workspace_core test:false 0.043
---
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] addr2line test:false 0.793
[RUSTC-TIMING] gimli test:false 6.611
[RUSTC-TIMING] object test:false 8.586
 ERROR rustc_interface::passes {"library/std/src/../../core/src/macros/panic.md", "library/std/src/../../core/src/error.md", "library/std/src/os/raw/../../../../core/src/ffi/c_char.md", "library/std/src/os/raw/../../../../core/src/ffi/c_schar.md", "library/std/src/os/raw/../../../../core/src/ffi/c_uchar.md", "library/std/src/os/raw/../../../../core/src/ffi/c_short.md", "library/std/src/os/raw/../../../../core/src/ffi/c_ushort.md", "library/std/src/os/raw/../../../../core/src/ffi/c_int.md", "library/std/src/os/raw/../../../../core/src/ffi/c_uint.md", "library/std/src/os/raw/../../../../core/src/ffi/c_long.md", "library/std/src/os/raw/../../../../core/src/ffi/c_ulong.md", "library/std/src/os/raw/../../../../core/src/ffi/c_longlong.md", "library/std/src/os/raw/../../../../core/src/ffi/c_ulonglong.md", "library/std/src/os/raw/../../../../core/src/ffi/c_float.md", "library/std/src/os/raw/../../../../core/src/ffi/c_double.md", "library/std/src/os/raw/../../../../core/src/ffi/c_void.md", "library/std/src/../../portable-simd/crates/core_simd/src/core_simd_docs.md", "library/std/src/../../core/src/autodiff.md", "library/std/src/../../core/src/offload.md", "library/std/src/../../stdarch/crates/core_arch/src/core_arch_docs.md"}
[RUSTC-TIMING] std test:false 21.894
   Compiling rustc-std-workspace-std v1.99.0 (/checkout/library/rustc-std-workspace-std)
   Compiling proc_macro v0.0.0 (/checkout/library/proc_macro)
 ERROR rustc_interface::passes {}
   Compiling getopts v0.2.24
---
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] hashbrown test:false 1.914
   Compiling indexmap v2.14.0
[RUSTC-TIMING] build_script_build test:false 0.201
 ERROR rustc_interface::passes {}
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.3.3/src/../README.md"}
[RUSTC-TIMING] getrandom test:false 0.331
   Compiling log v0.4.28
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] log test:false 0.398
   Compiling typenum v1.20.0
---
[RUSTC-TIMING] typenum test:false 1.770
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] lock_api test:false 0.469
   Compiling cc v1.4.3
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cc-1.4.3/src/detect_compiler_family.c"}
[RUSTC-TIMING] zerovec_derive test:false 1.534
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] parking_lot_core test:false 0.533
   Compiling synstructure v0.13.2
[RUSTC-TIMING] generic_array test:false 1.188
---
   Compiling derive_setters v0.1.8
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] rustc_hir_id test:false 1.742
   Compiling annotate-snippets v0.12.16
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/annotate-snippets-0.12.16/src/../examples/expected_type.rs", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/annotate-snippets-0.12.16/src/../examples/expected_type.svg", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/annotate-snippets-0.12.16/src/../examples/multi_suggestion.svg", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/annotate-snippets-0.12.16/src/../examples/custom_level.rs", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/annotate-snippets-0.12.16/src/../examples/custom_level.svg", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/annotate-snippets-0.12.16/src/../examples/highlight_message.rs", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/annotate-snippets-0.12.16/src/../examples/highlight_message.svg", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/annotate-snippets-0.12.16/src/../examples/elide_header.rs", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/annotate-snippets-0.12.16/src/../examples/elide_header.svg", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/annotate-snippets-0.12.16/src/../examples/struct_name_as_context.rs", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/annotate-snippets-0.12.16/src/../examples/struct_name_as_context.svg", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/annotate-snippets-0.12.16/src/../examples/multi_suggestion.rs"}
[RUSTC-TIMING] derive_setters test:false 0.762
   Compiling termize v0.2.1
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] termize test:false 0.173
   Compiling ref-cast v1.0.25
---
   Compiling rustc_abi v0.0.0 (/checkout/compiler/rustc_abi)
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] miniz_oxide test:false 2.579
   Compiling schemars_derive v1.1.0
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/schemars_derive-1.1.0/src/../deriving.md", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/schemars_derive-1.1.0/src/../attributes.md"}
[RUSTC-TIMING] schemars_derive test:false 2.599
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] ref_cast test:false 0.081
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] rustc_abi test:false 3.851
   Compiling dyn-clone v1.0.20
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] dyn_clone test:false 0.154
   Compiling twox-hash v2.1.2
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/twox-hash-2.1.2/src/../README.md"}
[RUSTC-TIMING] crc32fast test:false 0.319
   Compiling object v0.39.1
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] build_script_build test:false 0.266
   Compiling flate2 v1.1.10
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/flate2-1.1.10/src/../README.md"}
[RUSTC-TIMING] twox_hash test:false 0.662
   Compiling ruzstd v0.8.2
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ruzstd-0.8.2/src/../Readme.md"}
[RUSTC-TIMING] flate2 test:false 1.102
   Compiling schemars v1.1.0
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/schemars-1.1.0/src/../README.md"}
[RUSTC-TIMING] rustc_ast test:false 19.993
   Compiling wasmparser v0.247.0
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] ruzstd test:false 5.725
   Compiling unicode-properties v0.1.4
---
   Compiling getopts v0.2.24
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] getopts test:false 1.671
   Compiling rustc_attr_ir v0.0.0 (/checkout/compiler/rustc_attr_ir)
 ERROR rustc_interface::passes {"compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_clauses.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_clauses.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_clauses_super_trait.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_clauses_super_trait.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_def_parents.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_def_parents.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_def_path.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_def_path.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_generics.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_generics.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_hidden_type_of_opaques.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_hidden_type_of_opaques.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_inferred_outlives.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_inferred_outlives.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_item_bounds.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_item_bounds.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_layout_debug.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_layout_debug.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_layout_largest_niche.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_layout_largest_niche.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_layout_size.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_layout_size.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_layout_align.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_layout_align.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_layout_backend_repr.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_layout_backend_repr.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_layout_homogeneous_aggregate.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_layout_homogeneous_aggregate.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_object_lifetime_defaults.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_object_lifetime_defaults.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_symbol_name.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_symbol_name.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_variances.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_variances.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_variances_of_opaques.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_variances_of_opaques.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_vtable.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dump_vtable.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dyn_incompatible_trait.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dyn_incompatible_trait.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_dyn_incompatible_trait2.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_comptime.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_comptime.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_on_unimplemented.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_on_unimplemented.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_on_unimplemented_filter.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_on_unimplemented_filter.stderr", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_on_unimplemented_format.rs", "compiler/rustc_attr_ir/src/../../../tests/ui/attributes/doc_examples/rustc_on_unimplemented_format.stderr"}
[RUSTC-TIMING] rustc_feature test:false 2.607
   Compiling rustc_type_ir_macros v0.0.0 (/checkout/compiler/rustc_type_ir_macros)
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] rustc_type_ir_macros test:false 1.123
   Compiling derive-where v1.6.1
---
   Compiling gsgdt v0.1.2
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] rustc_apfloat test:false 1.190
   Compiling rustc_target v0.0.0 (/checkout/compiler/rustc_target)
 ERROR rustc_interface::passes {"compiler/rustc_target/src/spec/targets/./thumbv7a_vex_v5_linker_script.ld", "compiler/rustc_target/src/spec/targets/./mipsel_sony_psp_linker_script.ld", "compiler/rustc_target/src/spec/targets/./aarch64_nintendo_switch_freestanding_linker_script.ld", "compiler/rustc_target/src/spec/targets/./aarch64_unknown_qtee_linker_script.ld"}
[RUSTC-TIMING] gsgdt test:false 3.135
   Compiling itertools v0.15.0
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] object test:false 17.215
   Compiling tinyvec_macros v0.1.1
---
   Compiling matchers v0.2.0
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] matchers test:false 0.152
   Compiling bstr v1.12.1
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bstr-1.12.1/src/unicode/fsm/grapheme_break_fwd.littleendian.dfa", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bstr-1.12.1/src/unicode/fsm/grapheme_break_rev.littleendian.dfa", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bstr-1.12.1/src/unicode/fsm/regional_indicator_rev.littleendian.dfa", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bstr-1.12.1/src/unicode/fsm/sentence_break_fwd.littleendian.dfa", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bstr-1.12.1/src/unicode/fsm/simple_word_fwd.littleendian.dfa", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bstr-1.12.1/src/unicode/fsm/whitespace_anchored_fwd.littleendian.dfa", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bstr-1.12.1/src/unicode/fsm/whitespace_anchored_rev.littleendian.dfa", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bstr-1.12.1/src/unicode/fsm/word_break_fwd.littleendian.dfa"}
[RUSTC-TIMING] bstr test:false 2.807
   Compiling rustc_windows_rc v0.0.0 (/checkout/compiler/rustc_windows_rc)
 ERROR rustc_interface::passes {"compiler/rustc_windows_rc/src/../rustc.rc.in"}
[RUSTC-TIMING] rustc_windows_rc test:false 0.215
   Compiling thread_local v1.1.9
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] thread_local test:false 0.467
   Compiling unicase v2.8.1
---
   Compiling rustc_ty_utils v0.0.0 (/checkout/compiler/rustc_ty_utils)
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] rustc_mir_transform test:false 146.125
   Compiling rustc_borrowck v0.0.0 (/checkout/compiler/rustc_borrowck)
 ERROR rustc_interface::passes {"compiler/rustc_borrowck/src/polonius/./dump/polonius-mir-dump.template.html"}
[RUSTC-TIMING] rustc_ty_utils test:false 51.262
   Compiling rustc_traits v0.0.0 (/checkout/compiler/rustc_traits)
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] rustc_hir_typeck test:false 163.415
   Compiling rustc_monomorphize v0.0.0 (/checkout/compiler/rustc_monomorphize)
---
   Compiling rustc_driver v0.0.0 (/checkout/compiler/rustc_driver)
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] build_script_build test:false 0.153
   Compiling jiff v0.2.16
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/jiff-0.2.16/src/../COMPARE.md", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/jiff-0.2.16/src/../DESIGN.md", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/jiff-0.2.16/src/../PLATFORM.md", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/jiff-0.2.16/src/../CHANGELOG.md"}
[RUSTC-TIMING] jiff test:false 19.757
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] shlex test:false 0.455
   Compiling rustc_driver_impl v0.0.0 (/checkout/compiler/rustc_driver_impl)
 ERROR rustc_interface::passes {}
---
[RUSTC-TIMING] equivalent test:false 0.055
   Compiling cranelift-codegen-shared v0.137.0
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] cranelift_codegen_shared test:false 0.075
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cranelift-isle-0.137.0/src/../README.md"}
[RUSTC-TIMING] hashbrown test:false 1.818
   Compiling indexmap v2.14.0
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] cranelift_assembler_x64_meta test:false 2.891
 ERROR rustc_interface::passes {}
---
[RUSTC-TIMING] allocator_api2 test:false 0.820
   Compiling target-lexicon v0.13.5
[RUSTC-TIMING] cranelift_bitset test:false 0.286
   Compiling bumpalo v3.20.2
 ERROR rustc_interface::passes {}
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bumpalo-3.20.2/src/../README.md"}
[RUSTC-TIMING] bumpalo test:false 0.547
   Compiling cranelift-entity v0.137.0
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] build_script_build test:false 0.640
   Compiling hashbrown v0.16.1
---
   Compiling serde_derive v1.0.228
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] strsim test:false 1.401
   Compiling bumpalo v3.20.3
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bumpalo-3.20.3/src/../README.md"}
[RUSTC-TIMING] indexmap test:false 2.220
   Compiling wasmparser v0.257.1
[RUSTC-TIMING] bumpalo test:false 0.528
   Compiling cfg-if v1.0.4
 ERROR rustc_interface::passes {}
---
[RUSTC-TIMING] serde_json test:false 4.491
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] clap_lex test:false 0.525
   Compiling clap_builder v4.6.0
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/clap_builder-4.6.0/src/../README.md"}
[RUSTC-TIMING] serde_derive test:false 4.876
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.3.3/src/../README.md"}
[RUSTC-TIMING] getrandom test:false 0.258
   Compiling clap_derive v4.6.1
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/clap_derive-4.6.1/src/../README.md"}
[RUSTC-TIMING] rustix test:false 5.005
   Compiling once_cell v1.21.3
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] once_cell test:false 0.386
[RUSTC-TIMING] clap_derive test:false 2.683
---
   Compiling tempfile v3.23.0
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] lexopt test:false 0.614
   Compiling clap v4.6.1
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/clap-4.6.1/src/../examples/demo.rs", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/clap-4.6.1/src/../examples/demo.md"}
[RUSTC-TIMING] clap test:false 0.041
   Compiling wasi-preview1-component-adapter-provider v46.0.1
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasi-preview1-component-adapter-provider-46.0.1/src/../artefacts/wasi_snapshot_preview1.reactor.wasm", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasi-preview1-component-adapter-provider-46.0.1/src/../artefacts/wasi_snapshot_preview1.command.wasm", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasi-preview1-component-adapter-provider-46.0.1/src/../artefacts/wasi_snapshot_preview1.proxy.wasm"}
[RUSTC-TIMING] wasi_preview1_component_adapter_provider test:false 0.049
[RUSTC-TIMING] tempfile test:false 1.429
[RUSTC-TIMING] clap_builder test:false 10.552
   Compiling wasm-encoder v0.257.1
   Compiling wit-parser v0.257.1
---
   Compiling wast v257.0.1
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] wasm_encoder test:false 8.422
   Compiling wit-component v0.257.1
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wit-component-0.257.1/src/../libdl.so"}
[RUSTC-TIMING] wasmparser test:false 36.784
   Compiling wat v1.257.1
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] wat test:false 0.934
   Compiling wasm-component-ld v0.5.30
---
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] strsim test:false 1.401
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] clap_lex test:false 0.525
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/clap_builder-4.6.0/src/../README.md"}
[RUSTC-TIMING] clap_builder test:false 10.552
   Compiling sharded-slab v0.1.7
[RUSTC-TIMING] log test:false 0.394
   Compiling thread_local v1.1.9
 ERROR rustc_interface::passes {}
---
[RUSTC-TIMING] syn test:false 7.290
   Compiling thiserror-impl v1.0.69
   Compiling tracing-attributes v0.1.31
   Compiling clap_derive v4.6.1
 ERROR rustc_interface::passes {}
 ERROR rustc_interface::passes {}
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/clap_derive-4.6.1/src/../README.md"}
[RUSTC-TIMING] thiserror_impl test:false 1.645
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] thiserror test:false 0.087
[RUSTC-TIMING] tracing_attributes test:false 1.898
   Compiling tracing v0.1.44
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] clap_derive test:false 2.146
   Compiling clap v4.6.1
 ERROR rustc_interface::passes {"/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/clap-4.6.1/src/../examples/demo.rs", "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/clap-4.6.1/src/../examples/demo.md"}
[RUSTC-TIMING] clap test:false 0.038
   Compiling llvm-bitcode-linker v0.0.1 (/checkout/src/tools/llvm-bitcode-linker)
 ERROR rustc_interface::passes {}
[RUSTC-TIMING] tracing test:false 0.519
[RUSTC-TIMING] llvm_bitcode_linker test:false 0.629
---
To only update this specific test, also pass `--test-args consts/const-eval/unused-broken-const.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/consts/const-eval/unused-broken-const.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/consts/const-eval/unused-broken-const" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2015" "--emit=dep-info,metadata"
stdout: none
--- stderr -------------------------------
 ERROR rustc_interface::passes {}
error[E0080]: index out of bounds: the length is 0 but the index is 0
##[error]  --> /checkout/tests/ui/consts/const-eval/unused-broken-const.rs:5:18
   |
LL | const FOO: i32 = [][0];
   |                  ^^^^^ evaluation of `FOO` failed here

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0080`.
------------------------------------------

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants