Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Regression test for https://github.com/rust-lang/rust/issues/142913.

@TaKO8Ki TaKO8Ki May 24, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

region-parameter-out-of-range-ice-142913.rs comes from a ICE error message, but I think it needs to be based on what conditions cause the ICE as the comment mentioned below.

View changes since the review

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.

thx, got a new name for it, hope it's better now


// A const parameter introduced by `generic_const_parameter_types`,
// whose type mentions an earlier lifetime
// parameter and which carries a default value, used to ICE in `rustc_type_ir`
// with "region parameter out of range when instantiating args". It is now
// rejected with ordinary errors instead of crashing.

#![feature(generic_const_parameter_types)]

struct Variant;

fn foo<'a, const N: &'a Variant = {}>() {}
//~^ ERROR: defaults for generic parameters are not allowed here
//~| ERROR: anonymous constants with lifetimes in their type are not yet supported
//~| ERROR: `&'a Variant` is forbidden as the type of a const generic parameter

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
error: defaults for generic parameters are not allowed here
--> $DIR/lifetime_dependent_const_param_default.rs:13:12
|
LL | fn foo<'a, const N: &'a Variant = {}>() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: anonymous constants with lifetimes in their type are not yet supported
--> $DIR/lifetime_dependent_const_param_default.rs:13:35
|
LL | fn foo<'a, const N: &'a Variant = {}>() {}
| ^^

error: `&'a Variant` is forbidden as the type of a const generic parameter
--> $DIR/lifetime_dependent_const_param_default.rs:13:21
|
LL | fn foo<'a, const N: &'a Variant = {}>() {}
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool`, and `char`
help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types
|
LL + #![feature(min_adt_const_params)]
|
help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait
|
LL + #![feature(unsized_const_params)]
|

error: aborting due to 3 previous errors

Loading