From 9b5115f92b84ce95aed3e8f6faa3f546f6cf4bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20K=C3=A5rlin?= Date: Tue, 28 Feb 2023 19:13:21 +0100 Subject: [PATCH 1/7] rustdoc: run more HIR validation to mirror rustc --- src/librustdoc/core.rs | 3 ++ .../rustdoc-ui/const_arg_in_type_position.rs | 6 ++++ .../const_arg_in_type_position.stderr | 9 +++++ tests/rustdoc-ui/invalid-toplevel-const.rs | 2 ++ .../rustdoc-ui/invalid-toplevel-const.stderr | 9 +++++ tests/rustdoc-ui/invalid_associated_const.rs | 10 ++++++ .../invalid_associated_const.stderr | 9 +++++ .../invalid_const_in_lifetime_position.rs | 6 ++++ .../invalid_const_in_lifetime_position.stderr | 33 +++++++++++++++++++ .../invalid_const_in_type_position.rs | 4 +++ .../invalid_const_in_type_position.stderr | 9 +++++ .../invalid_infered_static_and_const.rs | 2 ++ .../invalid_infered_static_and_const.stderr | 15 +++++++++ tests/rustdoc-ui/mismatched_arg_count.rs | 12 +++++++ tests/rustdoc-ui/mismatched_arg_count.stderr | 17 ++++++++++ 15 files changed, 146 insertions(+) create mode 100644 tests/rustdoc-ui/const_arg_in_type_position.rs create mode 100644 tests/rustdoc-ui/const_arg_in_type_position.stderr create mode 100644 tests/rustdoc-ui/invalid-toplevel-const.rs create mode 100644 tests/rustdoc-ui/invalid-toplevel-const.stderr create mode 100644 tests/rustdoc-ui/invalid_associated_const.rs create mode 100644 tests/rustdoc-ui/invalid_associated_const.stderr create mode 100644 tests/rustdoc-ui/invalid_const_in_lifetime_position.rs create mode 100644 tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr create mode 100644 tests/rustdoc-ui/invalid_const_in_type_position.rs create mode 100644 tests/rustdoc-ui/invalid_const_in_type_position.stderr create mode 100644 tests/rustdoc-ui/invalid_infered_static_and_const.rs create mode 100644 tests/rustdoc-ui/invalid_infered_static_and_const.stderr create mode 100644 tests/rustdoc-ui/mismatched_arg_count.rs create mode 100644 tests/rustdoc-ui/mismatched_arg_count.stderr diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 28458f329036d..b392ba058360d 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -303,6 +303,9 @@ pub(crate) fn run_global_ctxt( // HACK(jynelson) this calls an _extremely_ limited subset of `typeck` // and might break if queries change their assumptions in the future. + tcx.sess.time("type_collecting", || { + tcx.hir().for_each_module(|module| tcx.ensure().collect_mod_item_types(module)) + }); // NOTE: This is copy/pasted from typeck/lib.rs and should be kept in sync with those changes. tcx.sess.time("item_types_checking", || { diff --git a/tests/rustdoc-ui/const_arg_in_type_position.rs b/tests/rustdoc-ui/const_arg_in_type_position.rs new file mode 100644 index 0000000000000..4969e8d195fb3 --- /dev/null +++ b/tests/rustdoc-ui/const_arg_in_type_position.rs @@ -0,0 +1,6 @@ +type Array = [T; N]; + +fn foo() -> Array { + //~^ ERROR constant provided when a type was expected + unimplemented!() +} diff --git a/tests/rustdoc-ui/const_arg_in_type_position.stderr b/tests/rustdoc-ui/const_arg_in_type_position.stderr new file mode 100644 index 0000000000000..ea05920dea79b --- /dev/null +++ b/tests/rustdoc-ui/const_arg_in_type_position.stderr @@ -0,0 +1,9 @@ +error[E0747]: constant provided when a type was expected + --> $DIR/const_arg_in_type_position.rs:3:35 + | +LL | fn foo() -> Array { + | ^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0747`. diff --git a/tests/rustdoc-ui/invalid-toplevel-const.rs b/tests/rustdoc-ui/invalid-toplevel-const.rs new file mode 100644 index 0000000000000..227be0cfc9ad9 --- /dev/null +++ b/tests/rustdoc-ui/invalid-toplevel-const.rs @@ -0,0 +1,2 @@ +static CONST: Option = None; +//~^ ERROR: the placeholder `_` is not allowed within types on item signatures for static items [E0121] diff --git a/tests/rustdoc-ui/invalid-toplevel-const.stderr b/tests/rustdoc-ui/invalid-toplevel-const.stderr new file mode 100644 index 0000000000000..953e332a32c55 --- /dev/null +++ b/tests/rustdoc-ui/invalid-toplevel-const.stderr @@ -0,0 +1,9 @@ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for static items + --> $DIR/invalid-toplevel-const.rs:2:31 + | +LL | static CONST: Option = None; + | ^ not allowed in type signatures + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0121`. diff --git a/tests/rustdoc-ui/invalid_associated_const.rs b/tests/rustdoc-ui/invalid_associated_const.rs new file mode 100644 index 0000000000000..6ab8c36f74041 --- /dev/null +++ b/tests/rustdoc-ui/invalid_associated_const.rs @@ -0,0 +1,10 @@ +#![feature(associated_const_equality)] + +trait T { + type A: S = 34>; + //~^ ERROR associated type bindings are not allowed here +} + +trait S { + const C: i32; +} diff --git a/tests/rustdoc-ui/invalid_associated_const.stderr b/tests/rustdoc-ui/invalid_associated_const.stderr new file mode 100644 index 0000000000000..1a8863fb18f5d --- /dev/null +++ b/tests/rustdoc-ui/invalid_associated_const.stderr @@ -0,0 +1,9 @@ +error[E0229]: associated type bindings are not allowed here + --> $DIR/invalid_associated_const.rs:4:17 + | +LL | type A: S = 34>; + | ^^^^^^^^ associated type not allowed here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0229`. diff --git a/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs b/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs new file mode 100644 index 0000000000000..c3f4fd63bac70 --- /dev/null +++ b/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs @@ -0,0 +1,6 @@ +trait X { + type Y<'a>; +} +fn f<'a>(arg : Box = &'a ()>>) {} +//~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments +//~| ERROR associated type takes 0 generic arguments but 1 generic argument diff --git a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr new file mode 100644 index 0000000000000..527729a822862 --- /dev/null +++ b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr @@ -0,0 +1,33 @@ +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied + --> $DIR/invalid_const_in_lifetime_position.rs:4:26 + | +LL | fn f<'a>(arg : Box = &'a ()>>) {} + | ^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/invalid_const_in_lifetime_position.rs:2:10 + | +LL | type Y<'a>; + | ^ -- +help: add missing lifetime argument + | +LL | fn f<'a>(arg : Box = &'a ()>>) {} + | +++ + +error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/invalid_const_in_lifetime_position.rs:4:26 + | +LL | fn f<'a>(arg : Box = &'a ()>>) {} + | ^--- help: remove these generics + | | + | expected 0 generic arguments + | +note: associated type defined here, with 0 generic parameters + --> $DIR/invalid_const_in_lifetime_position.rs:2:10 + | +LL | type Y<'a>; + | ^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/rustdoc-ui/invalid_const_in_type_position.rs b/tests/rustdoc-ui/invalid_const_in_type_position.rs new file mode 100644 index 0000000000000..b8ddd80d5cb06 --- /dev/null +++ b/tests/rustdoc-ui/invalid_const_in_type_position.rs @@ -0,0 +1,4 @@ +use std::ops::Generator; + +fn gen() -> impl Generator<{}> {} +//~^ERROR constant provided when a type was expected diff --git a/tests/rustdoc-ui/invalid_const_in_type_position.stderr b/tests/rustdoc-ui/invalid_const_in_type_position.stderr new file mode 100644 index 0000000000000..27c9a730fb4ae --- /dev/null +++ b/tests/rustdoc-ui/invalid_const_in_type_position.stderr @@ -0,0 +1,9 @@ +error[E0747]: constant provided when a type was expected + --> $DIR/invalid_const_in_type_position.rs:3:28 + | +LL | fn gen() -> impl Generator<{}> {} + | ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0747`. diff --git a/tests/rustdoc-ui/invalid_infered_static_and_const.rs b/tests/rustdoc-ui/invalid_infered_static_and_const.rs new file mode 100644 index 0000000000000..3f8e68dc02002 --- /dev/null +++ b/tests/rustdoc-ui/invalid_infered_static_and_const.rs @@ -0,0 +1,2 @@ +const FOO: dyn Fn() -> _ = ""; //~ ERROR E0121 +static BOO: dyn Fn() -> _ = ""; //~ ERROR E0121 diff --git a/tests/rustdoc-ui/invalid_infered_static_and_const.stderr b/tests/rustdoc-ui/invalid_infered_static_and_const.stderr new file mode 100644 index 0000000000000..401020224d6a5 --- /dev/null +++ b/tests/rustdoc-ui/invalid_infered_static_and_const.stderr @@ -0,0 +1,15 @@ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for constant items + --> $DIR/invalid_infered_static_and_const.rs:1:24 + | +LL | const FOO: dyn Fn() -> _ = ""; + | ^ not allowed in type signatures + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for static items + --> $DIR/invalid_infered_static_and_const.rs:2:25 + | +LL | static BOO: dyn Fn() -> _ = ""; + | ^ not allowed in type signatures + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0121`. diff --git a/tests/rustdoc-ui/mismatched_arg_count.rs b/tests/rustdoc-ui/mismatched_arg_count.rs new file mode 100644 index 0000000000000..792563fd82b35 --- /dev/null +++ b/tests/rustdoc-ui/mismatched_arg_count.rs @@ -0,0 +1,12 @@ +// ensures that we don't ICE when there are too many args supplied to the alias. + +trait Trait<'a> { + type Assoc; +} + +type Alias<'a, T> = >::Assoc; + +fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} +//~^ error: type alias takes 1 lifetime argument but 2 lifetime arguments were supplied + +fn main() {} diff --git a/tests/rustdoc-ui/mismatched_arg_count.stderr b/tests/rustdoc-ui/mismatched_arg_count.stderr new file mode 100644 index 0000000000000..de58a014ee8fa --- /dev/null +++ b/tests/rustdoc-ui/mismatched_arg_count.stderr @@ -0,0 +1,17 @@ +error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were supplied + --> $DIR/mismatched_arg_count.rs:9:29 + | +LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} + | ^^^^^ -- help: remove this lifetime argument + | | + | expected 1 lifetime argument + | +note: type alias defined here, with 1 lifetime parameter: `'a` + --> $DIR/mismatched_arg_count.rs:7:6 + | +LL | type Alias<'a, T> = >::Assoc; + | ^^^^^ -- + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0107`. From 466fc4af84c295b9ae601d6b49d5d794e273de5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20K=C3=A5rlin?= Date: Wed, 1 Mar 2023 10:40:39 +0100 Subject: [PATCH 2/7] rustdoc: update with --bless and change expected errors --- .../rustdoc-ui/invalid-toplevel-const.stderr | 2 +- tests/rustdoc-ui/issue-105742.rs | 24 +- tests/rustdoc-ui/issue-105742.stderr | 330 +++++++++++++++++- tests/rustdoc-ui/issue-106226.stderr | 8 +- tests/rustdoc-ui/issue-79465.rs | 1 - tests/rustdoc-ui/issue-79465.stderr | 8 +- tests/rustdoc-ui/issue-96287.rs | 1 - tests/rustdoc-ui/issue-96287.stderr | 8 +- 8 files changed, 352 insertions(+), 30 deletions(-) diff --git a/tests/rustdoc-ui/invalid-toplevel-const.stderr b/tests/rustdoc-ui/invalid-toplevel-const.stderr index 953e332a32c55..ae19b728bfee7 100644 --- a/tests/rustdoc-ui/invalid-toplevel-const.stderr +++ b/tests/rustdoc-ui/invalid-toplevel-const.stderr @@ -1,5 +1,5 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures for static items - --> $DIR/invalid-toplevel-const.rs:2:31 + --> $DIR/invalid-toplevel-const.rs:1:31 | LL | static CONST: Option = None; | ^ not allowed in type signatures diff --git a/tests/rustdoc-ui/issue-105742.rs b/tests/rustdoc-ui/issue-105742.rs index 9f36e5315ecc2..6d33e47a3680d 100644 --- a/tests/rustdoc-ui/issue-105742.rs +++ b/tests/rustdoc-ui/issue-105742.rs @@ -1,19 +1,37 @@ // compile-flags: -Znormalize-docs - use std::ops::Index; pub fn next<'a, T>(s: &'a mut dyn SVec) { + //~^ERROR + //~|ERROR + //~|ERROR let _ = s; } pub trait SVec: Index< ::Item, + //~^ERROR + //~|ERROR + //~|ERROR + //~|ERROR Output = ::Item, + //~^ERROR + //~|ERROR + //~|ERROR + //~|ERROR Output = ::Item> as SVec>::Item, + //~^ERROR + //~|ERROR + //~|ERROR + //~|ERROR + //~|ERROR + //~|ERROR + //~|ERROR + //~|ERROR > { type Item<'a, T>; fn len(&self) -> ::Item; - //~^ ERROR - //~^^ ERROR + //~^ERROR + //~|ERROR } diff --git a/tests/rustdoc-ui/issue-105742.stderr b/tests/rustdoc-ui/issue-105742.stderr index 4d2ee97268917..837e72852b4e5 100644 --- a/tests/rustdoc-ui/issue-105742.stderr +++ b/tests/rustdoc-ui/issue-105742.stderr @@ -1,11 +1,328 @@ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:16:38 + --> $DIR/issue-105742.rs:12:21 + | +LL | ::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | ::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:12:21 + | +LL | ::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | ::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:17:37 + | +LL | Output = ::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | Output = ::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:17:37 + | +LL | Output = ::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | Output = ::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:22:30 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | Output = ::Item<'a>> as SVec>::Item, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:22:30 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | Output = ::Item> as SVec>::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:22:46 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | Output = ::Item> as SVec>::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:22:46 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | Output = ::Item> as SVec>::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:4:40 + | +LL | pub fn next<'a, T>(s: &'a mut dyn SVec) { + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | pub fn next<'a, T>(s: &'a mut dyn SVec = T, Output = T>) { + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:4:40 + | +LL | pub fn next<'a, T>(s: &'a mut dyn SVec) { + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | pub fn next<'a, T>(s: &'a mut dyn SVec = T, Output = T>) { + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:12:21 + | +LL | ::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | ::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:12:21 + | +LL | ::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | ::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:17:37 + | +LL | Output = ::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | Output = ::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:17:37 + | +LL | Output = ::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | Output = ::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:22:30 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | Output = ::Item<'a>> as SVec>::Item, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:22:30 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | Output = ::Item> as SVec>::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:22:46 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | Output = ::Item> as SVec>::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:22:46 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:32:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | Output = ::Item> as SVec>::Item, + | +++ + +error[E0038]: the trait `SVec` cannot be made into an object + --> $DIR/issue-105742.rs:4:31 + | +LL | pub fn next<'a, T>(s: &'a mut dyn SVec) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SVec` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/issue-105742.rs:11:17 + | +LL | pub trait SVec: Index< + | ____________----__^ + | | | + | | this trait cannot be made into an object... +LL | | ::Item, +LL | | +LL | | +... | +LL | |/ Output = ::Item, +LL | || +LL | || +LL | || +LL | || +LL | || Output = ::Item> as SVec>::Item, + | ||_________________________________________________^ ...because it uses `Self` as a type parameter +... | +LL | | +LL | | > { + | |__^ ...because it uses `Self` as a type parameter + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:34:38 | LL | fn len(&self) -> ::Item; | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:14:10 + --> $DIR/issue-105742.rs:32:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -15,13 +332,13 @@ LL | fn len(&self) -> ::Item<'_>; | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:16:38 + --> $DIR/issue-105742.rs:34:38 | LL | fn len(&self) -> ::Item; | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:14:10 + --> $DIR/issue-105742.rs:32:10 | LL | type Item<'a, T>; | ^^^^ - @@ -30,6 +347,7 @@ help: add missing generic argument LL | fn len(&self) -> ::Item; | +++ -error: aborting due to 2 previous errors +error: aborting due to 21 previous errors -For more information about this error, try `rustc --explain E0107`. +Some errors have detailed explanations: E0038, E0107. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/rustdoc-ui/issue-106226.stderr b/tests/rustdoc-ui/issue-106226.stderr index 2beffbc125bd4..1c973dab61d89 100644 --- a/tests/rustdoc-ui/issue-106226.stderr +++ b/tests/rustdoc-ui/issue-106226.stderr @@ -1,9 +1,9 @@ -error[E0308]: mismatched types - --> $DIR/issue-106226.rs:2:14 +error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases + --> $DIR/issue-106226.rs:2:11 | LL | type F = [_; ()]; - | ^^ expected `usize`, found `()` + | ^ not allowed in type signatures error: aborting due to previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0121`. diff --git a/tests/rustdoc-ui/issue-79465.rs b/tests/rustdoc-ui/issue-79465.rs index f1a77982fb523..e50f3995b83dd 100644 --- a/tests/rustdoc-ui/issue-79465.rs +++ b/tests/rustdoc-ui/issue-79465.rs @@ -1,3 +1,2 @@ pub fn f1(x: T::A) {} //~^ ERROR -//~^^ ERROR diff --git a/tests/rustdoc-ui/issue-79465.stderr b/tests/rustdoc-ui/issue-79465.stderr index 489cc14420a4c..d187a2e664a25 100644 --- a/tests/rustdoc-ui/issue-79465.stderr +++ b/tests/rustdoc-ui/issue-79465.stderr @@ -4,12 +4,6 @@ error[E0220]: associated type `A` not found for `T` LL | pub fn f1(x: T::A) {} | ^ associated type `A` not found -error[E0220]: associated type `A` not found for `T` - --> $DIR/issue-79465.rs:1:20 - | -LL | pub fn f1(x: T::A) {} - | ^ associated type `A` not found - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0220`. diff --git a/tests/rustdoc-ui/issue-96287.rs b/tests/rustdoc-ui/issue-96287.rs index 8d8b4456e6335..08cc7ef4c902c 100644 --- a/tests/rustdoc-ui/issue-96287.rs +++ b/tests/rustdoc-ui/issue-96287.rs @@ -6,7 +6,6 @@ pub trait TraitWithAssoc { pub type Foo = impl Trait; //~^ ERROR -//~^^ ERROR pub trait Trait {} diff --git a/tests/rustdoc-ui/issue-96287.stderr b/tests/rustdoc-ui/issue-96287.stderr index 0236b9fe64775..7722eb96028df 100644 --- a/tests/rustdoc-ui/issue-96287.stderr +++ b/tests/rustdoc-ui/issue-96287.stderr @@ -4,12 +4,6 @@ error[E0220]: associated type `Assoc` not found for `V` LL | pub type Foo = impl Trait; | ^^^^^ there is a similarly named associated type `Assoc` in the trait `TraitWithAssoc` -error[E0220]: associated type `Assoc` not found for `V` - --> $DIR/issue-96287.rs:7:33 - | -LL | pub type Foo = impl Trait; - | ^^^^^ there is a similarly named associated type `Assoc` in the trait `TraitWithAssoc` - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0220`. From 2ee19c9c4c17d20d007a60c99166a073510addfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20K=C3=A5rlin?= Date: Wed, 1 Mar 2023 10:41:59 +0100 Subject: [PATCH 3/7] rustdoc: remove redundant test --- tests/rustdoc-ui/invalid_const_in_type_position.rs | 4 ---- tests/rustdoc-ui/invalid_const_in_type_position.stderr | 9 --------- 2 files changed, 13 deletions(-) delete mode 100644 tests/rustdoc-ui/invalid_const_in_type_position.rs delete mode 100644 tests/rustdoc-ui/invalid_const_in_type_position.stderr diff --git a/tests/rustdoc-ui/invalid_const_in_type_position.rs b/tests/rustdoc-ui/invalid_const_in_type_position.rs deleted file mode 100644 index b8ddd80d5cb06..0000000000000 --- a/tests/rustdoc-ui/invalid_const_in_type_position.rs +++ /dev/null @@ -1,4 +0,0 @@ -use std::ops::Generator; - -fn gen() -> impl Generator<{}> {} -//~^ERROR constant provided when a type was expected diff --git a/tests/rustdoc-ui/invalid_const_in_type_position.stderr b/tests/rustdoc-ui/invalid_const_in_type_position.stderr deleted file mode 100644 index 27c9a730fb4ae..0000000000000 --- a/tests/rustdoc-ui/invalid_const_in_type_position.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0747]: constant provided when a type was expected - --> $DIR/invalid_const_in_type_position.rs:3:28 - | -LL | fn gen() -> impl Generator<{}> {} - | ^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0747`. From d1b6aa6834744ec653a8de9f2f4ef25612e520e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20K=C3=A5rlin?= Date: Wed, 1 Mar 2023 10:43:41 +0100 Subject: [PATCH 4/7] rustdoc: remove excess from rustdoc test --- tests/rustdoc-ui/mismatched_arg_count.rs | 4 ---- tests/rustdoc-ui/mismatched_arg_count.stderr | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/rustdoc-ui/mismatched_arg_count.rs b/tests/rustdoc-ui/mismatched_arg_count.rs index 792563fd82b35..7841442987b72 100644 --- a/tests/rustdoc-ui/mismatched_arg_count.rs +++ b/tests/rustdoc-ui/mismatched_arg_count.rs @@ -1,5 +1,3 @@ -// ensures that we don't ICE when there are too many args supplied to the alias. - trait Trait<'a> { type Assoc; } @@ -8,5 +6,3 @@ type Alias<'a, T> = >::Assoc; fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} //~^ error: type alias takes 1 lifetime argument but 2 lifetime arguments were supplied - -fn main() {} diff --git a/tests/rustdoc-ui/mismatched_arg_count.stderr b/tests/rustdoc-ui/mismatched_arg_count.stderr index de58a014ee8fa..7e88ce954acae 100644 --- a/tests/rustdoc-ui/mismatched_arg_count.stderr +++ b/tests/rustdoc-ui/mismatched_arg_count.stderr @@ -1,5 +1,5 @@ error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were supplied - --> $DIR/mismatched_arg_count.rs:9:29 + --> $DIR/mismatched_arg_count.rs:7:29 | LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} | ^^^^^ -- help: remove this lifetime argument @@ -7,7 +7,7 @@ LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} | expected 1 lifetime argument | note: type alias defined here, with 1 lifetime parameter: `'a` - --> $DIR/mismatched_arg_count.rs:7:6 + --> $DIR/mismatched_arg_count.rs:5:6 | LL | type Alias<'a, T> = >::Assoc; | ^^^^^ -- From 4d571a9ccf239ae4d5e354786ede05fda2745f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20K=C3=A5rlin?= Date: Wed, 1 Mar 2023 10:45:08 +0100 Subject: [PATCH 5/7] rustdoc: remove other redundant item --- tests/rustdoc-ui/invalid-toplevel-const.rs | 2 -- tests/rustdoc-ui/invalid-toplevel-const.stderr | 9 --------- 2 files changed, 11 deletions(-) delete mode 100644 tests/rustdoc-ui/invalid-toplevel-const.rs delete mode 100644 tests/rustdoc-ui/invalid-toplevel-const.stderr diff --git a/tests/rustdoc-ui/invalid-toplevel-const.rs b/tests/rustdoc-ui/invalid-toplevel-const.rs deleted file mode 100644 index 227be0cfc9ad9..0000000000000 --- a/tests/rustdoc-ui/invalid-toplevel-const.rs +++ /dev/null @@ -1,2 +0,0 @@ -static CONST: Option = None; -//~^ ERROR: the placeholder `_` is not allowed within types on item signatures for static items [E0121] diff --git a/tests/rustdoc-ui/invalid-toplevel-const.stderr b/tests/rustdoc-ui/invalid-toplevel-const.stderr deleted file mode 100644 index ae19b728bfee7..0000000000000 --- a/tests/rustdoc-ui/invalid-toplevel-const.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0121]: the placeholder `_` is not allowed within types on item signatures for static items - --> $DIR/invalid-toplevel-const.rs:1:31 - | -LL | static CONST: Option = None; - | ^ not allowed in type signatures - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0121`. From df556a31774781ef645e286ee3ccaa816622f95a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20K=C3=A5rlin?= Date: Mon, 20 Mar 2023 14:14:06 +0100 Subject: [PATCH 6/7] rustdoc: add error messages to the test --- tests/rustdoc-ui/issue-105742.rs | 55 +++++++++++-------- tests/rustdoc-ui/issue-105742.stderr | 79 ++++++++++++++-------------- 2 files changed, 74 insertions(+), 60 deletions(-) diff --git a/tests/rustdoc-ui/issue-105742.rs b/tests/rustdoc-ui/issue-105742.rs index 6d33e47a3680d..dd79f0fac82a1 100644 --- a/tests/rustdoc-ui/issue-105742.rs +++ b/tests/rustdoc-ui/issue-105742.rs @@ -2,36 +2,49 @@ use std::ops::Index; pub fn next<'a, T>(s: &'a mut dyn SVec) { - //~^ERROR - //~|ERROR - //~|ERROR + //~^ expected 1 lifetime argument + //~| expected 1 generic argument + //~| the trait `SVec` cannot be made into an object + //~| `SVec` cannot be made into an object + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` let _ = s; } pub trait SVec: Index< ::Item, - //~^ERROR - //~|ERROR - //~|ERROR - //~|ERROR + //~^ expected 1 lifetime argument + //~| expected 1 generic argument + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` Output = ::Item, - //~^ERROR - //~|ERROR - //~|ERROR - //~|ERROR + //~^ expected 1 lifetime argument + //~| expected 1 generic argument + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` Output = ::Item> as SVec>::Item, - //~^ERROR - //~|ERROR - //~|ERROR - //~|ERROR - //~|ERROR - //~|ERROR - //~|ERROR - //~|ERROR + //~^ expected 1 lifetime argument + //~| expected 1 generic argument + //~| expected 1 lifetime argument + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| expected 1 generic argument + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` > { type Item<'a, T>; fn len(&self) -> ::Item; - //~^ERROR - //~|ERROR + //~^ expected 1 lifetime argument + //~| missing generics for associated type `SVec::Item` + //~| expected 1 generic argument + //~| missing generics for associated type `SVec::Item` } diff --git a/tests/rustdoc-ui/issue-105742.stderr b/tests/rustdoc-ui/issue-105742.stderr index 837e72852b4e5..cd53762ef9b2d 100644 --- a/tests/rustdoc-ui/issue-105742.stderr +++ b/tests/rustdoc-ui/issue-105742.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:12:21 + --> $DIR/issue-105742.rs:15:21 | LL | ::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -15,13 +15,13 @@ LL | ::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:12:21 + --> $DIR/issue-105742.rs:15:21 | LL | ::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ - @@ -31,13 +31,13 @@ LL | ::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:17:37 + --> $DIR/issue-105742.rs:22:37 | LL | Output = ::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -47,13 +47,13 @@ LL | Output = ::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:17:37 + --> $DIR/issue-105742.rs:22:37 | LL | Output = ::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ - @@ -63,13 +63,13 @@ LL | Output = ::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:22:30 + --> $DIR/issue-105742.rs:29:30 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -79,13 +79,13 @@ LL | Output = ::Item<'a>> as SVec>::Item, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:22:30 + --> $DIR/issue-105742.rs:29:30 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ - @@ -95,13 +95,13 @@ LL | Output = ::Item> as SVec>::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:22:46 + --> $DIR/issue-105742.rs:29:46 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -111,13 +111,13 @@ LL | Output = ::Item> as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:22:46 + --> $DIR/issue-105742.rs:29:46 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ - @@ -133,7 +133,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec) { | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -149,7 +149,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec) { | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ - @@ -159,13 +159,13 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec = T, Output = T>) { | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:12:21 + --> $DIR/issue-105742.rs:15:21 | LL | ::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -175,13 +175,13 @@ LL | ::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:12:21 + --> $DIR/issue-105742.rs:15:21 | LL | ::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ - @@ -191,13 +191,13 @@ LL | ::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:17:37 + --> $DIR/issue-105742.rs:22:37 | LL | Output = ::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -207,13 +207,13 @@ LL | Output = ::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:17:37 + --> $DIR/issue-105742.rs:22:37 | LL | Output = ::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ - @@ -223,13 +223,13 @@ LL | Output = ::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:22:30 + --> $DIR/issue-105742.rs:29:30 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -239,13 +239,13 @@ LL | Output = ::Item<'a>> as SVec>::Item, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:22:30 + --> $DIR/issue-105742.rs:29:30 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ - @@ -255,13 +255,13 @@ LL | Output = ::Item> as SVec>::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:22:46 + --> $DIR/issue-105742.rs:29:46 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -271,13 +271,13 @@ LL | Output = ::Item> as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:22:46 + --> $DIR/issue-105742.rs:29:46 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ - @@ -293,7 +293,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SVec` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/issue-105742.rs:11:17 + --> $DIR/issue-105742.rs:14:17 | LL | pub trait SVec: Index< | ____________----__^ @@ -307,6 +307,7 @@ LL | |/ Output = ::Item, LL | || LL | || LL | || +... || LL | || LL | || Output = ::Item> as SVec>::Item, | ||_________________________________________________^ ...because it uses `Self` as a type parameter @@ -316,13 +317,13 @@ LL | | > { | |__^ ...because it uses `Self` as a type parameter error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:34:38 + --> $DIR/issue-105742.rs:45:38 | LL | fn len(&self) -> ::Item; | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -332,13 +333,13 @@ LL | fn len(&self) -> ::Item<'_>; | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:34:38 + --> $DIR/issue-105742.rs:45:38 | LL | fn len(&self) -> ::Item; | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:32:10 + --> $DIR/issue-105742.rs:43:10 | LL | type Item<'a, T>; | ^^^^ - From 1f9e2d0538bf7b4271498654df14a06b7ced8bdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20K=C3=A5rlin?= Date: Thu, 30 Mar 2023 15:46:34 +0200 Subject: [PATCH 7/7] rustdoc: tidy excess whitespace --- tests/rustdoc-ui/issue-105742.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/rustdoc-ui/issue-105742.rs b/tests/rustdoc-ui/issue-105742.rs index dd79f0fac82a1..8f4172c0cbbbf 100644 --- a/tests/rustdoc-ui/issue-105742.rs +++ b/tests/rustdoc-ui/issue-105742.rs @@ -6,7 +6,7 @@ pub fn next<'a, T>(s: &'a mut dyn SVec) { //~| expected 1 generic argument //~| the trait `SVec` cannot be made into an object //~| `SVec` cannot be made into an object - //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` let _ = s; } @@ -14,7 +14,7 @@ pub fn next<'a, T>(s: &'a mut dyn SVec) { pub trait SVec: Index< ::Item, //~^ expected 1 lifetime argument - //~| expected 1 generic argument + //~| expected 1 generic argument //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` @@ -22,14 +22,14 @@ pub trait SVec: Index< Output = ::Item, //~^ expected 1 lifetime argument //~| expected 1 generic argument - //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` Output = ::Item> as SVec>::Item, //~^ expected 1 lifetime argument //~| expected 1 generic argument - //~| expected 1 lifetime argument + //~| expected 1 lifetime argument //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item`