mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Auto merge of #108576 - megakorre:rustdock_additional_typecheck_before_clean, r=GuillaumeGomez
rustdoc: run more HIR validation to mirror rustc # Explanation While investigating these issues: https://github.com/rust-lang/rust/issues/107093, https://github.com/rust-lang/rust/issues/106079 I thought it maybe would be useful to test running `rustdoc` on all rust files under `tests/ui` grepping for files that causes any ICEs. And these are the files I found would cause ICEs. ``` // These are handled by this fix. tests/ui/late-bound-lifetimes/mismatched_arg_count.rs tests/ui/associated-consts/issue-102335-const.rs tests/ui/const-generics/generic_const_exprs/issue-102768.rs tests/ui/const-generics/const-arg-type-arg-misordered.rs tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs tests/ui/typeck/issue-88643.rs tests/ui/typeck/issue-75889.rs tests/ui/typeck/issue-83621-placeholder-static-in-extern.rs // These are not they will still produce a ICE after this change tests/ui/limits/issue-56762.rs tests/ui/union/projection-as-union-type-error-2.rs tests/ui/union/projection-as-union-type-error.rs ``` I reduces the issues handled by this PR down to the tests added in the PR. That includes the linked issues. But the 3 files that are not handled I will leave for a future PR. This PR adds the `type_collecting` step from `hir_analysis::check_crate` to the rustdoc typechecks. It had the following comment on it. ``` // this ensures that later parts of type checking can assume that items // have valid types and not error ``` Adding the check report the same errors as rustc does for these input. And not ICE when the lint checker walks the HIR or when in the `rustdoc::clean` pass. This PR updates the expected errors of some existing rustdoc-ui tests (some now report less errors). These new reported errors does mirror the errors reported by rustc. # Performance It does more checking so it will probably regress. We should run ``@bors` try `@rust-timer` queue` and see. # Discussion Maybe instead of calling a subset of the checks in `hir_analysis::check_crate` and having comments that say they should be kept in sync. We could instead call `check_crate` directly and pass in some flag. Maybe `check_toplevel_signatures_only` or something like that. That flag would have to skip most of the checks in that function tough.
This commit is contained in:
commit
789ee5e433
@ -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", || {
|
||||
|
6
tests/rustdoc-ui/const_arg_in_type_position.rs
Normal file
6
tests/rustdoc-ui/const_arg_in_type_position.rs
Normal file
@ -0,0 +1,6 @@
|
||||
type Array<T, const N: usize> = [T; N];
|
||||
|
||||
fn foo<const N: usize>() -> Array<N, ()> {
|
||||
//~^ ERROR constant provided when a type was expected
|
||||
unimplemented!()
|
||||
}
|
9
tests/rustdoc-ui/const_arg_in_type_position.stderr
Normal file
9
tests/rustdoc-ui/const_arg_in_type_position.stderr
Normal file
@ -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<const N: usize>() -> Array<N, ()> {
|
||||
| ^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0747`.
|
10
tests/rustdoc-ui/invalid_associated_const.rs
Normal file
10
tests/rustdoc-ui/invalid_associated_const.rs
Normal file
@ -0,0 +1,10 @@
|
||||
#![feature(associated_const_equality)]
|
||||
|
||||
trait T {
|
||||
type A: S<C<X = 0i32> = 34>;
|
||||
//~^ ERROR associated type bindings are not allowed here
|
||||
}
|
||||
|
||||
trait S {
|
||||
const C: i32;
|
||||
}
|
9
tests/rustdoc-ui/invalid_associated_const.stderr
Normal file
9
tests/rustdoc-ui/invalid_associated_const.stderr
Normal file
@ -0,0 +1,9 @@
|
||||
error[E0229]: associated type bindings are not allowed here
|
||||
--> $DIR/invalid_associated_const.rs:4:17
|
||||
|
|
||||
LL | type A: S<C<X = 0i32> = 34>;
|
||||
| ^^^^^^^^ associated type not allowed here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0229`.
|
6
tests/rustdoc-ui/invalid_const_in_lifetime_position.rs
Normal file
6
tests/rustdoc-ui/invalid_const_in_lifetime_position.rs
Normal file
@ -0,0 +1,6 @@
|
||||
trait X {
|
||||
type Y<'a>;
|
||||
}
|
||||
fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
|
||||
//~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments
|
||||
//~| ERROR associated type takes 0 generic arguments but 1 generic argument
|
33
tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr
Normal file
33
tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr
Normal file
@ -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<dyn X<Y<1> = &'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<dyn X<Y<'_, 1> = &'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<dyn X<Y<1> = &'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`.
|
2
tests/rustdoc-ui/invalid_infered_static_and_const.rs
Normal file
2
tests/rustdoc-ui/invalid_infered_static_and_const.rs
Normal file
@ -0,0 +1,2 @@
|
||||
const FOO: dyn Fn() -> _ = ""; //~ ERROR E0121
|
||||
static BOO: dyn Fn() -> _ = ""; //~ ERROR E0121
|
15
tests/rustdoc-ui/invalid_infered_static_and_const.stderr
Normal file
15
tests/rustdoc-ui/invalid_infered_static_and_const.stderr
Normal file
@ -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`.
|
@ -1,19 +1,50 @@
|
||||
// compile-flags: -Znormalize-docs
|
||||
|
||||
use std::ops::Index;
|
||||
|
||||
pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
|
||||
//~^ 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<
|
||||
<Self as SVec>::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`
|
||||
Output = <Index<<Self as SVec>::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`
|
||||
Output = <Self as SVec>::Item> as SVec>::Item,
|
||||
//~^ 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) -> <Self as SVec>::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`
|
||||
}
|
||||
|
@ -1,11 +1,329 @@
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:16:38
|
||||
--> $DIR/issue-105742.rs:15:21
|
||||
|
|
||||
LL | <Self as SVec>::Item,
|
||||
| ^^^^ expected 1 lifetime argument
|
||||
|
|
||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | <Self as SVec>::Item<'a>,
|
||||
| ++++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:15:21
|
||||
|
|
||||
LL | <Self as SVec>::Item,
|
||||
| ^^^^ expected 1 generic argument
|
||||
|
|
||||
note: associated type defined here, with 1 generic parameter: `T`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ -
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <Self as SVec>::Item<T>,
|
||||
| +++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:22:37
|
||||
|
|
||||
LL | Output = <Index<<Self as SVec>::Item,
|
||||
| ^^^^ expected 1 lifetime argument
|
||||
|
|
||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | Output = <Index<<Self as SVec>::Item<'a>,
|
||||
| ++++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:22:37
|
||||
|
|
||||
LL | Output = <Index<<Self as SVec>::Item,
|
||||
| ^^^^ expected 1 generic argument
|
||||
|
|
||||
note: associated type defined here, with 1 generic parameter: `T`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ -
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | Output = <Index<<Self as SVec>::Item<T>,
|
||||
| +++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:29:30
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item> as SVec>::Item,
|
||||
| ^^^^ expected 1 lifetime argument
|
||||
|
|
||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
|
||||
| ++++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:29:30
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item> as SVec>::Item,
|
||||
| ^^^^ expected 1 generic argument
|
||||
|
|
||||
note: associated type defined here, with 1 generic parameter: `T`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ -
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
|
||||
| +++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:29:46
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item> as SVec>::Item,
|
||||
| ^^^^ expected 1 lifetime argument
|
||||
|
|
||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
|
||||
| ++++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:29:46
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item> as SVec>::Item,
|
||||
| ^^^^ expected 1 generic argument
|
||||
|
|
||||
note: associated type defined here, with 1 generic parameter: `T`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ -
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item> as SVec>::Item<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<Item = T, Output = T>) {
|
||||
| ^^^^ expected 1 lifetime argument
|
||||
|
|
||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item<'_> = 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<Item = T, Output = T>) {
|
||||
| ^^^^ expected 1 generic argument
|
||||
|
|
||||
note: associated type defined here, with 1 generic parameter: `T`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ -
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item<T> = T, Output = T>) {
|
||||
| +++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:15:21
|
||||
|
|
||||
LL | <Self as SVec>::Item,
|
||||
| ^^^^ expected 1 lifetime argument
|
||||
|
|
||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | <Self as SVec>::Item<'a>,
|
||||
| ++++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:15:21
|
||||
|
|
||||
LL | <Self as SVec>::Item,
|
||||
| ^^^^ expected 1 generic argument
|
||||
|
|
||||
note: associated type defined here, with 1 generic parameter: `T`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ -
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <Self as SVec>::Item<T>,
|
||||
| +++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:22:37
|
||||
|
|
||||
LL | Output = <Index<<Self as SVec>::Item,
|
||||
| ^^^^ expected 1 lifetime argument
|
||||
|
|
||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | Output = <Index<<Self as SVec>::Item<'a>,
|
||||
| ++++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:22:37
|
||||
|
|
||||
LL | Output = <Index<<Self as SVec>::Item,
|
||||
| ^^^^ expected 1 generic argument
|
||||
|
|
||||
note: associated type defined here, with 1 generic parameter: `T`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ -
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | Output = <Index<<Self as SVec>::Item<T>,
|
||||
| +++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:29:30
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item> as SVec>::Item,
|
||||
| ^^^^ expected 1 lifetime argument
|
||||
|
|
||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
|
||||
| ++++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:29:30
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item> as SVec>::Item,
|
||||
| ^^^^ expected 1 generic argument
|
||||
|
|
||||
note: associated type defined here, with 1 generic parameter: `T`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ -
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
|
||||
| +++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:29:46
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item> as SVec>::Item,
|
||||
| ^^^^ expected 1 lifetime argument
|
||||
|
|
||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
|
||||
| ++++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:29:46
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item> as SVec>::Item,
|
||||
| ^^^^ expected 1 generic argument
|
||||
|
|
||||
note: associated type defined here, with 1 generic parameter: `T`
|
||||
--> $DIR/issue-105742.rs:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ -
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | Output = <Self as SVec>::Item> as SVec>::Item<T>,
|
||||
| +++
|
||||
|
||||
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<Item = T, Output = T>) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `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 <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||
--> $DIR/issue-105742.rs:14:17
|
||||
|
|
||||
LL | pub trait SVec: Index<
|
||||
| ____________----__^
|
||||
| | |
|
||||
| | this trait cannot be made into an object...
|
||||
LL | | <Self as SVec>::Item,
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | |/ Output = <Index<<Self as SVec>::Item,
|
||||
LL | ||
|
||||
LL | ||
|
||||
LL | ||
|
||||
... ||
|
||||
LL | ||
|
||||
LL | || Output = <Self as SVec>::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:45:38
|
||||
|
|
||||
LL | fn len(&self) -> <Self as SVec>::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:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ --
|
||||
@ -15,13 +333,13 @@ LL | fn len(&self) -> <Self as SVec>::Item<'_>;
|
||||
| ++++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:16:38
|
||||
--> $DIR/issue-105742.rs:45:38
|
||||
|
|
||||
LL | fn len(&self) -> <Self as SVec>::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:43:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ -
|
||||
@ -30,6 +348,7 @@ help: add missing generic argument
|
||||
LL | fn len(&self) -> <Self as SVec>::Item<T>;
|
||||
| +++
|
||||
|
||||
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`.
|
||||
|
@ -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`.
|
||||
|
@ -1,3 +1,2 @@
|
||||
pub fn f1<T>(x: T::A) {}
|
||||
//~^ ERROR
|
||||
//~^^ ERROR
|
||||
|
@ -4,12 +4,6 @@ error[E0220]: associated type `A` not found for `T`
|
||||
LL | pub fn f1<T>(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<T>(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`.
|
||||
|
@ -6,7 +6,6 @@ pub trait TraitWithAssoc {
|
||||
|
||||
pub type Foo<V> = impl Trait<V::Assoc>;
|
||||
//~^ ERROR
|
||||
//~^^ ERROR
|
||||
|
||||
pub trait Trait<U> {}
|
||||
|
||||
|
@ -4,12 +4,6 @@ error[E0220]: associated type `Assoc` not found for `V`
|
||||
LL | pub type Foo<V> = impl Trait<V::Assoc>;
|
||||
| ^^^^^ 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<V> = impl Trait<V::Assoc>;
|
||||
| ^^^^^ 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`.
|
||||
|
8
tests/rustdoc-ui/mismatched_arg_count.rs
Normal file
8
tests/rustdoc-ui/mismatched_arg_count.rs
Normal file
@ -0,0 +1,8 @@
|
||||
trait Trait<'a> {
|
||||
type Assoc;
|
||||
}
|
||||
|
||||
type Alias<'a, T> = <T as Trait<'a>>::Assoc;
|
||||
|
||||
fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {}
|
||||
//~^ error: type alias takes 1 lifetime argument but 2 lifetime arguments were supplied
|
17
tests/rustdoc-ui/mismatched_arg_count.stderr
Normal file
17
tests/rustdoc-ui/mismatched_arg_count.stderr
Normal file
@ -0,0 +1,17 @@
|
||||
error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were supplied
|
||||
--> $DIR/mismatched_arg_count.rs:7: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:5:6
|
||||
|
|
||||
LL | type Alias<'a, T> = <T as Trait<'a>>::Assoc;
|
||||
| ^^^^^ --
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0107`.
|
Loading…
Reference in New Issue
Block a user