diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/const-generics/infer | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/const-generics/infer')
10 files changed, 0 insertions, 129 deletions
diff --git a/src/test/ui/const-generics/infer/cannot-infer-const-args.rs b/src/test/ui/const-generics/infer/cannot-infer-const-args.rs deleted file mode 100644 index f85a72910..000000000 --- a/src/test/ui/const-generics/infer/cannot-infer-const-args.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn foo<const X: usize>() -> usize { - 0 -} - -fn main() { - foo(); //~ ERROR type annotations needed -} diff --git a/src/test/ui/const-generics/infer/cannot-infer-const-args.stderr b/src/test/ui/const-generics/infer/cannot-infer-const-args.stderr deleted file mode 100644 index 93e45a88a..000000000 --- a/src/test/ui/const-generics/infer/cannot-infer-const-args.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/cannot-infer-const-args.rs:6:5 - | -LL | foo(); - | ^^^ cannot infer the value of the const parameter `X` declared on the function `foo` - | -help: consider specifying the generic argument - | -LL | foo::<X>(); - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/const-generics/infer/issue-77092.rs b/src/test/ui/const-generics/infer/issue-77092.rs deleted file mode 100644 index fcf7d3282..000000000 --- a/src/test/ui/const-generics/infer/issue-77092.rs +++ /dev/null @@ -1,14 +0,0 @@ -use std::convert::TryInto; - -fn take_array_from_mut<T, const N: usize>(data: &mut [T], start: usize) -> &mut [T; N] { - (&mut data[start .. start + N]).try_into().unwrap() -} - -fn main() { - let mut arr = [0, 1, 2, 3, 4, 5, 6, 7, 8]; - - for i in 1 .. 4 { - println!("{:?}", take_array_from_mut(&mut arr, i)); - //~^ ERROR type annotations needed - } -} diff --git a/src/test/ui/const-generics/infer/issue-77092.stderr b/src/test/ui/const-generics/infer/issue-77092.stderr deleted file mode 100644 index 1682b26ac..000000000 --- a/src/test/ui/const-generics/infer/issue-77092.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/issue-77092.rs:11:26 - | -LL | println!("{:?}", take_array_from_mut(&mut arr, i)); - | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the function `take_array_from_mut` - | -help: consider specifying the generic arguments - | -LL | println!("{:?}", take_array_from_mut::<i32, N>(&mut arr, i)); - | ++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/const-generics/infer/method-chain.rs b/src/test/ui/const-generics/infer/method-chain.rs deleted file mode 100644 index 0c5eed489..000000000 --- a/src/test/ui/const-generics/infer/method-chain.rs +++ /dev/null @@ -1,16 +0,0 @@ -struct Foo; - -impl Foo { - fn bar(self) -> Foo { - Foo - } - - fn baz<const N: usize>(self) -> Foo { - println!("baz: {}", N); - Foo - } -} - -fn main() { - Foo.bar().bar().bar().bar().baz(); //~ ERROR type annotations needed -} diff --git a/src/test/ui/const-generics/infer/method-chain.stderr b/src/test/ui/const-generics/infer/method-chain.stderr deleted file mode 100644 index ff6da535b..000000000 --- a/src/test/ui/const-generics/infer/method-chain.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/method-chain.rs:15:33 - | -LL | Foo.bar().bar().bar().bar().baz(); - | ^^^ cannot infer the value of the const parameter `N` declared on the associated function `baz` - | -help: consider specifying the generic argument - | -LL | Foo.bar().bar().bar().bar().baz::<N>(); - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/const-generics/infer/one-param-uninferred.rs b/src/test/ui/const-generics/infer/one-param-uninferred.rs deleted file mode 100644 index d6018650f..000000000 --- a/src/test/ui/const-generics/infer/one-param-uninferred.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Test that we emit an error if we cannot properly infer a constant. -fn foo<const N: usize, const M: usize>() -> [u8; N] { - todo!() -} - -fn main() { - // FIXME(const_generics): Currently this only suggests one const parameter, - // but instead it should suggest to provide all parameters. - let _: [u8; 17] = foo(); - //~^ ERROR type annotations needed -} diff --git a/src/test/ui/const-generics/infer/one-param-uninferred.stderr b/src/test/ui/const-generics/infer/one-param-uninferred.stderr deleted file mode 100644 index cf70c2181..000000000 --- a/src/test/ui/const-generics/infer/one-param-uninferred.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/one-param-uninferred.rs:9:23 - | -LL | let _: [u8; 17] = foo(); - | ^^^ cannot infer the value of the const parameter `M` declared on the function `foo` - | -help: consider specifying the generic arguments - | -LL | let _: [u8; 17] = foo::<17, M>(); - | +++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/const-generics/infer/uninferred-consts.rs b/src/test/ui/const-generics/infer/uninferred-consts.rs deleted file mode 100644 index 657f4b513..000000000 --- a/src/test/ui/const-generics/infer/uninferred-consts.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Test that we emit an error if we cannot properly infer a constant. - -// taken from https://github.com/rust-lang/rust/issues/70507#issuecomment-615268893 -struct Foo; -impl Foo { - fn foo<const A: usize, const B: usize>(self) {} -} -fn main() { - Foo.foo(); - //~^ ERROR type annotations needed -} diff --git a/src/test/ui/const-generics/infer/uninferred-consts.stderr b/src/test/ui/const-generics/infer/uninferred-consts.stderr deleted file mode 100644 index 3980ecea8..000000000 --- a/src/test/ui/const-generics/infer/uninferred-consts.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/uninferred-consts.rs:9:9 - | -LL | Foo.foo(); - | ^^^ cannot infer the value of the const parameter `A` declared on the associated function `foo` - | -help: consider specifying the generic arguments - | -LL | Foo.foo::<A, B>(); - | ++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. |