diff options
| author | bors <bors@rust-lang.org> | 2022-05-25 16:39:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-25 16:39:37 +0000 |
| commit | 1b5e1215efa47cf4d78a945c7be1c04cda4f57d4 (patch) | |
| tree | 87518ad71883196180f52cf48f026c88edec7bb9 /src/test/ui | |
| parent | 9fed13030c2a2ebd79bfb1fd8be4f768cbe8c9d9 (diff) | |
| parent | e98f8f8feffbb325e181020681599ee1ffa19ec4 (diff) | |
| download | rust-1b5e1215efa47cf4d78a945c7be1c04cda4f57d4.tar.gz rust-1b5e1215efa47cf4d78a945c7be1c04cda4f57d4.zip | |
Auto merge of #97401 - Dylan-DPC:rollup-fh9e61o, r=Dylan-DPC
Rollup of 5 pull requests Successful merges: - #97302 (Do writeback of Closure params before visiting the parent expression) - #97328 (rustc: Fix ICE in native library error reporting) - #97351 (Output correct type responsible for structural match violation) - #97398 (Add regression test for #82830) - #97400 (Fix a typo on Struct `Substructure`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/test/ui')
9 files changed, 109 insertions, 7 deletions
diff --git a/src/test/ui/const-generics/issues/issue-63322-forbid-dyn.full.stderr b/src/test/ui/const-generics/issues/issue-63322-forbid-dyn.full.stderr index e1c20e6ae78..16fabd1e88f 100644 --- a/src/test/ui/const-generics/issues/issue-63322-forbid-dyn.full.stderr +++ b/src/test/ui/const-generics/issues/issue-63322-forbid-dyn.full.stderr @@ -1,8 +1,8 @@ -error[E0741]: `&'static (dyn A + 'static)` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter +error[E0741]: `(dyn A + 'static)` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter --> $DIR/issue-63322-forbid-dyn.rs:9:18 | LL | fn test<const T: &'static dyn A>() { - | ^^^^^^^^^^^^^^ `&'static (dyn A + 'static)` doesn't derive both `PartialEq` and `Eq` + | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-97278.rs b/src/test/ui/const-generics/issues/issue-97278.rs new file mode 100644 index 00000000000..da0a9776fd4 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-97278.rs @@ -0,0 +1,14 @@ +#![feature(adt_const_params)] +#![allow(incomplete_features)] + +use std::sync::Arc; + +#[derive(PartialEq, Eq)] +enum Bar { + Bar(Arc<i32>) +} + +fn test<const BAR: Bar>() {} +//~^ ERROR `Arc<i32>` must be annotated with `#[derive(PartialEq, Eq)]` + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-97278.stderr b/src/test/ui/const-generics/issues/issue-97278.stderr new file mode 100644 index 00000000000..ff13cb505ab --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-97278.stderr @@ -0,0 +1,9 @@ +error[E0741]: `Arc<i32>` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter + --> $DIR/issue-97278.rs:11:20 + | +LL | fn test<const BAR: Bar>() {} + | ^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0741`. diff --git a/src/test/ui/native-library-link-flags/modifiers-override-3.rs b/src/test/ui/native-library-link-flags/modifiers-override-3.rs new file mode 100644 index 00000000000..b28c53c6b0a --- /dev/null +++ b/src/test/ui/native-library-link-flags/modifiers-override-3.rs @@ -0,0 +1,7 @@ +// Regression test for issue #97299, one command line library with modifiers +// overrides another command line library with modifiers. + +// compile-flags:-lstatic:+whole-archive=foo -lstatic:+whole-archive=foo +// error-pattern: overriding linking modifiers from command line is not supported + +fn main() {} diff --git a/src/test/ui/native-library-link-flags/modifiers-override-3.stderr b/src/test/ui/native-library-link-flags/modifiers-override-3.stderr new file mode 100644 index 00000000000..365e5618100 --- /dev/null +++ b/src/test/ui/native-library-link-flags/modifiers-override-3.stderr @@ -0,0 +1,4 @@ +error: overriding linking modifiers from command line is not supported + +error: aborting due to previous error + diff --git a/src/test/ui/traits/issue-82830.rs b/src/test/ui/traits/issue-82830.rs new file mode 100644 index 00000000000..c8289b2e30b --- /dev/null +++ b/src/test/ui/traits/issue-82830.rs @@ -0,0 +1,16 @@ +trait A<Y, N> { + type B; +} + +type MaybeBox<T> = <T as A<T, Box<T>>>::B; +struct P { + t: MaybeBox<P>, //~ ERROR: overflow evaluating the requirement `P: Sized` +} + +impl<Y, N> A<Y, N> for P { + type B = N; +} + +fn main() { + let t: MaybeBox<P>; +} diff --git a/src/test/ui/traits/issue-82830.stderr b/src/test/ui/traits/issue-82830.stderr new file mode 100644 index 00000000000..f863143c738 --- /dev/null +++ b/src/test/ui/traits/issue-82830.stderr @@ -0,0 +1,15 @@ +error[E0275]: overflow evaluating the requirement `P: Sized` + --> $DIR/issue-82830.rs:7:8 + | +LL | t: MaybeBox<P>, + | ^^^^^^^^^^^ + | +note: required because of the requirements on the impl of `A<P, Box<P>>` for `P` + --> $DIR/issue-82830.rs:10:12 + | +LL | impl<Y, N> A<Y, N> for P { + | ^^^^^^^ ^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/src/test/ui/type/type-check/unknown_type_for_closure.rs b/src/test/ui/type/type-check/unknown_type_for_closure.rs index 0dbf82453a2..0089d86e340 100644 --- a/src/test/ui/type/type-check/unknown_type_for_closure.rs +++ b/src/test/ui/type/type-check/unknown_type_for_closure.rs @@ -1,3 +1,17 @@ -fn main() { - let x = |_| { }; //~ ERROR type annotations needed +fn infer_in_arg() { + let x = |b: Vec<_>| {}; //~ ERROR E0282 } + +fn empty_pattern() { + let x = |_| {}; //~ ERROR type annotations needed +} + +fn infer_ty() { + let x = |k: _| {}; //~ ERROR type annotations needed +} + +fn ambig_return() { + let x = || -> Vec<_> { Vec::new() }; //~ ERROR type annotations needed for the closure `fn() -> Vec<_>` +} + +fn main() {} diff --git a/src/test/ui/type/type-check/unknown_type_for_closure.stderr b/src/test/ui/type/type-check/unknown_type_for_closure.stderr index 5971f56c97f..c3accad5f25 100644 --- a/src/test/ui/type/type-check/unknown_type_for_closure.stderr +++ b/src/test/ui/type/type-check/unknown_type_for_closure.stderr @@ -1,9 +1,32 @@ -error[E0282]: type annotations needed +error[E0282]: type annotations needed for `Vec<_>` --> $DIR/unknown_type_for_closure.rs:2:14 | -LL | let x = |_| { }; +LL | let x = |b: Vec<_>| {}; | ^ consider giving this closure parameter a type -error: aborting due to previous error +error[E0282]: type annotations needed + --> $DIR/unknown_type_for_closure.rs:6:14 + | +LL | let x = |_| {}; + | ^ consider giving this closure parameter a type + +error[E0282]: type annotations needed + --> $DIR/unknown_type_for_closure.rs:10:14 + | +LL | let x = |k: _| {}; + | ^ consider giving this closure parameter a type + +error[E0282]: type annotations needed for the closure `fn() -> Vec<_>` + --> $DIR/unknown_type_for_closure.rs:14:28 + | +LL | let x = || -> Vec<_> { Vec::new() }; + | ^^^^^^^^ cannot infer type for type parameter `T` + | +help: give this closure an explicit return type without `_` placeholders + | +LL | let x = || -> Vec<_> { Vec::new() }; + | ~~~~~~ + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0282`. |
