Skip to content

Commit 9becb7c

Browse files
authored
Rollup merge of #138259 - compiler-errors:disentangle-ribs, r=BoxyUwU
Disentangle `ForwardGenericParamBan` and `ConstParamTy` ribs In #137617, the `ConstParamTy` rib was adjusted to act kinda like the `ForwardGenericParamBan`. However, this means that it no longer served its purpose banning generics from *parent items*. Although we still are checking for param type validity using the `ConstParamTy_` trait, which means that we weren't accepting code we shouldn't, I think it's a bit strange for us not to be rejecting code like this during *resolution* and instead letting these malformed const generics leak into the type system: ```rust trait Foo<T> { fn bar<const N: T>() {} } ``` This PR does a few things: 1. Introduce a `ForwardGenericParamBanReason` enum, and start using the `ForwardGenericParamBan` rib to ban forward-declared params in const tys when `generic_const_parameter_types` is enabled. 2. Start using the `ConstParamTy` rib to ban *all* generics when `generic_const_parameter_types` is disabled. 3. Improve the diagnostics for both of the cases above, and for forward-declared params in parameter defaults too :3 r? `@BoxyUwU` or reassign
2 parents 89f2c40 + 440b6ba commit 9becb7c

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
     (0)