diff options
Diffstat (limited to 'tests')
15 files changed, 85 insertions, 36 deletions
diff --git a/tests/rustdoc/alias-reexport.rs b/tests/rustdoc/alias-reexport.rs index a2a8e651caf..4003ecec21c 100644 --- a/tests/rustdoc/alias-reexport.rs +++ b/tests/rustdoc/alias-reexport.rs @@ -3,6 +3,7 @@ #![crate_name = "foo"] #![feature(lazy_type_alias)] +#![allow(incomplete_features)] extern crate alias_reexport2; diff --git a/tests/rustdoc/alias-reexport2.rs b/tests/rustdoc/alias-reexport2.rs index 85d3cdad962..5f6357ad128 100644 --- a/tests/rustdoc/alias-reexport2.rs +++ b/tests/rustdoc/alias-reexport2.rs @@ -3,6 +3,7 @@ #![crate_name = "foo"] #![feature(lazy_type_alias)] +#![allow(incomplete_features)] extern crate alias_reexport; diff --git a/tests/ui/annotate-snippet/auxiliary/other_file.rs b/tests/ui/annotate-snippet/auxiliary/other_file.rs new file mode 100644 index 00000000000..6f5f412d086 --- /dev/null +++ b/tests/ui/annotate-snippet/auxiliary/other_file.rs @@ -0,0 +1,6 @@ +pub struct WithPrivateMethod; + +impl WithPrivateMethod { + /// Private to get an error involving two files + fn private_method(&self) {} +} diff --git a/tests/ui/annotate-snippet/multiple-files.rs b/tests/ui/annotate-snippet/multiple-files.rs new file mode 100644 index 00000000000..981cdbb10a9 --- /dev/null +++ b/tests/ui/annotate-snippet/multiple-files.rs @@ -0,0 +1,8 @@ +// aux-build:other_file.rs +// compile-flags: --error-format human-annotate-rs -Z unstable-options + +extern crate other_file; + +fn main() { + other_file::WithPrivateMethod.private_method(); +} diff --git a/tests/ui/annotate-snippet/multiple-files.stderr b/tests/ui/annotate-snippet/multiple-files.stderr new file mode 100644 index 00000000000..4236ec811d0 --- /dev/null +++ b/tests/ui/annotate-snippet/multiple-files.stderr @@ -0,0 +1,11 @@ +error[E0624]: method `private_method` is private + --> $DIR/multiple-files.rs:7:35 + | +LL | other_file::WithPrivateMethod.private_method(); + | ^^^^^^^^^^^^^^ private method + | + ::: $DIR/auxiliary/other_file.rs:5:5 + | +LL | fn private_method(&self) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ private method defined here + | diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr index f1f0d7e5907..5c8d64fc6cb 100644 --- a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr +++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr @@ -4,11 +4,11 @@ error[E0311]: the parameter type `U` may not live long enough LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; | ^^^^^^^ | -note: the parameter type `U` must be valid for the anonymous lifetime defined here... +note: the parameter type `U` must be valid for the anonymous lifetime as defined here... --> $DIR/async-generics-and-bounds.rs:12:18 | LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^ + | ^ note: ...so that the reference type `&(T, U)` does not outlive the data it points at --> $DIR/async-generics-and-bounds.rs:12:28 | @@ -21,11 +21,11 @@ error[E0311]: the parameter type `T` may not live long enough LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; | ^^^^^^^ | -note: the parameter type `T` must be valid for the anonymous lifetime defined here... +note: the parameter type `T` must be valid for the anonymous lifetime as defined here... --> $DIR/async-generics-and-bounds.rs:12:18 | LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^ + | ^ note: ...so that the reference type `&(T, U)` does not outlive the data it points at --> $DIR/async-generics-and-bounds.rs:12:28 | diff --git a/tests/ui/async-await/in-trait/async-generics.stderr b/tests/ui/async-await/in-trait/async-generics.stderr index 2f05564564c..6ae73d9e3a6 100644 --- a/tests/ui/async-await/in-trait/async-generics.stderr +++ b/tests/ui/async-await/in-trait/async-generics.stderr @@ -4,11 +4,11 @@ error[E0311]: the parameter type `U` may not live long enough LL | async fn foo(&self) -> &(T, U); | ^^^^^^^ | -note: the parameter type `U` must be valid for the anonymous lifetime defined here... +note: the parameter type `U` must be valid for the anonymous lifetime as defined here... --> $DIR/async-generics.rs:9:18 | LL | async fn foo(&self) -> &(T, U); - | ^^^^^ + | ^ note: ...so that the reference type `&(T, U)` does not outlive the data it points at --> $DIR/async-generics.rs:9:28 | @@ -21,11 +21,11 @@ error[E0311]: the parameter type `T` may not live long enough LL | async fn foo(&self) -> &(T, U); | ^^^^^^^ | -note: the parameter type `T` must be valid for the anonymous lifetime defined here... +note: the parameter type `T` must be valid for the anonymous lifetime as defined here... --> $DIR/async-generics.rs:9:18 | LL | async fn foo(&self) -> &(T, U); - | ^^^^^ + | ^ note: ...so that the reference type `&(T, U)` does not outlive the data it points at --> $DIR/async-generics.rs:9:28 | diff --git a/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs b/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs new file mode 100644 index 00000000000..2a61c5cc8df --- /dev/null +++ b/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs @@ -0,0 +1,29 @@ +// check-pass +// edition: 2021 +// issue: 113796 + +#![feature(async_fn_in_trait)] + +trait AsyncLendingIterator { + type Item<'a> + where + Self: 'a; + + async fn next(&mut self) -> Option<Self::Item<'_>>; +} + +struct Lend<I>(I); +impl<I> AsyncLendingIterator for Lend<I> { + type Item<'a> = &'a I + where + Self: 'a; + + // Checking that the synthetic `<Self as AsyncLendingIterator>::next()` GAT + // is well-formed requires being able to assume the WF types of `next`. + + async fn next(&mut self) -> Option<Self::Item<'_>> { + todo!() + } +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs index 8b97336fe0c..ff7ad4bf389 100644 --- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs +++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs @@ -17,7 +17,6 @@ impl<'a, I: 'a + Iterable> Iterable for &'a I { //~^ ERROR impl has stricter requirements than trait fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> { - //~^ ERROR the type `&'a I` does not fulfill the required lifetime (*self).iter() } } diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr index 54a08c5b516..106b8a7c804 100644 --- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr +++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr @@ -12,19 +12,6 @@ help: copy the `where` clause predicates from the trait LL | where Self: 'b; | ~~~~~~~~~~~~~~ -error[E0477]: the type `&'a I` does not fulfill the required lifetime - --> $DIR/bad-item-bound-within-rpitit.rs:19:23 - | -LL | fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: type must outlive the anonymous lifetime as defined here - --> $DIR/bad-item-bound-within-rpitit.rs:10:28 - | -LL | fn iter(&self) -> impl '_ + Iterator<Item = Self::Item<'_>>; - | ^^ - -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0276, E0477. -For more information about an error, try `rustc --explain E0276`. +For more information about this error, try `rustc --explain E0276`. diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.stderr b/tests/ui/impl-trait/in-trait/wf-bounds.stderr index beac6620911..4d60b133048 100644 --- a/tests/ui/impl-trait/in-trait/wf-bounds.stderr +++ b/tests/ui/impl-trait/in-trait/wf-bounds.stderr @@ -47,10 +47,6 @@ note: required by a bound in `NeedsDisplay` | LL | struct NeedsDisplay<T: Display>(T); | ^^^^^^^ required by this bound in `NeedsDisplay` -help: consider restricting type parameter `T` - | -LL | fn nya4<T: std::fmt::Display>() -> impl Wf<NeedsDisplay<T>>; - | +++++++++++++++++++ error: aborting due to 4 previous errors diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.rs index d3591e63a08..da27724007d 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.rs @@ -1,5 +1,4 @@ -// known-bug: #110395 -#![feature(const_trait_impl)] +#![feature(const_trait_impl, effects)] #[const_trait] pub trait Tr { @@ -7,7 +6,7 @@ pub trait Tr { fn b(&self) { ().a() - //FIXME ~^ ERROR the trait bound + //~^ ERROR the trait bound } } diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr index 9f9f17b0929..fe51c1f1ca3 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr @@ -1,11 +1,11 @@ -error[E0015]: cannot call non-const fn `<() as Tr>::a` in constant functions - --> $DIR/default-method-body-is-const-same-trait-ck.rs:9:12 +error[E0277]: the trait bound `(): ~const Tr` is not satisfied + --> $DIR/default-method-body-is-const-same-trait-ck.rs:8:12 | LL | ().a() - | ^^^ + | ^ the trait `~const Tr` is not implemented for `()` | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + = help: the trait `Tr` is implemented for `()` error: aborting due to previous error -For more information about this error, try `rustc --explain E0015`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/type-alias/lazy-type-alias-enum-variant.rs b/tests/ui/type-alias/lazy-type-alias-enum-variant.rs index 78c3159d1c2..6d18e9eca62 100644 --- a/tests/ui/type-alias/lazy-type-alias-enum-variant.rs +++ b/tests/ui/type-alias/lazy-type-alias-enum-variant.rs @@ -2,6 +2,7 @@ // check-pass #![feature(lazy_type_alias)] +//~^ WARN the feature `lazy_type_alias` is incomplete and may not be safe to use enum Enum { Unit, diff --git a/tests/ui/type-alias/lazy-type-alias-enum-variant.stderr b/tests/ui/type-alias/lazy-type-alias-enum-variant.stderr new file mode 100644 index 00000000000..381261b95c7 --- /dev/null +++ b/tests/ui/type-alias/lazy-type-alias-enum-variant.stderr @@ -0,0 +1,11 @@ +warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/lazy-type-alias-enum-variant.rs:4:12 + | +LL | #![feature(lazy_type_alias)] + | ^^^^^^^^^^^^^^^ + | + = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + |
