diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/rustdoc/issue-109695-crate-doc-hidden.rs | 8 | ||||
| -rw-r--r-- | tests/ui-fulldeps/fluent-messages/invalid-escape.ftl | 1 | ||||
| -rw-r--r-- | tests/ui-fulldeps/fluent-messages/test.rs | 9 | ||||
| -rw-r--r-- | tests/ui-fulldeps/fluent-messages/test.stderr | 26 | ||||
| -rw-r--r-- | tests/ui-fulldeps/internal-lints/existing_doc_keyword.stderr | 2 | ||||
| -rw-r--r-- | tests/ui/lint/issue-109529.fixed | 6 | ||||
| -rw-r--r-- | tests/ui/lint/issue-109529.rs | 6 | ||||
| -rw-r--r-- | tests/ui/lint/issue-109529.stderr | 23 | ||||
| -rw-r--r-- | tests/ui/traits/new-solver/dont-elaborate-for-projections.rs | 12 | ||||
| -rw-r--r-- | tests/ui/traits/new-solver/more-object-bound.rs | 2 | ||||
| -rw-r--r-- | tests/ui/traits/new-solver/more-object-bound.stderr | 13 |
11 files changed, 100 insertions, 8 deletions
diff --git a/tests/rustdoc/issue-109695-crate-doc-hidden.rs b/tests/rustdoc/issue-109695-crate-doc-hidden.rs new file mode 100644 index 00000000000..7a3e53a0d32 --- /dev/null +++ b/tests/rustdoc/issue-109695-crate-doc-hidden.rs @@ -0,0 +1,8 @@ +// This test ensures that even if the crate module is `#[doc(hidden)]`, the file +// is generated. + +// @has 'foo/index.html' +// @has 'foo/all.html' + +#![crate_name = "foo"] +#![doc(hidden)] diff --git a/tests/ui-fulldeps/fluent-messages/invalid-escape.ftl b/tests/ui-fulldeps/fluent-messages/invalid-escape.ftl new file mode 100644 index 00000000000..e28852ea005 --- /dev/null +++ b/tests/ui-fulldeps/fluent-messages/invalid-escape.ftl @@ -0,0 +1 @@ +no_crate_bad_escape = don't use \n, \', or \" diff --git a/tests/ui-fulldeps/fluent-messages/test.rs b/tests/ui-fulldeps/fluent-messages/test.rs index 66575eb8e30..1ee7227a8e9 100644 --- a/tests/ui-fulldeps/fluent-messages/test.rs +++ b/tests/ui-fulldeps/fluent-messages/test.rs @@ -92,3 +92,12 @@ mod missing_message_ref { fluent_messages! { "./missing-message-ref.ftl" } //~^ ERROR referenced message `message` does not exist } + +mod bad_escape { + use super::fluent_messages; + + fluent_messages! { "./invalid-escape.ftl" } + //~^ ERROR invalid escape `\n` + //~| ERROR invalid escape `\"` + //~| ERROR invalid escape `\'` +} diff --git a/tests/ui-fulldeps/fluent-messages/test.stderr b/tests/ui-fulldeps/fluent-messages/test.stderr index c7961ed22f2..8a6a4a91cc2 100644 --- a/tests/ui-fulldeps/fluent-messages/test.stderr +++ b/tests/ui-fulldeps/fluent-messages/test.stderr @@ -83,5 +83,29 @@ LL | fluent_messages! { "./missing-message-ref.ftl" } | = help: you may have meant to use a variable reference (`{$message}`) -error: aborting due to 10 previous errors +error: invalid escape `\n` in Fluent resource + --> $DIR/test.rs:99:24 + | +LL | fluent_messages! { "./invalid-escape.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: os-specific message + +error: invalid escape `\"` in Fluent resource + --> $DIR/test.rs:99:24 + | +LL | fluent_messages! { "./invalid-escape.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: os-specific message + +error: invalid escape `\'` in Fluent resource + --> $DIR/test.rs:99:24 + | +LL | fluent_messages! { "./invalid-escape.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: os-specific message + +error: aborting due to 13 previous errors diff --git a/tests/ui-fulldeps/internal-lints/existing_doc_keyword.stderr b/tests/ui-fulldeps/internal-lints/existing_doc_keyword.stderr index 4e296fff6d0..5110b9be08a 100644 --- a/tests/ui-fulldeps/internal-lints/existing_doc_keyword.stderr +++ b/tests/ui-fulldeps/internal-lints/existing_doc_keyword.stderr @@ -1,4 +1,4 @@ -error: found non-existing keyword `tadam` used in `#[doc(keyword = \"...\")]` +error: found non-existing keyword `tadam` used in `#[doc(keyword = "...")]` --> $DIR/existing_doc_keyword.rs:10:1 | LL | #[doc(keyword = "tadam")] diff --git a/tests/ui/lint/issue-109529.fixed b/tests/ui/lint/issue-109529.fixed new file mode 100644 index 00000000000..5ad489073ee --- /dev/null +++ b/tests/ui/lint/issue-109529.fixed @@ -0,0 +1,6 @@ +// run-rustfix + +fn main() { + for _ in 0..=255 as u8 {} //~ ERROR range endpoint is out of range + for _ in 0..=(255 as u8) {} //~ ERROR range endpoint is out of range +} diff --git a/tests/ui/lint/issue-109529.rs b/tests/ui/lint/issue-109529.rs new file mode 100644 index 00000000000..383d7bc4cf3 --- /dev/null +++ b/tests/ui/lint/issue-109529.rs @@ -0,0 +1,6 @@ +// run-rustfix + +fn main() { + for _ in 0..256 as u8 {} //~ ERROR range endpoint is out of range + for _ in 0..(256 as u8) {} //~ ERROR range endpoint is out of range +} diff --git a/tests/ui/lint/issue-109529.stderr b/tests/ui/lint/issue-109529.stderr new file mode 100644 index 00000000000..9e857d1b0ab --- /dev/null +++ b/tests/ui/lint/issue-109529.stderr @@ -0,0 +1,23 @@ +error: range endpoint is out of range for `u8` + --> $DIR/issue-109529.rs:4:14 + | +LL | for _ in 0..256 as u8 {} + | ------^^^^^^ + | | + | help: use an inclusive range instead: `0..=255` + | + = note: `#[deny(overflowing_literals)]` on by default + +error: range endpoint is out of range for `u8` + --> $DIR/issue-109529.rs:5:14 + | +LL | for _ in 0..(256 as u8) {} + | ^^^^^^^^^^^^^^ + | +help: use an inclusive range instead + | +LL | for _ in 0..=(255 as u8) {} + | + ~~~ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/traits/new-solver/dont-elaborate-for-projections.rs b/tests/ui/traits/new-solver/dont-elaborate-for-projections.rs new file mode 100644 index 00000000000..e608250063c --- /dev/null +++ b/tests/ui/traits/new-solver/dont-elaborate-for-projections.rs @@ -0,0 +1,12 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +trait Iter<'a, I: 'a>: Iterator<Item = &'a I> {} + +fn needs_iter<'a, T: Iter<'a, I> + ?Sized, I: 'a>(_: &T) {} + +fn test(x: &dyn Iter<'_, ()>) { + needs_iter(x); +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/more-object-bound.rs b/tests/ui/traits/new-solver/more-object-bound.rs index 712759ef0e6..bb730b18ef7 100644 --- a/tests/ui/traits/new-solver/more-object-bound.rs +++ b/tests/ui/traits/new-solver/more-object-bound.rs @@ -10,7 +10,7 @@ trait Trait: SuperTrait<A = <Self as SuperTrait>::B> {} fn transmute<A, B>(x: A) -> B { foo::<A, B, dyn Trait<A = A, B = B>>(x) - //~^ ERROR type annotations needed: cannot satisfy `dyn Trait<A = A, B = B>: Trait` + //~^ ERROR the trait bound `dyn Trait<A = A, B = B>: Trait` is not satisfied } fn foo<A, B, T: ?Sized>(x: T::A) -> B diff --git a/tests/ui/traits/new-solver/more-object-bound.stderr b/tests/ui/traits/new-solver/more-object-bound.stderr index 208fdecb08f..4554b8c7473 100644 --- a/tests/ui/traits/new-solver/more-object-bound.stderr +++ b/tests/ui/traits/new-solver/more-object-bound.stderr @@ -1,10 +1,9 @@ -error[E0283]: type annotations needed: cannot satisfy `dyn Trait<A = A, B = B>: Trait` - --> $DIR/more-object-bound.rs:12:5 +error[E0277]: the trait bound `dyn Trait<A = A, B = B>: Trait` is not satisfied + --> $DIR/more-object-bound.rs:12:17 | LL | foo::<A, B, dyn Trait<A = A, B = B>>(x) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `dyn Trait<A = A, B = B>` | - = note: cannot satisfy `dyn Trait<A = A, B = B>: Trait` note: required by a bound in `foo` --> $DIR/more-object-bound.rs:18:8 | @@ -13,7 +12,11 @@ LL | fn foo<A, B, T: ?Sized>(x: T::A) -> B LL | where LL | T: Trait<B = B>, | ^^^^^^^^^^^^ required by this bound in `foo` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | fn transmute<A, B>(x: A) -> B where dyn Trait<A = A, B = B>: Trait { + | ++++++++++++++++++++++++++++++++++++ error: aborting due to previous error -For more information about this error, try `rustc --explain E0283`. +For more information about this error, try `rustc --explain E0277`. |
