Auto merge of #117449 - oli-obk:query_merge_immobile_game, r=matthewjasper

Avoid silencing relevant follow-up errors

r? `@matthewjasper`

This PR only adds new errors to tests that are already failing and fixes one ICE.

Several tests were changed to not emit new errors. I believe all of them were faulty tests, and not explicitly testing for the code that had new errors.
This commit is contained in:
bors 2024-01-09 22:50:49 +00:00
commit 94807670a6
184 changed files with 2700 additions and 631 deletions

View File

@ -166,13 +166,12 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
// this ensures that later parts of type checking can assume that items
// have valid types and not error
// FIXME(matthewjasper) We shouldn't need to use `track_errors`.
tcx.sess.track_errors(|| {
tcx.sess.time("type_collecting", || {
tcx.hir().for_each_module(|module| tcx.ensure().collect_mod_item_types(module))
});
})?;
tcx.sess.time("type_collecting", || {
tcx.hir().for_each_module(|module| tcx.ensure().collect_mod_item_types(module))
});
// FIXME(matthewjasper) We shouldn't need to use `track_errors` anywhere in this function
// or the compiler in general.
if tcx.features().rustc_attrs {
tcx.sess.track_errors(|| {
tcx.sess.time("outlives_testing", || outlives::test::test_inferred_outlives(tcx));

View File

@ -279,6 +279,12 @@ pub fn normalize_param_env_or_error<'tcx>(
}
fn fold_const(&mut self, c: ty::Const<'tcx>) -> ty::Const<'tcx> {
// FIXME(return_type_notation): track binders in this normalizer, as
// `ty::Const::normalize` can only work with properly preserved binders.
if c.has_escaping_bound_vars() {
return ty::Const::new_misc_error(self.0, c.ty());
}
// While it is pretty sus to be evaluating things with an empty param env, it
// should actually be okay since without `feature(generic_const_exprs)` the only
// const arguments that have a non-empty param env are array repeat counts. These

View File

@ -13,7 +13,7 @@ LL | impl<T> Windows {
note: struct defined here, with 1 generic parameter: `T`
--> $DIR/issue-109071.rs:5:8
|
LL | struct Windows<T> {}
LL | struct Windows<T> { t: T }
| ^^^^^^^ -
help: add missing generic argument
|
@ -30,7 +30,7 @@ LL | type Item = &[T];
= help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
error[E0223]: ambiguous associated type
--> $DIR/issue-109071.rs:15:22
--> $DIR/issue-109071.rs:16:22
|
LL | fn T() -> Option<Self::Item> {}
| ^^^^^^^^^^

View File

@ -2,18 +2,20 @@
#![cfg_attr(with_gate, feature(inherent_associated_types))]
#![cfg_attr(with_gate, allow(incomplete_features))]
struct Windows<T> {}
struct Windows<T> { t: T }
impl<T> Windows { //~ ERROR: missing generics for struct `Windows`
type Item = &[T]; //~ ERROR: `&` without an explicit lifetime name cannot be used here
//[no_gate]~^ ERROR: inherent associated types are unstable
fn next() -> Option<Self::Item> {}
//[with_gate]~^ ERROR type annotations needed
}
impl<T> Windows<T> {
fn T() -> Option<Self::Item> {}
//[no_gate]~^ ERROR: ambiguous associated type
//[with_gate]~^^ ERROR type annotations needed
}
fn main() {}

View File

@ -13,14 +13,26 @@ LL | impl<T> Windows {
note: struct defined here, with 1 generic parameter: `T`
--> $DIR/issue-109071.rs:5:8
|
LL | struct Windows<T> {}
LL | struct Windows<T> { t: T }
| ^^^^^^^ -
help: add missing generic argument
|
LL | impl<T> Windows<T> {
| +++
error: aborting due to 2 previous errors
error[E0282]: type annotations needed
--> $DIR/issue-109071.rs:11:18
|
LL | fn next() -> Option<Self::Item> {}
| ^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T`
Some errors have detailed explanations: E0107, E0637.
error[E0282]: type annotations needed
--> $DIR/issue-109071.rs:16:15
|
LL | fn T() -> Option<Self::Item> {}
| ^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T`
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0107, E0282, E0637.
For more information about an error, try `rustc --explain E0107`.

View File

@ -8,5 +8,6 @@ impl Lexer<i32> {
}
type X = impl for<T> Fn() -> Lexer<T>::Cursor; //~ ERROR associated type `Cursor` not found for `Lexer<T>` in the current scope
//~^ ERROR: unconstrained opaque type
fn main() {}

View File

@ -10,6 +10,14 @@ LL | type X = impl for<T> Fn() -> Lexer<T>::Cursor;
= note: the associated type was found for
- `Lexer<i32>`
error: aborting due to 1 previous error
error: unconstrained opaque type
--> $DIR/issue-109299-1.rs:10:10
|
LL | type X = impl for<T> Fn() -> Lexer<T>::Cursor;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `X` must be used in combination with a concrete type within the same module
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0220`.

View File

@ -8,5 +8,6 @@ impl<T> Local { //~ ERROR missing generics for struct `Local`
type AssocType3 = T; //~ ERROR inherent associated types are unstable
const WRAPPED_ASSOC_3: Wrapper<Self::AssocType3> = Wrapper();
//~^ ERROR: this struct takes 1 argument but 0 arguments were supplied
}
//~^ ERROR `main` function not found

View File

@ -1,5 +1,5 @@
error[E0601]: `main` function not found in crate `issue_109768`
--> $DIR/issue-109768.rs:11:2
--> $DIR/issue-109768.rs:12:2
|
LL | }
| ^ consider adding a `main` function to `$DIR/issue-109768.rs`
@ -29,7 +29,23 @@ LL | type AssocType3 = T;
= note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
= help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
error: aborting due to 3 previous errors
error[E0061]: this struct takes 1 argument but 0 arguments were supplied
--> $DIR/issue-109768.rs:10:56
|
LL | const WRAPPED_ASSOC_3: Wrapper<Self::AssocType3> = Wrapper();
| ^^^^^^^-- an argument is missing
|
note: tuple struct defined here
--> $DIR/issue-109768.rs:3:8
|
LL | struct Wrapper<T>(T);
| ^^^^^^^
help: provide the argument
|
LL | const WRAPPED_ASSOC_3: Wrapper<Self::AssocType3> = Wrapper(/* value */);
| ~~~~~~~~~~~~~
Some errors have detailed explanations: E0107, E0601, E0658.
For more information about an error, try `rustc --explain E0107`.
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0061, E0107, E0601, E0658.
For more information about an error, try `rustc --explain E0061`.

View File

@ -134,14 +134,17 @@ where
fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
iter::empty()
//~^ ERROR type annotations needed
}
fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
iter::empty()
//~^ ERROR type annotations needed
}
fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
iter::empty()
//~^ ERROR type annotations needed
}
fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
@ -194,12 +197,15 @@ trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
trait TRS1: Iterator<Item: Copy, Item: Send> {}
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRS2: Iterator<Item: Copy, Item: Copy> {}
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRS3: Iterator<Item: 'static, Item: 'static> {}
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRW1<T>
where
T: Iterator<Item: Copy, Item: Send>,
@ -223,6 +229,7 @@ where
Self: Iterator<Item: Copy, Item: Send>,
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
trait TRSW2
@ -230,6 +237,7 @@ where
Self: Iterator<Item: Copy, Item: Copy>,
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
trait TRSW3
@ -237,15 +245,19 @@ where
Self: Iterator<Item: 'static, Item: 'static>,
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
trait TRA1 {
type A: Iterator<Item: Copy, Item: Send>;
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
//~| ERROR `<<Self as TRA1>::A as Iterator>::Item` cannot be sent between threads safely
//~| ERROR the trait bound `<<Self as TRA1>::A as Iterator>::Item: Copy` is not satisfied
}
trait TRA2 {
type A: Iterator<Item: Copy, Item: Copy>;
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
//~| ERROR the trait bound `<<Self as TRA2>::A as Iterator>::Item: Copy` is not satisfied
}
trait TRA3 {
type A: Iterator<Item: 'static, Item: 'static>;

View File

@ -7,7 +7,7 @@ LL | struct SI1<T: Iterator<Item: Copy, Item: Send>> {
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:255:40
--> $DIR/duplicate.rs:267:40
|
LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
@ -15,7 +15,7 @@ LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:257:44
--> $DIR/duplicate.rs:269:44
|
LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
| ---------- ^^^^^^^^^^ re-bound here
@ -23,7 +23,7 @@ LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:259:43
--> $DIR/duplicate.rs:271:43
|
LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -223,7 +223,7 @@ LL | fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:138:42
--> $DIR/duplicate.rs:139:42
|
LL | fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
| ---------- ^^^^^^^^^^ re-bound here
@ -231,7 +231,7 @@ LL | fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:142:45
--> $DIR/duplicate.rs:144:45
|
LL | fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -239,7 +239,7 @@ LL | fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:146:40
--> $DIR/duplicate.rs:149:40
|
LL | fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
| ---------- ^^^^^^^^^^ re-bound here
@ -247,7 +247,7 @@ LL | fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:148:40
--> $DIR/duplicate.rs:151:40
|
LL | fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
| ---------- ^^^^^^^^^^ re-bound here
@ -255,7 +255,7 @@ LL | fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:150:43
--> $DIR/duplicate.rs:153:43
|
LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -263,7 +263,7 @@ LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:153:35
--> $DIR/duplicate.rs:156:35
|
LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
| ---------- ^^^^^^^^^^ re-bound here
@ -271,7 +271,7 @@ LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:155:35
--> $DIR/duplicate.rs:158:35
|
LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
| ---------- ^^^^^^^^^^ re-bound here
@ -279,7 +279,7 @@ LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:157:38
--> $DIR/duplicate.rs:160:38
|
LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -287,7 +287,7 @@ LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:161:29
--> $DIR/duplicate.rs:164:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -295,7 +295,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:166:29
--> $DIR/duplicate.rs:169:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -303,7 +303,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:171:32
--> $DIR/duplicate.rs:174:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -311,7 +311,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:175:36
--> $DIR/duplicate.rs:178:36
|
LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| ---------- ^^^^^^^^^^ re-bound here
@ -319,7 +319,7 @@ LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:177:36
--> $DIR/duplicate.rs:180:36
|
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| ---------- ^^^^^^^^^^ re-bound here
@ -327,7 +327,7 @@ LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:179:39
--> $DIR/duplicate.rs:182:39
|
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -335,7 +335,7 @@ LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:181:40
--> $DIR/duplicate.rs:184:40
|
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
@ -343,7 +343,7 @@ LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:183:40
--> $DIR/duplicate.rs:186:40
|
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| ---------- ^^^^^^^^^^ re-bound here
@ -351,7 +351,7 @@ LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:185:43
--> $DIR/duplicate.rs:188:43
|
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -359,7 +359,7 @@ LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:188:36
--> $DIR/duplicate.rs:191:36
|
LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -367,7 +367,7 @@ LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:190:36
--> $DIR/duplicate.rs:193:36
|
LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -375,7 +375,7 @@ LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:192:39
--> $DIR/duplicate.rs:195:39
|
LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -383,7 +383,7 @@ LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:194:34
--> $DIR/duplicate.rs:197:34
|
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -391,7 +391,7 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:194:34
--> $DIR/duplicate.rs:197:34
|
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -401,7 +401,7 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:197:34
--> $DIR/duplicate.rs:201:34
|
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -409,7 +409,7 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:197:34
--> $DIR/duplicate.rs:201:34
|
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
@ -419,7 +419,7 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:200:37
--> $DIR/duplicate.rs:205:37
|
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -427,7 +427,7 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:200:37
--> $DIR/duplicate.rs:205:37
|
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -437,7 +437,7 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:205:29
--> $DIR/duplicate.rs:211:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -445,7 +445,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:211:29
--> $DIR/duplicate.rs:217:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -453,7 +453,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:217:32
--> $DIR/duplicate.rs:223:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -461,7 +461,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:223:32
--> $DIR/duplicate.rs:229:32
|
LL | Self: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -469,7 +469,7 @@ LL | Self: Iterator<Item: Copy, Item: Send>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:223:32
--> $DIR/duplicate.rs:229:32
|
LL | Self: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
@ -479,7 +479,7 @@ LL | Self: Iterator<Item: Copy, Item: Send>,
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:230:32
--> $DIR/duplicate.rs:237:32
|
LL | Self: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -487,7 +487,7 @@ LL | Self: Iterator<Item: Copy, Item: Copy>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:230:32
--> $DIR/duplicate.rs:237:32
|
LL | Self: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
@ -497,7 +497,7 @@ LL | Self: Iterator<Item: Copy, Item: Copy>,
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:237:35
--> $DIR/duplicate.rs:245:35
|
LL | Self: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -505,7 +505,7 @@ LL | Self: Iterator<Item: 'static, Item: 'static>,
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:237:35
--> $DIR/duplicate.rs:245:35
|
LL | Self: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
@ -515,7 +515,7 @@ LL | Self: Iterator<Item: 'static, Item: 'static>,
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:243:34
--> $DIR/duplicate.rs:252:34
|
LL | type A: Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
@ -523,7 +523,7 @@ LL | type A: Iterator<Item: Copy, Item: Send>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:247:34
--> $DIR/duplicate.rs:258:34
|
LL | type A: Iterator<Item: Copy, Item: Copy>;
| ---------- ^^^^^^^^^^ re-bound here
@ -531,13 +531,141 @@ LL | type A: Iterator<Item: Copy, Item: Copy>;
| `Item` bound here first
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:251:37
--> $DIR/duplicate.rs:263:37
|
LL | type A: Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error: aborting due to 66 previous errors
error[E0282]: type annotations needed
--> $DIR/duplicate.rs:136:5
|
LL | iter::empty()
| ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty`
|
help: consider specifying the generic argument
|
LL | iter::empty::<T>()
| +++++
For more information about this error, try `rustc --explain E0719`.
error[E0282]: type annotations needed
--> $DIR/duplicate.rs:141:5
|
LL | iter::empty()
| ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty`
|
help: consider specifying the generic argument
|
LL | iter::empty::<T>()
| +++++
error[E0282]: type annotations needed
--> $DIR/duplicate.rs:146:5
|
LL | iter::empty()
| ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty`
|
help: consider specifying the generic argument
|
LL | iter::empty::<T>()
| +++++
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:197:34
|
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:201:34
|
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:205:37
|
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:229:32
|
LL | Self: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:237:32
|
LL | Self: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:245:35
|
LL | Self: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `<<Self as TRA1>::A as Iterator>::Item: Copy` is not satisfied
--> $DIR/duplicate.rs:252:28
|
LL | type A: Iterator<Item: Copy, Item: Send>;
| ^^^^ the trait `Copy` is not implemented for `<<Self as TRA1>::A as Iterator>::Item`
|
help: consider further restricting the associated type
|
LL | trait TRA1 where <<Self as TRA1>::A as Iterator>::Item: Copy {
| +++++++++++++++++++++++++++++++++++++++++++++++++
error[E0277]: `<<Self as TRA1>::A as Iterator>::Item` cannot be sent between threads safely
--> $DIR/duplicate.rs:252:40
|
LL | type A: Iterator<Item: Copy, Item: Send>;
| ^^^^ `<<Self as TRA1>::A as Iterator>::Item` cannot be sent between threads safely
|
= help: the trait `Send` is not implemented for `<<Self as TRA1>::A as Iterator>::Item`
help: consider further restricting the associated type
|
LL | trait TRA1 where <<Self as TRA1>::A as Iterator>::Item: Send {
| +++++++++++++++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `<<Self as TRA2>::A as Iterator>::Item: Copy` is not satisfied
--> $DIR/duplicate.rs:258:28
|
LL | type A: Iterator<Item: Copy, Item: Copy>;
| ^^^^ the trait `Copy` is not implemented for `<<Self as TRA2>::A as Iterator>::Item`
|
help: consider further restricting the associated type
|
LL | trait TRA2 where <<Self as TRA2>::A as Iterator>::Item: Copy {
| +++++++++++++++++++++++++++++++++++++++++++++++++
error: aborting due to 78 previous errors
Some errors have detailed explanations: E0277, E0282, E0719.
For more information about an error, try `rustc --explain E0277`.

View File

@ -25,7 +25,7 @@ fn c<C>(_: C::Color) where C : Vehicle, C : Box {
//~^ ERROR ambiguous associated type `Color` in bounds of `C`
}
struct D<X>;
struct D<X>(X);
impl<X> D<X> where X : Vehicle {
fn d(&self, _: X::Color) where X : Box { }
//~^ ERROR ambiguous associated type `Color` in bounds of `X`

View File

@ -20,7 +20,7 @@ fn dent<C:BoxCar>(c: C, color: C::Color) {
//~^ ERROR ambiguous associated type `Color` in bounds of `C`
}
fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
fn dent_object<COLOR>(c: &dyn BoxCar<Color=COLOR>) {
//~^ ERROR ambiguous associated type
//~| ERROR the value of the associated types
}
@ -29,7 +29,7 @@ fn paint<C:BoxCar>(c: C, d: C::Color) {
//~^ ERROR ambiguous associated type `Color` in bounds of `C`
}
fn dent_object_2<COLOR>(c: dyn BoxCar) where <dyn BoxCar as Vehicle>::Color = COLOR {
fn dent_object_2<COLOR>(c: &dyn BoxCar) where <dyn BoxCar as Vehicle>::Color = COLOR {
//~^ ERROR the value of the associated types
//~| ERROR equality constraints are not yet supported in `where` clauses
}

View File

@ -1,8 +1,8 @@
error: equality constraints are not yet supported in `where` clauses
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:46
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:47
|
LL | fn dent_object_2<COLOR>(c: dyn BoxCar) where <dyn BoxCar as Vehicle>::Color = COLOR {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not supported
LL | fn dent_object_2<COLOR>(c: &dyn BoxCar) where <dyn BoxCar as Vehicle>::Color = COLOR {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not supported
|
= note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information
@ -28,7 +28,7 @@ LL | fn dent<C:BoxCar>(c: C, color: <C as Box>::Color) {
| ~~~~~~~~~~~~
error[E0222]: ambiguous associated type `Color` in bounds of `BoxCar`
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:37
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:38
|
LL | type Color;
| ---------- ambiguous `Color` from `Vehicle`
@ -36,8 +36,8 @@ LL | type Color;
LL | type Color;
| ---------- ambiguous `Color` from `Box`
...
LL | fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
| ^^^^^^^^^^^ ambiguous associated type `Color`
LL | fn dent_object<COLOR>(c: &dyn BoxCar<Color=COLOR>) {
| ^^^^^^^^^^^ ambiguous associated type `Color`
|
= help: consider introducing a new type parameter `T` and adding `where` constraints:
where
@ -46,7 +46,7 @@ LL | fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
T: Box::Color = COLOR
error[E0191]: the value of the associated types `Color` in `Box`, `Color` in `Vehicle` must be specified
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:30
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:31
|
LL | type Color;
| ---------- `Vehicle::Color` defined here
@ -54,8 +54,8 @@ LL | type Color;
LL | type Color;
| ---------- `Box::Color` defined here
...
LL | fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
| ^^^^^^^^^^^^^^^^^^^ associated types `Color` (from trait `Vehicle`), `Color` (from trait `Box`) must be specified
LL | fn dent_object<COLOR>(c: &dyn BoxCar<Color=COLOR>) {
| ^^^^^^^^^^^^^^^^^^^ associated types `Color` (from trait `Vehicle`), `Color` (from trait `Box`) must be specified
|
= help: consider introducing a new type parameter, adding `where` constraints using the fully-qualified path to the associated types
@ -81,7 +81,7 @@ LL | fn paint<C:BoxCar>(c: C, d: <C as Box>::Color) {
| ~~~~~~~~~~~~
error[E0191]: the value of the associated types `Color` in `Box`, `Color` in `Vehicle` must be specified
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:32
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:33
|
LL | type Color;
| ---------- `Vehicle::Color` defined here
@ -89,8 +89,8 @@ LL | type Color;
LL | type Color;
| ---------- `Box::Color` defined here
...
LL | fn dent_object_2<COLOR>(c: dyn BoxCar) where <dyn BoxCar as Vehicle>::Color = COLOR {
| ^^^^^^ associated types `Color` (from trait `Vehicle`), `Color` (from trait `Box`) must be specified
LL | fn dent_object_2<COLOR>(c: &dyn BoxCar) where <dyn BoxCar as Vehicle>::Color = COLOR {
| ^^^^^^ associated types `Color` (from trait `Vehicle`), `Color` (from trait `Box`) must be specified
|
= help: consider introducing a new type parameter, adding `where` constraints using the fully-qualified path to the associated types

View File

@ -7,6 +7,7 @@ trait Hierarchy {
type ChildKey;
type Children = dyn Index<Self::ChildKey, Output=dyn Hierarchy>;
//~^ ERROR: the value of the associated types
//~| ERROR: the size for values of type
fn data(&self) -> Option<(Self::Value, Self::Children)>;
}

View File

@ -8,6 +8,20 @@ LL | type ChildKey;
LL | type Children = dyn Index<Self::ChildKey, Output=dyn Hierarchy>;
| ------------- `Children` defined here ^^^^^^^^^ help: specify the associated types: `Hierarchy<Value = Type, ChildKey = Type, Children = Type>`
error: aborting due to 1 previous error
error[E0277]: the size for values of type `(dyn Index<<Self as Hierarchy>::ChildKey, Output = (dyn Hierarchy + 'static)> + 'static)` cannot be known at compilation time
--> $DIR/issue-23595-1.rs:8:21
|
LL | type Children = dyn Index<Self::ChildKey, Output=dyn Hierarchy>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `(dyn Index<<Self as Hierarchy>::ChildKey, Output = (dyn Hierarchy + 'static)> + 'static)`
note: required by a bound in `Hierarchy::Children`
--> $DIR/issue-23595-1.rs:8:5
|
LL | type Children = dyn Index<Self::ChildKey, Output=dyn Hierarchy>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Hierarchy::Children`
For more information about this error, try `rustc --explain E0191`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0191, E0277.
For more information about an error, try `rustc --explain E0191`.

View File

@ -5,7 +5,7 @@
async fn copy() -> Result<()>
//~^ ERROR enum takes 2 generic arguments
{
Ok(())
Ok(()) //~ ERROR: type annotations needed
}
fn main() { }

View File

@ -11,6 +11,18 @@ help: add missing generic argument
LL | async fn copy() -> Result<(), E>
| +++
error: aborting due to 1 previous error
error[E0282]: type annotations needed
--> $DIR/issue-65159.rs:8:5
|
LL | Ok(())
| ^^ cannot infer type of the type parameter `E` declared on the enum `Result`
|
help: consider specifying the generic arguments
|
LL | Ok::<(), E>(())
| +++++++++
For more information about this error, try `rustc --explain E0107`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0107, E0282.
For more information about an error, try `rustc --explain E0107`.

View File

@ -9,5 +9,6 @@ trait Super1<'a> {
impl Super1<'_, bar(): Send> for () {}
//~^ ERROR associated type bindings are not allowed here
//~| ERROR not all trait items implemented
fn main() {}

View File

@ -13,6 +13,16 @@ error[E0229]: associated type bindings are not allowed here
LL | impl Super1<'_, bar(): Send> for () {}
| ^^^^^^^^^^^ associated type not allowed here
error: aborting due to 1 previous error; 1 warning emitted
error[E0046]: not all trait items implemented, missing: `bar`
--> $DIR/rtn-in-impl-signature.rs:10:1
|
LL | fn bar<'b>() -> bool;
| --------------------- `bar` from trait
...
LL | impl Super1<'_, bar(): Send> for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `bar` in implementation
For more information about this error, try `rustc --explain E0229`.
error: aborting due to 2 previous errors; 1 warning emitted
Some errors have detailed explanations: E0046, E0229.
For more information about an error, try `rustc --explain E0046`.

View File

@ -26,7 +26,7 @@ LL | let _ = #[track_caller] || {
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
error[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:28:17
--> $DIR/async-closure-gate.rs:29:17
|
LL | let _ = #[track_caller] || {
| ^^^^^^^^^^^^^^^
@ -35,7 +35,7 @@ LL | let _ = #[track_caller] || {
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
error[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:36:9
--> $DIR/async-closure-gate.rs:37:9
|
LL | #[track_caller] || {
| ^^^^^^^^^^^^^^^
@ -44,7 +44,7 @@ LL | #[track_caller] || {
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
error[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:45:13
--> $DIR/async-closure-gate.rs:47:13
|
LL | #[track_caller] || {
| ^^^^^^^^^^^^^^^
@ -52,6 +52,40 @@ LL | #[track_caller] || {
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
error: aborting due to 6 previous errors
error[E0308]: mismatched types
--> $DIR/async-closure-gate.rs:27:5
|
LL | fn foo3() {
| - help: a return type might be missing here: `-> _`
LL | / async {
LL | |
LL | | let _ = #[track_caller] || {
LL | |
LL | | };
LL | | }
| |_____^ expected `()`, found `async` block
|
= note: expected unit type `()`
found `async` block `{async block@$DIR/async-closure-gate.rs:27:5: 32:6}`
For more information about this error, try `rustc --explain E0658`.
error[E0308]: mismatched types
--> $DIR/async-closure-gate.rs:44:5
|
LL | fn foo5() {
| - help: a return type might be missing here: `-> _`
LL | / async {
LL | |
LL | | let _ = || {
LL | | #[track_caller] || {
... |
LL | | };
LL | | }
| |_____^ expected `()`, found `async` block
|
= note: expected unit type `()`
found `async` block `{async block@$DIR/async-closure-gate.rs:44:5: 51:6}`
error: aborting due to 8 previous errors
Some errors have detailed explanations: E0308, E0658.
For more information about an error, try `rustc --explain E0308`.

View File

@ -26,7 +26,7 @@ LL | let _ = #[track_caller] || {
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
error[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:28:17
--> $DIR/async-closure-gate.rs:29:17
|
LL | let _ = #[track_caller] || {
| ^^^^^^^^^^^^^^^
@ -35,7 +35,7 @@ LL | let _ = #[track_caller] || {
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
error[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:36:9
--> $DIR/async-closure-gate.rs:37:9
|
LL | #[track_caller] || {
| ^^^^^^^^^^^^^^^
@ -44,7 +44,7 @@ LL | #[track_caller] || {
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
error[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/async-closure-gate.rs:45:13
--> $DIR/async-closure-gate.rs:47:13
|
LL | #[track_caller] || {
| ^^^^^^^^^^^^^^^
@ -52,6 +52,40 @@ LL | #[track_caller] || {
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
error: aborting due to 6 previous errors
error[E0308]: mismatched types
--> $DIR/async-closure-gate.rs:27:5
|
LL | fn foo3() {
| - help: a return type might be missing here: `-> _`
LL | / async {
LL | |
LL | | let _ = #[track_caller] || {
LL | |
LL | | };
LL | | }
| |_____^ expected `()`, found `async` block
|
= note: expected unit type `()`
found `async` block `{async block@$DIR/async-closure-gate.rs:27:5: 32:6}`
For more information about this error, try `rustc --explain E0658`.
error[E0308]: mismatched types
--> $DIR/async-closure-gate.rs:44:5
|
LL | fn foo5() {
| - help: a return type might be missing here: `-> _`
LL | / async {
LL | |
LL | | let _ = || {
LL | | #[track_caller] || {
... |
LL | | };
LL | | }
| |_____^ expected `()`, found `async` block
|
= note: expected unit type `()`
found `async` block `{async block@$DIR/async-closure-gate.rs:44:5: 51:6}`
error: aborting due to 8 previous errors
Some errors have detailed explanations: E0308, E0658.
For more information about an error, try `rustc --explain E0308`.

View File

@ -25,6 +25,7 @@ async fn foo2() {
fn foo3() {
async {
//~^ ERROR mismatched types
let _ = #[track_caller] || {
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
};
@ -41,6 +42,7 @@ async fn foo4() {
fn foo5() {
async {
//~^ ERROR mismatched types
let _ = || {
#[track_caller] || {
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]

View File

@ -17,6 +17,7 @@ async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied
//~^^ ERROR struct takes 1 generic argument but 0 generic arguments were supplied
LockedMarket(coroutine.lock().unwrap().buy())
//~^ ERROR: cannot return value referencing temporary value
}
struct LockedMarket<T>(T);

View File

@ -7,7 +7,7 @@ LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_>
| expected 0 lifetime arguments
|
note: struct defined here, with 0 lifetime parameters
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:22:8
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:23:8
|
LL | struct LockedMarket<T>(T);
| ^^^^^^^^^^^^
@ -19,7 +19,7 @@ LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_>
| ^^^^^^^^^^^^ expected 1 generic argument
|
note: struct defined here, with 1 generic parameter: `T`
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:22:8
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:23:8
|
LL | struct LockedMarket<T>(T);
| ^^^^^^^^^^^^ -
@ -28,6 +28,16 @@ help: add missing generic argument
LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_, T> {
| +++
error: aborting due to 2 previous errors
error[E0515]: cannot return value referencing temporary value
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:19:5
|
LL | LockedMarket(coroutine.lock().unwrap().buy())
| ^^^^^^^^^^^^^-------------------------^^^^^^^
| | |
| | temporary value created here
| returns a value referencing data owned by the current function
For more information about this error, try `rustc --explain E0107`.
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0107, E0515.
For more information about an error, try `rustc --explain E0107`.

View File

@ -9,9 +9,10 @@ pub trait Parse {
}
pub trait CoolStuff: Parse<MODE = Mode::Cool> {}
//~^ ERROR expected type, found variant
//~^ ERROR expected constant, found type
//~| ERROR expected constant, found type
//~| ERROR expected constant, found type
//~| ERROR expected type
fn no_help() -> Mode::Cool {}
//~^ ERROR expected type, found variant

View File

@ -8,7 +8,7 @@ LL | pub trait CoolStuff: Parse<MODE = Mode::Cool> {}
| help: try using the variant's enum: `Mode`
error[E0573]: expected type, found variant `Mode::Cool`
--> $DIR/assoc_const_eq_diagnostic.rs:16:17
--> $DIR/assoc_const_eq_diagnostic.rs:17:17
|
LL | fn no_help() -> Mode::Cool {}
| ^^^^^^^^^^
@ -53,6 +53,25 @@ help: consider adding braces here
LL | pub trait CoolStuff: Parse<MODE = { Mode::Cool }> {}
| + +
error: aborting due to 4 previous errors
error: expected constant, found type
--> $DIR/assoc_const_eq_diagnostic.rs:11:35
|
LL | pub trait CoolStuff: Parse<MODE = Mode::Cool> {}
| ---- ^^^^^^^^^^ unexpected type
| |
| expected a constant because of this associated constant
|
note: the associated constant is defined here
--> $DIR/assoc_const_eq_diagnostic.rs:8:5
|
LL | const MODE: Mode;
| ^^^^^^^^^^^^^^^^
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider adding braces here
|
LL | pub trait CoolStuff: Parse<MODE = { Mode::Cool }> {}
| + +
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0573`.

View File

@ -9,6 +9,11 @@ const _: () = {
fn f2<'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
//~| 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 `X` cannot be made into an object
};
fn main() {}

View File

@ -28,6 +28,86 @@ note: associated type defined here, with 0 generic parameters
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/issue-102768.rs:9:30
|
LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
| ^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-102768.rs:5:10
|
LL | type Y<'a>;
| ^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | fn f2<'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/issue-102768.rs:9:30
|
LL | fn f2<'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/issue-102768.rs:5: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/issue-102768.rs:9:30
|
LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
| ^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-102768.rs:5:10
|
LL | type Y<'a>;
| ^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | fn f2<'a>(arg: Box<dyn X<Y<'_, 1> = &'a ()>>) {}
| +++
error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/issue-102768.rs:9:30
|
LL | fn f2<'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/issue-102768.rs:5: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/issue-102768.rs:9:24
|
LL | fn f2<'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/issue-102768.rs:5: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

@ -3,6 +3,7 @@
trait Trait<T> {
fn fnc<const N: usize = "">(&self) {} //~ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
//~^ ERROR: mismatched types
fn foo<const N: usize = { std::mem::size_of::<T>() }>(&self) {} //~ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
}

View File

@ -5,10 +5,17 @@ LL | fn fnc<const N: usize = "">(&self) {}
| ^^^^^^^^^^^^^^^^^^^
error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
--> $DIR/issue-105257.rs:6:12
--> $DIR/issue-105257.rs:7:12
|
LL | fn foo<const N: usize = { std::mem::size_of::<T>() }>(&self) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
error[E0308]: mismatched types
--> $DIR/issue-105257.rs:5:29
|
LL | fn fnc<const N: usize = "">(&self) {}
| ^^ expected `usize`, found `&str`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0308`.

View File

@ -4,5 +4,14 @@ error: cannot capture late-bound lifetime in constant
LL | fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> {
| -- lifetime defined here ^^
error: aborting due to 1 previous error
error: overly complex generic constant
--> $DIR/late-bound-in-return-issue-77357.rs:9:46
|
LL | fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ blocks are not supported in generic constants
|
= help: consider moving this anonymous constant into a `const` function
= note: this operation may be supported in the future
error: aborting due to 2 previous errors

View File

@ -14,6 +14,7 @@ impl<const N: usize> Marker<N> for Example<N> {}
fn make_marker() -> impl Marker<gimme_a_const!(marker)> {
//~^ ERROR: type provided when a constant was expected
Example::<gimme_a_const!(marker)>
//~^ ERROR: type provided when a constant was expected
}
fn from_marker(_: impl Marker<{
@ -33,7 +34,9 @@ fn main() {
}>;
let _fail = Example::<external_macro!()>;
//~^ ERROR: type provided when a constant was expected
let _fail = Example::<gimme_a_const!()>;
//~^ ERROR unexpected end of macro invocation
//~| ERROR: type provided when a constant was expected
}

View File

@ -1,5 +1,5 @@
error: expected type, found `{`
--> $DIR/macro-fail.rs:28:27
--> $DIR/macro-fail.rs:29:27
|
LL | fn make_marker() -> impl Marker<gimme_a_const!(marker)> {
| ----------------------
@ -13,7 +13,7 @@ LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }}
= note: this error originates in the macro `gimme_a_const` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected type, found `{`
--> $DIR/macro-fail.rs:28:27
--> $DIR/macro-fail.rs:29:27
|
LL | Example::<gimme_a_const!(marker)>
| ----------------------
@ -41,7 +41,7 @@ LL | let _fail = Example::<external_macro!()>;
= note: this error originates in the macro `external_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: unexpected end of macro invocation
--> $DIR/macro-fail.rs:37:25
--> $DIR/macro-fail.rs:39:25
|
LL | macro_rules! gimme_a_const {
| -------------------------- when calling this macro
@ -50,7 +50,7 @@ LL | let _fail = Example::<gimme_a_const!()>;
| ^^^^^^^^^^^^^^^^ missing tokens in macro arguments
|
note: while trying to match meta-variable `$rusty:ident`
--> $DIR/macro-fail.rs:28:8
--> $DIR/macro-fail.rs:29:8
|
LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }}
| ^^^^^^^^^^^^^
@ -61,6 +61,24 @@ error[E0747]: type provided when a constant was expected
LL | fn make_marker() -> impl Marker<gimme_a_const!(marker)> {
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 5 previous errors
error[E0747]: type provided when a constant was expected
--> $DIR/macro-fail.rs:16:13
|
LL | Example::<gimme_a_const!(marker)>
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0747]: type provided when a constant was expected
--> $DIR/macro-fail.rs:36:25
|
LL | let _fail = Example::<external_macro!()>;
| ^^^^^^^^^^^^^^^^^
error[E0747]: type provided when a constant was expected
--> $DIR/macro-fail.rs:39:25
|
LL | let _fail = Example::<gimme_a_const!()>;
| ^^^^^^^^^^^^^^^^
error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0747`.

View File

@ -3,7 +3,7 @@
fn test<'a>(
_: &'a (),
) -> [(); {
) -> [(); { //~ ERROR: mismatched types
let x: &'a ();
//~^ ERROR cannot capture late-bound lifetime in constant
1

View File

@ -16,5 +16,23 @@ LL | fn test<'a>(
LL | let x: &'a ();
| ^^
error: aborting due to 1 previous error; 1 warning emitted
error[E0308]: mismatched types
--> $DIR/escaping-bound-var.rs:6:6
|
LL | fn test<'a>(
| ---- implicitly returns `()` as its body has no tail or `return` expression
LL | _: &'a (),
LL | ) -> [(); {
| ______^
LL | | let x: &'a ();
LL | |
LL | | 1
LL | | }] {
| |__^ expected `[(); {
let x: &'a ();
1
}]`, found `()`
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0308`.

View File

@ -6,5 +6,6 @@ struct S<const S: (), const S: S = { S }>;
//~| ERROR missing generics for struct `S`
//~| ERROR cycle detected when computing type of `S::S`
//~| ERROR cycle detected when computing type of `S`
//~| ERROR `()` is forbidden as the type of a const generic parameter
fn main() {}

View File

@ -61,7 +61,16 @@ LL | | fn main() {}
| |____________^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to 4 previous errors
error: `()` is forbidden as the type of a const generic parameter
--> $DIR/issue-103790.rs:4:19
|
LL | struct S<const S: (), const S: S = { S }>;
| ^^
|
= note: the only supported types are integers, `bool` and `char`
= help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0107, E0391, E0403.
For more information about an error, try `rustc --explain E0107`.

View File

@ -2,6 +2,7 @@ use std::fmt::Debug;
#[derive(Debug)]
pub struct Irrelevant<Irrelevant> { //~ ERROR type arguments are not allowed on type parameter
//~^ ERROR `Irrelevant` must be used
irrelevant: Irrelevant,
}

View File

@ -16,6 +16,16 @@ LL | pub struct Irrelevant<Irrelevant> {
| ^^^^^^^^^^
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 1 previous error
error[E0210]: type parameter `Irrelevant` must be used as the type parameter for some local type (e.g., `MyStruct<Irrelevant>`)
--> $DIR/issue-97343.rs:4:23
|
LL | pub struct Irrelevant<Irrelevant> {
| ^^^^^^^^^^ type parameter `Irrelevant` must be used as the type parameter for some local type
|
= note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local
= note: only traits defined in the current crate can be implemented for a type parameter
For more information about this error, try `rustc --explain E0109`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0109, E0210.
For more information about an error, try `rustc --explain E0109`.

View File

@ -71,6 +71,7 @@ enum N<F> where F: Fn() -> _ {
union O<F> where F: Fn() -> _ {
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for unions
foo: F,
//~^ ERROR must implement `Copy`
}
trait P<F> where F: Fn() -> _ {

View File

@ -299,7 +299,7 @@ LL | union O<F, T> where F: Fn() -> T {
| +++ ~
error[E0121]: the placeholder `_` is not allowed within types on item signatures for traits
--> $DIR/bad-assoc-ty.rs:76:29
--> $DIR/bad-assoc-ty.rs:77:29
|
LL | trait P<F> where F: Fn() -> _ {
| ^ not allowed in type signatures
@ -310,7 +310,7 @@ LL | trait P<F, T> where F: Fn() -> T {
| +++ ~
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
--> $DIR/bad-assoc-ty.rs:81:38
--> $DIR/bad-assoc-ty.rs:82:38
|
LL | fn foo<F>(_: F) where F: Fn() -> _ {}
| ^ not allowed in type signatures
@ -320,7 +320,19 @@ help: use type parameters instead
LL | fn foo<F, T>(_: F) where F: Fn() -> T {}
| +++ ~
error: aborting due to 28 previous errors; 1 warning emitted
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/bad-assoc-ty.rs:73:5
|
LL | foo: F,
| ^^^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | foo: std::mem::ManuallyDrop<F>,
| +++++++++++++++++++++++ +
Some errors have detailed explanations: E0121, E0223.
error: aborting due to 29 previous errors; 1 warning emitted
Some errors have detailed explanations: E0121, E0223, E0740.
For more information about an error, try `rustc --explain E0121`.

View File

@ -8,6 +8,7 @@ trait Foo<T>: Sized {
impl Foo<usize> for () {
fn bar(i: i32, t: usize, s: &()) -> (usize, i32) {
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for functions
//~| ERROR type annotations needed
(1, 2)
}
}

View File

@ -8,6 +8,7 @@ trait Foo<T>: Sized {
impl Foo<usize> for () {
fn bar(i: _, t: _, s: _) -> _ {
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for functions
//~| ERROR type annotations needed
(1, 2)
}
}

View File

@ -13,6 +13,13 @@ help: try replacing `_` with the types in the corresponding trait method signatu
LL | fn bar(i: i32, t: usize, s: &()) -> (usize, i32) {
| ~~~ ~~~~~ ~~~ ~~~~~~~~~~~~
error: aborting due to 1 previous error
error[E0282]: type annotations needed
--> $DIR/replace-impl-infer-ty-from-trait.rs:9:12
|
LL | fn bar(i: _, t: _, s: _) -> _ {
| ^ cannot infer type
For more information about this error, try `rustc --explain E0121`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0121, E0282.
For more information about an error, try `rustc --explain E0121`.

View File

@ -4,6 +4,7 @@ fn function(x: &SomeTrait, y: Box<SomeTrait>) {
//~^ ERROR trait objects must include the `dyn` keyword
//~| ERROR trait objects must include the `dyn` keyword
let _x: &SomeTrait = todo!();
//~^ ERROR trait objects must include the `dyn` keyword
}
trait SomeTrait {}

View File

@ -20,6 +20,17 @@ help: add `dyn` keyword before this trait
LL | fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) {
| +++
error: aborting due to 2 previous errors
error[E0782]: trait objects must include the `dyn` keyword
--> $DIR/dyn-2021-edition-error.rs:6:14
|
LL | let _x: &SomeTrait = todo!();
| ^^^^^^^^^
|
help: add `dyn` keyword before this trait
|
LL | let _x: &dyn SomeTrait = todo!();
| +++
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0782`.

View File

@ -6,6 +6,7 @@ trait FooBar<'foo, 'bar>: Foo<'foo> + Bar<'bar> {}
struct Baz<'foo, 'bar> {
baz: dyn FooBar<'foo, 'bar>,
//~^ ERROR ambiguous lifetime bound, explicit lifetime bound required
//~| ERROR lifetime bound not satisfied
}
fn main() {

View File

@ -4,6 +4,24 @@ error[E0227]: ambiguous lifetime bound, explicit lifetime bound required
LL | baz: dyn FooBar<'foo, 'bar>,
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error
error[E0478]: lifetime bound not satisfied
--> $DIR/E0227.rs:7:10
|
LL | baz: dyn FooBar<'foo, 'bar>,
| ^^^^^^^^^^^^^^^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime `'bar` as defined here
--> $DIR/E0227.rs:6:18
|
LL | struct Baz<'foo, 'bar> {
| ^^^^
note: but lifetime parameter must outlive the lifetime `'foo` as defined here
--> $DIR/E0227.rs:6:12
|
LL | struct Baz<'foo, 'bar> {
| ^^^^
For more information about this error, try `rustc --explain E0227`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0227, E0478.
For more information about an error, try `rustc --explain E0227`.

View File

@ -12,6 +12,9 @@ impl Foo for isize {
fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
//~^ ERROR associated type bindings are not allowed here [E0229]
//~| ERROR associated type bindings are not allowed here [E0229]
//~| ERROR associated type bindings are not allowed here [E0229]
//~| ERROR the trait bound `I: Foo` is not satisfied
fn main() {
}

View File

@ -4,6 +4,34 @@ error[E0229]: associated type bindings are not allowed here
LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
| ^^^^^ associated type not allowed here
error: aborting due to 1 previous error
error[E0229]: associated type bindings are not allowed here
--> $DIR/E0229.rs:13:25
|
LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
| ^^^^^ associated type not allowed here
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
For more information about this error, try `rustc --explain E0229`.
error[E0229]: associated type bindings are not allowed here
--> $DIR/E0229.rs:13:25
|
LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
| ^^^^^ associated type not allowed here
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `I: Foo` is not satisfied
--> $DIR/E0229.rs:13:15
|
LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
| ^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `I`
|
help: consider restricting type parameter `I`
|
LL | fn baz<I: Foo>(x: &<I as Foo<A=Bar>>::A) {}
| +++++
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0229, E0277.
For more information about an error, try `rustc --explain E0229`.

View File

@ -1,6 +1,7 @@
trait Foo: Iterator<Item = i32, Item = i32> {}
//~^ ERROR is already specified
//~| ERROR is already specified
//~| ERROR is already specified
type Unit = ();
@ -11,5 +12,6 @@ fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> {
fn main() {
let _: &dyn Iterator<Item = i32, Item = i32>;
//~^ ERROR already specified
test();
}

View File

@ -17,13 +17,31 @@ LL | trait Foo: Iterator<Item = i32, Item = i32> {}
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/E0719.rs:7:42
--> $DIR/E0719.rs:8:42
|
LL | fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> {
| --------- ^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error: aborting due to 3 previous errors
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/E0719.rs:1:33
|
LL | trait Foo: Iterator<Item = i32, Item = i32> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/E0719.rs:14:38
|
LL | let _: &dyn Iterator<Item = i32, Item = i32>;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0719`.

View File

@ -5,6 +5,7 @@ trait Foo {
impl Foo for () {
type Bar = impl std::fmt::Debug;
//~^ ERROR: `impl Trait` in associated types is unstable
//~| ERROR: unconstrained opaque type
}
struct Mop;
@ -13,6 +14,7 @@ impl Mop {
type Bop = impl std::fmt::Debug;
//~^ ERROR: `impl Trait` in associated types is unstable
//~| ERROR: inherent associated types are unstable
//~| ERROR: unconstrained opaque type
}
fn main() {}

View File

@ -8,7 +8,7 @@ LL | type Bar = impl std::fmt::Debug;
= help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable
error[E0658]: `impl Trait` in associated types is unstable
--> $DIR/feature-gate-impl_trait_in_assoc_type.rs:13:16
--> $DIR/feature-gate-impl_trait_in_assoc_type.rs:14:16
|
LL | type Bop = impl std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^
@ -17,7 +17,7 @@ LL | type Bop = impl std::fmt::Debug;
= help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable
error[E0658]: inherent associated types are unstable
--> $DIR/feature-gate-impl_trait_in_assoc_type.rs:13:5
--> $DIR/feature-gate-impl_trait_in_assoc_type.rs:14:5
|
LL | type Bop = impl std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -25,6 +25,22 @@ LL | type Bop = impl std::fmt::Debug;
= note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
= help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
error: aborting due to 3 previous errors
error: unconstrained opaque type
--> $DIR/feature-gate-impl_trait_in_assoc_type.rs:6:16
|
LL | type Bar = impl std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^
|
= note: `Bar` must be used in combination with a concrete type within the same impl
error: unconstrained opaque type
--> $DIR/feature-gate-impl_trait_in_assoc_type.rs:14:16
|
LL | type Bop = impl std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^
|
= note: `Bop` must be used in combination with a concrete type within the same impl
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -7,29 +7,35 @@
struct Foo;
impl Fn<()> for Foo {
//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change
//~| ERROR manual implementations of `Fn` are experimental
//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change
//~| ERROR manual implementations of `Fn` are experimental
//~| ERROR expected a `FnMut()` closure, found `Foo`
extern "rust-call" fn call(self, args: ()) -> () {}
//~^ ERROR rust-call ABI is subject to change
//~| ERROR `call` has an incompatible type for trait
}
struct Foo1;
impl FnOnce() for Foo1 {
//~^ ERROR associated type bindings are not allowed here
//~| ERROR manual implementations of `FnOnce` are experimental
//~^ ERROR associated type bindings are not allowed here
//~| ERROR manual implementations of `FnOnce` are experimental
//~| ERROR not all trait items implemented
extern "rust-call" fn call_once(self, args: ()) -> () {}
//~^ ERROR rust-call ABI is subject to change
}
struct Bar;
impl FnMut<()> for Bar {
//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change
//~| ERROR manual implementations of `FnMut` are experimental
//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change
//~| ERROR manual implementations of `FnMut` are experimental
//~| ERROR expected a `FnOnce()` closure, found `Bar`
extern "rust-call" fn call_mut(&self, args: ()) -> () {}
//~^ ERROR rust-call ABI is subject to change
//~| ERROR incompatible type for trait
}
struct Baz;
impl FnOnce<()> for Baz {
//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change
//~| ERROR manual implementations of `FnOnce` are experimental
//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change
//~| ERROR manual implementations of `FnOnce` are experimental
//~| ERROR not all trait items implemented
extern "rust-call" fn call_once(&self, args: ()) -> () {}
//~^ ERROR rust-call ABI is subject to change
}

View File

@ -1,5 +1,5 @@
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:12:12
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:13:12
|
LL | extern "rust-call" fn call(self, args: ()) -> () {}
| ^^^^^^^^^^^
@ -8,7 +8,7 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {}
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:19:12
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:22:12
|
LL | extern "rust-call" fn call_once(self, args: ()) -> () {}
| ^^^^^^^^^^^
@ -17,7 +17,7 @@ LL | extern "rust-call" fn call_once(self, args: ()) -> () {}
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:12
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:30:12
|
LL | extern "rust-call" fn call_mut(&self, args: ()) -> () {}
| ^^^^^^^^^^^
@ -26,7 +26,7 @@ LL | extern "rust-call" fn call_mut(&self, args: ()) -> () {}
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:33:12
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:39:12
|
LL | extern "rust-call" fn call_once(&self, args: ()) -> () {}
| ^^^^^^^^^^^
@ -52,7 +52,7 @@ LL | impl Fn<()> for Foo {
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0183]: manual implementations of `FnOnce` are experimental
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:16:6
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6
|
LL | impl FnOnce() for Foo1 {
| ^^^^^^^^ manual implementations of `FnOnce` are experimental
@ -60,19 +60,19 @@ LL | impl FnOnce() for Foo1 {
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0229]: associated type bindings are not allowed here
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:16:6
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6
|
LL | impl FnOnce() for Foo1 {
| ^^^^^^^^ associated type not allowed here
|
help: parenthesized trait syntax expands to `FnOnce<(), Output=()>`
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:16:6
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6
|
LL | impl FnOnce() for Foo1 {
| ^^^^^^^^
error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:23:6
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:6
|
LL | impl FnMut<()> for Bar {
| ^^^^^^^^^
@ -81,7 +81,7 @@ LL | impl FnMut<()> for Bar {
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0183]: manual implementations of `FnMut` are experimental
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:23:6
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:6
|
LL | impl FnMut<()> for Bar {
| ^^^^^^^^^ manual implementations of `FnMut` are experimental
@ -89,7 +89,7 @@ LL | impl FnMut<()> for Bar {
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:30:6
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:35:6
|
LL | impl FnOnce<()> for Baz {
| ^^^^^^^^^^
@ -98,14 +98,76 @@ LL | impl FnOnce<()> for Baz {
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0183]: manual implementations of `FnOnce` are experimental
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:30:6
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:35:6
|
LL | impl FnOnce<()> for Baz {
| ^^^^^^^^^^ manual implementations of `FnOnce` are experimental
|
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error: aborting due to 12 previous errors
error[E0277]: expected a `FnMut()` closure, found `Foo`
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:9:17
|
LL | impl Fn<()> for Foo {
| ^^^ expected an `FnMut()` closure, found `Foo`
|
= help: the trait `FnMut<()>` is not implemented for `Foo`
= note: wrap the `Foo` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `Fn`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
Some errors have detailed explanations: E0183, E0229, E0658.
For more information about an error, try `rustc --explain E0183`.
error[E0053]: method `call` has an incompatible type for trait
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:13:32
|
LL | extern "rust-call" fn call(self, args: ()) -> () {}
| ^^^^
| |
| expected `&Foo`, found `Foo`
| help: change the self-receiver type to match the trait: `&self`
|
= note: expected signature `extern "rust-call" fn(&Foo, ()) -> _`
found signature `extern "rust-call" fn(Foo, ())`
error[E0046]: not all trait items implemented, missing: `Output`
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:1
|
LL | impl FnOnce() for Foo1 {
| ^^^^^^^^^^^^^^^^^^^^^^ missing `Output` in implementation
|
= help: implement the missing item: `type Output = /* Type */;`
error[E0277]: expected a `FnOnce()` closure, found `Bar`
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:20
|
LL | impl FnMut<()> for Bar {
| ^^^ expected an `FnOnce()` closure, found `Bar`
|
= help: the trait `FnOnce<()>` is not implemented for `Bar`
= note: wrap the `Bar` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `FnMut`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error[E0053]: method `call_mut` has an incompatible type for trait
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:30:36
|
LL | extern "rust-call" fn call_mut(&self, args: ()) -> () {}
| ^^^^^
| |
| types differ in mutability
| help: change the self-receiver type to match the trait: `&mut self`
|
= note: expected signature `extern "rust-call" fn(&mut Bar, ()) -> _`
found signature `extern "rust-call" fn(&Bar, ())`
error[E0046]: not all trait items implemented, missing: `Output`
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:35:1
|
LL | impl FnOnce<()> for Baz {
| ^^^^^^^^^^^^^^^^^^^^^^^ missing `Output` in implementation
|
= help: implement the missing item: `type Output = /* Type */;`
error: aborting due to 18 previous errors
Some errors have detailed explanations: E0046, E0053, E0183, E0229, E0277, E0658.
For more information about an error, try `rustc --explain E0046`.

View File

@ -4,8 +4,10 @@
struct S;
impl Fn(u32) -> u32 for S {
//~^ ERROR associated type bindings are not allowed here [E0229]
//~^ ERROR associated type bindings are not allowed here [E0229]
//~| ERROR expected a `FnMut(u32)` closure, found `S`
fn call(&self) -> u32 {
//~^ ERROR method `call` has 1 parameter but the declaration in trait `call` has 2
5
}
}

View File

@ -10,6 +10,25 @@ help: parenthesized trait syntax expands to `Fn<(u32,), Output=u32>`
LL | impl Fn(u32) -> u32 for S {
| ^^^^^^^^^^^^^^
error: aborting due to 1 previous error
error[E0277]: expected a `FnMut(u32)` closure, found `S`
--> $DIR/issue-39259.rs:6:25
|
LL | impl Fn(u32) -> u32 for S {
| ^ expected an `FnMut(u32)` closure, found `S`
|
= help: the trait `FnMut<(u32,)>` is not implemented for `S`
note: required by a bound in `Fn`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
For more information about this error, try `rustc --explain E0229`.
error[E0050]: method `call` has 1 parameter but the declaration in trait `call` has 2
--> $DIR/issue-39259.rs:9:13
|
LL | fn call(&self) -> u32 {
| ^^^^^ expected 2 parameters, found 1
|
= note: `call` from trait: `extern "rust-call" fn(&Self, Args) -> <Self as FnOnce<Args>>::Output`
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0050, E0229, E0277.
For more information about an error, try `rustc --explain E0050`.

View File

@ -6,4 +6,7 @@ fn main() {
fn _f(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {}
//~^ ERROR: use of undeclared lifetime name `'x`
//~| ERROR: binding for associated type `Y` references lifetime
//~| ERROR: binding for associated type `Y` references lifetime
//~| ERROR: binding for associated type `Y` references lifetime
//~| ERROR: the trait `X` cannot be made into an object
}

View File

@ -20,7 +20,38 @@ error[E0582]: binding for associated type `Y` references lifetime `'a`, which do
LL | fn _f(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {}
| ^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
error[E0582]: binding for associated type `Y` references lifetime `'a`, which does not appear in the trait input types
--> $DIR/gat-in-trait-path-undeclared-lifetime.rs:6:33
|
LL | fn _f(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {}
| ^^^^^^^^^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
Some errors have detailed explanations: E0261, E0582.
For more information about an error, try `rustc --explain E0261`.
error[E0582]: binding for associated type `Y` references lifetime `'a`, which does not appear in the trait input types
--> $DIR/gat-in-trait-path-undeclared-lifetime.rs:6:33
|
LL | fn _f(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {}
| ^^^^^^^^^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0038]: the trait `X` cannot be made into an object
--> $DIR/gat-in-trait-path-undeclared-lifetime.rs:6:19
|
LL | fn _f(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `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/gat-in-trait-path-undeclared-lifetime.rs:2:8
|
LL | trait X {
| - this trait cannot be made into an object...
LL | type Y<'x>;
| ^ ...because it contains the generic associated type `Y`
= help: consider moving `Y` to another trait
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0038, E0261, E0582.
For more information about an error, try `rustc --explain E0038`.

View File

@ -4,10 +4,11 @@ trait X {
fn foo<'a>(t : Self::Y<'a>) -> Self::Y<'a> { t }
}
impl<T> X for T {
impl<T> X for T { //~ ERROR: not all trait items implemented
fn foo<'a, T1: X<Y = T1>>(t : T1) -> T1::Y<'a> {
//~^ ERROR missing generics for associated type
//~^^ ERROR missing generics for associated type
//~| ERROR method `foo` has 1 type parameter but its trait declaration has 0 type parameters
t
}
}

View File

@ -31,6 +31,27 @@ help: add missing lifetime argument
LL | fn foo<'a, T1: X<Y<'a> = T1>>(t : T1) -> T1::Y<'a> {
| ++++
error: aborting due to 2 previous errors
error[E0049]: method `foo` has 1 type parameter but its trait declaration has 0 type parameters
--> $DIR/gat-trait-path-missing-lifetime.rs:8:10
|
LL | fn foo<'a>(t : Self::Y<'a>) -> Self::Y<'a> { t }
| -- expected 0 type parameters
...
LL | fn foo<'a, T1: X<Y = T1>>(t : T1) -> T1::Y<'a> {
| ^^ ^^
| |
| found 1 type parameter
For more information about this error, try `rustc --explain E0107`.
error[E0046]: not all trait items implemented, missing: `Y`
--> $DIR/gat-trait-path-missing-lifetime.rs:7:1
|
LL | type Y<'a>;
| ---------- `Y` from trait
...
LL | impl<T> X for T {
| ^^^^^^^^^^^^^^^ missing `Y` in implementation
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0046, E0049, E0107.
For more information about an error, try `rustc --explain E0046`.

View File

@ -7,10 +7,19 @@ fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
//~| ERROR: parenthesized generic arguments cannot be used
//~| 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 associated type takes 1 lifetime argument but 0 lifetime arguments
//~| ERROR at least one trait is required
//~| ERROR: the trait `X` cannot be made into an object
fn bar<'a>(arg: Box<dyn X<Y() = ()>>) {}
//~^ ERROR: parenthesized generic arguments cannot be used
//~| 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 1 lifetime argument but 0 lifetime arguments
//~| ERROR: the trait `X` cannot be made into an object
fn main() {}

View File

@ -16,7 +16,7 @@ LL | fn foo<'a>(arg: Box<dyn X<Y<'a> = &'a ()>>) {}
| ~ ~
error: parenthesized generic arguments cannot be used in associated type constraints
--> $DIR/gat-trait-path-parenthesised-args.rs:12:27
--> $DIR/gat-trait-path-parenthesised-args.rs:18:27
|
LL | fn bar<'a>(arg: Box<dyn X<Y() = ()>>) {}
| ^--
@ -54,7 +54,7 @@ LL | type Y<'a>;
| ^
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/gat-trait-path-parenthesised-args.rs:12:27
--> $DIR/gat-trait-path-parenthesised-args.rs:18:27
|
LL | fn bar<'a>(arg: Box<dyn X<Y() = ()>>) {}
| ^ expected 1 lifetime argument
@ -69,6 +69,141 @@ help: add missing lifetime argument
LL | fn bar<'a>(arg: Box<dyn X<Y('_) = ()>>) {}
| ++
error: aborting due to 6 previous errors
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/gat-trait-path-parenthesised-args.rs:5:27
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
| ^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/gat-trait-path-parenthesised-args.rs:2:8
|
LL | type Y<'a>;
| ^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | fn foo<'a>(arg: Box<dyn X<Y('_, 'a) = &'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/gat-trait-path-parenthesised-args.rs:5:27
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
| ^---- help: remove these generics
| |
| expected 0 generic arguments
|
note: associated type defined here, with 0 generic parameters
--> $DIR/gat-trait-path-parenthesised-args.rs:2:8
|
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/gat-trait-path-parenthesised-args.rs:5:27
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
| ^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/gat-trait-path-parenthesised-args.rs:2:8
|
LL | type Y<'a>;
| ^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | fn foo<'a>(arg: Box<dyn X<Y('_, 'a) = &'a ()>>) {}
| +++
error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/gat-trait-path-parenthesised-args.rs:5:27
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
| ^---- help: remove these generics
| |
| expected 0 generic arguments
|
note: associated type defined here, with 0 generic parameters
--> $DIR/gat-trait-path-parenthesised-args.rs:2:8
|
LL | type Y<'a>;
| ^
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0224]: at least one trait is required for an object type
--> $DIR/gat-trait-path-parenthesised-args.rs:5:29
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
| ^^
error[E0038]: the trait `X` cannot be made into an object
--> $DIR/gat-trait-path-parenthesised-args.rs:5:21
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'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/gat-trait-path-parenthesised-args.rs:2:8
|
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[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/gat-trait-path-parenthesised-args.rs:18:27
|
LL | fn bar<'a>(arg: Box<dyn X<Y() = ()>>) {}
| ^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/gat-trait-path-parenthesised-args.rs:2:8
|
LL | type Y<'a>;
| ^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | fn bar<'a>(arg: Box<dyn X<Y('_) = ()>>) {}
| ++
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/gat-trait-path-parenthesised-args.rs:18:27
|
LL | fn bar<'a>(arg: Box<dyn X<Y() = ()>>) {}
| ^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/gat-trait-path-parenthesised-args.rs:2:8
|
LL | type Y<'a>;
| ^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | fn bar<'a>(arg: Box<dyn X<Y('_) = ()>>) {}
| ++
error[E0038]: the trait `X` cannot be made into an object
--> $DIR/gat-trait-path-parenthesised-args.rs:18:21
|
LL | fn bar<'a>(arg: Box<dyn X<Y() = ()>>) {}
| ^^^^^^^^^^^^^^^ `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/gat-trait-path-parenthesised-args.rs:2:8
|
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 15 previous errors
Some errors have detailed explanations: E0038, E0107, E0224.
For more information about an error, try `rustc --explain E0038`.

View File

@ -9,6 +9,9 @@ impl Provider for () {
struct Holder<B> {
inner: Box<dyn Provider<A = B>>,
//~^ ERROR: missing generics for associated type
//~| ERROR: missing generics for associated type
//~| ERROR: missing generics for associated type
//~| ERROR: the trait `Provider` cannot be made into an object
}
fn main() {

View File

@ -14,6 +14,57 @@ help: add missing lifetime argument
LL | inner: Box<dyn Provider<A<'a> = B>>,
| ++++
error: aborting due to 1 previous error
error[E0107]: missing generics for associated type `Provider::A`
--> $DIR/issue-71176.rs:10:27
|
LL | inner: Box<dyn Provider<A = B>>,
| ^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-71176.rs:2:10
|
LL | type A<'a>;
| ^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | inner: Box<dyn Provider<A<'a> = B>>,
| ++++
For more information about this error, try `rustc --explain E0107`.
error[E0107]: missing generics for associated type `Provider::A`
--> $DIR/issue-71176.rs:10:27
|
LL | inner: Box<dyn Provider<A = B>>,
| ^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-71176.rs:2:10
|
LL | type A<'a>;
| ^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | inner: Box<dyn Provider<A<'a> = B>>,
| ++++
error[E0038]: the trait `Provider` cannot be made into an object
--> $DIR/issue-71176.rs:10:14
|
LL | inner: Box<dyn Provider<A = B>>,
| ^^^^^^^^^^^^^^^^^^^ `Provider` 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-71176.rs:2:10
|
LL | trait Provider {
| -------- this trait cannot be made into an object...
LL | type A<'a>;
| ^ ...because it contains the generic associated type `A`
= help: consider moving `A` to another trait
= help: only type `()` implements the trait, consider using it directly instead
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0038, E0107.
For more information about an error, try `rustc --explain E0038`.

View File

@ -3,6 +3,7 @@ trait Monad {
type Wrapped<B>;
fn bind<B, F>(self, f: F) -> Self::Wrapped<B> {
//~^ ERROR: the size for values of type `Self` cannot be known
todo!()
}
}
@ -14,8 +15,10 @@ where
//~^ ERROR: missing generics for associated type `Monad::Wrapped`
{
outer.bind(|inner| inner)
//~^ ERROR type annotations needed
}
fn main() {
assert_eq!(join(Some(Some(true))), Some(true));
//~^ ERROR: `Option<Option<bool>>: Monad` is not satisfied
}

View File

@ -1,5 +1,5 @@
error[E0107]: missing generics for associated type `Monad::Wrapped`
--> $DIR/issue-79636-1.rs:13:34
--> $DIR/issue-79636-1.rs:14:34
|
LL | MInner: Monad<Unwrapped = A, Wrapped = MOuter::Wrapped<A>>,
| ^^^^^^^ expected 1 generic argument
@ -14,6 +14,56 @@ help: add missing generic argument
LL | MInner: Monad<Unwrapped = A, Wrapped<B> = MOuter::Wrapped<A>>,
| +++
error: aborting due to 1 previous error
error[E0277]: the size for values of type `Self` cannot be known at compilation time
--> $DIR/issue-79636-1.rs:5:19
|
LL | fn bind<B, F>(self, f: F) -> Self::Wrapped<B> {
| ^^^^ doesn't have a size known at compile-time
|
= help: unsized fn params are gated as an unstable feature
help: consider further restricting `Self`
|
LL | fn bind<B, F>(self, f: F) -> Self::Wrapped<B> where Self: Sized {
| +++++++++++++++++
help: function arguments must have a statically known size, borrowed types always have a known size
|
LL | fn bind<B, F>(&self, f: F) -> Self::Wrapped<B> {
| +
For more information about this error, try `rustc --explain E0107`.
error[E0282]: type annotations needed
--> $DIR/issue-79636-1.rs:17:17
|
LL | outer.bind(|inner| inner)
| ^^^^^
|
help: consider giving this closure parameter an explicit type
|
LL | outer.bind(|inner: /* Type */| inner)
| ++++++++++++
error[E0277]: the trait bound `Option<Option<bool>>: Monad` is not satisfied
--> $DIR/issue-79636-1.rs:22:21
|
LL | assert_eq!(join(Some(Some(true))), Some(true));
| ---- ^^^^^^^^^^^^^^^^ the trait `Monad` is not implemented for `Option<Option<bool>>`
| |
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> $DIR/issue-79636-1.rs:1:1
|
LL | trait Monad {
| ^^^^^^^^^^^
note: required by a bound in `join`
--> $DIR/issue-79636-1.rs:13:13
|
LL | fn join<MOuter, MInner, A>(outer: MOuter) -> MOuter::Wrapped<A>
| ---- required by a bound in this function
LL | where
LL | MOuter: Monad<Unwrapped = MInner>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `join`
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0107, E0277, E0282.
For more information about an error, try `rustc --explain E0107`.

View File

@ -4,7 +4,7 @@ struct E<T> {
}
trait TestMut {
type Output<'a>;
type Output<'a>; //~ ERROR missing required bound
fn test_mut<'a>(&'a mut self) -> Self::Output<'a>;
}

View File

@ -14,6 +14,17 @@ help: add missing lifetime argument
LL | fn test_simpler<'a>(dst: &'a mut impl TestMut<Output<'a> = &'a mut f32>)
| ++++
error: aborting due to 1 previous error
error: missing required bound on `Output`
--> $DIR/issue-80433.rs:7:5
|
LL | type Output<'a>;
| ^^^^^^^^^^^^^^^-
| |
| help: add the required where clause: `where Self: 'a`
|
= note: this bound is currently required to ensure that impls have maximum flexibility
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0107`.

View File

@ -10,6 +10,9 @@ struct Foo<'a, 'b, 'c> {
fn foo<'c, 'd>(_arg: Box<dyn X<Y = (&'c u32, &'d u32)>>) {}
//~^ ERROR missing generics for associated type
//~| ERROR missing generics for associated type
//~| ERROR missing generics for associated type
//~| ERROR the trait `X` cannot be made into an object
fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {}
//~^ ERROR struct takes 3 lifetime arguments but 2 lifetime

View File

@ -15,7 +15,7 @@ LL | fn foo<'c, 'd>(_arg: Box<dyn X<Y<'_, '_> = (&'c u32, &'d u32)>>) {}
| ++++++++
error[E0107]: struct takes 3 lifetime arguments but 2 lifetime arguments were supplied
--> $DIR/missing_lifetime_args.rs:14:26
--> $DIR/missing_lifetime_args.rs:17:26
|
LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {}
| ^^^ -- -- supplied 2 lifetime arguments
@ -33,7 +33,7 @@ LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b, 'a>) {}
| ++++
error[E0107]: struct takes 3 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing_lifetime_args.rs:17:16
--> $DIR/missing_lifetime_args.rs:20:16
|
LL | fn f<'a>(_arg: Foo<'a>) {}
| ^^^ -- supplied 1 lifetime argument
@ -50,6 +50,56 @@ help: add missing lifetime arguments
LL | fn f<'a>(_arg: Foo<'a, 'a, 'a>) {}
| ++++++++
error: aborting due to 3 previous errors
error[E0107]: missing generics for associated type `X::Y`
--> $DIR/missing_lifetime_args.rs:11:32
|
LL | fn foo<'c, 'd>(_arg: Box<dyn X<Y = (&'c u32, &'d u32)>>) {}
| ^ expected 2 lifetime arguments
|
note: associated type defined here, with 2 lifetime parameters: `'a`, `'b`
--> $DIR/missing_lifetime_args.rs:2:10
|
LL | type Y<'a, 'b>;
| ^ -- --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime arguments
|
LL | fn foo<'c, 'd>(_arg: Box<dyn X<Y<'_, '_> = (&'c u32, &'d u32)>>) {}
| ++++++++
For more information about this error, try `rustc --explain E0107`.
error[E0107]: missing generics for associated type `X::Y`
--> $DIR/missing_lifetime_args.rs:11:32
|
LL | fn foo<'c, 'd>(_arg: Box<dyn X<Y = (&'c u32, &'d u32)>>) {}
| ^ expected 2 lifetime arguments
|
note: associated type defined here, with 2 lifetime parameters: `'a`, `'b`
--> $DIR/missing_lifetime_args.rs:2:10
|
LL | type Y<'a, 'b>;
| ^ -- --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime arguments
|
LL | fn foo<'c, 'd>(_arg: Box<dyn X<Y<'_, '_> = (&'c u32, &'d u32)>>) {}
| ++++++++
error[E0038]: the trait `X` cannot be made into an object
--> $DIR/missing_lifetime_args.rs:11:26
|
LL | fn foo<'c, 'd>(_arg: Box<dyn X<Y = (&'c u32, &'d u32)>>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `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/missing_lifetime_args.rs:2:10
|
LL | trait X {
| - this trait cannot be made into an object...
LL | type Y<'a, 'b>;
| ^ ...because it contains the generic associated type `Y`
= help: consider moving `Y` to another trait
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0038, E0107.
For more information about an error, try `rustc --explain E0038`.

View File

@ -6,6 +6,11 @@ const _: () = {
fn f2<'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
//~| 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 the trait `X` cannot be made into an object
};
fn main() {}

View File

@ -28,6 +28,86 @@ note: associated type defined here, with 0 generic parameters
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/trait-path-type-error-once-implemented.rs:6:29
|
LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
| ^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/trait-path-type-error-once-implemented.rs:2:10
|
LL | type Y<'a>;
| ^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | fn f2<'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/trait-path-type-error-once-implemented.rs:6:29
|
LL | fn f2<'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/trait-path-type-error-once-implemented.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/trait-path-type-error-once-implemented.rs:6:29
|
LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
| ^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/trait-path-type-error-once-implemented.rs:2:10
|
LL | type Y<'a>;
| ^ --
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | fn f2<'a>(arg : Box<dyn X<Y<'_, 1> = &'a ()>>) {}
| +++
error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/trait-path-type-error-once-implemented.rs:6:29
|
LL | fn f2<'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/trait-path-type-error-once-implemented.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/trait-path-type-error-once-implemented.rs:6:23
|
LL | fn f2<'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/trait-path-type-error-once-implemented.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

@ -29,6 +29,8 @@ where
fn main() {
// errors
foo::<()>();
//~^ ERROR type mismatch
//~| ERROR `u64: Other` is not satisfied
// works
foo::<u32>();
}

View File

@ -16,5 +16,43 @@ error: defaults for type parameters are only allowed in `struct`, `enum`, `type`
LL | type Assoc<T = u32> = T;
| ^^^^^^^
error: aborting due to 3 previous errors
error[E0271]: type mismatch resolving `<() as Trait>::Assoc == u32`
--> $DIR/type-param-defaults.rs:31:11
|
LL | foo::<()>();
| ^^ type mismatch resolving `<() as Trait>::Assoc == u32`
|
note: expected this to be `u32`
--> $DIR/type-param-defaults.rs:11:27
|
LL | type Assoc<T = u32> = u64;
| ^^^
note: required by a bound in `foo`
--> $DIR/type-param-defaults.rs:25:14
|
LL | fn foo<T>()
| --- required by a bound in this function
LL | where
LL | T: Trait<Assoc = u32>,
| ^^^^^^^^^^^ required by this bound in `foo`
error[E0277]: the trait bound `u64: Other` is not satisfied
--> $DIR/type-param-defaults.rs:31:11
|
LL | foo::<()>();
| ^^ the trait `Other` is not implemented for `u64`
|
= help: the trait `Other` is implemented for `u32`
note: required by a bound in `foo`
--> $DIR/type-param-defaults.rs:26:15
|
LL | fn foo<T>()
| --- required by a bound in this function
...
LL | T::Assoc: Other {
| ^^^^^ required by this bound in `foo`
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0271, E0277.
For more information about an error, try `rustc --explain E0271`.

View File

@ -11,4 +11,5 @@ const NONE<T = ()>: Option<T> = None::<T>; //~ ERROR defaults for type parameter
fn main() {
let _ = NONE;
//~^ ERROR type annotations needed
}

View File

@ -4,5 +4,17 @@ error: defaults for type parameters are only allowed in `struct`, `enum`, `type`
LL | const NONE<T = ()>: Option<T> = None::<T>;
| ^^^^^^
error: aborting due to 1 previous error
error[E0282]: type annotations needed for `Option<T>`
--> $DIR/parameter-defaults.rs:13:9
|
LL | let _ = NONE;
| ^
|
help: consider giving this pattern a type, where the type for type parameter `T` is specified
|
LL | let _: Option<T> = NONE;
| +++++++++++
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0282`.

View File

@ -21,7 +21,7 @@ mod no_generics {
}
mod type_and_type {
struct Ty<A, B>;
struct Ty<A, B>(A, B);
type A = Ty;
//~^ ERROR missing generics for struct `type_and_type::Ty`
@ -43,7 +43,7 @@ mod type_and_type {
}
mod lifetime_and_type {
struct Ty<'a, T>;
struct Ty<'a, T>(&'a T);
type A = Ty;
//~^ ERROR missing generics for struct
@ -75,7 +75,7 @@ mod lifetime_and_type {
}
mod type_and_type_and_type {
struct Ty<A, B, C = &'static str>;
struct Ty<A, B, C = &'static str>(A, B, C);
type A = Ty;
//~^ ERROR missing generics for struct `type_and_type_and_type::Ty`

View File

@ -246,7 +246,7 @@ LL | type A = Ty;
note: struct defined here, with 2 generic parameters: `A`, `B`
--> $DIR/wrong-number-of-args.rs:24:12
|
LL | struct Ty<A, B>;
LL | struct Ty<A, B>(A, B);
| ^^ - -
help: add missing generic arguments
|
@ -264,7 +264,7 @@ LL | type B = Ty<usize>;
note: struct defined here, with 2 generic parameters: `A`, `B`
--> $DIR/wrong-number-of-args.rs:24:12
|
LL | struct Ty<A, B>;
LL | struct Ty<A, B>(A, B);
| ^^ - -
help: add missing generic argument
|
@ -282,7 +282,7 @@ LL | type D = Ty<usize, String, char>;
note: struct defined here, with 2 generic parameters: `A`, `B`
--> $DIR/wrong-number-of-args.rs:24:12
|
LL | struct Ty<A, B>;
LL | struct Ty<A, B>(A, B);
| ^^ - -
error[E0107]: struct takes 2 generic arguments but 0 generic arguments were supplied
@ -294,7 +294,7 @@ LL | type E = Ty<>;
note: struct defined here, with 2 generic parameters: `A`, `B`
--> $DIR/wrong-number-of-args.rs:24:12
|
LL | struct Ty<A, B>;
LL | struct Ty<A, B>(A, B);
| ^^ - -
help: add missing generic arguments
|
@ -310,7 +310,7 @@ LL | type A = Ty;
note: struct defined here, with 1 generic parameter: `T`
--> $DIR/wrong-number-of-args.rs:46:12
|
LL | struct Ty<'a, T>;
LL | struct Ty<'a, T>(&'a T);
| ^^ -
help: add missing generic argument
|
@ -326,7 +326,7 @@ LL | type B = Ty<'static>;
note: struct defined here, with 1 generic parameter: `T`
--> $DIR/wrong-number-of-args.rs:46:12
|
LL | struct Ty<'a, T>;
LL | struct Ty<'a, T>(&'a T);
| ^^ -
help: add missing generic argument
|
@ -342,7 +342,7 @@ LL | type E = Ty<>;
note: struct defined here, with 1 generic parameter: `T`
--> $DIR/wrong-number-of-args.rs:46:12
|
LL | struct Ty<'a, T>;
LL | struct Ty<'a, T>(&'a T);
| ^^ -
help: add missing generic argument
|
@ -360,7 +360,7 @@ LL | type F = Ty<'static, usize, 'static, usize>;
note: struct defined here, with 1 lifetime parameter: `'a`
--> $DIR/wrong-number-of-args.rs:46:12
|
LL | struct Ty<'a, T>;
LL | struct Ty<'a, T>(&'a T);
| ^^ --
error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied
@ -374,7 +374,7 @@ LL | type F = Ty<'static, usize, 'static, usize>;
note: struct defined here, with 1 generic parameter: `T`
--> $DIR/wrong-number-of-args.rs:46:12
|
LL | struct Ty<'a, T>;
LL | struct Ty<'a, T>(&'a T);
| ^^ -
error[E0107]: missing generics for struct `type_and_type_and_type::Ty`
@ -386,7 +386,7 @@ LL | type A = Ty;
note: struct defined here, with at least 2 generic parameters: `A`, `B`
--> $DIR/wrong-number-of-args.rs:78:12
|
LL | struct Ty<A, B, C = &'static str>;
LL | struct Ty<A, B, C = &'static str>(A, B, C);
| ^^ - -
help: add missing generic arguments
|
@ -404,7 +404,7 @@ LL | type B = Ty<usize>;
note: struct defined here, with at least 2 generic parameters: `A`, `B`
--> $DIR/wrong-number-of-args.rs:78:12
|
LL | struct Ty<A, B, C = &'static str>;
LL | struct Ty<A, B, C = &'static str>(A, B, C);
| ^^ - -
help: add missing generic argument
|
@ -422,7 +422,7 @@ LL | type E = Ty<usize, String, char, f64>;
note: struct defined here, with at most 3 generic parameters: `A`, `B`, `C`
--> $DIR/wrong-number-of-args.rs:78:12
|
LL | struct Ty<A, B, C = &'static str>;
LL | struct Ty<A, B, C = &'static str>(A, B, C);
| ^^ - - ----------------
error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied
@ -434,7 +434,7 @@ LL | type F = Ty<>;
note: struct defined here, with at least 2 generic parameters: `A`, `B`
--> $DIR/wrong-number-of-args.rs:78:12
|
LL | struct Ty<A, B, C = &'static str>;
LL | struct Ty<A, B, C = &'static str>(A, B, C);
| ^^ - -
help: add missing generic arguments
|

View File

@ -1,3 +1,9 @@
error[E0277]: the trait bound `(): AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not satisfied
--> $DIR/generic-with-implicit-hrtb-without-dyn.rs:6:13
|
LL | fn ice() -> impl AsRef<Fn(&())> {
| ^^^^^^^^^^^^^^^^^^^ the trait `AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not implemented for `()`
error[E0782]: trait objects must include the `dyn` keyword
--> $DIR/generic-with-implicit-hrtb-without-dyn.rs:6:24
|
@ -9,6 +15,7 @@ help: add `dyn` keyword before this trait
LL | fn ice() -> impl AsRef<dyn Fn(&())> {
| +++
error: aborting due to 1 previous error
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0782`.
Some errors have detailed explanations: E0277, E0782.
For more information about an error, try `rustc --explain E0277`.

View File

@ -6,6 +6,7 @@
fn ice() -> impl AsRef<Fn(&())> {
//[edition2015]~^ ERROR: the trait bound `(): AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not satisfied [E0277]
//[edition2021]~^^ ERROR: trait objects must include the `dyn` keyword [E0782]
//[edition2021]~| ERROR: the trait bound `(): AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not satisfied [E0277]
todo!()
}

View File

@ -4,16 +4,19 @@ use std::fmt::Debug;
fn a() -> impl Fn(&u8) -> (impl Debug + '_) {
//~^ ERROR higher kinded lifetime bounds on nested opaque types are not supported yet
|x| x
//~^ ERROR lifetime may not live long enough
}
fn b() -> impl for<'a> Fn(&'a u8) -> (impl Debug + 'a) {
//~^ ERROR higher kinded lifetime bounds on nested opaque types are not supported yet
|x| x
//~^ ERROR lifetime may not live long enough
}
fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) {
//~^ ERROR higher kinded lifetime bounds on nested opaque types are not supported yet
|x| x
//~^ ERROR lifetime may not live long enough
}
fn d() -> impl Fn() -> (impl Debug + '_) {

View File

@ -1,5 +1,5 @@
error[E0106]: missing lifetime specifier
--> $DIR/impl-fn-hrtb-bounds.rs:19:38
--> $DIR/impl-fn-hrtb-bounds.rs:22:38
|
LL | fn d() -> impl Fn() -> (impl Debug + '_) {
| ^^ expected named lifetime parameter
@ -23,29 +23,56 @@ LL | fn a() -> impl Fn(&u8) -> (impl Debug + '_) {
| ^
error: higher kinded lifetime bounds on nested opaque types are not supported yet
--> $DIR/impl-fn-hrtb-bounds.rs:9:52
--> $DIR/impl-fn-hrtb-bounds.rs:10:52
|
LL | fn b() -> impl for<'a> Fn(&'a u8) -> (impl Debug + 'a) {
| ^^
|
note: lifetime declared here
--> $DIR/impl-fn-hrtb-bounds.rs:9:20
--> $DIR/impl-fn-hrtb-bounds.rs:10:20
|
LL | fn b() -> impl for<'a> Fn(&'a u8) -> (impl Debug + 'a) {
| ^^
error: higher kinded lifetime bounds on nested opaque types are not supported yet
--> $DIR/impl-fn-hrtb-bounds.rs:14:52
--> $DIR/impl-fn-hrtb-bounds.rs:16:52
|
LL | fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) {
| ^^
|
note: lifetime declared here
--> $DIR/impl-fn-hrtb-bounds.rs:14:20
--> $DIR/impl-fn-hrtb-bounds.rs:16:20
|
LL | fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) {
| ^^
error: aborting due to 4 previous errors
error: lifetime may not live long enough
--> $DIR/impl-fn-hrtb-bounds.rs:6:9
|
LL | |x| x
| -- ^ returning this value requires that `'1` must outlive `'2`
| ||
| |return type of closure is impl Debug + '2
| has type `&'1 u8`
error: lifetime may not live long enough
--> $DIR/impl-fn-hrtb-bounds.rs:12:9
|
LL | |x| x
| -- ^ returning this value requires that `'1` must outlive `'2`
| ||
| |return type of closure is impl Debug + '2
| has type `&'1 u8`
error: lifetime may not live long enough
--> $DIR/impl-fn-hrtb-bounds.rs:18:9
|
LL | |x| x
| -- ^ returning this value requires that `'1` must outlive `'2`
| ||
| |return type of closure is impl Debug + '2
| has type `&'1 u8`
error: aborting due to 7 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -5,6 +5,7 @@ fn a() -> impl Fn(&u8) -> impl Debug + '_ {
//~^ ERROR ambiguous `+` in a type
//~| ERROR higher kinded lifetime bounds on nested opaque types are not supported yet
|x| x
//~^ ERROR lifetime may not live long enough
}
fn b() -> impl Fn() -> impl Debug + Send {

View File

@ -5,7 +5,7 @@ LL | fn a() -> impl Fn(&u8) -> impl Debug + '_ {
| ^^^^^^^^^^^^^^^ help: use parentheses to disambiguate: `(impl Debug + '_)`
error: ambiguous `+` in a type
--> $DIR/impl-fn-parsing-ambiguities.rs:10:24
--> $DIR/impl-fn-parsing-ambiguities.rs:11:24
|
LL | fn b() -> impl Fn() -> impl Debug + Send {
| ^^^^^^^^^^^^^^^^^ help: use parentheses to disambiguate: `(impl Debug + Send)`
@ -22,5 +22,14 @@ note: lifetime declared here
LL | fn a() -> impl Fn(&u8) -> impl Debug + '_ {
| ^
error: aborting due to 3 previous errors
error: lifetime may not live long enough
--> $DIR/impl-fn-parsing-ambiguities.rs:7:9
|
LL | |x| x
| -- ^ returning this value requires that `'1` must outlive `'2`
| ||
| |return type of closure is impl Debug + '2
| has type `&'1 u8`
error: aborting due to 4 previous errors

View File

@ -15,7 +15,7 @@ fn projection_is_disallowed(x: impl Iterator) -> <impl Iterator>::Item {
x.next().unwrap()
}
fn projection_with_named_trait_is_disallowed(x: impl Iterator)
fn projection_with_named_trait_is_disallowed(mut x: impl Iterator)
-> <impl Iterator as Iterator>::Item
//~^ ERROR `impl Trait` is not allowed in path parameters
{
@ -25,7 +25,9 @@ fn projection_with_named_trait_is_disallowed(x: impl Iterator)
fn projection_with_named_trait_inside_path_is_disallowed()
-> <::std::ops::Range<impl Debug> as Iterator>::Item
//~^ ERROR `impl Trait` is not allowed in path parameters
//~| ERROR `impl Debug: Step` is not satisfied
{
//~^ ERROR `impl Debug: Step` is not satisfied
(1i32..100).next().unwrap()
}

View File

@ -17,7 +17,7 @@ LL | -> <::std::ops::Range<impl Debug> as Iterator>::Item
| ^^^^^^^^^^
error[E0667]: `impl Trait` is not allowed in path parameters
--> $DIR/impl_trait_projections.rs:33:29
--> $DIR/impl_trait_projections.rs:35:29
|
LL | -> <dyn Iterator<Item = impl Debug> as Iterator>::Item
| ^^^^^^^^^^
@ -28,6 +28,46 @@ error[E0667]: `impl Trait` is not allowed in path parameters
LL | fn projection_is_disallowed(x: impl Iterator) -> <impl Iterator>::Item {
| ^^^^^^^^^^^^^
error: aborting due to 5 previous errors
error[E0277]: the trait bound `impl Debug: Step` is not satisfied
--> $DIR/impl_trait_projections.rs:26:8
|
LL | -> <::std::ops::Range<impl Debug> as Iterator>::Item
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Step` is not implemented for `impl Debug`
|
= help: the following other types implement trait `Step`:
char
isize
i8
i16
i32
i64
i128
usize
and 8 others
= note: required for `std::ops::Range<impl Debug>` to implement `Iterator`
For more information about this error, try `rustc --explain E0667`.
error[E0277]: the trait bound `impl Debug: Step` is not satisfied
--> $DIR/impl_trait_projections.rs:29:1
|
LL | / {
LL | |
LL | | (1i32..100).next().unwrap()
LL | | }
| |_^ the trait `Step` is not implemented for `impl Debug`
|
= help: the following other types implement trait `Step`:
char
isize
i8
i16
i32
i64
i128
usize
and 8 others
= note: required for `std::ops::Range<impl Debug>` to implement `Iterator`
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0277, E0667.
For more information about an error, try `rustc --explain E0277`.

View File

@ -4,6 +4,12 @@ error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl le
LL | fn foo(x: Vec<i32>) -> Box<dyn for<'a> Deref<Target = impl ?Sized>> {
| ^^
error: aborting due to 1 previous error
error: [o]
--> $DIR/implicit-capture-late.rs:10:55
|
LL | fn foo(x: Vec<i32>) -> Box<dyn for<'a> Deref<Target = impl ?Sized>> {
| ^^^^^^^^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0657`.

View File

@ -21,6 +21,8 @@ struct A;
fn test() -> impl for<'a> MyFn<&'a A, Output=impl Iterator + 'a> {
//~^ ERROR higher kinded lifetime bounds on nested opaque types are not supported yet
Wrap(|a| Some(a).into_iter())
//~^ ERROR implementation of `FnOnce` is not general enough
//~| ERROR implementation of `FnOnce` is not general enough
}
fn main() {}

View File

@ -10,5 +10,24 @@ note: lifetime declared here
LL | fn test() -> impl for<'a> MyFn<&'a A, Output=impl Iterator + 'a> {
| ^^
error: aborting due to 1 previous error
error: implementation of `FnOnce` is not general enough
--> $DIR/issue-67830.rs:23:5
|
LL | Wrap(|a| Some(a).into_iter())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
= note: closure with signature `fn(&'2 A) -> std::option::IntoIter<&A>` must implement `FnOnce<(&'1 A,)>`, for any lifetime `'1`...
= note: ...but it actually implements `FnOnce<(&'2 A,)>`, for some specific lifetime `'2`
error: implementation of `FnOnce` is not general enough
--> $DIR/issue-67830.rs:23:5
|
LL | Wrap(|a| Some(a).into_iter())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
= note: closure with signature `fn(&'2 A) -> std::option::IntoIter<&A>` must implement `FnOnce<(&'1 A,)>`, for any lifetime `'1`...
= note: ...but it actually implements `FnOnce<(&'2 A,)>`, for some specific lifetime `'2`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors

View File

@ -18,11 +18,16 @@ fn make_impl() -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {}
fn make_weird_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
//~^ ERROR higher kinded lifetime bounds on nested opaque types are not supported yet
&()
//~^ ERROR implementation of `Hrtb` is not general enough
//~| ERROR implementation of `Hrtb` is not general enough
}
fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
//~^ ERROR higher kinded lifetime bounds on nested opaque types are not supported yet
x
//~^ ERROR implementation of `Hrtb` is not general enough
//~| ERROR implementation of `Hrtb` is not general enough
//~| ERROR lifetime may not live long enough
}
fn main() {}

View File

@ -23,16 +23,70 @@ LL | fn make_weird_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Sen
| ^^
error: higher kinded lifetime bounds on nested opaque types are not supported yet
--> $DIR/issue-88236-2.rs:23:78
--> $DIR/issue-88236-2.rs:25:78
|
LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
| ^^
|
note: lifetime declared here
--> $DIR/issue-88236-2.rs:23:45
--> $DIR/issue-88236-2.rs:25:45
|
LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
| ^^
error: aborting due to 3 previous errors
error: implementation of `Hrtb` is not general enough
--> $DIR/issue-88236-2.rs:20:5
|
LL | &()
| ^^^ implementation of `Hrtb` is not general enough
|
= note: `Hrtb<'0>` would have to be implemented for the type `&()`, for any lifetime `'0`...
= note: ...but `Hrtb<'1>` is actually implemented for the type `&'1 ()`, for some specific lifetime `'1`
error: implementation of `Hrtb` is not general enough
--> $DIR/issue-88236-2.rs:20:5
|
LL | &()
| ^^^ implementation of `Hrtb` is not general enough
|
= note: `Hrtb<'a>` would have to be implemented for the type `&()`
= note: ...but `Hrtb<'0>` is actually implemented for the type `&'0 ()`, for some specific lifetime `'0`
error: lifetime may not live long enough
--> $DIR/issue-88236-2.rs:27:5
|
LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
| -- lifetime `'b` defined here
LL |
LL | x
| ^ returning this value requires that `'b` must outlive `'static`
|
help: to declare that `impl for<'a> Hrtb<'a, Assoc = impl Send + '_>` captures data from argument `x`, you can add an explicit `'b` lifetime bound
|
LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> + 'b {
| ++++
help: to declare that `impl Send + 'a` captures data from argument `x`, you can add an explicit `'b` lifetime bound
|
LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a + 'b> {
| ++++
error: implementation of `Hrtb` is not general enough
--> $DIR/issue-88236-2.rs:27:5
|
LL | x
| ^ implementation of `Hrtb` is not general enough
|
= note: `Hrtb<'0>` would have to be implemented for the type `&()`, for any lifetime `'0`...
= note: ...but `Hrtb<'1>` is actually implemented for the type `&'1 ()`, for some specific lifetime `'1`
error: implementation of `Hrtb` is not general enough
--> $DIR/issue-88236-2.rs:27:5
|
LL | x
| ^ implementation of `Hrtb` is not general enough
|
= note: `Hrtb<'a>` would have to be implemented for the type `&()`
= note: ...but `Hrtb<'0>` is actually implemented for the type `&'0 ()`, for some specific lifetime `'0`
error: aborting due to 8 previous errors

View File

@ -5,6 +5,7 @@ use std::iter;
fn f<T>(data: &[T]) -> impl Iterator<Item = Vec> {
//~^ ERROR: missing generics for struct `Vec` [E0107]
iter::empty()
//~^ ERROR: type annotations needed
}
fn g<T>(data: &[T], target: T) -> impl Iterator<Item = Vec<T>> {

View File

@ -9,6 +9,18 @@ help: add missing generic argument
LL | fn f<T>(data: &[T]) -> impl Iterator<Item = Vec<T>> {
| +++
error: aborting due to 1 previous error
error[E0282]: type annotations needed
--> $DIR/issue-92305.rs:7:5
|
LL | iter::empty()
| ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty`
|
help: consider specifying the generic argument
|
LL | iter::empty::<T>()
| +++++
For more information about this error, try `rustc --explain E0107`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0107, E0282.
For more information about an error, try `rustc --explain E0107`.

View File

@ -31,9 +31,11 @@ fn one_hrtb_trait_param() -> impl for<'a> Foo<'a, Assoc = impl Qux<'a>> {}
fn one_hrtb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'a> {}
//~^ ERROR higher kinded lifetime bounds on nested opaque types are not supported yet
//~| ERROR implementation of `Bar` is not general enough
fn one_hrtb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl Qux<'a>> {}
//~^ ERROR higher kinded lifetime bounds on nested opaque types are not supported yet
//~| ERROR: the trait bound `for<'a> &'a (): Qux<'_>` is not satisfied
// This should resolve.
fn one_hrtb_mention_fn_trait_param<'b>() -> impl for<'a> Foo<'a, Assoc = impl Qux<'b>> {}
@ -43,9 +45,11 @@ fn one_hrtb_mention_fn_outlives<'b>() -> impl for<'a> Foo<'a, Assoc = impl Sized
// This should resolve.
fn one_hrtb_mention_fn_trait_param_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Qux<'b>> {}
//~^ ERROR: the trait bound `for<'a> &'a (): Qux<'b>` is not satisfied
// This should resolve.
fn one_hrtb_mention_fn_outlives_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'b> {}
//~^ ERROR implementation of `Bar` is not general enough
// This should resolve.
fn two_htrb_trait_param() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Qux<'b>> {}
@ -56,9 +60,11 @@ fn two_htrb_outlives() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Sized + 'b>
// This should resolve.
fn two_htrb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Qux<'b>> {}
//~^ ERROR: the trait bound `for<'a, 'b> &'a (): Qux<'b>` is not satisfied
// `'b` is not in scope for the outlives bound.
fn two_htrb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Sized + 'b> {}
//~^ ERROR use of undeclared lifetime name `'b` [E0261]
//~| ERROR implementation of `Bar` is not general enough
fn main() {}

View File

@ -1,5 +1,5 @@
error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/nested-rpit-hrtb.rs:54:77
--> $DIR/nested-rpit-hrtb.rs:58:77
|
LL | fn two_htrb_outlives() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Sized + 'b> {}
| ^^ undeclared lifetime
@ -15,7 +15,7 @@ LL | fn two_htrb_outlives<'b>() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Siz
| ++++
error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/nested-rpit-hrtb.rs:61:82
--> $DIR/nested-rpit-hrtb.rs:66:82
|
LL | fn two_htrb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Sized + 'b> {}
| ^^ undeclared lifetime
@ -66,17 +66,72 @@ LL | fn one_hrtb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'a
| ^^
error: higher kinded lifetime bounds on nested opaque types are not supported yet
--> $DIR/nested-rpit-hrtb.rs:35:73
--> $DIR/nested-rpit-hrtb.rs:36:73
|
LL | fn one_hrtb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl Qux<'a>> {}
| ^^
|
note: lifetime declared here
--> $DIR/nested-rpit-hrtb.rs:35:44
--> $DIR/nested-rpit-hrtb.rs:36:44
|
LL | fn one_hrtb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl Qux<'a>> {}
| ^^
error: aborting due to 6 previous errors
error: implementation of `Bar` is not general enough
--> $DIR/nested-rpit-hrtb.rs:32:78
|
LL | fn one_hrtb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'a> {}
| ^^ implementation of `Bar` is not general enough
|
= note: `()` must implement `Bar<'a>`
= note: ...but it actually implements `Bar<'0>`, for some specific lifetime `'0`
For more information about this error, try `rustc --explain E0261`.
error[E0277]: the trait bound `for<'a> &'a (): Qux<'_>` is not satisfied
--> $DIR/nested-rpit-hrtb.rs:36:64
|
LL | fn one_hrtb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl Qux<'a>> {}
| ^^^^^^^^^^^^ the trait `for<'a> Qux<'_>` is not implemented for `&'a ()`
|
= help: the trait `Qux<'_>` is implemented for `()`
= help: for that trait implementation, expected `()`, found `&'a ()`
error[E0277]: the trait bound `for<'a> &'a (): Qux<'b>` is not satisfied
--> $DIR/nested-rpit-hrtb.rs:47:79
|
LL | fn one_hrtb_mention_fn_trait_param_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Qux<'b>> {}
| ^^^^^^^^^^^^ the trait `for<'a> Qux<'b>` is not implemented for `&'a ()`
|
= help: the trait `Qux<'_>` is implemented for `()`
= help: for that trait implementation, expected `()`, found `&'a ()`
error: implementation of `Bar` is not general enough
--> $DIR/nested-rpit-hrtb.rs:51:93
|
LL | fn one_hrtb_mention_fn_outlives_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'b> {}
| ^^ implementation of `Bar` is not general enough
|
= note: `()` must implement `Bar<'a>`
= note: ...but it actually implements `Bar<'0>`, for some specific lifetime `'0`
error[E0277]: the trait bound `for<'a, 'b> &'a (): Qux<'b>` is not satisfied
--> $DIR/nested-rpit-hrtb.rs:62:64
|
LL | fn two_htrb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Qux<'b>> {}
| ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a, 'b> Qux<'b>` is not implemented for `&'a ()`
|
= help: the trait `Qux<'_>` is implemented for `()`
= help: for that trait implementation, expected `()`, found `&'a ()`
error: implementation of `Bar` is not general enough
--> $DIR/nested-rpit-hrtb.rs:66:86
|
LL | fn two_htrb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Sized + 'b> {}
| ^^ implementation of `Bar` is not general enough
|
= note: `()` must implement `Bar<'a>`
= note: ...but it actually implements `Bar<'0>`, for some specific lifetime `'0`
error: aborting due to 12 previous errors
Some errors have detailed explanations: E0261, E0277.
For more information about an error, try `rustc --explain E0261`.

View File

@ -3,9 +3,11 @@
extern "rust-intrinsic" {
fn size_of<T>() -> usize; //~ ERROR intrinsic safety mismatch
//~^ ERROR intrinsic safety mismatch
#[rustc_safe_intrinsic]
fn assume(b: bool); //~ ERROR intrinsic safety mismatch
//~^ ERROR intrinsic safety mismatch
}
fn main() {}

View File

@ -5,10 +5,26 @@ LL | fn size_of<T>() -> usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `assume`
--> $DIR/safe-intrinsic-mismatch.rs:8:5
--> $DIR/safe-intrinsic-mismatch.rs:9:5
|
LL | fn assume(b: bool);
| ^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of`
--> $DIR/safe-intrinsic-mismatch.rs:5:5
|
LL | fn size_of<T>() -> usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `assume`
--> $DIR/safe-intrinsic-mismatch.rs:9:5
|
LL | fn assume(b: bool);
| ^^^^^^^^^^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors

Some files were not shown because too many files have changed in this diff Show More