Skip to content

Commit 4d1ded8

Browse files
Rollup merge of #142449 - oli-obk:missing-mgca-args, r=BoxyUwU
Require generic params for const generic params I think that was just an oversight when the support for them was added r? `@BoxyUwU` or `@camelid` fixes #137188 fixes #138166 fixes #138240 fixes #138266 fixes #138359
2 parents c3537c2 + bb2b765 commit 4d1ded8

File tree

8 files changed

+37
-40
lines changed

8 files changed

+37
-40
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,7 +2147,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
21472147
ty_id,
21482148
&None,
21492149
path,
2150-
ParamMode::Optional,
2150+
ParamMode::Explicit,
21512151
AllowReturnTypeNotation::No,
21522152
// FIXME(mgca): update for `fn foo() -> Bar<FOO<impl Trait>>` support
21532153
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
@@ -2219,7 +2219,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
22192219
expr.id,
22202220
qself,
22212221
path,
2222-
ParamMode::Optional,
2222+
ParamMode::Explicit,
22232223
AllowReturnTypeNotation::No,
22242224
// FIXME(mgca): update for `fn foo() -> Bar<FOO<impl Trait>>` support
22252225
ImplTraitContext::Disallowed(ImplTraitPosition::Path),

tests/crashes/137188.rs

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/crashes/138166.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/crashes/138240.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/crashes/138266.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/crashes/138359.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This used to ICE: #137188
2+
// The missing parameter list on `N` was set to
3+
// "infer from use site" in ast lowering, which
4+
// caused later code to not emit a missing generic
5+
// param error. The missing param was then attempted
6+
// to be inferred, but inference of generic params
7+
// is only possible within bodies. So a delayed
8+
// bug was generated with no error ever reported.
9+
10+
#![feature(min_generic_const_args)]
11+
#![allow(incomplete_features)]
12+
trait Trait {}
13+
impl Trait for [(); N] {}
14+
//~^ ERROR: missing generics for function `N`
15+
fn N<T>() {}
16+
pub fn main() {}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0107]: missing generics for function `N`
2+
--> $DIR/missing_generic_params.rs:13:21
3+
|
4+
LL | impl Trait for [(); N] {}
5+
| ^ expected 1 generic argument
6+
|
7+
note: function defined here, with 1 generic parameter: `T`
8+
--> $DIR/missing_generic_params.rs:15:4
9+
|
10+
LL | fn N<T>() {}
11+
| ^ -
12+
help: add missing generic argument
13+
|
14+
LL | impl Trait for [(); N<T>] {}
15+
| +++
16+
17+
error: aborting due to 1 previous error
18+
19+
For more information about this error, try `rustc --explain E0107`.

0 commit comments

Comments
 (0)