mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Auto merge of #121500 - oli-obk:track_errors12, r=petrochenkov
Merge `collect_mod_item_types` query into `check_well_formed` follow-up to https://github.com/rust-lang/rust/pull/121154 this removes more potential parallel-compiler bottlenecks and moves diagnostics for the same items next to each other, instead of grouping diagnostics by analysis kind
This commit is contained in:
commit
74acabe9b0
@ -1,7 +1,9 @@
|
||||
use crate::autoderef::Autoderef;
|
||||
use crate::collect::CollectItemTypesVisitor;
|
||||
use crate::constrained_generic_params::{identify_constrained_generic_params, Parameter};
|
||||
use crate::errors;
|
||||
|
||||
use hir::intravisit::Visitor;
|
||||
use rustc_ast as ast;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
|
||||
use rustc_errors::{codes::*, pluralize, struct_span_code_err, Applicability, ErrorGuaranteed};
|
||||
@ -225,6 +227,7 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
|
||||
?item.owner_id,
|
||||
item.name = ? tcx.def_path_str(def_id)
|
||||
);
|
||||
CollectItemTypesVisitor { tcx }.visit_item(item);
|
||||
|
||||
let res = match item.kind {
|
||||
// Right now we check that every default trait implementation
|
||||
@ -336,9 +339,14 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
|
||||
res
|
||||
}
|
||||
|
||||
fn check_foreign_item(tcx: TyCtxt<'_>, item: &hir::ForeignItem<'_>) -> Result<(), ErrorGuaranteed> {
|
||||
fn check_foreign_item<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
item: &'tcx hir::ForeignItem<'tcx>,
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
let def_id = item.owner_id.def_id;
|
||||
|
||||
CollectItemTypesVisitor { tcx }.visit_foreign_item(item);
|
||||
|
||||
debug!(
|
||||
?item.owner_id,
|
||||
item.name = ? tcx.def_path_str(def_id)
|
||||
@ -355,12 +363,14 @@ fn check_foreign_item(tcx: TyCtxt<'_>, item: &hir::ForeignItem<'_>) -> Result<()
|
||||
}
|
||||
}
|
||||
|
||||
fn check_trait_item(
|
||||
tcx: TyCtxt<'_>,
|
||||
trait_item: &hir::TraitItem<'_>,
|
||||
fn check_trait_item<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
trait_item: &'tcx hir::TraitItem<'tcx>,
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
let def_id = trait_item.owner_id.def_id;
|
||||
|
||||
CollectItemTypesVisitor { tcx }.visit_trait_item(trait_item);
|
||||
|
||||
let (method_sig, span) = match trait_item.kind {
|
||||
hir::TraitItemKind::Fn(ref sig, _) => (Some(sig), trait_item.span),
|
||||
hir::TraitItemKind::Type(_bounds, Some(ty)) => (None, ty.span),
|
||||
@ -895,7 +905,12 @@ fn check_object_unsafe_self_trait_by_name(tcx: TyCtxt<'_>, item: &hir::TraitItem
|
||||
}
|
||||
}
|
||||
|
||||
fn check_impl_item(tcx: TyCtxt<'_>, impl_item: &hir::ImplItem<'_>) -> Result<(), ErrorGuaranteed> {
|
||||
fn check_impl_item<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
impl_item: &'tcx hir::ImplItem<'tcx>,
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
CollectItemTypesVisitor { tcx }.visit_impl_item(impl_item);
|
||||
|
||||
let (method_sig, span) = match impl_item.kind {
|
||||
hir::ImplItemKind::Fn(ref sig, _) => (Some(sig), impl_item.span),
|
||||
// Constrain binding and overflow error spans to `<Ty>` in `type foo = <Ty>`.
|
||||
|
@ -20,7 +20,7 @@ use rustc_data_structures::unord::UnordMap;
|
||||
use rustc_errors::{Applicability, Diag, ErrorGuaranteed, StashKey};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
use rustc_hir::{GenericParamKind, Node};
|
||||
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
|
||||
@ -52,11 +52,6 @@ mod resolve_bound_vars;
|
||||
mod type_of;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Main entry point
|
||||
|
||||
fn collect_mod_item_types(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) {
|
||||
tcx.hir().visit_item_likes_in_module(module_def_id, &mut CollectItemTypesVisitor { tcx });
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
resolve_bound_vars::provide(providers);
|
||||
@ -82,7 +77,6 @@ pub fn provide(providers: &mut Providers) {
|
||||
impl_trait_header,
|
||||
coroutine_kind,
|
||||
coroutine_for_closure,
|
||||
collect_mod_item_types,
|
||||
is_type_alias_impl_trait,
|
||||
find_field,
|
||||
..*providers
|
||||
@ -155,8 +149,8 @@ impl<'v> Visitor<'v> for HirPlaceholderCollector {
|
||||
}
|
||||
}
|
||||
|
||||
struct CollectItemTypesVisitor<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
pub struct CollectItemTypesVisitor<'tcx> {
|
||||
pub tcx: TyCtxt<'tcx>,
|
||||
}
|
||||
|
||||
/// If there are any placeholder types (`_`), emit an error explaining that this is not allowed
|
||||
|
@ -159,12 +159,6 @@ pub fn provide(providers: &mut Providers) {
|
||||
pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
|
||||
let _prof_timer = tcx.sess.timer("type_check_crate");
|
||||
|
||||
// this ensures that later parts of type checking can assume that items
|
||||
// have valid types and not error
|
||||
tcx.sess.time("type_collecting", || {
|
||||
tcx.hir().for_each_module(|module| tcx.ensure().collect_mod_item_types(module))
|
||||
});
|
||||
|
||||
if tcx.features().rustc_attrs {
|
||||
tcx.sess.time("outlives_testing", || outlives::test::test_inferred_outlives(tcx))?;
|
||||
}
|
||||
|
@ -762,6 +762,7 @@ rustc_queries! {
|
||||
desc { |tcx| "computing the variances of `{}`", tcx.def_path_str(def_id) }
|
||||
cache_on_disk_if { def_id.is_local() }
|
||||
separate_provide_extern
|
||||
cycle_delay_bug
|
||||
}
|
||||
|
||||
/// Maps from thee `DefId` of a type to its (inferred) outlives.
|
||||
@ -959,10 +960,6 @@ rustc_queries! {
|
||||
ensure_forwards_result_if_red
|
||||
}
|
||||
|
||||
query collect_mod_item_types(key: LocalModDefId) {
|
||||
desc { |tcx| "collecting item types in {}", describe_as_module(key, tcx) }
|
||||
}
|
||||
|
||||
/// Caches `CoerceUnsized` kinds for impls on custom types.
|
||||
query coerce_unsized_info(key: DefId) -> Result<ty::adjustment::CoerceUnsizedInfo, ErrorGuaranteed> {
|
||||
desc { |tcx| "computing CoerceUnsized info for `{}`", tcx.def_path_str(key) }
|
||||
|
@ -131,6 +131,27 @@ impl<'tcx> Value<TyCtxt<'tcx>> for ty::EarlyBinder<ty::Binder<'_, ty::FnSig<'_>>
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Value<TyCtxt<'tcx>> for &[ty::Variance] {
|
||||
fn from_cycle_error(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
cycle_error: &CycleError,
|
||||
_guar: ErrorGuaranteed,
|
||||
) -> Self {
|
||||
if let Some(frame) = cycle_error.cycle.get(0)
|
||||
&& frame.query.dep_kind == dep_kinds::variances_of
|
||||
&& let Some(def_id) = frame.query.def_id
|
||||
{
|
||||
let n = tcx.generics_of(def_id).params.len();
|
||||
vec![ty::Variance::Bivariant; n].leak()
|
||||
} else {
|
||||
span_bug!(
|
||||
cycle_error.usage.as_ref().unwrap().0,
|
||||
"only `variances_of` returns `&[ty::Variance]`"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Take a cycle of `Q` and try `try_cycle` on every permutation, falling back to `otherwise`.
|
||||
fn search_for_cycle_permutation<Q, T>(
|
||||
cycle: &[Q],
|
||||
|
@ -314,21 +314,10 @@ pub(crate) fn run_global_ctxt(
|
||||
// typeck function bodies or run the default rustc lints.
|
||||
// (see `override_queries` in the `config`)
|
||||
|
||||
// HACK(jynelson) this calls an _extremely_ limited subset of `typeck`
|
||||
// and might break if queries change their assumptions in the future.
|
||||
tcx.sess.time("type_collecting", || {
|
||||
tcx.hir().for_each_module(|module| tcx.ensure().collect_mod_item_types(module))
|
||||
});
|
||||
|
||||
// NOTE: These are copy/pasted from typeck/lib.rs and should be kept in sync with those changes.
|
||||
let _ = tcx.sess.time("wf_checking", || {
|
||||
tcx.hir().try_par_for_each_module(|module| tcx.ensure().check_mod_type_wf(module))
|
||||
});
|
||||
tcx.sess.time("item_types_checking", || {
|
||||
tcx.hir().for_each_module(|module| {
|
||||
let _ = tcx.ensure().check_mod_type_wf(module);
|
||||
});
|
||||
});
|
||||
|
||||
if let Some(guar) = tcx.dcx().has_errors() {
|
||||
return Err(guar);
|
||||
|
@ -8,17 +8,11 @@ LL | type Bar<'a, 'b> = Box<dyn PartialEq<Bar<'a, 'b>>>;
|
||||
= note: type aliases cannot be recursive
|
||||
= help: consider using a struct, enum, or union instead to break the cycle
|
||||
= help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information
|
||||
note: cycle used when collecting item types in top-level module
|
||||
note: cycle used when checking that `Bar` is well-formed
|
||||
--> $DIR/issue-110629-private-type-cycle-dyn.rs:1:1
|
||||
|
|
||||
LL | / type Bar<'a, 'b> = Box<dyn PartialEq<Bar<'a, 'b>>>;
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> {
|
||||
... |
|
||||
LL | | assert!(bar(&meh) == bar(&muh));
|
||||
LL | | }
|
||||
| |_^
|
||||
LL | type Bar<'a, 'b> = Box<dyn PartialEq<Bar<'a, 'b>>>;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
= 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 1 previous error
|
||||
|
@ -464,38 +464,6 @@ help: add missing generic argument
|
||||
LL | Output = <Self as SVec>::Item> as SVec>::Item<T>,
|
||||
| +++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:61:38
|
||||
|
|
||||
LL | fn len(&self) -> <Self as SVec>::Item;
|
||||
| ^^^^ expected 1 lifetime argument
|
||||
|
|
||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||
--> $DIR/issue-105742.rs:59:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | fn len(&self) -> <Self as SVec>::Item<'_>;
|
||||
| ++++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:61:38
|
||||
|
|
||||
LL | fn len(&self) -> <Self as SVec>::Item;
|
||||
| ^^^^ expected 1 generic argument
|
||||
|
|
||||
note: associated type defined here, with 1 generic parameter: `T`
|
||||
--> $DIR/issue-105742.rs:59:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ -
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | fn len(&self) -> <Self as SVec>::Item<T>;
|
||||
| +++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:15:21
|
||||
|
|
||||
@ -632,6 +600,38 @@ help: add missing generic argument
|
||||
LL | Output = <Self as SVec>::Item> as SVec>::Item<T>,
|
||||
| +++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:61:38
|
||||
|
|
||||
LL | fn len(&self) -> <Self as SVec>::Item;
|
||||
| ^^^^ expected 1 lifetime argument
|
||||
|
|
||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||
--> $DIR/issue-105742.rs:59:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | fn len(&self) -> <Self as SVec>::Item<'_>;
|
||||
| ++++
|
||||
|
||||
error[E0107]: missing generics for associated type `SVec::Item`
|
||||
--> $DIR/issue-105742.rs:61:38
|
||||
|
|
||||
LL | fn len(&self) -> <Self as SVec>::Item;
|
||||
| ^^^^ expected 1 generic argument
|
||||
|
|
||||
note: associated type defined here, with 1 generic parameter: `T`
|
||||
--> $DIR/issue-105742.rs:59:10
|
||||
|
|
||||
LL | type Item<'a, T>;
|
||||
| ^^^^ -
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | fn len(&self) -> <Self as SVec>::Item<T>;
|
||||
| +++
|
||||
|
||||
error: aborting due to 37 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0038, E0107.
|
||||
|
@ -26,17 +26,11 @@ note: ...which requires computing normalized predicates of `Foo`...
|
||||
LL | struct Foo {
|
||||
| ^^^^^^^^^^
|
||||
= note: ...which again requires computing predicates of `Foo`, completing the cycle
|
||||
note: cycle used when collecting item types in top-level module
|
||||
--> $DIR/cycle-iat-inside-of-adt.rs:3:1
|
||||
note: cycle used when checking that `Foo` is well-formed
|
||||
--> $DIR/cycle-iat-inside-of-adt.rs:7:1
|
||||
|
|
||||
LL | / #![feature(inherent_associated_types)]
|
||||
LL | | #![allow(incomplete_features)]
|
||||
LL | | // FIXME(inherent_associated_types): This should pass.
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | fn main() {}
|
||||
| |____________^
|
||||
LL | struct Foo {
|
||||
| ^^^^^^^^^^
|
||||
= 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 1 previous error
|
||||
|
@ -20,19 +20,23 @@ note: ...which requires computing normalized predicates of `user`...
|
||||
LL | fn user<T>() where S<T>::P: std::fmt::Debug {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: ...which again requires computing predicates of `user`, completing the cycle
|
||||
note: cycle used when collecting item types in top-level module
|
||||
--> $DIR/cycle-iat-inside-of-where-predicate.rs:3:1
|
||||
note: cycle used when checking that `user` is well-formed
|
||||
--> $DIR/cycle-iat-inside-of-where-predicate.rs:8:1
|
||||
|
|
||||
LL | / #![feature(inherent_associated_types)]
|
||||
LL | | #![allow(incomplete_features)]
|
||||
LL | |
|
||||
LL | | // FIXME(inherent_associated_types): This shouldn't lead to a cycle error.
|
||||
... |
|
||||
LL | |
|
||||
LL | | fn main() {}
|
||||
| |____________^
|
||||
LL | fn user<T>() where S<T>::P: std::fmt::Debug {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= 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 1 previous error
|
||||
error[E0392]: type parameter `T` is never used
|
||||
--> $DIR/cycle-iat-inside-of-where-predicate.rs:10:10
|
||||
|
|
||||
LL | struct S<T>;
|
||||
| ^ unused type parameter
|
||||
|
|
||||
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
|
||||
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
|
||||
|
||||
For more information about this error, try `rustc --explain E0391`.
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0391, E0392.
|
||||
For more information about an error, try `rustc --explain E0391`.
|
||||
|
@ -20,16 +20,6 @@ help: add missing generic argument
|
||||
LL | impl<T> Windows<T> {
|
||||
| +++
|
||||
|
||||
error[E0658]: inherent associated types are unstable
|
||||
--> $DIR/issue-109071.rs:8:5
|
||||
|
|
||||
LL | type Item = &[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
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/issue-109071.rs:15:22
|
||||
|
|
||||
@ -43,6 +33,16 @@ LL | fn T() -> Option<<Windows<T> as IntoAsyncIterator>::Item> {}
|
||||
LL | fn T() -> Option<<Windows<T> as IntoIterator>::Item> {}
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error[E0658]: inherent associated types are unstable
|
||||
--> $DIR/issue-109071.rs:8:5
|
||||
|
|
||||
LL | type Item = &[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
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0107, E0223, E0637, E0658.
|
||||
|
@ -198,6 +198,17 @@ LL | fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
|
||||
| |
|
||||
| `Item` bound here first
|
||||
|
||||
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>()
|
||||
| +++++
|
||||
|
||||
error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
||||
--> $DIR/duplicate.rs:139:42
|
||||
|
|
||||
@ -206,6 +217,17 @@ LL | fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
|
||||
| |
|
||||
| `Item` bound here first
|
||||
|
||||
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[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
||||
--> $DIR/duplicate.rs:144:45
|
||||
|
|
||||
@ -214,6 +236,17 @@ LL | fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
|
||||
| |
|
||||
| `Item` bound here first
|
||||
|
||||
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:149:40
|
||||
|
|
||||
@ -376,6 +409,16 @@ 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
|
||||
|
|
||||
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
|
||||
|
|
||||
@ -394,6 +437,16 @@ 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: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
|
||||
|
|
||||
@ -412,6 +465,16 @@ 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: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:211:29
|
||||
|
|
||||
@ -454,6 +517,16 @@ 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: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
|
||||
|
|
||||
@ -472,6 +545,16 @@ 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: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
|
||||
|
|
||||
@ -490,6 +573,16 @@ 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: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[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
|
||||
--> $DIR/duplicate.rs:252:34
|
||||
|
|
||||
@ -514,99 +607,6 @@ LL | type A: Iterator<Item: 'static, Item: 'static>;
|
||||
| |
|
||||
| `Item` bound here first
|
||||
|
||||
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>()
|
||||
| +++++
|
||||
|
||||
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: aborting due to 72 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0282, E0719.
|
||||
|
@ -9,6 +9,23 @@ help: if there were a type named `Example` that implemented `Get`, you could use
|
||||
LL | fn get<T:Get,U:Get>(x: T, y: U) -> <Example as Get>::Value {}
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/associated-types-in-ambiguous-context.rs:13:23
|
||||
|
|
||||
LL | fn grab(&self) -> Grab::Value;
|
||||
| ^^^^^^^^^^^ help: use fully-qualified syntax: `<Self as Grab>::Value`
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/associated-types-in-ambiguous-context.rs:16:22
|
||||
|
|
||||
LL | fn get(&self) -> Get::Value;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
help: if there were a type named `Example` that implemented `Get`, you could use the fully-qualified path
|
||||
|
|
||||
LL | fn get(&self) -> <Example as Get>::Value;
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/associated-types-in-ambiguous-context.rs:22:17
|
||||
|
|
||||
@ -33,23 +50,6 @@ LL | type X = <OsString as Deref>::Target;
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
and N other candidates
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/associated-types-in-ambiguous-context.rs:13:23
|
||||
|
|
||||
LL | fn grab(&self) -> Grab::Value;
|
||||
| ^^^^^^^^^^^ help: use fully-qualified syntax: `<Self as Grab>::Value`
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/associated-types-in-ambiguous-context.rs:16:22
|
||||
|
|
||||
LL | fn get(&self) -> Get::Value;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
help: if there were a type named `Example` that implemented `Get`, you could use the fully-qualified path
|
||||
|
|
||||
LL | fn get(&self) -> <Example as Get>::Value;
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0223`.
|
||||
|
@ -74,26 +74,6 @@ LL | static TY_STATIC_MIXED: Bar<_, _> = Bar::<i32, 3>(0);
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `Bar<i32, 3>`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
|
||||
--> $DIR/in-signature.rs:35:21
|
||||
|
|
||||
LL | const ARR: [u8; _];
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
|
||||
--> $DIR/in-signature.rs:39:25
|
||||
|
|
||||
LL | const ARR: Bar<i32, _>;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
|
||||
--> $DIR/in-signature.rs:43:20
|
||||
|
|
||||
LL | const ARR: Bar<_, _>;
|
||||
| ^ ^ not allowed in type signatures
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/in-signature.rs:51:23
|
||||
|
|
||||
@ -114,6 +94,26 @@ LL | type Assoc = Bar<_, _>;
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
|
||||
--> $DIR/in-signature.rs:35:21
|
||||
|
|
||||
LL | const ARR: [u8; _];
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
|
||||
--> $DIR/in-signature.rs:39:25
|
||||
|
|
||||
LL | const ARR: Bar<i32, _>;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
|
||||
--> $DIR/in-signature.rs:43:20
|
||||
|
|
||||
LL | const ARR: Bar<_, _>;
|
||||
| ^ ^ not allowed in type signatures
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
|
||||
error: aborting due to 15 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0121`.
|
||||
|
@ -48,17 +48,11 @@ note: ...which requires computing type of `S::S`...
|
||||
LL | struct S<const S: (), const S: S = { S }>;
|
||||
| ^
|
||||
= note: ...which again requires computing type of `S`, completing the cycle
|
||||
note: cycle used when collecting item types in top-level module
|
||||
--> $DIR/issue-103790.rs:1:1
|
||||
note: cycle used when checking that `S` is well-formed
|
||||
--> $DIR/issue-103790.rs:4:1
|
||||
|
|
||||
LL | / #![feature(generic_const_exprs)]
|
||||
LL | | #![allow(incomplete_features)]
|
||||
LL | |
|
||||
LL | | struct S<const S: (), const S: S = { S }>;
|
||||
... |
|
||||
LL | |
|
||||
LL | | fn main() {}
|
||||
| |____________^
|
||||
LL | struct S<const S: (), const S: S = { S }>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= 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: `()` is forbidden as the type of a const generic parameter
|
||||
|
@ -20,17 +20,11 @@ note: ...which requires const-evaluating + checking `A`...
|
||||
LL | const A: isize = Foo::B as isize;
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: ...which again requires simplifying constant for the type system `Foo::B::{constant#0}`, completing the cycle
|
||||
note: cycle used when collecting item types in top-level module
|
||||
--> $DIR/issue-36163.rs:1:1
|
||||
note: cycle used when checking that `Foo` is well-formed
|
||||
--> $DIR/issue-36163.rs:3:1
|
||||
|
|
||||
LL | / const A: isize = Foo::B as isize;
|
||||
LL | |
|
||||
LL | | enum Foo {
|
||||
LL | | B = A,
|
||||
LL | | }
|
||||
LL | |
|
||||
LL | | fn main() {}
|
||||
| |____________^
|
||||
LL | enum Foo {
|
||||
| ^^^^^^^^
|
||||
= 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 1 previous error
|
||||
|
@ -5,15 +5,11 @@ LL | trait Foo<X = Box<dyn Foo>> {
|
||||
| ^^^
|
||||
|
|
||||
= note: ...which immediately requires computing type of `Foo::X` again
|
||||
note: cycle used when collecting item types in top-level module
|
||||
note: cycle used when checking that `Foo` is well-formed
|
||||
--> $DIR/cycle-trait-default-type-trait.rs:4:1
|
||||
|
|
||||
LL | / trait Foo<X = Box<dyn Foo>> {
|
||||
LL | |
|
||||
LL | | }
|
||||
LL | |
|
||||
LL | | fn main() { }
|
||||
| |_____________^
|
||||
LL | trait Foo<X = Box<dyn Foo>> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= 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 1 previous error
|
||||
|
@ -5,7 +5,7 @@ LL | trait Chromosome: Chromosome {
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: ...which immediately requires computing the super predicates of `Chromosome` again
|
||||
note: cycle used when collecting item types in top-level module
|
||||
note: cycle used when checking that `Chromosome` is well-formed
|
||||
--> $DIR/cycle-trait-supertrait-direct.rs:3:1
|
||||
|
|
||||
LL | / trait Chromosome: Chromosome {
|
||||
|
@ -10,7 +10,7 @@ note: ...which requires computing the super predicates of `T2`...
|
||||
LL | trait T2 : T1 {
|
||||
| ^^
|
||||
= note: ...which again requires computing the super predicates of `T1`, completing the cycle
|
||||
note: cycle used when collecting item types in top-level module
|
||||
note: cycle used when checking that `T1` is well-formed
|
||||
--> $DIR/issue-12511.rs:1:1
|
||||
|
|
||||
LL | / trait T1 : T2 {
|
||||
|
@ -70,14 +70,14 @@ LL | fn foo(&self, x: i32) -> i32 { x }
|
||||
LL | reuse Trait::foo;
|
||||
| ^^^
|
||||
|
||||
error: delegation with early bound generics is not supported yet
|
||||
error[E0049]: method `foo2` has 0 type parameters but its trait declaration has 1 type parameter
|
||||
--> $DIR/not-supported.rs:49:22
|
||||
|
|
||||
LL | fn foo2<T>(&self, x: T) -> T { x }
|
||||
| ---------------------------- callee defined here
|
||||
| - expected 1 type parameter
|
||||
...
|
||||
LL | reuse Trait::foo2 { &self.0 }
|
||||
| ^^^^
|
||||
| ^^^^ found 0 type parameters
|
||||
|
||||
error: delegation with early bound generics is not supported yet
|
||||
--> $DIR/not-supported.rs:52:29
|
||||
@ -88,6 +88,15 @@ LL | fn foo3<'a: 'a>(_: &'a u32) {}
|
||||
LL | reuse <F as Trait>::foo3;
|
||||
| ^^^^
|
||||
|
||||
error[E0195]: lifetime parameters or bounds on method `foo3` do not match the trait declaration
|
||||
--> $DIR/not-supported.rs:52:29
|
||||
|
|
||||
LL | fn foo3<'a: 'a>(_: &'a u32) {}
|
||||
| -------- lifetimes in impl do not match this method in trait
|
||||
...
|
||||
LL | reuse <F as Trait>::foo3;
|
||||
| ^^^^ lifetimes do not match method in trait
|
||||
|
||||
error: delegation with early bound generics is not supported yet
|
||||
--> $DIR/not-supported.rs:59:22
|
||||
|
|
||||
@ -97,6 +106,15 @@ LL | fn foo(&self, x: i32) -> i32 { x }
|
||||
LL | reuse Trait::foo { &self.0 }
|
||||
| ^^^
|
||||
|
||||
error: delegation with early bound generics is not supported yet
|
||||
--> $DIR/not-supported.rs:49:22
|
||||
|
|
||||
LL | fn foo2<T>(&self, x: T) -> T { x }
|
||||
| ---------------------------- callee defined here
|
||||
...
|
||||
LL | reuse Trait::foo2 { &self.0 }
|
||||
| ^^^^
|
||||
|
||||
error: delegation with early bound generics is not supported yet
|
||||
--> $DIR/not-supported.rs:74:21
|
||||
|
|
||||
@ -160,24 +178,6 @@ LL | pub reuse to_reuse2::foo;
|
||||
LL | reuse to_reuse1::foo;
|
||||
| ^^^
|
||||
|
||||
error[E0049]: method `foo2` has 0 type parameters but its trait declaration has 1 type parameter
|
||||
--> $DIR/not-supported.rs:49:22
|
||||
|
|
||||
LL | fn foo2<T>(&self, x: T) -> T { x }
|
||||
| - expected 1 type parameter
|
||||
...
|
||||
LL | reuse Trait::foo2 { &self.0 }
|
||||
| ^^^^ found 0 type parameters
|
||||
|
||||
error[E0195]: lifetime parameters or bounds on method `foo3` do not match the trait declaration
|
||||
--> $DIR/not-supported.rs:52:29
|
||||
|
|
||||
LL | fn foo3<'a: 'a>(_: &'a u32) {}
|
||||
| -------- lifetimes in impl do not match this method in trait
|
||||
...
|
||||
LL | reuse <F as Trait>::foo3;
|
||||
| ^^^^ lifetimes do not match method in trait
|
||||
|
||||
error: aborting due to 19 previous errors; 1 warning emitted
|
||||
|
||||
Some errors have detailed explanations: E0049, E0195.
|
||||
|
@ -272,6 +272,17 @@ help: use type parameters instead
|
||||
LL | struct L<F, T>(F) where F: Fn() -> T;
|
||||
| +++ ~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/bad-assoc-ty.rs:82:38
|
||||
|
|
||||
LL | fn foo<F>(_: F) where F: Fn() -> _ {}
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
LL | fn foo<F, T>(_: F) where F: Fn() -> T {}
|
||||
| +++ ~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/bad-assoc-ty.rs:62:30
|
||||
|
|
||||
@ -305,28 +316,6 @@ help: use type parameters instead
|
||||
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:77:29
|
||||
|
|
||||
LL | trait P<F> where F: Fn() -> _ {
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
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:82:38
|
||||
|
|
||||
LL | fn foo<F>(_: F) where F: Fn() -> _ {}
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
LL | fn foo<F, T>(_: F) where F: Fn() -> T {}
|
||||
| +++ ~
|
||||
|
||||
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
|
||||
--> $DIR/bad-assoc-ty.rs:73:5
|
||||
|
|
||||
@ -339,6 +328,17 @@ help: wrap the field type in `ManuallyDrop<...>`
|
||||
LL | foo: std::mem::ManuallyDrop<F>,
|
||||
| +++++++++++++++++++++++ +
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for traits
|
||||
--> $DIR/bad-assoc-ty.rs:77:29
|
||||
|
|
||||
LL | trait P<F> where F: Fn() -> _ {
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
LL | trait P<F, T> where F: Fn() -> T {
|
||||
| +++ ~
|
||||
|
||||
error: aborting due to 29 previous errors; 1 warning emitted
|
||||
|
||||
Some errors have detailed explanations: E0121, E0223, E0740.
|
||||
|
@ -16,6 +16,16 @@ 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: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:8:42
|
||||
|
|
||||
@ -24,16 +34,6 @@ LL | fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> {
|
||||
| |
|
||||
| `Item` bound here first
|
||||
|
||||
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
|
||||
|
|
||||
|
@ -18,6 +18,14 @@ LL | type Bop = impl std::fmt::Debug;
|
||||
= help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
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[E0658]: inherent associated types are unstable
|
||||
--> $DIR/feature-gate-impl_trait_in_assoc_type.rs:14:5
|
||||
|
|
||||
@ -28,14 +36,6 @@ LL | type Bop = impl std::fmt::Debug;
|
||||
= help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
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
|
||||
|
|
||||
|
@ -56,26 +56,6 @@ 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:18:6
|
||||
|
|
||||
LL | impl FnOnce() for Foo1 {
|
||||
| ^^^^^^^^ manual implementations of `FnOnce` are experimental
|
||||
|
|
||||
= 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: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: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:26:6
|
||||
|
|
||||
@ -94,24 +74,6 @@ 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:35:6
|
||||
|
|
||||
LL | impl FnOnce<()> for Baz {
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
|
||||
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0183]: manual implementations of `FnOnce` are experimental
|
||||
--> $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[E0277]: expected a `FnMut()` closure, found `Foo`
|
||||
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:9:17
|
||||
|
|
||||
@ -135,6 +97,44 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {}
|
||||
= note: expected signature `extern "rust-call" fn(&Foo, ()) -> _`
|
||||
found signature `extern "rust-call" fn(Foo, ())`
|
||||
|
||||
error[E0183]: manual implementations of `FnOnce` are experimental
|
||||
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6
|
||||
|
|
||||
LL | impl FnOnce() for Foo1 {
|
||||
| ^^^^^^^^ manual implementations of `FnOnce` are experimental
|
||||
|
|
||||
= 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: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: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:35:6
|
||||
|
|
||||
LL | impl FnOnce<()> for Baz {
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
|
||||
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0183]: manual implementations of `FnOnce` are experimental
|
||||
--> $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[E0046]: not all trait items implemented, missing: `Output`
|
||||
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:1
|
||||
|
|
||||
|
@ -1,3 +1,23 @@
|
||||
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
|
||||
|
||||
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[E0107]: missing generics for associated type `X::Y`
|
||||
--> $DIR/gat-trait-path-missing-lifetime.rs:8:20
|
||||
|
|
||||
@ -31,26 +51,6 @@ help: add missing lifetime argument
|
||||
LL | fn foo<'a, T1: X<Y<'a> = T1>>(t : T1) -> T1::Y<'a> {
|
||||
| ++++
|
||||
|
||||
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
|
||||
|
||||
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: lifetime may not live long enough
|
||||
--> $DIR/gat-trait-path-missing-lifetime.rs:8:3
|
||||
|
|
||||
|
@ -53,22 +53,6 @@ note: associated type defined here, with 0 generic parameters
|
||||
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: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>;
|
||||
| ^ --
|
||||
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:5:27
|
||||
|
|
||||
@ -154,6 +138,22 @@ 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>;
|
||||
| ^ --
|
||||
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
|
||||
|
|
||||
|
@ -1,3 +1,14 @@
|
||||
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[E0107]: missing generics for associated type `TestMut::Output`
|
||||
--> $DIR/issue-80433.rs:21:47
|
||||
|
|
||||
@ -14,17 +25,6 @@ help: add missing lifetime argument
|
||||
LL | fn test_simpler<'a>(dst: &'a mut impl TestMut<Output<'a> = &'a mut f32>)
|
||||
| ++++
|
||||
|
||||
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[E0499]: cannot borrow `*dst` as mutable more than once at a time
|
||||
--> $DIR/issue-80433.rs:25:10
|
||||
|
|
||||
|
@ -14,42 +14,6 @@ help: add missing lifetime arguments
|
||||
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:17:26
|
||||
|
|
||||
LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {}
|
||||
| ^^^ -- -- supplied 2 lifetime arguments
|
||||
| |
|
||||
| expected 3 lifetime arguments
|
||||
|
|
||||
note: struct defined here, with 3 lifetime parameters: `'a`, `'b`, `'c`
|
||||
--> $DIR/missing_lifetime_args.rs:5:8
|
||||
|
|
||||
LL | struct Foo<'a, 'b, 'c> {
|
||||
| ^^^ -- -- --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
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:20:16
|
||||
|
|
||||
LL | fn f<'a>(_arg: Foo<'a>) {}
|
||||
| ^^^ -- supplied 1 lifetime argument
|
||||
| |
|
||||
| expected 3 lifetime arguments
|
||||
|
|
||||
note: struct defined here, with 3 lifetime parameters: `'a`, `'b`, `'c`
|
||||
--> $DIR/missing_lifetime_args.rs:5:8
|
||||
|
|
||||
LL | struct Foo<'a, 'b, 'c> {
|
||||
| ^^^ -- -- --
|
||||
help: add missing lifetime arguments
|
||||
|
|
||||
LL | fn f<'a>(_arg: Foo<'a, 'a, 'a>) {}
|
||||
| ++++++++
|
||||
|
||||
error[E0107]: missing generics for associated type `X::Y`
|
||||
--> $DIR/missing_lifetime_args.rs:11:32
|
||||
|
|
||||
@ -99,6 +63,42 @@ LL | type Y<'a, 'b>;
|
||||
| ^ ...because it contains the generic associated type `Y`
|
||||
= help: consider moving `Y` to another trait
|
||||
|
||||
error[E0107]: struct takes 3 lifetime arguments but 2 lifetime arguments were supplied
|
||||
--> $DIR/missing_lifetime_args.rs:17:26
|
||||
|
|
||||
LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {}
|
||||
| ^^^ -- -- supplied 2 lifetime arguments
|
||||
| |
|
||||
| expected 3 lifetime arguments
|
||||
|
|
||||
note: struct defined here, with 3 lifetime parameters: `'a`, `'b`, `'c`
|
||||
--> $DIR/missing_lifetime_args.rs:5:8
|
||||
|
|
||||
LL | struct Foo<'a, 'b, 'c> {
|
||||
| ^^^ -- -- --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
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:20:16
|
||||
|
|
||||
LL | fn f<'a>(_arg: Foo<'a>) {}
|
||||
| ^^^ -- supplied 1 lifetime argument
|
||||
| |
|
||||
| expected 3 lifetime arguments
|
||||
|
|
||||
note: struct defined here, with 3 lifetime parameters: `'a`, `'b`, `'c`
|
||||
--> $DIR/missing_lifetime_args.rs:5:8
|
||||
|
|
||||
LL | struct Foo<'a, 'b, 'c> {
|
||||
| ^^^ -- -- --
|
||||
help: add missing lifetime arguments
|
||||
|
|
||||
LL | fn f<'a>(_arg: Foo<'a, 'a, 'a>) {}
|
||||
| ++++++++
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0038, E0107.
|
||||
|
@ -1,16 +1,10 @@
|
||||
trait Foo {
|
||||
//~^ ERROR cycle detected
|
||||
type Context<'c>
|
||||
where
|
||||
Self: 'c;
|
||||
}
|
||||
|
||||
impl Foo for Box<dyn Foo> {}
|
||||
//~^ ERROR `Foo` cannot be made into an object
|
||||
//~| ERROR `Foo` cannot be made into an object
|
||||
//~| ERROR cycle detected
|
||||
//~| ERROR cycle detected
|
||||
//~| ERROR cycle detected
|
||||
//~| ERROR the trait bound `Box<(dyn Foo + 'static)>: Foo` is not satisfied
|
||||
//~| ERROR not all trait items implemented
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,119 +1,22 @@
|
||||
error[E0391]: cycle detected when computing type of `<impl at $DIR/unknown-lifetime-ice-119827.rs:7:1: 7:26>`
|
||||
--> $DIR/unknown-lifetime-ice-119827.rs:7:1
|
||||
|
|
||||
LL | impl Foo for Box<dyn Foo> {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...which requires finding trait impls of `Foo`...
|
||||
error[E0391]: cycle detected when finding trait impls of `Foo`
|
||||
--> $DIR/unknown-lifetime-ice-119827.rs:1:1
|
||||
|
|
||||
LL | trait Foo {
|
||||
| ^^^^^^^^^
|
||||
= note: ...which again requires computing type of `<impl at $DIR/unknown-lifetime-ice-119827.rs:7:1: 7:26>`, completing the cycle
|
||||
note: cycle used when collecting item types in top-level module
|
||||
--> $DIR/unknown-lifetime-ice-119827.rs:1:1
|
||||
|
|
||||
LL | / trait Foo {
|
||||
LL | | type Context<'c>
|
||||
LL | | where
|
||||
LL | | Self: 'c;
|
||||
... |
|
||||
LL | |
|
||||
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[E0391]: cycle detected when computing type of `<impl at $DIR/unknown-lifetime-ice-119827.rs:7:1: 7:26>`
|
||||
--> $DIR/unknown-lifetime-ice-119827.rs:7:1
|
||||
note: ...which requires computing type of `<impl at $DIR/unknown-lifetime-ice-119827.rs:8:1: 8:26>`...
|
||||
--> $DIR/unknown-lifetime-ice-119827.rs:8:1
|
||||
|
|
||||
LL | impl Foo for Box<dyn Foo> {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: ...which immediately requires computing type of `<impl at $DIR/unknown-lifetime-ice-119827.rs:7:1: 7:26>` again
|
||||
note: cycle used when collecting item types in top-level module
|
||||
= note: ...which again requires finding trait impls of `Foo`, completing the cycle
|
||||
note: cycle used when checking that `Foo` is well-formed
|
||||
--> $DIR/unknown-lifetime-ice-119827.rs:1:1
|
||||
|
|
||||
LL | / trait Foo {
|
||||
LL | | type Context<'c>
|
||||
LL | | where
|
||||
LL | | Self: 'c;
|
||||
... |
|
||||
LL | |
|
||||
LL | | fn main() {}
|
||||
| |____________^
|
||||
LL | trait Foo {
|
||||
| ^^^^^^^^^
|
||||
= 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[E0391]: cycle detected when computing type of `<impl at $DIR/unknown-lifetime-ice-119827.rs:7:1: 7:26>`
|
||||
--> $DIR/unknown-lifetime-ice-119827.rs:7:1
|
||||
|
|
||||
LL | impl Foo for Box<dyn Foo> {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: ...which immediately requires computing type of `<impl at $DIR/unknown-lifetime-ice-119827.rs:7:1: 7:26>` again
|
||||
note: cycle used when collecting item types in top-level module
|
||||
--> $DIR/unknown-lifetime-ice-119827.rs:1:1
|
||||
|
|
||||
LL | / trait Foo {
|
||||
LL | | type Context<'c>
|
||||
LL | | where
|
||||
LL | | Self: 'c;
|
||||
... |
|
||||
LL | |
|
||||
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
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
error[E0038]: the trait `Foo` cannot be made into an object
|
||||
--> $DIR/unknown-lifetime-ice-119827.rs:7:22
|
||||
|
|
||||
LL | impl Foo for Box<dyn Foo> {}
|
||||
| ^^^ `Foo` 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/unknown-lifetime-ice-119827.rs:2:10
|
||||
|
|
||||
LL | trait Foo {
|
||||
| --- this trait cannot be made into an object...
|
||||
LL | type Context<'c>
|
||||
| ^^^^^^^ ...because it contains the generic associated type `Context`
|
||||
= help: consider moving `Context` to another trait
|
||||
= help: only type `{type error}` implements the trait, consider using it directly instead
|
||||
|
||||
error[E0277]: the trait bound `Box<(dyn Foo + 'static)>: Foo` is not satisfied
|
||||
--> $DIR/unknown-lifetime-ice-119827.rs:7:14
|
||||
|
|
||||
LL | impl Foo for Box<dyn Foo> {}
|
||||
| ^^^^^^^^^^^^ the trait `Foo` is not implemented for `Box<(dyn Foo + 'static)>`
|
||||
|
|
||||
= help: the trait `Foo` is implemented for `Box<(dyn Foo + 'static)>`
|
||||
|
||||
error[E0038]: the trait `Foo` cannot be made into an object
|
||||
--> $DIR/unknown-lifetime-ice-119827.rs:7:14
|
||||
|
|
||||
LL | impl Foo for Box<dyn Foo> {}
|
||||
| ^^^^^^^^^^^^ `Foo` 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/unknown-lifetime-ice-119827.rs:2:10
|
||||
|
|
||||
LL | trait Foo {
|
||||
| --- this trait cannot be made into an object...
|
||||
LL | type Context<'c>
|
||||
| ^^^^^^^ ...because it contains the generic associated type `Context`
|
||||
= help: consider moving `Context` to another trait
|
||||
= help: only type `std::boxed::Box<(dyn Foo + 'static)>` implements the trait, consider using it directly instead
|
||||
|
||||
error[E0046]: not all trait items implemented, missing: `Context`
|
||||
--> $DIR/unknown-lifetime-ice-119827.rs:7:1
|
||||
|
|
||||
LL | type Context<'c>
|
||||
| ---------------- `Context` from trait
|
||||
...
|
||||
LL | impl Foo for Box<dyn Foo> {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Context` in implementation
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0038, E0046, E0277, E0391.
|
||||
For more information about an error, try `rustc --explain E0038`.
|
||||
For more information about this error, try `rustc --explain E0391`.
|
||||
|
@ -22,6 +22,15 @@ note: lifetime declared here
|
||||
LL | fn a() -> impl Fn(&u8) -> (impl Debug + '_) {
|
||||
| ^
|
||||
|
||||
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: higher kinded lifetime bounds on nested opaque types are not supported yet
|
||||
--> $DIR/impl-fn-hrtb-bounds.rs:10:52
|
||||
|
|
||||
@ -34,6 +43,15 @@ note: lifetime declared here
|
||||
LL | fn b() -> impl for<'a> Fn(&'a u8) -> (impl Debug + 'a) {
|
||||
| ^^
|
||||
|
||||
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: higher kinded lifetime bounds on nested opaque types are not supported yet
|
||||
--> $DIR/impl-fn-hrtb-bounds.rs:16:52
|
||||
|
|
||||
@ -46,24 +64,6 @@ note: lifetime declared here
|
||||
LL | fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) {
|
||||
| ^^
|
||||
|
||||
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
|
||||
|
|
||||
|
@ -22,18 +22,6 @@ note: lifetime declared here
|
||||
LL | 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
|
||||
--> $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:25:45
|
||||
|
|
||||
LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
|
||||
| ^^
|
||||
|
||||
error: implementation of `Hrtb` is not general enough
|
||||
--> $DIR/issue-88236-2.rs:20:5
|
||||
|
|
||||
@ -52,6 +40,18 @@ LL | &()
|
||||
= 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: higher kinded lifetime bounds on nested opaque types are not supported yet
|
||||
--> $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:25:45
|
||||
|
|
||||
LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {
|
||||
| ^^
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/issue-88236-2.rs:27:5
|
||||
|
|
||||
|
@ -65,6 +65,15 @@ note: lifetime declared here
|
||||
LL | fn one_hrtb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'a> {}
|
||||
| ^^
|
||||
|
||||
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`
|
||||
|
||||
error: higher kinded lifetime bounds on nested opaque types are not supported yet
|
||||
--> $DIR/nested-rpit-hrtb.rs:36:73
|
||||
|
|
||||
@ -77,15 +86,6 @@ note: lifetime declared here
|
||||
LL | fn one_hrtb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl Qux<'a>> {}
|
||||
| ^^
|
||||
|
||||
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`
|
||||
|
||||
error[E0277]: the trait bound `for<'a> &'a (): Qux<'_>` is not satisfied
|
||||
--> $DIR/nested-rpit-hrtb.rs:36:64
|
||||
|
|
||||
|
@ -342,25 +342,6 @@ LL | let _in_return_in_local_variable = || -> impl Fn() { || {} };
|
||||
|
|
||||
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
|
||||
|
||||
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
|
||||
--> $DIR/where-allowed.rs:239:7
|
||||
|
|
||||
LL | impl <T = impl Debug> T {}
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
|
||||
= note: `#[deny(invalid_type_param_default)]` on by default
|
||||
|
||||
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
|
||||
--> $DIR/where-allowed.rs:246:36
|
||||
|
|
||||
LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
|
||||
|
||||
error[E0283]: type annotations needed
|
||||
--> $DIR/where-allowed.rs:46:57
|
||||
|
|
||||
@ -381,6 +362,16 @@ LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { pani
|
||||
- impl<Args, F, A> Fn<Args> for Box<F, A>
|
||||
where Args: Tuple, F: Fn<Args>, A: Allocator, F: ?Sized;
|
||||
|
||||
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
|
||||
--> $DIR/where-allowed.rs:239:7
|
||||
|
|
||||
LL | impl <T = impl Debug> T {}
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
|
||||
= note: `#[deny(invalid_type_param_default)]` on by default
|
||||
|
||||
error[E0118]: no nominal type found for inherent implementation
|
||||
--> $DIR/where-allowed.rs:239:1
|
||||
|
|
||||
@ -428,6 +419,15 @@ LL | type Out = impl Debug;
|
||||
|
|
||||
= note: `Out` must be used in combination with a concrete type within the same impl
|
||||
|
||||
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
|
||||
--> $DIR/where-allowed.rs:246:36
|
||||
|
|
||||
LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
|
||||
|
||||
error: aborting due to 50 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0053, E0118, E0283, E0562, E0599, E0658, E0666.
|
||||
|
@ -16,7 +16,7 @@ LL | trait T3 = T1 + T3;
|
||||
| ^^
|
||||
= note: ...which again requires computing the super predicates of `T1`, completing the cycle
|
||||
= note: trait aliases cannot be recursive
|
||||
note: cycle used when collecting item types in top-level module
|
||||
note: cycle used when checking that `T1` is well-formed
|
||||
--> $DIR/infinite-trait-alias-recursion.rs:3:1
|
||||
|
|
||||
LL | trait T1 = T2;
|
||||
|
@ -18,17 +18,11 @@ LL | type X3 = X1;
|
||||
= note: type aliases cannot be recursive
|
||||
= help: consider using a struct, enum, or union instead to break the cycle
|
||||
= help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information
|
||||
note: cycle used when collecting item types in top-level module
|
||||
--> $DIR/infinite-type-alias-mutual-recursion.rs:3:1
|
||||
note: cycle used when checking that `X1` is well-formed
|
||||
--> $DIR/infinite-type-alias-mutual-recursion.rs:6:1
|
||||
|
|
||||
LL | / #![cfg_attr(feature, feature(lazy_type_alias))]
|
||||
LL | | #![allow(incomplete_features)]
|
||||
LL | |
|
||||
LL | | type X1 = X2;
|
||||
... |
|
||||
LL | |
|
||||
LL | | fn main() {}
|
||||
| |____________^
|
||||
LL | type X1 = X2;
|
||||
| ^^^^^^^
|
||||
= 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 1 previous error
|
||||
|
@ -8,17 +8,11 @@ LL | type X = Vec<X>;
|
||||
= note: type aliases cannot be recursive
|
||||
= help: consider using a struct, enum, or union instead to break the cycle
|
||||
= help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information
|
||||
note: cycle used when collecting item types in top-level module
|
||||
--> $DIR/infinite-vec-type-recursion.rs:3:1
|
||||
note: cycle used when checking that `X` is well-formed
|
||||
--> $DIR/infinite-vec-type-recursion.rs:6:1
|
||||
|
|
||||
LL | / #![cfg_attr(feature, feature(lazy_type_alias))]
|
||||
LL | | #![allow(incomplete_features)]
|
||||
LL | |
|
||||
LL | | type X = Vec<X>;
|
||||
... |
|
||||
LL | | #[rustfmt::skip]
|
||||
LL | | fn main() { let b: X = Vec::new(); }
|
||||
| |____________________________________^
|
||||
LL | type X = Vec<X>;
|
||||
| ^^^^^^
|
||||
= 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 1 previous error
|
||||
|
@ -10,15 +10,11 @@ note: ...which requires const-evaluating + checking `X::A::{constant#0}`...
|
||||
LL | A = X::A as isize,
|
||||
| ^^^^^^^^^^^^^
|
||||
= note: ...which again requires simplifying constant for the type system `X::A::{constant#0}`, completing the cycle
|
||||
note: cycle used when collecting item types in top-level module
|
||||
note: cycle used when checking that `X` is well-formed
|
||||
--> $DIR/issue-23302-1.rs:3:1
|
||||
|
|
||||
LL | / enum X {
|
||||
LL | | A = X::A as isize,
|
||||
LL | | }
|
||||
LL | |
|
||||
LL | | fn main() { }
|
||||
| |_____________^
|
||||
LL | enum X {
|
||||
| ^^^^^^
|
||||
= 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 1 previous error
|
||||
|
@ -10,16 +10,11 @@ note: ...which requires const-evaluating + checking `Y::A::{constant#0}`...
|
||||
LL | A = Y::B as isize,
|
||||
| ^^^^^^^^^^^^^
|
||||
= note: ...which again requires simplifying constant for the type system `Y::A::{constant#0}`, completing the cycle
|
||||
note: cycle used when collecting item types in top-level module
|
||||
note: cycle used when checking that `Y` is well-formed
|
||||
--> $DIR/issue-23302-2.rs:3:1
|
||||
|
|
||||
LL | / enum Y {
|
||||
LL | | A = Y::B as isize,
|
||||
LL | | B,
|
||||
LL | | }
|
||||
LL | |
|
||||
LL | | fn main() { }
|
||||
| |_____________^
|
||||
LL | enum Y {
|
||||
| ^^^^^^
|
||||
= 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 1 previous error
|
||||
|
@ -10,17 +10,11 @@ note: ...which requires expanding type alias `DefaultFoo`...
|
||||
LL | type DefaultFoo = Foo;
|
||||
| ^^^
|
||||
= note: ...which again requires computing type of `Foo::T`, completing the cycle
|
||||
note: cycle used when collecting item types in top-level module
|
||||
--> $DIR/issue-34373.rs:1:1
|
||||
note: cycle used when checking that `Foo` is well-formed
|
||||
--> $DIR/issue-34373.rs:7:1
|
||||
|
|
||||
LL | / #![allow(warnings)]
|
||||
LL | |
|
||||
LL | | trait Trait<T> {
|
||||
LL | | fn foo(_: T) {}
|
||||
... |
|
||||
LL | | fn main() {
|
||||
LL | | }
|
||||
| |_^
|
||||
LL | pub struct Foo<T = Box<Trait<DefaultFoo>>>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= 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[E0038]: the trait `Trait` cannot be made into an object
|
||||
|
@ -32,12 +32,6 @@ help: parenthesized trait syntax expands to `Fn<(&isize,), Output=()>`
|
||||
LL | impl Fn(&isize) for Error {
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error[E0220]: associated type `B` not found for `Self`
|
||||
--> $DIR/issue-95023.rs:8:44
|
||||
|
|
||||
LL | fn foo<const N: usize>(&self) -> Self::B<{ N }>;
|
||||
| ^ help: `Self` has the following associated type: `Output`
|
||||
|
||||
error[E0277]: expected a `FnMut(&isize)` closure, found `Error`
|
||||
--> $DIR/issue-95023.rs:3:21
|
||||
|
|
||||
@ -56,6 +50,12 @@ LL | impl Fn(&isize) for Error {
|
||||
|
|
||||
= help: implement the missing item: `fn call(&self, _: (&isize,)) -> <Self as FnOnce<(&isize,)>>::Output { todo!() }`
|
||||
|
||||
error[E0220]: associated type `B` not found for `Self`
|
||||
--> $DIR/issue-95023.rs:8:44
|
||||
|
|
||||
LL | fn foo<const N: usize>(&self) -> Self::B<{ N }>;
|
||||
| ^ help: `Self` has the following associated type: `Output`
|
||||
|
||||
error[E0220]: associated type `B` not found for `Self`
|
||||
--> $DIR/issue-95023.rs:8:44
|
||||
|
|
||||
|
@ -25,22 +25,6 @@ help: consider using one of the available lifetimes here
|
||||
LL | type C<'a, 'b> = <A<'a> as Trait<'lifetime>>::Bar;
|
||||
| +++++++++++
|
||||
|
||||
error[E0107]: missing generics for associated type `Trait::Bar`
|
||||
--> $DIR/missing-lifetime-in-alias.rs:27:36
|
||||
|
|
||||
LL | type C<'a, 'b> = <A<'a> as Trait>::Bar;
|
||||
| ^^^ expected 1 lifetime argument
|
||||
|
|
||||
note: associated type defined here, with 1 lifetime parameter: `'b`
|
||||
--> $DIR/missing-lifetime-in-alias.rs:4:10
|
||||
|
|
||||
LL | type Bar<'b>
|
||||
| ^^^ --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | type C<'a, 'b> = <A<'a> as Trait>::Bar<'a>;
|
||||
| ++++
|
||||
|
||||
error[E0477]: the type `Impl<'a>` does not fulfill the required lifetime
|
||||
--> $DIR/missing-lifetime-in-alias.rs:16:20
|
||||
|
|
||||
@ -60,6 +44,22 @@ help: copy the `where` clause predicates from the trait
|
||||
LL | type Bar<'b> = &'b () where Self: 'b;
|
||||
| ++++++++++++++
|
||||
|
||||
error[E0107]: missing generics for associated type `Trait::Bar`
|
||||
--> $DIR/missing-lifetime-in-alias.rs:27:36
|
||||
|
|
||||
LL | type C<'a, 'b> = <A<'a> as Trait>::Bar;
|
||||
| ^^^ expected 1 lifetime argument
|
||||
|
|
||||
note: associated type defined here, with 1 lifetime parameter: `'b`
|
||||
--> $DIR/missing-lifetime-in-alias.rs:4:10
|
||||
|
|
||||
LL | type Bar<'b>
|
||||
| ^^^ --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | type C<'a, 'b> = <A<'a> as Trait>::Bar<'a>;
|
||||
| ++++
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0106, E0107, E0477.
|
||||
|
@ -1,21 +1,3 @@
|
||||
error[E0038]: the trait `Baz` cannot be made into an object
|
||||
--> $DIR/object-safety-supertrait-mentions-Self.rs:16:31
|
||||
|
|
||||
LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
|
||||
| ^^^^^^^ `Baz` 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/object-safety-supertrait-mentions-Self.rs:8:13
|
||||
|
|
||||
LL | trait Baz : Bar<Self> {
|
||||
| --- ^^^^^^^^^ ...because it uses `Self` as a type parameter
|
||||
| |
|
||||
| this trait cannot be made into an object...
|
||||
help: consider using an opaque type instead
|
||||
|
|
||||
LL | fn make_baz<T:Baz>(t: &T) -> &impl Baz {
|
||||
| ~~~~
|
||||
|
||||
error[E0277]: the size for values of type `Self` cannot be known at compilation time
|
||||
--> $DIR/object-safety-supertrait-mentions-Self.rs:8:13
|
||||
|
|
||||
@ -36,6 +18,24 @@ help: consider relaxing the implicit `Sized` restriction
|
||||
LL | trait Bar<T: ?Sized> {
|
||||
| ++++++++
|
||||
|
||||
error[E0038]: the trait `Baz` cannot be made into an object
|
||||
--> $DIR/object-safety-supertrait-mentions-Self.rs:16:31
|
||||
|
|
||||
LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
|
||||
| ^^^^^^^ `Baz` 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/object-safety-supertrait-mentions-Self.rs:8:13
|
||||
|
|
||||
LL | trait Baz : Bar<Self> {
|
||||
| --- ^^^^^^^^^ ...because it uses `Self` as a type parameter
|
||||
| |
|
||||
| this trait cannot be made into an object...
|
||||
help: consider using an opaque type instead
|
||||
|
|
||||
LL | fn make_baz<T:Baz>(t: &T) -> &impl Baz {
|
||||
| ~~~~
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0038, E0277.
|
||||
|
@ -14,6 +14,20 @@ LL | impl Tr for S<Self> {}
|
||||
|
|
||||
= note: replace `Self` with a different type
|
||||
|
||||
error[E0391]: cycle detected when computing trait implemented by `<impl at $DIR/resolve-self-in-impl.rs:19:1: 19:23>`
|
||||
--> $DIR/resolve-self-in-impl.rs:19:1
|
||||
|
|
||||
LL | impl Tr<Self::A> for S {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: ...which immediately requires computing trait implemented by `<impl at $DIR/resolve-self-in-impl.rs:19:1: 19:23>` again
|
||||
note: cycle used when building specialization graph of trait `Tr`
|
||||
--> $DIR/resolve-self-in-impl.rs:4:1
|
||||
|
|
||||
LL | trait Tr<T = u8> {
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
= 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: `Self` is not valid in the self type of an impl block
|
||||
--> $DIR/resolve-self-in-impl.rs:16:6
|
||||
|
|
||||
@ -38,26 +52,6 @@ LL | impl (Self, Self) {}
|
||||
|
|
||||
= note: replace `Self` with a different type
|
||||
|
||||
error[E0391]: cycle detected when computing trait implemented by `<impl at $DIR/resolve-self-in-impl.rs:19:1: 19:23>`
|
||||
--> $DIR/resolve-self-in-impl.rs:19:1
|
||||
|
|
||||
LL | impl Tr<Self::A> for S {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: ...which immediately requires computing trait implemented by `<impl at $DIR/resolve-self-in-impl.rs:19:1: 19:23>` again
|
||||
note: cycle used when collecting item types in top-level module
|
||||
--> $DIR/resolve-self-in-impl.rs:1:1
|
||||
|
|
||||
LL | / #![feature(associated_type_defaults)]
|
||||
LL | |
|
||||
LL | | struct S<T = u8>(T);
|
||||
LL | | trait Tr<T = u8> {
|
||||
... |
|
||||
LL | |
|
||||
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 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0391`.
|
||||
|
@ -1,12 +1,3 @@
|
||||
error: `#[target_feature(..)]` cannot be applied to safe trait method
|
||||
--> $DIR/trait-impl.rs:22:5
|
||||
|
|
||||
LL | #[target_feature(enable = "sse2")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method
|
||||
LL |
|
||||
LL | fn foo(&self) {}
|
||||
| ------------- not an `unsafe` function
|
||||
|
||||
error: `#[target_feature(..)]` cannot be applied to safe trait method
|
||||
--> $DIR/trait-impl.rs:13:5
|
||||
|
|
||||
@ -16,5 +7,14 @@ LL |
|
||||
LL | fn foo(&self) {}
|
||||
| ------------- not an `unsafe` function
|
||||
|
||||
error: `#[target_feature(..)]` cannot be applied to safe trait method
|
||||
--> $DIR/trait-impl.rs:22:5
|
||||
|
|
||||
LL | #[target_feature(enable = "sse2")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method
|
||||
LL |
|
||||
LL | fn foo(&self) {}
|
||||
| ------------- not an `unsafe` function
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -13,6 +13,15 @@ LL | impl const Default for A {
|
||||
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
|
||||
= note: adding a non-const method body in the future would be a breaking change
|
||||
|
||||
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
|
||||
--> $DIR/derive-const-use.rs:7:6
|
||||
|
|
||||
LL | impl const Default for A {
|
||||
| ^^^^^ unconstrained const parameter
|
||||
|
|
||||
= note: expressions using a const parameter must map each value to a distinct output value
|
||||
= note: proving the result of expressions other than the parameter are unique is not supported
|
||||
|
||||
error: const `impl` for trait `Default` which is not marked with `#[const_trait]`
|
||||
--> $DIR/derive-const-use.rs:15:16
|
||||
|
|
||||
@ -23,15 +32,6 @@ LL | #[derive_const(Default, PartialEq)]
|
||||
= note: adding a non-const method body in the future would be a breaking change
|
||||
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
|
||||
--> $DIR/derive-const-use.rs:7:6
|
||||
|
|
||||
LL | impl const Default for A {
|
||||
| ^^^^^ unconstrained const parameter
|
||||
|
|
||||
= note: expressions using a const parameter must map each value to a distinct output value
|
||||
= note: proving the result of expressions other than the parameter are unique is not supported
|
||||
|
||||
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
|
||||
|
|
||||
= note: expressions using a const parameter must map each value to a distinct output value
|
||||
|
@ -24,12 +24,6 @@ LL | trait Bar: ~const Foo {}
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/super-traits-fail-3.rs:18:24
|
||||
|
|
||||
LL | const fn foo<T: ~const Bar>(x: &T) {
|
||||
| ^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/super-traits-fail-3.rs:12:19
|
||||
|
|
||||
@ -38,5 +32,11 @@ LL | trait Bar: ~const Foo {}
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/super-traits-fail-3.rs:18:24
|
||||
|
|
||||
LL | const fn foo<T: ~const Bar>(x: &T) {
|
||||
| ^^^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
@ -262,16 +262,6 @@ LL | const CONSTANT<T: ~const Trait>: () = ();
|
||||
= help: add `#![feature(generic_const_items)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: inherent associated types are unstable
|
||||
--> $DIR/tilde-const-invalid-places.rs:44:5
|
||||
|
|
||||
LL | type Type<T: ~const Trait> = ();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= 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
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0392]: type parameter `T` is never used
|
||||
--> $DIR/tilde-const-invalid-places.rs:11:19
|
||||
|
|
||||
@ -304,6 +294,16 @@ note: required by a bound in `NonConstTrait::Type`
|
||||
LL | type Type<T: ~const Trait>: ~const Trait;
|
||||
| ^^^^^^^^^^^^ required by this bound in `NonConstTrait::Type`
|
||||
|
||||
error[E0658]: inherent associated types are unstable
|
||||
--> $DIR/tilde-const-invalid-places.rs:44:5
|
||||
|
|
||||
LL | type Type<T: ~const Trait> = ();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= 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
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 30 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0275, E0392, E0658, E0740.
|
||||
|
@ -7,6 +7,7 @@ impl<T: Clone, Add> Add for Foo<T> {
|
||||
type Output = usize;
|
||||
|
||||
fn add(self, rhs: Self) -> Self::Output {
|
||||
//~^ ERROR ambiguous associated type
|
||||
unimplemented!();
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,20 @@ LL | impl<T: Clone, Add> Add for Foo<T> {
|
||||
| |
|
||||
| found this type parameter
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/issue-35987.rs:9:32
|
||||
|
|
||||
LL | fn add(self, rhs: Self) -> Self::Output {
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
help: use fully-qualified syntax
|
||||
|
|
||||
LL | fn add(self, rhs: Self) -> <Foo<T> as BitOr>::Output {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
LL | fn add(self, rhs: Self) -> <Foo<T> as IntoFuture>::Output {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
For more information about this error, try `rustc --explain E0404`.
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0223, E0404.
|
||||
For more information about an error, try `rustc --explain E0223`.
|
||||
|
@ -150,6 +150,14 @@ help: consider introducing a named lifetime parameter
|
||||
LL | fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&()> { x.next() }
|
||||
| ++++ ++
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/impl-trait-missing-lifetime-gated.rs:19:67
|
||||
|
|
||||
LL | async fn i(mut x: impl Iterator<Item = &()>) -> Option<&()> { x.next() }
|
||||
| ----------------------------------------------------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static`
|
||||
| |
|
||||
| return type `impl Future<Output = Option<&'static ()>>` contains a lifetime `'1`
|
||||
|
||||
error[E0658]: anonymous lifetimes in `impl Trait` are unstable
|
||||
--> $DIR/impl-trait-missing-lifetime-gated.rs:25:35
|
||||
|
|
||||
@ -176,6 +184,14 @@ help: consider introducing a named lifetime parameter
|
||||
LL | fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'_ ()> { x.next() }
|
||||
| ++++ ~~
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/impl-trait-missing-lifetime-gated.rs:38:73
|
||||
|
|
||||
LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
|
||||
| ----------------------------------------------------------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static`
|
||||
| |
|
||||
| return type `impl Future<Output = Option<&'static ()>>` contains a lifetime `'1`
|
||||
|
||||
error[E0658]: anonymous lifetimes in `impl Trait` are unstable
|
||||
--> $DIR/impl-trait-missing-lifetime-gated.rs:46:18
|
||||
|
|
||||
@ -228,22 +244,6 @@ help: consider introducing a named lifetime parameter
|
||||
LL | fn g<'a>(mut x: impl Foo<'a, ()>) -> Option<&()> { x.next() }
|
||||
| ++++ +++
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/impl-trait-missing-lifetime-gated.rs:19:67
|
||||
|
|
||||
LL | async fn i(mut x: impl Iterator<Item = &()>) -> Option<&()> { x.next() }
|
||||
| ----------------------------------------------------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static`
|
||||
| |
|
||||
| return type `impl Future<Output = Option<&'static ()>>` contains a lifetime `'1`
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/impl-trait-missing-lifetime-gated.rs:38:73
|
||||
|
|
||||
LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
|
||||
| ----------------------------------------------------------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static`
|
||||
| |
|
||||
| return type `impl Future<Output = Option<&'static ()>>` contains a lifetime `'1`
|
||||
|
||||
error: aborting due to 16 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0106, E0658.
|
||||
|
@ -1,40 +1,3 @@
|
||||
error[E0782]: trait objects must include the `dyn` keyword
|
||||
--> $DIR/suggest-blanket-impl-local-trait.rs:13:24
|
||||
|
|
||||
LL | impl LocalTraitTwo for LocalTraitOne {}
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
help: add `dyn` keyword before this trait
|
||||
|
|
||||
LL | impl LocalTraitTwo for dyn LocalTraitOne {}
|
||||
| +++
|
||||
help: alternatively use a blanket implementation to implement `LocalTraitTwo` for all types that also implement `LocalTraitOne`
|
||||
|
|
||||
LL | impl<T: LocalTraitOne> LocalTraitTwo for T {}
|
||||
| ++++++++++++++++++ ~
|
||||
|
||||
error[E0782]: trait objects must include the `dyn` keyword
|
||||
--> $DIR/suggest-blanket-impl-local-trait.rs:18:23
|
||||
|
|
||||
LL | impl fmt::Display for LocalTraitOne {
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
help: add `dyn` keyword before this trait
|
||||
|
|
||||
LL | impl fmt::Display for dyn LocalTraitOne {
|
||||
| +++
|
||||
|
||||
error[E0782]: trait objects must include the `dyn` keyword
|
||||
--> $DIR/suggest-blanket-impl-local-trait.rs:26:23
|
||||
|
|
||||
LL | impl fmt::Display for LocalTraitTwo + Send {
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: add `dyn` keyword before this trait
|
||||
|
|
||||
LL | impl fmt::Display for dyn LocalTraitTwo + Send {
|
||||
| +++
|
||||
|
||||
error[E0782]: trait objects must include the `dyn` keyword
|
||||
--> $DIR/suggest-blanket-impl-local-trait.rs:34:24
|
||||
|
|
||||
@ -65,6 +28,21 @@ help: alternatively use a blanket implementation to implement `LocalTraitOne` fo
|
||||
LL | impl<T: fmt::Display + Send> LocalTraitOne for T {}
|
||||
| ++++++++++++++++++++++++ ~
|
||||
|
||||
error[E0782]: trait objects must include the `dyn` keyword
|
||||
--> $DIR/suggest-blanket-impl-local-trait.rs:13:24
|
||||
|
|
||||
LL | impl LocalTraitTwo for LocalTraitOne {}
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
help: add `dyn` keyword before this trait
|
||||
|
|
||||
LL | impl LocalTraitTwo for dyn LocalTraitOne {}
|
||||
| +++
|
||||
help: alternatively use a blanket implementation to implement `LocalTraitTwo` for all types that also implement `LocalTraitOne`
|
||||
|
|
||||
LL | impl<T: LocalTraitOne> LocalTraitTwo for T {}
|
||||
| ++++++++++++++++++ ~
|
||||
|
||||
error[E0782]: trait objects must include the `dyn` keyword
|
||||
--> $DIR/suggest-blanket-impl-local-trait.rs:46:29
|
||||
|
|
||||
@ -80,6 +58,28 @@ help: alternatively use a blanket implementation to implement `GenericTrait<E>`
|
||||
LL | impl<E, T: LocalTraitOne> GenericTrait<E> for T {}
|
||||
| ++++++++++++++++++ ~
|
||||
|
||||
error[E0782]: trait objects must include the `dyn` keyword
|
||||
--> $DIR/suggest-blanket-impl-local-trait.rs:18:23
|
||||
|
|
||||
LL | impl fmt::Display for LocalTraitOne {
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
help: add `dyn` keyword before this trait
|
||||
|
|
||||
LL | impl fmt::Display for dyn LocalTraitOne {
|
||||
| +++
|
||||
|
||||
error[E0782]: trait objects must include the `dyn` keyword
|
||||
--> $DIR/suggest-blanket-impl-local-trait.rs:26:23
|
||||
|
|
||||
LL | impl fmt::Display for LocalTraitTwo + Send {
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: add `dyn` keyword before this trait
|
||||
|
|
||||
LL | impl fmt::Display for dyn LocalTraitTwo + Send {
|
||||
| +++
|
||||
|
||||
error[E0782]: trait objects must include the `dyn` keyword
|
||||
--> $DIR/suggest-blanket-impl-local-trait.rs:53:35
|
||||
|
|
||||
|
@ -3,9 +3,12 @@
|
||||
pub trait Trait<'a, T> {}
|
||||
|
||||
pub struct Struct<T>;
|
||||
//~^ ERROR `T` is never used
|
||||
pub enum Enum<T> {}
|
||||
//~^ ERROR `T` is never used
|
||||
|
||||
pub union Union<T> {
|
||||
//~^ ERROR `T` is never used
|
||||
f1: usize,
|
||||
}
|
||||
|
||||
@ -15,8 +18,10 @@ impl<'a, T> Struct<T> for Trait<'a, T> {}
|
||||
|
||||
impl<'a, T> Enum<T> for Trait<'a, T> {}
|
||||
//~^ ERROR expected trait, found enum `Enum`
|
||||
//~| ERROR trait objects must include the `dyn` keyword
|
||||
|
||||
impl<'a, T> Union<T> for Trait<'a, T> {}
|
||||
//~^ ERROR expected trait, found union `Union`
|
||||
//~| ERROR trait objects must include the `dyn` keyword
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0404]: expected trait, found struct `Struct`
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:12:13
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:15:13
|
||||
|
|
||||
LL | impl<'a, T> Struct<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^^ not a trait
|
||||
@ -10,7 +10,7 @@ LL | impl<'a, T> Trait<'a, T> for Struct<T> {}
|
||||
| ~~~~~~~~~~~~ ~~~~~~~~~
|
||||
|
||||
error[E0404]: expected trait, found enum `Enum`
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:16:13
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:19:13
|
||||
|
|
||||
LL | impl<'a, T> Enum<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^ not a trait
|
||||
@ -21,7 +21,7 @@ LL | impl<'a, T> Trait<'a, T> for Enum<T> {}
|
||||
| ~~~~~~~~~~~~ ~~~~~~~
|
||||
|
||||
error[E0404]: expected trait, found union `Union`
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:19:13
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:23:13
|
||||
|
|
||||
LL | impl<'a, T> Union<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^ not a trait
|
||||
@ -31,8 +31,35 @@ help: `impl` items mention the trait being implemented first and the type it is
|
||||
LL | impl<'a, T> Trait<'a, T> for Union<T> {}
|
||||
| ~~~~~~~~~~~~ ~~~~~~~~
|
||||
|
||||
error[E0392]: type parameter `T` is never used
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:5:19
|
||||
|
|
||||
LL | pub struct Struct<T>;
|
||||
| ^ unused type parameter
|
||||
|
|
||||
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
|
||||
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
|
||||
|
||||
error[E0392]: type parameter `T` is never used
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:7:15
|
||||
|
|
||||
LL | pub enum Enum<T> {}
|
||||
| ^ unused type parameter
|
||||
|
|
||||
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
|
||||
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
|
||||
|
||||
error[E0392]: type parameter `T` is never used
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:10:17
|
||||
|
|
||||
LL | pub union Union<T> {
|
||||
| ^ unused type parameter
|
||||
|
|
||||
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
|
||||
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
|
||||
|
||||
error[E0782]: trait objects must include the `dyn` keyword
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:12:27
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:15:27
|
||||
|
|
||||
LL | impl<'a, T> Struct<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^^^^^
|
||||
@ -42,7 +69,29 @@ help: add `dyn` keyword before this trait
|
||||
LL | impl<'a, T> Struct<T> for dyn Trait<'a, T> {}
|
||||
| +++
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error[E0782]: trait objects must include the `dyn` keyword
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:19:25
|
||||
|
|
||||
LL | impl<'a, T> Enum<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
help: add `dyn` keyword before this trait
|
||||
|
|
||||
LL | impl<'a, T> Enum<T> for dyn Trait<'a, T> {}
|
||||
| +++
|
||||
|
||||
Some errors have detailed explanations: E0404, E0782.
|
||||
For more information about an error, try `rustc --explain E0404`.
|
||||
error[E0782]: trait objects must include the `dyn` keyword
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:23:26
|
||||
|
|
||||
LL | impl<'a, T> Union<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
help: add `dyn` keyword before this trait
|
||||
|
|
||||
LL | impl<'a, T> Union<T> for dyn Trait<'a, T> {}
|
||||
| +++
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0392, E0404, E0782.
|
||||
For more information about an error, try `rustc --explain E0392`.
|
||||
|
@ -1,9 +1,12 @@
|
||||
pub trait Trait<'a, T> {}
|
||||
|
||||
pub struct Struct<T>;
|
||||
//~^ ERROR `T` is never used
|
||||
pub enum Enum<T> {}
|
||||
//~^ ERROR `T` is never used
|
||||
|
||||
pub union Union<T> {
|
||||
//~^ ERROR `T` is never used
|
||||
f1: usize,
|
||||
}
|
||||
|
||||
@ -14,8 +17,12 @@ impl<'a, T> Struct<T> for Trait<'a, T> {}
|
||||
|
||||
impl<'a, T> Enum<T> for Trait<'a, T> {}
|
||||
//~^ ERROR expected trait, found enum `Enum`
|
||||
//~| WARNING trait objects without an explicit `dyn` are deprecated
|
||||
//~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
|
||||
impl<'a, T> Union<T> for Trait<'a, T> {}
|
||||
//~^ ERROR expected trait, found union `Union`
|
||||
//~| WARNING trait objects without an explicit `dyn` are deprecated
|
||||
//~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0404]: expected trait, found struct `Struct`
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:10:13
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:13:13
|
||||
|
|
||||
LL | impl<'a, T> Struct<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^^ not a trait
|
||||
@ -10,7 +10,7 @@ LL | impl<'a, T> Trait<'a, T> for Struct<T> {}
|
||||
| ~~~~~~~~~~~~ ~~~~~~~~~
|
||||
|
||||
error[E0404]: expected trait, found enum `Enum`
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:15:13
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:18:13
|
||||
|
|
||||
LL | impl<'a, T> Enum<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^ not a trait
|
||||
@ -21,7 +21,7 @@ LL | impl<'a, T> Trait<'a, T> for Enum<T> {}
|
||||
| ~~~~~~~~~~~~ ~~~~~~~
|
||||
|
||||
error[E0404]: expected trait, found union `Union`
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:18:13
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:23:13
|
||||
|
|
||||
LL | impl<'a, T> Union<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^ not a trait
|
||||
@ -31,8 +31,35 @@ help: `impl` items mention the trait being implemented first and the type it is
|
||||
LL | impl<'a, T> Trait<'a, T> for Union<T> {}
|
||||
| ~~~~~~~~~~~~ ~~~~~~~~
|
||||
|
||||
error[E0392]: type parameter `T` is never used
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:3:19
|
||||
|
|
||||
LL | pub struct Struct<T>;
|
||||
| ^ unused type parameter
|
||||
|
|
||||
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
|
||||
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
|
||||
|
||||
error[E0392]: type parameter `T` is never used
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:5:15
|
||||
|
|
||||
LL | pub enum Enum<T> {}
|
||||
| ^ unused type parameter
|
||||
|
|
||||
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
|
||||
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
|
||||
|
||||
error[E0392]: type parameter `T` is never used
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:8:17
|
||||
|
|
||||
LL | pub union Union<T> {
|
||||
| ^ unused type parameter
|
||||
|
|
||||
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
|
||||
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
|
||||
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:10:27
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:13:27
|
||||
|
|
||||
LL | impl<'a, T> Struct<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^^^^^
|
||||
@ -45,6 +72,33 @@ help: if this is an object-safe trait, use `dyn`
|
||||
LL | impl<'a, T> Struct<T> for dyn Trait<'a, T> {}
|
||||
| +++
|
||||
|
||||
error: aborting due to 3 previous errors; 1 warning emitted
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:18:25
|
||||
|
|
||||
LL | impl<'a, T> Enum<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
|
||||
help: if this is an object-safe trait, use `dyn`
|
||||
|
|
||||
LL | impl<'a, T> Enum<T> for dyn Trait<'a, T> {}
|
||||
| +++
|
||||
|
||||
For more information about this error, try `rustc --explain E0404`.
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/suggest-swapping-self-ty-and-trait.rs:23:26
|
||||
|
|
||||
LL | impl<'a, T> Union<T> for Trait<'a, T> {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
|
||||
help: if this is an object-safe trait, use `dyn`
|
||||
|
|
||||
LL | impl<'a, T> Union<T> for dyn Trait<'a, T> {}
|
||||
| +++
|
||||
|
||||
error: aborting due to 6 previous errors; 3 warnings emitted
|
||||
|
||||
Some errors have detailed explanations: E0392, E0404.
|
||||
For more information about an error, try `rustc --explain E0392`.
|
||||
|
@ -1,3 +1,12 @@
|
||||
error[E0392]: type parameter `T` is never used
|
||||
--> $DIR/tag-type-args.rs:1:11
|
||||
|
|
||||
LL | enum Quux<T> { Bar }
|
||||
| ^ unused type parameter
|
||||
|
|
||||
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
|
||||
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
|
||||
|
||||
error[E0107]: missing generics for enum `Quux`
|
||||
--> $DIR/tag-type-args.rs:4:11
|
||||
|
|
||||
@ -14,15 +23,6 @@ help: add missing generic argument
|
||||
LL | fn foo(c: Quux<T>) { assert!((false)); }
|
||||
| +++
|
||||
|
||||
error[E0392]: type parameter `T` is never used
|
||||
--> $DIR/tag-type-args.rs:1:11
|
||||
|
|
||||
LL | enum Quux<T> { Bar }
|
||||
| ^ unused type parameter
|
||||
|
|
||||
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
|
||||
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0107, E0392.
|
||||
|
@ -183,6 +183,15 @@ error: cannot use `#[inline(always)]` with `#[target_feature]`
|
||||
LL | #[inline(always)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0046]: not all trait items implemented, missing: `foo`
|
||||
--> $DIR/invalid-attribute.rs:88:1
|
||||
|
|
||||
LL | impl Quux for u8 {}
|
||||
| ^^^^^^^^^^^^^^^^ missing `foo` in implementation
|
||||
...
|
||||
LL | fn foo();
|
||||
| --------- `foo` from trait
|
||||
|
||||
error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions
|
||||
--> $DIR/invalid-attribute.rs:103:5
|
||||
|
|
||||
@ -196,15 +205,6 @@ LL | fn foo() {}
|
||||
= help: add `#![feature(target_feature_11)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0046]: not all trait items implemented, missing: `foo`
|
||||
--> $DIR/invalid-attribute.rs:88:1
|
||||
|
|
||||
LL | impl Quux for u8 {}
|
||||
| ^^^^^^^^^^^^^^^^ missing `foo` in implementation
|
||||
...
|
||||
LL | fn foo();
|
||||
| --------- `foo` from trait
|
||||
|
||||
error: aborting due to 23 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0046, E0658.
|
||||
|
@ -1,3 +1,9 @@
|
||||
error[E0207]: the type parameter `S` is not constrained by the impl trait, self type, or predicates
|
||||
--> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:9:9
|
||||
|
|
||||
LL | impl<T, S> Trait<T> for i32 {
|
||||
| ^ unconstrained type parameter
|
||||
|
||||
error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
|
||||
--> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:15:12
|
||||
|
|
||||
@ -10,6 +16,12 @@ note: trait defined here, with 1 generic parameter: `T`
|
||||
LL | pub trait Trait<T> {
|
||||
| ^^^^^ -
|
||||
|
||||
error[E0207]: the type parameter `S` is not constrained by the impl trait, self type, or predicates
|
||||
--> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:15:9
|
||||
|
|
||||
LL | impl<T, S> Trait<T, S> for () {}
|
||||
| ^ unconstrained type parameter
|
||||
|
||||
error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
|
||||
--> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:20:12
|
||||
|
|
||||
@ -42,6 +54,12 @@ help: replace the generic bound with the associated type
|
||||
LL | fn func<T: Trait<u32, String>>(t: T) -> impl Trait<(), Assoc = i32> {
|
||||
| +++++++
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:20:41
|
||||
|
|
||||
LL | fn func<T: Trait<u32, String>>(t: T) -> impl Trait<(), i32> {
|
||||
| ^^^^^^^^^^^^^^^^^^^ cannot infer type
|
||||
|
||||
error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
|
||||
--> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:27:18
|
||||
|
|
||||
@ -104,24 +122,6 @@ note: struct defined here, with 1 generic parameter: `T`
|
||||
LL | struct Struct<T: Trait<u32, String>> {
|
||||
| ^^^^^^ -
|
||||
|
||||
error[E0207]: the type parameter `S` is not constrained by the impl trait, self type, or predicates
|
||||
--> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:9:9
|
||||
|
|
||||
LL | impl<T, S> Trait<T> for i32 {
|
||||
| ^ unconstrained type parameter
|
||||
|
||||
error[E0207]: the type parameter `S` is not constrained by the impl trait, self type, or predicates
|
||||
--> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:15:9
|
||||
|
|
||||
LL | impl<T, S> Trait<T, S> for () {}
|
||||
| ^ unconstrained type parameter
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:20:41
|
||||
|
|
||||
LL | fn func<T: Trait<u32, String>>(t: T) -> impl Trait<(), i32> {
|
||||
| ^^^^^^^^^^^^^^^^^^^ cannot infer type
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0107, E0207, E0282.
|
||||
|
@ -1,3 +1,23 @@
|
||||
error[E0277]: the size for values of type `Self` cannot be known at compilation time
|
||||
--> $DIR/issue-28576.rs:5:16
|
||||
|
|
||||
LL | pub trait Bar: Foo<Assoc=()> {
|
||||
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
note: required by an implicit `Sized` bound in `Foo`
|
||||
--> $DIR/issue-28576.rs:1:15
|
||||
|
|
||||
LL | pub trait Foo<RHS=Self> {
|
||||
| ^^^^^^^^ required by the implicit `Sized` requirement on this type parameter in `Foo`
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | pub trait Bar: Foo<Assoc=()> + Sized {
|
||||
| +++++++
|
||||
help: consider relaxing the implicit `Sized` restriction
|
||||
|
|
||||
LL | pub trait Foo<RHS: ?Sized=Self> {
|
||||
| ++++++++
|
||||
|
||||
error[E0038]: the trait `Bar` cannot be made into an object
|
||||
--> $DIR/issue-28576.rs:9:12
|
||||
|
|
||||
@ -19,26 +39,6 @@ help: consider using an opaque type instead
|
||||
LL | impl Bar
|
||||
| ~~~~
|
||||
|
||||
error[E0277]: the size for values of type `Self` cannot be known at compilation time
|
||||
--> $DIR/issue-28576.rs:5:16
|
||||
|
|
||||
LL | pub trait Bar: Foo<Assoc=()> {
|
||||
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
note: required by an implicit `Sized` bound in `Foo`
|
||||
--> $DIR/issue-28576.rs:1:15
|
||||
|
|
||||
LL | pub trait Foo<RHS=Self> {
|
||||
| ^^^^^^^^ required by the implicit `Sized` requirement on this type parameter in `Foo`
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | pub trait Bar: Foo<Assoc=()> + Sized {
|
||||
| +++++++
|
||||
help: consider relaxing the implicit `Sized` restriction
|
||||
|
|
||||
LL | pub trait Foo<RHS: ?Sized=Self> {
|
||||
| ++++++++
|
||||
|
||||
error[E0277]: the size for values of type `Self` cannot be known at compilation time
|
||||
--> $DIR/issue-28576.rs:5:16
|
||||
|
|
||||
|
@ -1,5 +1,6 @@
|
||||
trait A: B + A {}
|
||||
//~^ ERROR cycle detected when computing the super predicates of `A` [E0391]
|
||||
//~| ERROR cycle detected when computing the implied predicates of `A` [E0391]
|
||||
|
||||
trait B {}
|
||||
|
||||
|
@ -5,13 +5,27 @@ LL | trait A: B + A {}
|
||||
| ^
|
||||
|
|
||||
= note: ...which immediately requires computing the super predicates of `A` again
|
||||
note: cycle used when collecting item types in top-level module
|
||||
note: cycle used when checking that `A` is well-formed
|
||||
--> $DIR/cyclic-trait-resolution.rs:1:1
|
||||
|
|
||||
LL | trait A: B + A {}
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
= 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 1 previous error
|
||||
error[E0391]: cycle detected when computing the implied predicates of `A`
|
||||
--> $DIR/cyclic-trait-resolution.rs:1:14
|
||||
|
|
||||
LL | trait A: B + A {}
|
||||
| ^
|
||||
|
|
||||
= note: ...which immediately requires computing the implied predicates of `A` again
|
||||
note: cycle used when checking that `<impl at $DIR/cyclic-trait-resolution.rs:7:1: 7:14>` is well-formed
|
||||
--> $DIR/cyclic-trait-resolution.rs:7:1
|
||||
|
|
||||
LL | impl A for () {}
|
||||
| ^^^^^^^^^^^^^
|
||||
= 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 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0391`.
|
||||
|
@ -46,17 +46,11 @@ LL | V3 = Self::V1 {} as u8 + 2,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: ...which requires computing layout of `Alpha`...
|
||||
= note: ...which again requires simplifying constant for the type system `Alpha::V3::{constant#0}`, completing the cycle
|
||||
note: cycle used when collecting item types in top-level module
|
||||
--> $DIR/self-in-enum-definition.rs:1:1
|
||||
note: cycle used when checking that `Alpha` is well-formed
|
||||
--> $DIR/self-in-enum-definition.rs:2:1
|
||||
|
|
||||
LL | / #[repr(u8)]
|
||||
LL | | enum Alpha {
|
||||
LL | | V1 = 41,
|
||||
LL | | V2 = Self::V1 as u8 + 1, // OK; See #50072.
|
||||
... |
|
||||
LL | |
|
||||
LL | | fn main() {}
|
||||
| |____________^
|
||||
LL | enum Alpha {
|
||||
| ^^^^^^^^^^
|
||||
= 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 1 previous error
|
||||
|
@ -1,3 +1,9 @@
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/type-placeholder-fn-in-const.rs:10:25
|
||||
|
|
||||
LL | const TEST: fn() -> _ = 42;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/type-placeholder-fn-in-const.rs:4:25
|
||||
|
|
||||
@ -5,21 +11,15 @@ LL | const TEST: fn() -> _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
|
||||
--> $DIR/type-placeholder-fn-in-const.rs:4:25
|
||||
|
|
||||
LL | const TEST: fn() -> _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/type-placeholder-fn-in-const.rs:10:25
|
||||
|
|
||||
LL | const TEST: fn() -> _ = 42;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
|
||||
--> $DIR/type-placeholder-fn-in-const.rs:10:25
|
||||
--> $DIR/type-placeholder-fn-in-const.rs:4:25
|
||||
|
|
||||
LL | const TEST: fn() -> _ = 42;
|
||||
LL | const TEST: fn() -> _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
@ -24,6 +24,16 @@ LL | trait Trait: Copy<dyn Send> {}
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
|
||||
--> $DIR/typeck-builtin-bound-type-parameters.rs:4:14
|
||||
|
|
||||
LL | trait Trait: Copy<dyn Send> {}
|
||||
| ^^^^---------- help: remove these generics
|
||||
| |
|
||||
| expected 0 generic arguments
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
|
||||
--> $DIR/typeck-builtin-bound-type-parameters.rs:9:21
|
||||
|
|
||||
@ -56,16 +66,6 @@ LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
|
||||
| |
|
||||
| expected 0 generic arguments
|
||||
|
||||
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
|
||||
--> $DIR/typeck-builtin-bound-type-parameters.rs:4:14
|
||||
|
|
||||
LL | trait Trait: Copy<dyn Send> {}
|
||||
| ^^^^---------- help: remove these generics
|
||||
| |
|
||||
| expected 0 generic arguments
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0107`.
|
||||
|
@ -169,6 +169,28 @@ LL | unsafe fn test12(x: *const usize) -> *const *const _ {
|
||||
| | not allowed in type signatures
|
||||
| help: replace with the correct return type: `*const *const usize`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:59:24
|
||||
|
|
||||
LL | fn clone(&self) -> _ { Test9 }
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: try replacing `_` with the type in the corresponding trait method signature
|
||||
|
|
||||
LL | fn clone(&self) -> Test9 { Test9 }
|
||||
| ~~~~~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:62:37
|
||||
|
|
||||
LL | fn clone_from(&mut self, other: _) { *self = Test9; }
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: try replacing `_` with the type in the corresponding trait method signature
|
||||
|
|
||||
LL | fn clone_from(&mut self, other: &Test9) { *self = Test9; }
|
||||
| ~~~~~~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:67:8
|
||||
|
|
||||
@ -294,6 +316,28 @@ help: use type parameters instead
|
||||
LL | fn fn_test8<T>(_f: fn() -> T) { }
|
||||
| +++ ~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:115:28
|
||||
|
|
||||
LL | fn clone(&self) -> _ { FnTest9 }
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: try replacing `_` with the type in the corresponding trait method signature
|
||||
|
|
||||
LL | fn clone(&self) -> FnTest9 { FnTest9 }
|
||||
| ~~~~~~~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:118:41
|
||||
|
|
||||
LL | fn clone_from(&mut self, other: _) { *self = FnTest9; }
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: try replacing `_` with the type in the corresponding trait method signature
|
||||
|
|
||||
LL | fn clone_from(&mut self, other: &FnTest9) { *self = FnTest9; }
|
||||
| ~~~~~~~~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:123:12
|
||||
|
|
||||
@ -346,109 +390,6 @@ LL | fn fn_test13(x: _) -> (i32, _) { (x, x) }
|
||||
| | not allowed in type signatures
|
||||
| help: replace with the correct return type: `(i32, i32)`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:154:21
|
||||
|
|
||||
LL | struct BadStruct<_>(_);
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
LL | struct BadStruct<T>(T);
|
||||
| ~ ~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for implementations
|
||||
--> $DIR/typeck_type_placeholder_item.rs:159:15
|
||||
|
|
||||
LL | impl BadTrait<_> for BadStruct<_> {}
|
||||
| ^ ^ not allowed in type signatures
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
LL | impl<T> BadTrait<T> for BadStruct<T> {}
|
||||
| +++ ~ ~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for opaque types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:162:34
|
||||
|
|
||||
LL | fn impl_trait() -> impl BadTrait<_> {
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:167:25
|
||||
|
|
||||
LL | struct BadStruct1<_, _>(_);
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
LL | struct BadStruct1<T, _>(T);
|
||||
| ~ ~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:172:25
|
||||
|
|
||||
LL | struct BadStruct2<_, T>(_, T);
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
LL | struct BadStruct2<U, T>(U, T);
|
||||
| ~ ~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases
|
||||
--> $DIR/typeck_type_placeholder_item.rs:176:14
|
||||
|
|
||||
LL | type X = Box<_>;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for opaque types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:182:21
|
||||
|
|
||||
LL | type Y = impl Trait<_>;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:217:31
|
||||
|
|
||||
LL | fn value() -> Option<&'static _> {
|
||||
| ----------------^-
|
||||
| | |
|
||||
| | not allowed in type signatures
|
||||
| help: replace with the correct return type: `Option<&'static u8>`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:222:10
|
||||
|
|
||||
LL | const _: Option<_> = map(value);
|
||||
| ^^^^^^^^^
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `Option<u8>`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:225:31
|
||||
|
|
||||
LL | fn evens_squared(n: usize) -> _ {
|
||||
| ^
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
| help: replace with an appropriate return type: `impl Iterator<Item = usize>`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:230:10
|
||||
|
|
||||
LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
note: however, the inferred type `Map<Filter<Range<i32>, {closure@typeck_type_placeholder_item.rs:230:29}>, {closure@typeck_type_placeholder_item.rs:230:49}>` cannot be named
|
||||
--> $DIR/typeck_type_placeholder_item.rs:230:14
|
||||
|
|
||||
LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:140:31
|
||||
|
|
||||
@ -519,41 +460,69 @@ help: use type parameters instead
|
||||
LL | fn assoc_fn_test3<T>() -> T;
|
||||
| +++ ~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:190:14
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:154:21
|
||||
|
|
||||
LL | type B = _;
|
||||
LL | struct BadStruct<_>(_);
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
LL | struct BadStruct<T>(T);
|
||||
| ~ ~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for implementations
|
||||
--> $DIR/typeck_type_placeholder_item.rs:159:15
|
||||
|
|
||||
LL | impl BadTrait<_> for BadStruct<_> {}
|
||||
| ^ ^ not allowed in type signatures
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
LL | impl<T> BadTrait<T> for BadStruct<T> {}
|
||||
| +++ ~ ~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for opaque types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:162:34
|
||||
|
|
||||
LL | fn impl_trait() -> impl BadTrait<_> {
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:167:25
|
||||
|
|
||||
LL | struct BadStruct1<_, _>(_);
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
LL | struct BadStruct1<T, _>(T);
|
||||
| ~ ~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:172:25
|
||||
|
|
||||
LL | struct BadStruct2<_, T>(_, T);
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
LL | struct BadStruct2<U, T>(U, T);
|
||||
| ~ ~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases
|
||||
--> $DIR/typeck_type_placeholder_item.rs:176:14
|
||||
|
|
||||
LL | type X = Box<_>;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:192:14
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for opaque types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:182:21
|
||||
|
|
||||
LL | const C: _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:194:14
|
||||
|
|
||||
LL | const D: _ = 42;
|
||||
| ^
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `i32`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:197:26
|
||||
|
|
||||
LL | type F: std::ops::Fn(_);
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:41:24
|
||||
|
|
||||
LL | fn test9(&self) -> _ { () }
|
||||
| ^
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `()`
|
||||
LL | type Y = impl Trait<_>;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:44:27
|
||||
@ -566,37 +535,6 @@ help: use type parameters instead
|
||||
LL | fn test10<T>(&self, _x : T) { }
|
||||
| +++ ~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:59:24
|
||||
|
|
||||
LL | fn clone(&self) -> _ { Test9 }
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: try replacing `_` with the type in the corresponding trait method signature
|
||||
|
|
||||
LL | fn clone(&self) -> Test9 { Test9 }
|
||||
| ~~~~~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:62:37
|
||||
|
|
||||
LL | fn clone_from(&mut self, other: _) { *self = Test9; }
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: try replacing `_` with the type in the corresponding trait method signature
|
||||
|
|
||||
LL | fn clone_from(&mut self, other: &Test9) { *self = Test9; }
|
||||
| ~~~~~~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:107:31
|
||||
|
|
||||
LL | fn fn_test9(&self) -> _ { () }
|
||||
| ^
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `()`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:110:34
|
||||
|
|
||||
@ -608,39 +546,23 @@ help: use type parameters instead
|
||||
LL | fn fn_test10<T>(&self, _x : T) { }
|
||||
| +++ ~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:115:28
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:217:31
|
||||
|
|
||||
LL | fn clone(&self) -> _ { FnTest9 }
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: try replacing `_` with the type in the corresponding trait method signature
|
||||
|
|
||||
LL | fn clone(&self) -> FnTest9 { FnTest9 }
|
||||
| ~~~~~~~
|
||||
LL | fn value() -> Option<&'static _> {
|
||||
| ----------------^-
|
||||
| | |
|
||||
| | not allowed in type signatures
|
||||
| help: replace with the correct return type: `Option<&'static u8>`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:118:41
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:222:10
|
||||
|
|
||||
LL | fn clone_from(&mut self, other: _) { *self = FnTest9; }
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: try replacing `_` with the type in the corresponding trait method signature
|
||||
|
|
||||
LL | fn clone_from(&mut self, other: &FnTest9) { *self = FnTest9; }
|
||||
| ~~~~~~~~
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:202:14
|
||||
|
|
||||
LL | type A = _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:204:14
|
||||
|
|
||||
LL | type B = _;
|
||||
| ^ not allowed in type signatures
|
||||
LL | const _: Option<_> = map(value);
|
||||
| ^^^^^^^^^
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `Option<u8>`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:206:14
|
||||
@ -657,6 +579,15 @@ LL | const D: _ = 42;
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `i32`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:194:14
|
||||
|
|
||||
LL | const D: _ = 42;
|
||||
| ^
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `i32`
|
||||
|
||||
error[E0046]: not all trait items implemented, missing: `F`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:200:1
|
||||
|
|
||||
@ -666,6 +597,75 @@ LL | type F: std::ops::Fn(_);
|
||||
LL | impl Qux for Struct {
|
||||
| ^^^^^^^^^^^^^^^^^^^ missing `F` in implementation
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:225:31
|
||||
|
|
||||
LL | fn evens_squared(n: usize) -> _ {
|
||||
| ^
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
| help: replace with an appropriate return type: `impl Iterator<Item = usize>`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:230:10
|
||||
|
|
||||
LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
note: however, the inferred type `Map<Filter<Range<i32>, {closure@typeck_type_placeholder_item.rs:230:29}>, {closure@typeck_type_placeholder_item.rs:230:49}>` cannot be named
|
||||
--> $DIR/typeck_type_placeholder_item.rs:230:14
|
||||
|
|
||||
LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:41:24
|
||||
|
|
||||
LL | fn test9(&self) -> _ { () }
|
||||
| ^
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `()`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:107:31
|
||||
|
|
||||
LL | fn fn_test9(&self) -> _ { () }
|
||||
| ^
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct return type: `()`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:202:14
|
||||
|
|
||||
LL | type A = _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:204:14
|
||||
|
|
||||
LL | type B = _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:190:14
|
||||
|
|
||||
LL | type B = _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:192:14
|
||||
|
|
||||
LL | const C: _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types
|
||||
--> $DIR/typeck_type_placeholder_item.rs:197:26
|
||||
|
|
||||
LL | type F: std::ops::Fn(_);
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::filter::<{closure@$DIR/typeck_type_placeholder_item.rs:230:29: 230:32}>` in constants
|
||||
--> $DIR/typeck_type_placeholder_item.rs:230:22
|
||||
|
|
||||
|
@ -38,18 +38,18 @@ LL | const TEST4: fn() -> _ = 42;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
|
||||
--> $DIR/typeck_type_placeholder_item_help.rs:18:18
|
||||
--> $DIR/typeck_type_placeholder_item_help.rs:25:18
|
||||
|
|
||||
LL | const TEST5: _ = 42;
|
||||
LL | const TEST6: _ = 13;
|
||||
| ^
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
| help: replace with the correct type: `i32`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants
|
||||
--> $DIR/typeck_type_placeholder_item_help.rs:25:18
|
||||
--> $DIR/typeck_type_placeholder_item_help.rs:18:18
|
||||
|
|
||||
LL | const TEST6: _ = 13;
|
||||
LL | const TEST5: _ = 42;
|
||||
| ^
|
||||
| |
|
||||
| not allowed in type signatures
|
||||
|
Loading…
Reference in New Issue
Block a user