Add generic arg infer
This commit is contained in:
parent
71a6c7c803
commit
417b098cfc
28 changed files with 265 additions and 89 deletions
|
|
@ -4,13 +4,13 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
|||
LL | fn foo<const N: usize, const A: [u8; N]>() {}
|
||||
| ^ the type must not depend on the parameter `N`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/issue-62878.rs:10:11
|
||||
error: constant expression depends on a generic parameter
|
||||
--> $DIR/issue-62878.rs:10:14
|
||||
|
|
||||
LL | foo::<_, {[1]}>();
|
||||
| ^
|
||||
| ^^^^^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
= note: this may fail depending on what value the parameter takes
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-62878.rs:10:15
|
||||
|
|
@ -20,5 +20,5 @@ LL | foo::<_, {[1]}>();
|
|||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0747, E0770.
|
||||
Some errors have detailed explanations: E0308, E0770.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@ fn foo<const N: usize, const A: [u8; N]>() {}
|
|||
|
||||
fn main() {
|
||||
foo::<_, {[1]}>();
|
||||
//[full]~^ ERROR type provided when a constant was expected
|
||||
//[full]~| ERROR mismatched types
|
||||
//[full]~^ ERROR mismatched types
|
||||
//[full]~| ERROR constant expression
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#![feature(min_const_generics)]
|
||||
fn foo<const N: usize, const K: usize>(data: [u32; N]) -> [u32; K] {
|
||||
// run-pass
|
||||
|
||||
fn foo<const N: usize, const K: usize>(_data: [u32; N]) -> [u32; K] {
|
||||
[0; K]
|
||||
}
|
||||
fn main() {
|
||||
let a = foo::<_, 2>([0, 1, 2]);
|
||||
//~^ ERROR type provided when a constant was expected
|
||||
let _a = foo::<_, 2>([0, 1, 2]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/inferred_const.rs:6:19
|
||||
|
|
||||
LL | let a = foo::<_, 2>([0, 1, 2]);
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0747`.
|
||||
|
|
@ -11,7 +11,7 @@ fn foo<'a, 'b>(start: &'a usize, end: &'a usize) {
|
|||
let _x = (*start..*end)
|
||||
.map(|x| S { a: start, b: end })
|
||||
.collect::<Vec<S<_, 'a>>>();
|
||||
//~^ ERROR type provided when a lifetime was expected
|
||||
//~^ ERROR inferred provided when a lifetime was expected
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0747]: type provided when a lifetime was expected
|
||||
error[E0747]: inferred provided when a lifetime was expected
|
||||
--> $DIR/issue-14303-fncall.rs:13:26
|
||||
|
|
||||
LL | .collect::<Vec<S<_, 'a>>>();
|
||||
|
|
|
|||
|
|
@ -273,17 +273,6 @@ LL | priv_parent_substs::mac!();
|
|||
|
|
||||
= note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: type `priv_parent_substs::Priv` is private
|
||||
--> $DIR/associated-item-privacy-trait.rs:117:30
|
||||
|
|
||||
LL | let _: <Pub as PubTr<_>>::AssocTy;
|
||||
| ^ private type
|
||||
...
|
||||
LL | priv_parent_substs::mac!();
|
||||
| --------------------------- in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: type `priv_parent_substs::Priv` is private
|
||||
--> $DIR/associated-item-privacy-trait.rs:119:17
|
||||
|
|
||||
|
|
@ -328,5 +317,5 @@ LL | priv_parent_substs::mac!();
|
|||
|
|
||||
= note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 30 previous errors
|
||||
error: aborting due to 29 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue