Skip to content

Commit a86be95

Browse files
authored
Unrolled build for #149334
Rollup merge of #149334 - asukaminato0721:149288, r=notriddle fix ICE: rustdoc: const parameter types cannot be generic #149288 fix #149288 Applied the patch.
2 parents cf8a955 + 171c77e commit a86be95

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,12 +561,7 @@ fn clean_generic_param_def(
561561
def.name,
562562
GenericParamDefKind::Const {
563563
ty: Box::new(clean_middle_ty(
564-
ty::Binder::dummy(
565-
cx.tcx
566-
.type_of(def.def_id)
567-
.no_bound_vars()
568-
.expect("const parameter types cannot be generic"),
569-
),
564+
ty::Binder::dummy(cx.tcx.type_of(def.def_id).instantiate_identity()),
570565
cx,
571566
Some(def.def_id),
572567
None,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//! rustdoc regression test for #149288: const generic parameter types may depend on
2+
//! other generics when `generic_const_parameter_types` is enabled.
3+
#![allow(incomplete_features)]
4+
#![feature(adt_const_params, generic_const_parameter_types)]
5+
#![crate_name = "foo"]
6+
7+
pub struct Bar<const N: usize, const M: [u8; N]>;
8+
9+
pub fn takes<const N: usize, const M: [u8; N]>(_: Bar<N, M>) {}
10+
11+
pub fn instantiate() {
12+
takes(Bar::<2, { [1; 2] }>);
13+
}
14+
15+
//@ has foo/struct.Bar.html '//pre[@class="rust item-decl"]' 'pub struct Bar<const N: usize, const M: [u8; N]>'
16+
//@ has foo/fn.takes.html '//pre[@class="rust item-decl"]' 'pub fn takes<const N: usize, const M: [u8; N]>(_: Bar<N, M>)'

0 commit comments

Comments
 (0)