forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#133779 - BoxyUwU:array_const_arg_infer_hir_…
…id, r=compiler-errors Use correct `hir_id` for array const arg infers Fixes rust-lang#133771 `self.next_id()` results in the `DefId` for the const argument, created from the hack introduced by rust-lang#133468, having no `HirId` associated with it. This then results in an ICE in metadata encoding. Fixing this then results in *another* ICE where `encode_defs` was not skipping encoding `type_of` and other queries for `DefId`s when they correspond to a `ConstArgKind::Infer` node. This only reproduces with a library crate as metadata is not encoded for binaries, and apparently we had 0 tests for `generic_arg_infer` for array lengths in a library crate so this was not caught :< cc rust-lang#133589 ``@voidc`` r? ``@compiler-errors`` ``@lcnr``
- Loading branch information
Showing
3 changed files
with
22 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
tests/ui/const-generics/generic_arg_infer/array-repeat-expr-lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//@ check-pass | ||
|
||
#![feature(generic_arg_infer)] | ||
#![crate_type = "lib"] | ||
|
||
// Test that encoding the hallucinated `DefId` for the `_` const argument doesn't | ||
// ICE (see #133468). This requires this to be a library crate. | ||
|
||
pub fn foo() { | ||
let s: [u8; 10]; | ||
s = [0; _]; | ||
} |