Accept less invalid Rust in rustdoc

This commit is contained in:
Oli Scherer 2023-10-31 13:58:03 +00:00
parent 22b27120b9
commit 4512f211ae
35 changed files with 428 additions and 127 deletions

View File

@ -1077,26 +1077,6 @@ mod prim_tuple {}
#[doc(hidden)] #[doc(hidden)]
impl<T> (T,) {} impl<T> (T,) {}
// Fake impl that's only really used for docs.
#[cfg(doc)]
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(fake_variadic)]
/// This trait is implemented on arbitrary-length tuples.
impl<T: Clone> Clone for (T,) {
fn clone(&self) -> Self {
loop {}
}
}
// Fake impl that's only really used for docs.
#[cfg(doc)]
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(fake_variadic)]
/// This trait is implemented on arbitrary-length tuples.
impl<T: Copy> Copy for (T,) {
// empty
}
#[rustc_doc_primitive = "f32"] #[rustc_doc_primitive = "f32"]
/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008). /// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008).
/// ///

View File

@ -319,10 +319,14 @@ pub(crate) fn run_global_ctxt(
tcx.hir().for_each_module(|module| tcx.ensure().collect_mod_item_types(module)) 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. // NOTE: These are copy/pasted from typeck/lib.rs and should be kept in sync with those changes.
let _ = tcx.sess.time("wf_checking", || {
tcx.hir().try_par_for_each_module(|module| tcx.ensure().check_mod_type_wf(module))
});
tcx.sess.time("item_types_checking", || { tcx.sess.time("item_types_checking", || {
tcx.hir().for_each_module(|module| tcx.ensure().check_mod_item_types(module)) tcx.hir().for_each_module(|module| tcx.ensure().check_mod_item_types(module))
}); });
tcx.sess.abort_if_errors(); tcx.sess.abort_if_errors();
tcx.sess.time("missing_docs", || rustc_lint::check_crate(tcx)); tcx.sess.time("missing_docs", || rustc_lint::check_crate(tcx));
tcx.sess.time("check_mod_attrs", || { tcx.sess.time("check_mod_attrs", || {

View File

@ -147,13 +147,13 @@ pub struct LongItemInfo2;
#[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))] #[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))]
impl SimpleTrait for LongItemInfo2 {} impl SimpleTrait for LongItemInfo2 {}
pub struct WhereWhitespace<T>; pub struct WhereWhitespace<T>(T);
impl<T> WhereWhitespace<T> { impl<T> WhereWhitespace<T> {
pub fn new<F>(f: F) -> Self pub fn new<F>(f: F) -> Self
where where
F: FnMut() -> i32, F: FnMut() -> i32,
{} {todo!()}
} }
impl<K, T> Whitespace<&K> for WhereWhitespace<T> impl<K, T> Whitespace<&K> for WhereWhitespace<T>
@ -187,6 +187,11 @@ impl ItemInfoAlignmentTest {
pub mod scroll_traits { pub mod scroll_traits {
use std::iter::*; use std::iter::*;
struct Intersperse<T>(T);
struct IntersperseWith<T, U>(T, U);
struct Flatten<T>(T);
struct Peekable<T>(T);
/// Shamelessly (partially) copied from `std::iter::Iterator`. /// Shamelessly (partially) copied from `std::iter::Iterator`.
/// It allows us to check that the scroll is working as expected on "hidden" items. /// It allows us to check that the scroll is working as expected on "hidden" items.
pub trait Iterator { pub trait Iterator {

View File

@ -1,7 +1,10 @@
// Regression test for <https://github.com/rust-lang/rust/issues/100529>. // Regression test for <https://github.com/rust-lang/rust/issues/100529>.
#![no_core] #![no_core]
#![feature(no_core)] #![feature(no_core, lang_items)]
#[lang = "sized"]
trait Sized {}
// @has "$.index[*][?(@.name=='ParseError')]" // @has "$.index[*][?(@.name=='ParseError')]"
// @has "$.index[*][?(@.name=='UnexpectedEndTag')]" // @has "$.index[*][?(@.name=='UnexpectedEndTag')]"

View File

@ -1,8 +1,11 @@
// ignore-tidy-linelength // ignore-tidy-linelength
#![feature(no_core)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"]
trait Sized {}
pub enum Foo { pub enum Foo {
// @set Unit = "$.index[*][?(@.name=='Unit')].id" // @set Unit = "$.index[*][?(@.name=='Unit')].id"
// @is "$.index[*][?(@.name=='Unit')].inner.variant.kind" '"plain"' // @is "$.index[*][?(@.name=='Unit')].inner.variant.kind" '"plain"'

View File

@ -1,6 +1,9 @@
#![feature(no_core)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"]
trait Sized {}
// @set 1.1.0 = "$.index[*][?(@.docs=='1.1.0')].id" // @set 1.1.0 = "$.index[*][?(@.docs=='1.1.0')].id"
// @set 2.1.0 = "$.index[*][?(@.docs=='2.1.0')].id" // @set 2.1.0 = "$.index[*][?(@.docs=='2.1.0')].id"
// @set 2.1.1 = "$.index[*][?(@.docs=='2.1.1')].id" // @set 2.1.1 = "$.index[*][?(@.docs=='2.1.1')].id"

View File

@ -1,11 +1,14 @@
// ignore-tidy-linelength // ignore-tidy-linelength
#![no_core] #![no_core]
#![feature(lang_items, no_core)] #![feature(lang_items, no_core, arbitrary_self_types)]
#[lang = "sized"] #[lang = "sized"]
pub trait Sized {} pub trait Sized {}
#[lang = "receiver"]
pub trait Receiver {}
pub trait Display {} pub trait Display {}
pub trait LendingIterator { pub trait LendingIterator {

View File

@ -1,9 +1,12 @@
#![feature(no_core, auto_traits, lang_items)] #![feature(no_core, auto_traits, lang_items, arbitrary_self_types)]
#![no_core] #![no_core]
#[lang = "sized"] #[lang = "sized"]
trait Sized {} trait Sized {}
#[lang = "receiver"]
pub trait Receiver {}
pub auto trait Bar {} pub auto trait Bar {}
/// has span /// has span
@ -12,8 +15,8 @@ impl Foo {
} }
// Testing spans, so all tests below code // Testing spans, so all tests below code
// @is "$.index[*][?(@.docs=='has span')].span.begin" "[10, 0]" // @is "$.index[*][?(@.docs=='has span')].span.begin" "[13, 0]"
// @is "$.index[*][?(@.docs=='has span')].span.end" "[12, 1]" // @is "$.index[*][?(@.docs=='has span')].span.end" "[15, 1]"
// FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91 // FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91
// is "$.index[*][?(@.inner.impl.synthetic==true)].span" null // is "$.index[*][?(@.inner.impl.synthetic==true)].span" null
pub struct Foo; pub struct Foo;

View File

@ -16,5 +16,5 @@ pub struct Carrier<'a>(&'a ());
pub fn user(_: for<'b> fn(Carrier<'b>::Focus<i32>)) {} pub fn user(_: for<'b> fn(Carrier<'b>::Focus<i32>)) {}
impl<'a> Carrier<'a> { impl<'a> Carrier<'a> {
pub type Focus<T> = &'a mut T; pub type Focus<T> = &'a mut T where T: 'a;
} }

View File

@ -1,7 +1,6 @@
// check-pass
pub fn f() -> impl Sized { pub fn f() -> impl Sized {
pub enum E { pub enum E {
//~^ ERROR: recursive type
V(E), V(E),
} }

View File

@ -0,0 +1,17 @@
error[E0072]: recursive type `f::E` has infinite size
--> $DIR/infinite-recursive-type-2.rs:2:5
|
LL | pub enum E {
| ^^^^^^^^^^
LL |
LL | V(E),
| - recursive without indirection
|
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
|
LL | V(Box<E>),
| ++++ +
error: aborting due to previous error
For more information about this error, try `rustc --explain E0072`.

View File

@ -1,7 +1,6 @@
// check-pass
fn f() -> impl Sized { fn f() -> impl Sized {
enum E { enum E {
//~^ ERROR: recursive type
V(E), V(E),
} }

View File

@ -0,0 +1,17 @@
error[E0072]: recursive type `f::E` has infinite size
--> $DIR/infinite-recursive-type.rs:2:5
|
LL | enum E {
| ^^^^^^
LL |
LL | V(E),
| - recursive without indirection
|
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
|
LL | V(Box<E>),
| ++++ +
error: aborting due to previous error
For more information about this error, try `rustc --explain E0072`.

View File

@ -4,3 +4,8 @@ trait X {
fn f<'a>(arg : Box<dyn X<Y<1> = &'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 1 lifetime argument but 0 lifetime arguments
//~| ERROR associated type takes 0 generic arguments but 1 generic argument //~| ERROR associated type takes 0 generic arguments but 1 generic argument
//~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments
//~| ERROR associated type takes 0 generic arguments but 1 generic argument
//~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments
//~| ERROR associated type takes 0 generic arguments but 1 generic argument
//~| ERROR trait `X` cannot be made into an object

View File

@ -28,6 +28,86 @@ note: associated type defined here, with 0 generic parameters
LL | type Y<'a>; LL | type Y<'a>;
| ^ | ^
error: aborting due to 2 previous errors 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>;
| ^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | fn f<'a>(arg : Box<dyn X<Y<'_, 1> = &'a ()>>) {}
| +++
For more information about this error, try `rustc --explain E0107`. 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>;
| ^
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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>;
| ^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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>;
| ^
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0038]: the trait `X` cannot be made into an object
--> $DIR/invalid_const_in_lifetime_position.rs:4:20
|
LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
| ^^^^^^^^^^^^^^^^^^^^ `X` 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/invalid_const_in_lifetime_position.rs:2:10
|
LL | trait X {
| - this trait cannot be made into an object...
LL | type Y<'a>;
| ^ ...because it contains the generic associated type `Y`
= help: consider moving `Y` to another trait
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0038, E0107.
For more information about an error, try `rustc --explain E0038`.

View File

@ -21,6 +21,8 @@ pub trait SVec: Index<
//~| 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` //~| 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, Output = <Index<<Self as SVec>::Item,
//~^ expected 1 lifetime argument //~^ expected 1 lifetime argument
//~| expected 1 generic argument //~| expected 1 generic argument
@ -30,6 +32,8 @@ pub trait SVec: Index<
//~| 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` //~| 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, Output = <Self as SVec>::Item> as SVec>::Item,
//~^ expected 1 lifetime argument //~^ expected 1 lifetime argument
//~| expected 1 generic argument //~| expected 1 generic argument
@ -47,6 +51,10 @@ pub trait SVec: Index<
//~| 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` //~| 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`
> { > {
type Item<'a, T>; type Item<'a, T>;

View File

@ -5,7 +5,7 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -21,7 +21,7 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -31,13 +31,13 @@ LL | <Self as SVec>::Item<T>,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:24:37 --> $DIR/issue-105742.rs:26:37
| |
LL | Output = <Index<<Self as SVec>::Item, LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -47,13 +47,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>,
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:24:37 --> $DIR/issue-105742.rs:26:37
| |
LL | Output = <Index<<Self as SVec>::Item, LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -63,13 +63,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:30 --> $DIR/issue-105742.rs:37:30
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -79,13 +79,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:30 --> $DIR/issue-105742.rs:37:30
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -95,13 +95,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:46 --> $DIR/issue-105742.rs:37:46
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -111,13 +111,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:46 --> $DIR/issue-105742.rs:37:46
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -133,7 +133,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -149,7 +149,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -165,7 +165,7 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -182,7 +182,7 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -193,13 +193,13 @@ LL | <Self as SVec>::Item<T>,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:24:37 --> $DIR/issue-105742.rs:26:37
| |
LL | Output = <Index<<Self as SVec>::Item, LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -210,13 +210,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>,
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:24:37 --> $DIR/issue-105742.rs:26:37
| |
LL | Output = <Index<<Self as SVec>::Item, LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -227,13 +227,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:30 --> $DIR/issue-105742.rs:37:30
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -244,13 +244,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:30 --> $DIR/issue-105742.rs:37:30
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -261,13 +261,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:46 --> $DIR/issue-105742.rs:37:46
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -278,13 +278,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:46 --> $DIR/issue-105742.rs:37:46
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -331,7 +331,7 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -348,7 +348,7 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -359,13 +359,13 @@ LL | <Self as SVec>::Item<T>,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:24:37 --> $DIR/issue-105742.rs:26:37
| |
LL | Output = <Index<<Self as SVec>::Item, LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -376,13 +376,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>,
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:24:37 --> $DIR/issue-105742.rs:26:37
| |
LL | Output = <Index<<Self as SVec>::Item, LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -393,13 +393,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:30 --> $DIR/issue-105742.rs:37:30
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -410,13 +410,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:30 --> $DIR/issue-105742.rs:37:30
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -427,13 +427,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:46 --> $DIR/issue-105742.rs:37:46
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -444,13 +444,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:33:46 --> $DIR/issue-105742.rs:37:46
| |
LL | Output = <Self as SVec>::Item> as SVec>::Item, LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -461,13 +461,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<T>,
| +++ | +++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:53:38 --> $DIR/issue-105742.rs:61:38
| |
LL | fn len(&self) -> <Self as SVec>::Item; LL | fn len(&self) -> <Self as SVec>::Item;
| ^^^^ expected 1 lifetime argument | ^^^^ expected 1 lifetime argument
| |
note: associated type defined here, with 1 lifetime parameter: `'a` note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ -- | ^^^^ --
@ -477,13 +477,13 @@ LL | fn len(&self) -> <Self as SVec>::Item<'_>;
| ++++ | ++++
error[E0107]: missing generics for associated type `SVec::Item` error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:53:38 --> $DIR/issue-105742.rs:61:38
| |
LL | fn len(&self) -> <Self as SVec>::Item; LL | fn len(&self) -> <Self as SVec>::Item;
| ^^^^ expected 1 generic argument | ^^^^ expected 1 generic argument
| |
note: associated type defined here, with 1 generic parameter: `T` note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-105742.rs:51:10 --> $DIR/issue-105742.rs:59:10
| |
LL | type Item<'a, T>; LL | type Item<'a, T>;
| ^^^^ - | ^^^^ -
@ -492,7 +492,143 @@ help: add missing generic argument
LL | fn len(&self) -> <Self as SVec>::Item<T>; LL | fn len(&self) -> <Self as SVec>::Item<T>;
| +++ | +++
error: aborting due to 29 previous errors 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:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing generic argument
|
LL | <Self as SVec>::Item<T>,
| +++
error[E0107]: missing generics for associated type `SVec::Item`
--> $DIR/issue-105742.rs:26: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:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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:26: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:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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:37: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:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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:37: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:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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:37: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:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
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:37: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:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing generic argument
|
LL | Output = <Self as SVec>::Item> as SVec>::Item<T>,
| +++
error: aborting due to 37 previous errors
Some errors have detailed explanations: E0038, E0107. Some errors have detailed explanations: E0038, E0107.
For more information about an error, try `rustc --explain E0038`. For more information about an error, try `rustc --explain E0038`.

View File

@ -12,6 +12,7 @@ struct DefaultAllocator;
// `<DefaultAllocator as Allocator>::Buffer` to be ambiguous, // `<DefaultAllocator as Allocator>::Buffer` to be ambiguous,
// which caused an ICE with `-Znormalize-docs`. // which caused an ICE with `-Znormalize-docs`.
impl<T> Allocator for DefaultAllocator { impl<T> Allocator for DefaultAllocator {
//~^ ERROR: type annotations needed
type Buffer = (); type Buffer = ();
} }

View File

@ -0,0 +1,9 @@
error[E0282]: type annotations needed
--> $DIR/not-wf-ambiguous-normalization.rs:14:23
|
LL | impl<T> Allocator for DefaultAllocator {
| ^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0282`.

View File

@ -4,7 +4,10 @@
pub struct Attribute; pub struct Attribute;
pub struct Map<'hir> {} pub struct Map<'hir> {
lt: &'hir (),
}
impl<'hir> Map<'hir> { impl<'hir> Map<'hir> {
pub fn attrs(&self) -> &'hir [Attribute] { &[] } pub fn attrs(&self) -> &'hir [Attribute] { &[] }
} }

View File

@ -3,7 +3,8 @@
pub struct Foo<'a, 'b, T> { pub struct Foo<'a, 'b, T> {
field1: dyn Bar<'a, 'b,>, field1: dyn Bar<'a, 'b,>,
//~^ ERROR //~^ ERROR
//~^^ ERROR //~| ERROR
//~| ERROR
} }
pub trait Bar<'x, 's, U> pub trait Bar<'x, 's, U>

View File

@ -5,7 +5,7 @@ LL | field1: dyn Bar<'a, 'b,>,
| ^^^ expected 1 generic argument | ^^^ expected 1 generic argument
| |
note: trait defined here, with 1 generic parameter: `U` note: trait defined here, with 1 generic parameter: `U`
--> $DIR/unable-fulfill-trait.rs:9:11 --> $DIR/unable-fulfill-trait.rs:10:11
| |
LL | pub trait Bar<'x, 's, U> LL | pub trait Bar<'x, 's, U>
| ^^^ - | ^^^ -
@ -20,7 +20,24 @@ error[E0227]: ambiguous lifetime bound, explicit lifetime bound required
LL | field1: dyn Bar<'a, 'b,>, LL | field1: dyn Bar<'a, 'b,>,
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors error[E0478]: lifetime bound not satisfied
--> $DIR/unable-fulfill-trait.rs:4:13
|
LL | field1: dyn Bar<'a, 'b,>,
| ^^^^^^^^^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime `'b` as defined here
--> $DIR/unable-fulfill-trait.rs:3:20
|
LL | pub struct Foo<'a, 'b, T> {
| ^^
note: but lifetime parameter must outlive the lifetime `'a` as defined here
--> $DIR/unable-fulfill-trait.rs:3:16
|
LL | pub struct Foo<'a, 'b, T> {
| ^^
Some errors have detailed explanations: E0107, E0227. error: aborting due to 3 previous errors
Some errors have detailed explanations: E0107, E0227, E0478.
For more information about an error, try `rustc --explain E0107`. For more information about an error, try `rustc --explain E0107`.

View File

@ -2,7 +2,9 @@
#![feature(adt_const_params)] #![feature(adt_const_params)]
#![crate_name = "foo"] #![crate_name = "foo"]
#[derive(PartialEq, Eq)] use std::marker::ConstParamTy;
#[derive(PartialEq, Eq, ConstParamTy)]
pub enum Order { pub enum Order {
Sorted, Sorted,
Unsorted, Unsorted,

View File

@ -1,22 +1,16 @@
<code>pub trait Write { <code>pub trait Write {
// Required methods // Required methods
fn <a href="#tymethod.poll_write" class="fn">poll_write</a>( fn <a href="#tymethod.poll_write" class="fn">poll_write</a>(
self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;, self,
cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;, cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,
buf: &amp;mut [<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>] buf: &amp;mut [<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>]
) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;; ) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
<span class="item-spacer" /> fn <a href="#tymethod.poll_flush" class="fn">poll_flush</a>( <span class="item-spacer" /> fn <a href="#tymethod.poll_flush" class="fn">poll_flush</a>(self, cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;, <span class="item-spacer" /> fn <a href="#tymethod.poll_close" class="fn">poll_close</a>(self, cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;
) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
<span class="item-spacer" /> fn <a href="#tymethod.poll_close" class="fn">poll_close</a>(
self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,
cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;
) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
// Provided method // Provided method
fn <a href="#method.poll_write_vectored" class="fn">poll_write_vectored</a>( fn <a href="#method.poll_write_vectored" class="fn">poll_write_vectored</a>(
self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;, self,
cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;, cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,
bufs: &amp;[<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>] bufs: &amp;[<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>]
) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt; { ... } ) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt; { ... }

View File

@ -9,21 +9,21 @@ pub struct Error;
pub trait Write { pub trait Write {
// @snapshot 'declaration' - '//*[@class="rust item-decl"]//code' // @snapshot 'declaration' - '//*[@class="rust item-decl"]//code'
fn poll_write( fn poll_write(
self: Option<String>, self,
cx: &mut Option<String>, cx: &mut Option<String>,
buf: &mut [usize] buf: &mut [usize]
) -> Option<Result<usize, Error>>; ) -> Option<Result<usize, Error>>;
fn poll_flush( fn poll_flush(
self: Option<String>, self,
cx: &mut Option<String> cx: &mut Option<String>
) -> Option<Result<(), Error>>; ) -> Option<Result<(), Error>>;
fn poll_close( fn poll_close(
self: Option<String>, self,
cx: &mut Option<String>, cx: &mut Option<String>,
) -> Option<Result<(), Error>>; ) -> Option<Result<(), Error>>;
fn poll_write_vectored( fn poll_write_vectored(
self: Option<String>, self,
cx: &mut Option<String>, cx: &mut Option<String>,
bufs: &[usize] bufs: &[usize]
) -> Option<Result<usize, Error>> {} ) -> Option<Result<usize, Error>> {}

View File

@ -4,9 +4,11 @@
// //
// Read the documentation of `rustdoc::clean::utils::print_const_expr` // Read the documentation of `rustdoc::clean::utils::print_const_expr`
// for further details. // for further details.
#![feature(const_trait_impl, generic_const_exprs)] #![feature(const_trait_impl, generic_const_exprs, adt_const_params, generic_const_items)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
use std::marker::ConstParamTy;
// @has hide_complex_unevaluated_const_arguments/trait.Stage.html // @has hide_complex_unevaluated_const_arguments/trait.Stage.html
pub trait Stage { pub trait Stage {
// A helper constant that prevents const expressions containing it // A helper constant that prevents const expressions containing it
@ -29,11 +31,13 @@ pub trait Stage {
// //
// @has - '//*[@id="associatedconstant.ARRAY1"]' \ // @has - '//*[@id="associatedconstant.ARRAY1"]' \
// 'const ARRAY1: [u8; { _ }]' // 'const ARRAY1: [u8; { _ }]'
const ARRAY1: [u8; Struct::new(/* ... */).do_something(Self::ABSTRACT * 1_000)]; const ARRAY1: [u8; Struct::new(/* ... */).do_something(Self::ABSTRACT * 1_000)]
where [(); Struct::new(/* ... */).do_something(Self::ABSTRACT * 1_000)]:;
// @has - '//*[@id="associatedconstant.VERBOSE"]' \ // @has - '//*[@id="associatedconstant.VERBOSE"]' \
// 'const VERBOSE: [u16; { _ }]' // 'const VERBOSE: [u16; { _ }]'
const VERBOSE: [u16; compute("thing", 9 + 9) * Self::ABSTRACT]; const VERBOSE: [u16; compute("thing", 9 + 9) * Self::ABSTRACT]
where [(); compute("thing", 9 + 9) * Self::ABSTRACT]:;
// Check that we do not leak the private struct field contained within // Check that we do not leak the private struct field contained within
// the path. The output could definitely be improved upon // the path. The output could definitely be improved upon
@ -69,6 +73,7 @@ pub trait Sub: Sup<{ 90 * 20 * 4 }, { Struct { private: () } }> {}
pub trait Sup<const N: usize, const S: Struct> {} pub trait Sup<const N: usize, const S: Struct> {}
#[derive(ConstParamTy, PartialEq, Eq)]
pub struct Struct { private: () } pub struct Struct { private: () }
impl Struct { impl Struct {

View File

@ -41,6 +41,6 @@ pub struct Number {
pub u_128: u128, pub u_128: u128,
pub ch: char, pub ch: char,
pub boolean: bool, pub boolean: bool,
pub string: str, pub string: &'static str,
pub n: !, pub n: !,
} }

View File

@ -3,25 +3,28 @@
#![feature(no_core)] #![feature(no_core)]
#![no_core] #![no_core]
#[lang = "owned_box"] #[lang = "owned_box"]
pub struct Box<T>; pub struct Box<T>(*const T);
impl<T> Box<T> { impl<T> Box<T> {
pub fn new(x: T) -> Box<T> { pub fn new(x: T) -> Box<T> {
Box Box(std::ptr::null())
} }
} }
#[lang = "sized"]
trait Sized {}
#[doc(notable_trait)] #[doc(notable_trait)]
pub trait FakeIterator {} pub trait FakeIterator {}
impl<I: FakeIterator> FakeIterator for Box<I> {} impl<I: FakeIterator> FakeIterator for Box<I> {}
#[lang = "pin"] #[lang = "pin"]
pub struct Pin<T>; pub struct Pin<T>(T);
impl<T> Pin<T> { impl<T> Pin<T> {
pub fn new(x: T) -> Pin<T> { pub fn new(x: T) -> Pin<T> {
Pin Pin(x)
} }
} }

View File

@ -1,5 +1,5 @@
<pre class="rust item-decl"><code>pub enum Cow&lt;'a, B&gt;<span class="where fmt-newline">where <pre class="rust item-decl"><code>pub enum Cow&lt;'a, B&gt;<span class="where fmt-newline">where
B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>&gt; + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>&gt; + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{
Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&amp;'a B</a>), Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&amp;'a B</a>),
Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>), Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>),
}</code></pre> }</code></pre>

View File

@ -1,4 +1,4 @@
<pre class="rust item-decl"><code>pub enum Cow2&lt;'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>&gt; + 'a&gt; { <pre class="rust item-decl"><code>pub enum Cow2&lt;'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>&gt; + 'a&gt; {
Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&amp;'a B</a>), Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&amp;'a B</a>),
Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>), Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>),
}</code></pre> }</code></pre>

View File

@ -6,7 +6,8 @@
// @has 'foo/trait.ToOwned.html' // @has 'foo/trait.ToOwned.html'
// @snapshot trait - '//*[@class="rust item-decl"]' // @snapshot trait - '//*[@class="rust item-decl"]'
pub trait ToOwned<T> pub trait ToOwned<T>
where T: Clone where
T: Clone,
{ {
type Owned; type Owned;
fn to_owned(&self) -> Self::Owned; fn to_owned(&self) -> Self::Owned;
@ -26,7 +27,7 @@ pub trait ToOwned2<T: Clone> {
// @snapshot enum - '//*[@class="rust item-decl"]' // @snapshot enum - '//*[@class="rust item-decl"]'
pub enum Cow<'a, B: ?Sized + 'a> pub enum Cow<'a, B: ?Sized + 'a>
where where
B: ToOwned<Clone>, B: ToOwned<()>,
{ {
Borrowed(&'a B), Borrowed(&'a B),
Whatever(u32), Whatever(u32),
@ -35,7 +36,7 @@ where
// @has 'foo/enum.Cow2.html' // @has 'foo/enum.Cow2.html'
// @snapshot enum2 - '//*[@class="rust item-decl"]' // @snapshot enum2 - '//*[@class="rust item-decl"]'
// There should be a whitespace before `{` in this case! // There should be a whitespace before `{` in this case!
pub enum Cow2<'a, B: ?Sized + ToOwned<Clone> + 'a> { pub enum Cow2<'a, B: ?Sized + ToOwned<()> + 'a> {
Borrowed(&'a B), Borrowed(&'a B),
Whatever(u32), Whatever(u32),
} }
@ -44,7 +45,7 @@ pub enum Cow2<'a, B: ?Sized + ToOwned<Clone> + 'a> {
// @snapshot struct - '//*[@class="rust item-decl"]' // @snapshot struct - '//*[@class="rust item-decl"]'
pub struct Struct<'a, B: ?Sized + 'a> pub struct Struct<'a, B: ?Sized + 'a>
where where
B: ToOwned<Clone>, B: ToOwned<()>,
{ {
pub a: &'a B, pub a: &'a B,
pub b: u32, pub b: u32,
@ -53,7 +54,7 @@ where
// @has 'foo/struct.Struct2.html' // @has 'foo/struct.Struct2.html'
// @snapshot struct2 - '//*[@class="rust item-decl"]' // @snapshot struct2 - '//*[@class="rust item-decl"]'
// There should be a whitespace before `{` in this case! // There should be a whitespace before `{` in this case!
pub struct Struct2<'a, B: ?Sized + ToOwned<Clone> + 'a> { pub struct Struct2<'a, B: ?Sized + ToOwned<()> + 'a> {
pub a: &'a B, pub a: &'a B,
pub b: u32, pub b: u32,
} }
@ -62,7 +63,7 @@ pub struct Struct2<'a, B: ?Sized + ToOwned<Clone> + 'a> {
// @snapshot union - '//*[@class="rust item-decl"]' // @snapshot union - '//*[@class="rust item-decl"]'
pub union Union<'a, B: ?Sized + 'a> pub union Union<'a, B: ?Sized + 'a>
where where
B: ToOwned<Clone>, B: ToOwned<()>,
{ {
a: &'a B, a: &'a B,
b: u32, b: u32,
@ -71,7 +72,7 @@ where
// @has 'foo/union.Union2.html' // @has 'foo/union.Union2.html'
// @snapshot union2 - '//*[@class="rust item-decl"]' // @snapshot union2 - '//*[@class="rust item-decl"]'
// There should be a whitespace before `{` in this case! // There should be a whitespace before `{` in this case!
pub union Union2<'a, B: ?Sized + ToOwned<Clone> + 'a> { pub union Union2<'a, B: ?Sized + ToOwned<()> + 'a> {
a: &'a B, a: &'a B,
b: u32, b: u32,
} }

View File

@ -1,5 +1,5 @@
<pre class="rust item-decl"><code>pub struct Struct&lt;'a, B&gt;<span class="where fmt-newline">where <pre class="rust item-decl"><code>pub struct Struct&lt;'a, B&gt;<span class="where fmt-newline">where
B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>&gt; + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>&gt; + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{
pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&amp;'a B</a>, pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&amp;'a B</a>,
pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>, pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>,
}</code></pre> }</code></pre>

View File

@ -1,4 +1,4 @@
<pre class="rust item-decl"><code>pub struct Struct2&lt;'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>&gt; + 'a&gt; { <pre class="rust item-decl"><code>pub struct Struct2&lt;'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>&gt; + 'a&gt; {
pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&amp;'a B</a>, pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&amp;'a B</a>,
pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>, pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>,
}</code></pre> }</code></pre>

View File

@ -1,4 +1,4 @@
<pre class="rust item-decl"><code>pub union Union&lt;'a, B&gt;<span class="where fmt-newline">where <pre class="rust item-decl"><code>pub union Union&lt;'a, B&gt;<span class="where fmt-newline">where
B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>&gt; + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>&gt; + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{
/* private fields */ /* private fields */
}</code></pre> }</code></pre>

View File

@ -1,3 +1,3 @@
<pre class="rust item-decl"><code>pub union Union2&lt;'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>&gt; + 'a&gt; { <pre class="rust item-decl"><code>pub union Union2&lt;'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>&gt; + 'a&gt; {
/* private fields */ /* private fields */
}</code></pre> }</code></pre>