Fix tests from rebase

This commit is contained in:
Matthew Jasper 2020-09-07 10:01:45 +01:00
parent 1db284ecb0
commit 022c148fcd
100 changed files with 584 additions and 480 deletions

View File

@ -1513,7 +1513,9 @@ impl<'tcx> ExistentialProjection<'tcx> {
/// then this function would return a `exists T. T: Iterator` existential trait /// then this function would return a `exists T. T: Iterator` existential trait
/// reference. /// reference.
pub fn trait_ref(&self, tcx: TyCtxt<'_>) -> ty::ExistentialTraitRef<'tcx> { pub fn trait_ref(&self, tcx: TyCtxt<'_>) -> ty::ExistentialTraitRef<'tcx> {
// FIXME(generic_associated_types): truncate substs to have the right length. // FIXME(generic_associated_types): substs is the substs of the
// associated type, which should be truncated to get the correct substs
// for the trait.
let def_id = tcx.associated_item(self.item_def_id).container.id(); let def_id = tcx.associated_item(self.item_def_id).container.id();
ty::ExistentialTraitRef { def_id, substs: self.substs } ty::ExistentialTraitRef { def_id, substs: self.substs }
} }

View File

@ -125,29 +125,34 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
self.infcx.commit_unconditionally(|_| { self.infcx.commit_unconditionally(|_| {
let tcx = self.tcx(); let tcx = self.tcx();
let bound_self_ty = self.infcx.shallow_resolve(obligation.self_ty()); let trait_predicate = self.infcx.shallow_resolve(obligation.predicate);
let (def_id, substs) = match *bound_self_ty.skip_binder().kind() { let placeholder_trait_predicate =
self.infcx().replace_bound_vars_with_placeholders(&trait_predicate);
let placeholder_self_ty = placeholder_trait_predicate.self_ty();
let (def_id, substs) = match *placeholder_self_ty.kind() {
ty::Projection(proj) => (proj.item_def_id, proj.substs), ty::Projection(proj) => (proj.item_def_id, proj.substs),
ty::Opaque(def_id, substs) => (def_id, substs), ty::Opaque(def_id, substs) => (def_id, substs),
_ => bug!("projection candidate for unexpected type: {:?}", bound_self_ty), _ => bug!("projection candidate for unexpected type: {:?}", placeholder_self_ty),
}; };
let candidate_predicate = tcx.item_bounds(def_id)[idx].subst(tcx, substs); let candidate_predicate = tcx.item_bounds(def_id)[idx].subst(tcx, substs);
let candidate = candidate_predicate let candidate = candidate_predicate
.to_opt_poly_trait_ref() .to_opt_poly_trait_ref()
.expect("projection candidate is not a trait predicate"); .expect("projection candidate is not a trait predicate");
let Normalized { value: candidate, mut obligations } = normalize_with_depth( let mut obligations = Vec::new();
let candidate = normalize_with_depth_to(
self, self,
obligation.param_env, obligation.param_env,
obligation.cause.clone(), obligation.cause.clone(),
obligation.recursion_depth + 1, obligation.recursion_depth + 1,
&candidate, &candidate,
&mut obligations,
); );
obligations.extend( obligations.extend(
self.infcx self.infcx
.at(&obligation.cause, obligation.param_env) .at(&obligation.cause, obligation.param_env)
.sup(obligation.predicate.to_poly_trait_ref(), candidate) .sup(placeholder_trait_predicate.trait_ref.to_poly_trait_ref(), candidate)
.map(|InferOk { obligations, .. }| obligations) .map(|InferOk { obligations, .. }| obligations)
.unwrap_or_else(|_| { .unwrap_or_else(|_| {
bug!( bug!(
@ -158,7 +163,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}), }),
); );
if let ty::Projection(..) = bound_self_ty.skip_binder().kind() { if let ty::Projection(..) = placeholder_self_ty.kind() {
for predicate in tcx.predicates_of(def_id).instantiate_own(tcx, substs).predicates { for predicate in tcx.predicates_of(def_id).instantiate_own(tcx, substs).predicates {
let normalized = normalize_with_depth_to( let normalized = normalize_with_depth_to(
self, self,

View File

@ -1204,23 +1204,19 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
if let ty::PredicateAtom::Trait(pred, _) = bound.skip_binders() { if let ty::PredicateAtom::Trait(pred, _) = bound.skip_binders() {
let bound = ty::Binder::bind(pred.trait_ref); let bound = ty::Binder::bind(pred.trait_ref);
if self.infcx.probe(|_| { if self.infcx.probe(|_| {
if let Ok(normalized_trait) = self.match_projection( match self.match_projection(
obligation, obligation,
bound, bound,
placeholder_trait_predicate.trait_ref, placeholder_trait_predicate.trait_ref,
) { ) {
match normalized_trait { Ok(None) => true,
None => true, Ok(Some(normalized_trait))
Some(normalized_trait)
if distinct_normalized_bounds.insert(normalized_trait) => if distinct_normalized_bounds.insert(normalized_trait) =>
{ {
true true
} }
_ => false, _ => false,
} }
} else {
false
}
}) { }) {
return Some(idx); return Some(idx);
} }

View File

@ -767,7 +767,10 @@ impl<'tcx> LowerInto<'tcx, Option<chalk_solve::rust_ir::QuantifiedInlineBound<Ru
| ty::PredicateAtom::ClosureKind(..) | ty::PredicateAtom::ClosureKind(..)
| ty::PredicateAtom::Subtype(..) | ty::PredicateAtom::Subtype(..)
| ty::PredicateAtom::ConstEvaluatable(..) | ty::PredicateAtom::ConstEvaluatable(..)
| ty::PredicateAtom::ConstEquate(..) => bug!("unexpected predicate {}", &self), | ty::PredicateAtom::ConstEquate(..)
| ty::PredicateAtom::TypeWellFormedFromEnv(..) => {
bug!("unexpected predicate {}", &self)
}
} }
} }
} }

View File

@ -4,13 +4,13 @@ use super::compare_method::{compare_const_impl, compare_impl_method, compare_ty_
use super::*; use super::*;
use rustc_attr as attr; use rustc_attr as attr;
use rustc_errors::Applicability; use rustc_errors::{Applicability, ErrorReported};
use rustc_hir as hir; use rustc_hir as hir;
use rustc_hir::def_id::{DefId, LocalDefId, LOCAL_CRATE}; use rustc_hir::def_id::{DefId, LocalDefId, LOCAL_CRATE};
use rustc_hir::lang_items::LangItem; use rustc_hir::lang_items::LangItem;
use rustc_hir::{ItemKind, Node}; use rustc_hir::{ItemKind, Node};
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
use rustc_infer::infer::RegionVariableOrigin; use rustc_infer::infer::{RegionVariableOrigin, TyCtxtInferExt};
use rustc_middle::ty::fold::TypeFoldable; use rustc_middle::ty::fold::TypeFoldable;
use rustc_middle::ty::subst::GenericArgKind; use rustc_middle::ty::subst::GenericArgKind;
use rustc_middle::ty::util::{Discr, IntTypeExt, Representability}; use rustc_middle::ty::util::{Discr, IntTypeExt, Representability};
@ -19,6 +19,8 @@ use rustc_session::config::EntryFnType;
use rustc_span::symbol::sym; use rustc_span::symbol::sym;
use rustc_span::{self, MultiSpan, Span}; use rustc_span::{self, MultiSpan, Span};
use rustc_target::spec::abi::Abi; use rustc_target::spec::abi::Abi;
use rustc_trait_selection::opaque_types::InferCtxtExt as _;
use rustc_trait_selection::traits::error_reporting::InferCtxtExt as _;
use rustc_trait_selection::traits::{self, ObligationCauseCode}; use rustc_trait_selection::traits::{self, ObligationCauseCode};
pub fn check_wf_new(tcx: TyCtxt<'_>) { pub fn check_wf_new(tcx: TyCtxt<'_>) {
@ -386,7 +388,9 @@ pub(super) fn check_opaque<'tcx>(
origin: &hir::OpaqueTyOrigin, origin: &hir::OpaqueTyOrigin,
) { ) {
check_opaque_for_inheriting_lifetimes(tcx, def_id, span); check_opaque_for_inheriting_lifetimes(tcx, def_id, span);
tcx.ensure().type_of(def_id); if tcx.type_of(def_id).references_error() {
return;
}
if check_opaque_for_cycles(tcx, def_id, substs, span, origin).is_err() { if check_opaque_for_cycles(tcx, def_id, substs, span, origin).is_err() {
return; return;
} }

View File

@ -704,6 +704,7 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::HirId) {
hir::ItemKind::OpaqueTy(..) => { hir::ItemKind::OpaqueTy(..) => {
tcx.ensure().generics_of(def_id); tcx.ensure().generics_of(def_id);
tcx.ensure().predicates_of(def_id); tcx.ensure().predicates_of(def_id);
tcx.ensure().explicit_item_bounds(def_id);
} }
hir::ItemKind::TyAlias(..) hir::ItemKind::TyAlias(..)
| hir::ItemKind::Static(..) | hir::ItemKind::Static(..)

View File

@ -69,7 +69,7 @@ fn test() -> Option<Box<u32>> {
bb5: { bb5: {
StorageDead(_9); // scope 2 at $DIR/issue-62289.rs:9:19: 9:20 StorageDead(_9); // scope 2 at $DIR/issue-62289.rs:9:19: 9:20
_0 = <Option<Box<u32>> as Try>::from_error(move _8) -> [return: bb6, unwind: bb12]; // scope 2 at $DIR/issue-62289.rs:9:19: 9:20 _0 = <Option<Box<u32>> as Try>::from_error(move _8) -> [return: bb6, unwind: bb12]; // scope 2 at $DIR/issue-62289.rs:9:15: 9:20
// mir::Constant // mir::Constant
// + span: $DIR/issue-62289.rs:9:15: 9:20 // + span: $DIR/issue-62289.rs:9:15: 9:20
// + literal: Const { ty: fn(<std::option::Option<std::boxed::Box<u32>> as std::ops::Try>::Error) -> std::option::Option<std::boxed::Box<u32>> {<std::option::Option<std::boxed::Box<u32>> as std::ops::Try>::from_error}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: fn(<std::option::Option<std::boxed::Box<u32>> as std::ops::Try>::Error) -> std::option::Option<std::boxed::Box<u32>> {<std::option::Option<std::boxed::Box<u32>> as std::ops::Try>::from_error}, val: Value(Scalar(<ZST>)) }

View File

@ -29,7 +29,7 @@
scope 8 { scope 8 {
- debug v => _8; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - debug v => _8; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
+ debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _12: i32; // in scope 8 at $DIR/simplify-arm.rs:24:14: 24:15 let mut _12: i32; // in scope 8 at $DIR/simplify-arm.rs:24:13: 24:15
} }
} }
} }

View File

@ -25,7 +25,7 @@
} }
scope 8 { scope 8 {
debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _12: i32; // in scope 8 at $DIR/simplify-arm.rs:24:14: 24:15 let mut _12: i32; // in scope 8 at $DIR/simplify-arm.rs:24:13: 24:15
} }
} }
} }

View File

@ -12,7 +12,9 @@
fn main() {} fn main() {}
trait Bar { type Assoc; } trait Bar {
type Assoc;
}
trait Thing { trait Thing {
type Out; type Out;
@ -20,11 +22,14 @@ trait Thing {
} }
struct AssocNoCopy; struct AssocNoCopy;
impl Bar for AssocNoCopy { type Assoc = String; } impl Bar for AssocNoCopy {
type Assoc = String;
}
impl Thing for AssocNoCopy { impl Thing for AssocNoCopy {
type Out = Box<dyn Bar<Assoc: Copy>>; type Out = Box<dyn Bar<Assoc: Copy>>;
//~^ ERROR the trait bound `String: Copy` is not satisfied //~^ ERROR the trait bound `String: Copy` is not satisfied
//~| ERROR the trait bound `String: Copy` is not satisfied
fn func() -> Self::Out { fn func() -> Self::Out {
Box::new(AssocNoCopy) Box::new(AssocNoCopy)

View File

@ -1,11 +1,15 @@
error[E0277]: the trait bound `String: Copy` is not satisfied error[E0277]: the trait bound `String: Copy` is not satisfied
--> $DIR/assoc-type-eq-with-dyn-atb-fail.rs:26:28 --> $DIR/assoc-type-eq-with-dyn-atb-fail.rs:30:28
| |
LL | type Out = Box<dyn Bar<Assoc: Copy>>; LL | type Out = Box<dyn Bar<Assoc: Copy>>;
| ^^^^^^^^^^^ the trait `Copy` is not implemented for `String` | ^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
|
= note: the return type of a function must have a statically known size
error: aborting due to previous error error[E0277]: the trait bound `String: Copy` is not satisfied
--> $DIR/assoc-type-eq-with-dyn-atb-fail.rs:30:28
|
LL | type Out = Box<dyn Bar<Assoc: Copy>>;
| ^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`. For more information about this error, try `rustc --explain E0277`.

View File

@ -24,9 +24,9 @@ impl<'a, 'b> Lam<&'a &'b u8> for L2 {
trait Case1 { trait Case1 {
type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8, App: Debug>> + Sync>; type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8, App: Debug>> + Sync>;
//~^ ERROR `<<Self as Case1>::C as std::iter::Iterator>::Item` is not an iterator //~^ ERROR `<<Self as Case1>::C as Iterator>::Item` is not an iterator
//~| ERROR `<<Self as Case1>::C as std::iter::Iterator>::Item` cannot be sent between threads safely //~| ERROR `<<Self as Case1>::C as Iterator>::Item` cannot be sent between threads safely
//~| ERROR `<<Self as Case1>::C as std::iter::Iterator>::Item` cannot be shared between threads safely //~| ERROR `<<Self as Case1>::C as Iterator>::Item` cannot be shared between threads safely
} }
pub struct S1; pub struct S1;

View File

@ -1,53 +1,48 @@
error[E0277]: `<<Self as Case1>::C as std::iter::Iterator>::Item` is not an iterator error[E0277]: `<<Self as Case1>::C as Iterator>::Item` is not an iterator
--> $DIR/bad-bounds-on-assoc-in-trait.rs:28:5 --> $DIR/bad-bounds-on-assoc-in-trait.rs:26:5
| |
LL | / type C: Clone + Iterator<Item: LL | type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8, App: Debug>> + Sync>;
LL | | Send + Iterator<Item: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `<<Self as Case1>::C as Iterator>::Item` is not an iterator
LL | | for<'a> Lam<&'a u8, App:
LL | | Debug
LL | | >
LL | | > + Sync>;
| |__________________^ `<<Self as Case1>::C as std::iter::Iterator>::Item` is not an iterator
| |
= help: the trait `std::iter::Iterator` is not implemented for `<<Self as Case1>::C as std::iter::Iterator>::Item` = help: the trait `Iterator` is not implemented for `<<Self as Case1>::C as Iterator>::Item`
help: consider further restricting the associated type help: consider further restricting the associated type
| |
LL | trait Case1 where <<Self as Case1>::C as std::iter::Iterator>::Item: std::iter::Iterator { LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Iterator {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: `<<Self as Case1>::C as std::iter::Iterator>::Item` cannot be sent between threads safely error[E0277]: `<<Self as Case1>::C as Iterator>::Item` cannot be sent between threads safely
--> $DIR/bad-bounds-on-assoc-in-trait.rs:23:9 --> $DIR/bad-bounds-on-assoc-in-trait.rs:26:36
| |
LL | Send + Iterator<Item: LL | type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8, App: Debug>> + Sync>;
| ^^^^ `<<Self as Case1>::C as std::iter::Iterator>::Item` cannot be sent between threads safely | ^^^^ `<<Self as Case1>::C as Iterator>::Item` cannot be sent between threads safely
| |
::: $SRC_DIR/libcore/marker.rs:LL:COL ::: $SRC_DIR/core/src/marker.rs:LL:COL
| |
LL | pub unsafe auto trait Send { LL | pub unsafe auto trait Send {
| -------------------------- required by this bound in `std::marker::Send` | -------------------------- required by this bound in `Send`
| |
= help: the trait `std::marker::Send` is not implemented for `<<Self as Case1>::C as std::iter::Iterator>::Item` = help: the trait `Send` is not implemented for `<<Self as Case1>::C as Iterator>::Item`
help: consider further restricting the associated type help: consider further restricting the associated type
| |
LL | trait Case1 where <<Self as Case1>::C as std::iter::Iterator>::Item: std::marker::Send { LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Send {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: `<<Self as Case1>::C as std::iter::Iterator>::Item` cannot be shared between threads safely error[E0277]: `<<Self as Case1>::C as Iterator>::Item` cannot be shared between threads safely
--> $DIR/bad-bounds-on-assoc-in-trait.rs:27:13 --> $DIR/bad-bounds-on-assoc-in-trait.rs:26:93
| |
LL | > + Sync>; LL | type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8, App: Debug>> + Sync>;
| ^^^^ `<<Self as Case1>::C as std::iter::Iterator>::Item` cannot be shared between threads safely | ^^^^ `<<Self as Case1>::C as Iterator>::Item` cannot be shared between threads safely
| |
::: $SRC_DIR/libcore/marker.rs:LL:COL ::: $SRC_DIR/core/src/marker.rs:LL:COL
| |
LL | pub unsafe auto trait Sync { LL | pub unsafe auto trait Sync {
| -------------------------- required by this bound in `std::marker::Sync` | -------------------------- required by this bound in `Sync`
| |
= help: the trait `std::marker::Sync` is not implemented for `<<Self as Case1>::C as std::iter::Iterator>::Item` = help: the trait `Sync` is not implemented for `<<Self as Case1>::C as Iterator>::Item`
help: consider further restricting the associated type help: consider further restricting the associated type
| |
LL | trait Case1 where <<Self as Case1>::C as std::iter::Iterator>::Item: std::marker::Sync { LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Sync {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View File

@ -1,5 +1,3 @@
// ignore-tidy-linelength
#![feature(associated_type_bounds)] #![feature(associated_type_bounds)]
use std::fmt::Debug; use std::fmt::Debug;
@ -18,7 +16,7 @@ impl<'a, 'b> Lam<&'a &'b u8> for L2 { type App = u8; }
trait Case1 { trait Case1 {
type A: Iterator<Item: Debug>; type A: Iterator<Item: Debug>;
//~^ ERROR `<<Self as Case1>::A as std::iter::Iterator>::Item` doesn't implement `std::fmt::Debug` //~^ ERROR `<<Self as Case1>::A as Iterator>::Item` doesn't implement `Debug`
type B: Iterator<Item: 'static>; type B: Iterator<Item: 'static>;
} }
@ -35,7 +33,7 @@ impl Case1 for S1 {
// bounds of `Out`, but trait selection can't find the bound since it applies // bounds of `Out`, but trait selection can't find the bound since it applies
// to a type other than `Self::Out`. // to a type other than `Self::Out`.
pub trait Foo { type Out: Baz<Assoc: Default>; } pub trait Foo { type Out: Baz<Assoc: Default>; }
//~^ ERROR trait bound `<<Self as Foo>::Out as Baz>::Assoc: std::default::Default` is not satisfied //~^ ERROR trait bound `<<Self as Foo>::Out as Baz>::Assoc: Default` is not satisfied
pub trait Baz { type Assoc; } pub trait Baz { type Assoc; }
#[derive(Default)] #[derive(Default)]

View File

@ -1,35 +1,35 @@
error[E0277]: `<<Self as Case1>::A as std::iter::Iterator>::Item` doesn't implement `std::fmt::Debug` error[E0277]: `<<Self as Case1>::A as Iterator>::Item` doesn't implement `Debug`
--> $DIR/bounds-on-assoc-in-trait.rs:20:28 --> $DIR/bounds-on-assoc-in-trait.rs:18:28
| |
LL | type A: Iterator<Item: Debug>; LL | type A: Iterator<Item: Debug>;
| ^^^^^ `<<Self as Case1>::A as std::iter::Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | ^^^^^ `<<Self as Case1>::A as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
| |
::: $SRC_DIR/core/src/fmt/mod.rs:LL:COL ::: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
| |
LL | pub trait Debug { LL | pub trait Debug {
| --------------- required by this bound in `std::fmt::Debug` | --------------- required by this bound in `Debug`
| |
= help: the trait `std::fmt::Debug` is not implemented for `<<Self as Case1>::A as std::iter::Iterator>::Item` = help: the trait `Debug` is not implemented for `<<Self as Case1>::A as Iterator>::Item`
help: consider further restricting the associated type help: consider further restricting the associated type
| |
LL | trait Case1 where <<Self as Case1>::A as std::iter::Iterator>::Item: std::fmt::Debug { LL | trait Case1 where <<Self as Case1>::A as Iterator>::Item: Debug {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `<<Self as Foo>::Out as Baz>::Assoc: std::default::Default` is not satisfied error[E0277]: the trait bound `<<Self as Foo>::Out as Baz>::Assoc: Default` is not satisfied
--> $DIR/bounds-on-assoc-in-trait.rs:37:38 --> $DIR/bounds-on-assoc-in-trait.rs:35:38
| |
LL | pub trait Foo { type Out: Baz<Assoc: Default>; } LL | pub trait Foo { type Out: Baz<Assoc: Default>; }
| ^^^^^^^ the trait `std::default::Default` is not implemented for `<<Self as Foo>::Out as Baz>::Assoc` | ^^^^^^^ the trait `Default` is not implemented for `<<Self as Foo>::Out as Baz>::Assoc`
| |
::: $SRC_DIR/core/src/default.rs:LL:COL ::: $SRC_DIR/core/src/default.rs:LL:COL
| |
LL | pub trait Default: Sized { LL | pub trait Default: Sized {
| ------------------------ required by this bound in `std::default::Default` | ------------------------ required by this bound in `Default`
| |
help: consider further restricting the associated type help: consider further restricting the associated type
| |
LL | pub trait Foo where <<Self as Foo>::Out as Baz>::Assoc: std::default::Default { type Out: Baz<Assoc: Default>; } LL | pub trait Foo where <<Self as Foo>::Out as Baz>::Assoc: Default { type Out: Baz<Assoc: Default>; }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -512,7 +512,7 @@ LL | trait TRSW3 where Self: Iterator<Item: 'static, Item: 'static> {}
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:167:40 --> $DIR/duplicate.rs:152:40
| |
LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>; LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here | ---------- ^^^^^^^^^^ re-bound here
@ -535,6 +535,30 @@ LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
| | | |
| `Item` bound here first | `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:145:43
|
LL | trait TRA1 { type A: Iterator<Item: Copy, Item: Send>; }
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:147:43
|
LL | trait TRA2 { type A: Iterator<Item: Copy, Item: Copy>; }
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
--> $DIR/duplicate.rs:149:46
|
LL | trait TRA3 { type A: Iterator<Item: 'static, Item: 'static>; }
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error: aborting due to 69 previous errors; 1 warning emitted error: aborting due to 69 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0719`. For more information about this error, try `rustc --explain E0719`.

View File

@ -20,7 +20,7 @@ where
Self::Ty: Clone, Self::Ty: Clone,
{ {
type Ty = NotClone; type Ty = NotClone;
//~^ ERROR the trait bound `NotClone: std::clone::Clone` is not satisfied //~^ ERROR the trait bound `NotClone: Clone` is not satisfied
} }
// Involved type parameters must fulfill all bounds required by defaults that mention them // Involved type parameters must fulfill all bounds required by defaults that mention them
@ -85,7 +85,7 @@ where
{ {
type Bar = Vec<Self::Baz>; type Bar = Vec<Self::Baz>;
type Baz = T; type Baz = T;
//~^ ERROR the trait bound `T: std::clone::Clone` is not satisfied //~^ ERROR the trait bound `T: Clone` is not satisfied
} }
// This one finally works, with `Clone` bounds on all assoc. types and the type // This one finally works, with `Clone` bounds on all assoc. types and the type

View File

@ -1,31 +1,32 @@
error[E0277]: the trait bound `NotClone: std::clone::Clone` is not satisfied error[E0277]: the trait bound `NotClone: Clone` is not satisfied
--> $DIR/defaults-suitability.rs:13:5 --> $DIR/defaults-suitability.rs:13:5
| |
LL | type Ty: Clone = NotClone; LL | type Ty: Clone = NotClone;
| ^^^^^^^^^-----^^^^^^^^^^^^ | ^^^^^^^^^-----^^^^^^^^^^^^
| | | | | |
| | required by this bound in `Tr::Ty` | | required by this bound in `Tr::Ty`
| the trait `std::clone::Clone` is not implemented for `NotClone` | the trait `Clone` is not implemented for `NotClone`
error[E0277]: the trait bound `NotClone: std::clone::Clone` is not satisfied error[E0277]: the trait bound `NotClone: Clone` is not satisfied
--> $DIR/defaults-suitability.rs:19:5 --> $DIR/defaults-suitability.rs:22:5
| |
LL | trait Tr2 where Self::Ty: Clone { LL | Self::Ty: Clone,
| ----- required by this bound in `Tr2::Ty` | ----- required by this bound in `Tr2::Ty`
LL | {
LL | type Ty = NotClone; LL | type Ty = NotClone;
| ^^^^^--^^^^^^^^^^^^ | ^^^^^--^^^^^^^^^^^^
| | | | | |
| | required by a bound in this | | required by a bound in this
| the trait `std::clone::Clone` is not implemented for `NotClone` | the trait `Clone` is not implemented for `NotClone`
error[E0277]: the trait bound `T: std::clone::Clone` is not satisfied error[E0277]: the trait bound `T: Clone` is not satisfied
--> $DIR/defaults-suitability.rs:25:5 --> $DIR/defaults-suitability.rs:28:5
| |
LL | type Bar: Clone = Vec<T>; LL | type Bar: Clone = Vec<T>;
| ^^^^^^^^^^-----^^^^^^^^^^ | ^^^^^^^^^^-----^^^^^^^^^^
| | | | | |
| | required by this bound in `Foo::Bar` | | required by this bound in `Foo::Bar`
| the trait `std::clone::Clone` is not implemented for `T` | the trait `Clone` is not implemented for `T`
| |
= note: required because of the requirements on the impl of `Clone` for `Vec<T>` = note: required because of the requirements on the impl of `Clone` for `Vec<T>`
help: consider restricting type parameter `T` help: consider restricting type parameter `T`
@ -34,7 +35,7 @@ LL | trait Foo<T: Clone> {
| ^^^^^^^ | ^^^^^^^
error[E0277]: the trait bound `(): Foo<Self>` is not satisfied error[E0277]: the trait bound `(): Foo<Self>` is not satisfied
--> $DIR/defaults-suitability.rs:31:5 --> $DIR/defaults-suitability.rs:34:5
| |
LL | type Assoc: Foo<Self> = (); LL | type Assoc: Foo<Self> = ();
| ^^^^^^^^^^^^---------^^^^^^ | ^^^^^^^^^^^^---------^^^^^^
@ -43,7 +44,7 @@ LL | type Assoc: Foo<Self> = ();
| the trait `Foo<Self>` is not implemented for `()` | the trait `Foo<Self>` is not implemented for `()`
error[E0277]: the trait bound `NotClone: IsU8<NotClone>` is not satisfied error[E0277]: the trait bound `NotClone: IsU8<NotClone>` is not satisfied
--> $DIR/defaults-suitability.rs:53:5 --> $DIR/defaults-suitability.rs:56:5
| |
LL | Self::Assoc: IsU8<Self::Assoc>, LL | Self::Assoc: IsU8<Self::Assoc>,
| ----------------- required by this bound in `D::Assoc` | ----------------- required by this bound in `D::Assoc`
@ -54,14 +55,14 @@ LL | type Assoc = NotClone;
| | required by a bound in this | | required by a bound in this
| the trait `IsU8<NotClone>` is not implemented for `NotClone` | the trait `IsU8<NotClone>` is not implemented for `NotClone`
error[E0277]: the trait bound `<Self as Foo2<T>>::Baz: std::clone::Clone` is not satisfied error[E0277]: the trait bound `<Self as Foo2<T>>::Baz: Clone` is not satisfied
--> $DIR/defaults-suitability.rs:62:5 --> $DIR/defaults-suitability.rs:65:5
| |
LL | type Bar: Clone = Vec<Self::Baz>; LL | type Bar: Clone = Vec<Self::Baz>;
| ^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^
| | | | | |
| | required by this bound in `Foo2::Bar` | | required by this bound in `Foo2::Bar`
| the trait `std::clone::Clone` is not implemented for `<Self as Foo2<T>>::Baz` | the trait `Clone` is not implemented for `<Self as Foo2<T>>::Baz`
| |
= note: required because of the requirements on the impl of `Clone` for `Vec<<Self as Foo2<T>>::Baz>` = note: required because of the requirements on the impl of `Clone` for `Vec<<Self as Foo2<T>>::Baz>`
help: consider further restricting the associated type help: consider further restricting the associated type
@ -69,14 +70,14 @@ help: consider further restricting the associated type
LL | trait Foo2<T> where <Self as Foo2<T>>::Baz: Clone { LL | trait Foo2<T> where <Self as Foo2<T>>::Baz: Clone {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `<Self as Foo25<T>>::Baz: std::clone::Clone` is not satisfied error[E0277]: the trait bound `<Self as Foo25<T>>::Baz: Clone` is not satisfied
--> $DIR/defaults-suitability.rs:71:5 --> $DIR/defaults-suitability.rs:74:5
| |
LL | type Bar: Clone = Vec<Self::Baz>; LL | type Bar: Clone = Vec<Self::Baz>;
| ^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^
| | | | | |
| | required by this bound in `Foo25::Bar` | | required by this bound in `Foo25::Bar`
| the trait `std::clone::Clone` is not implemented for `<Self as Foo25<T>>::Baz` | the trait `Clone` is not implemented for `<Self as Foo25<T>>::Baz`
| |
= note: required because of the requirements on the impl of `Clone` for `Vec<<Self as Foo25<T>>::Baz>` = note: required because of the requirements on the impl of `Clone` for `Vec<<Self as Foo25<T>>::Baz>`
help: consider further restricting the associated type help: consider further restricting the associated type
@ -84,8 +85,8 @@ help: consider further restricting the associated type
LL | trait Foo25<T: Clone> where <Self as Foo25<T>>::Baz: Clone { LL | trait Foo25<T: Clone> where <Self as Foo25<T>>::Baz: Clone {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `T: std::clone::Clone` is not satisfied error[E0277]: the trait bound `T: Clone` is not satisfied
--> $DIR/defaults-suitability.rs:83:5 --> $DIR/defaults-suitability.rs:87:5
| |
LL | Self::Baz: Clone, LL | Self::Baz: Clone,
| ----- required by this bound in `Foo3::Baz` | ----- required by this bound in `Foo3::Baz`
@ -94,7 +95,7 @@ LL | type Baz = T;
| ^^^^^---^^^^^ | ^^^^^---^^^^^
| | | | | |
| | required by a bound in this | | required by a bound in this
| the trait `std::clone::Clone` is not implemented for `T` | the trait `Clone` is not implemented for `T`
| |
help: consider further restricting type parameter `T` help: consider further restricting type parameter `T`
| |

View File

@ -18,6 +18,10 @@ trait UncheckedCopy: Sized {
// This Output is said to be Copy. Yet we default to Self // This Output is said to be Copy. Yet we default to Self
// and it's accepted, not knowing if Self ineed is Copy // and it's accepted, not knowing if Self ineed is Copy
type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
//~^ ERROR the trait bound `Self: Copy` is not satisfied
//~| ERROR the trait bound `Self: Deref` is not satisfied
//~| ERROR cannot add-assign `&'static str` to `Self`
//~| ERROR `Self` doesn't implement `std::fmt::Display`
// We said the Output type was Copy, so we can Copy it freely! // We said the Output type was Copy, so we can Copy it freely!
fn unchecked_copy(other: &Self::Output) -> Self::Output { fn unchecked_copy(other: &Self::Output) -> Self::Output {

View File

@ -1,19 +1,11 @@
error[E0277]: `Self` doesn't implement `std::fmt::Display` error[E0277]: `Self` doesn't implement `std::fmt::Display`
--> $DIR/defaults-unsound-62211-1.rs:21:5 --> $DIR/defaults-unsound-62211-1.rs:20:5
| |
LL | type Output: Copy LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^ ------ required by a bound in this | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^^^^^^^^
| _____| | | |
| | | | required by this bound in `UncheckedCopy::Output`
LL | | | `Self` cannot be formatted with the default formatter
LL | |
LL | |
... |
LL | | + From<Self>
LL | | + Display = Self;
| |___________-------_______^ `Self` cannot be formatted with the default formatter
| |
| required by this bound in `UncheckedCopy::Output`
| |
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
help: consider further restricting `Self` help: consider further restricting `Self`
@ -21,23 +13,14 @@ help: consider further restricting `Self`
LL | trait UncheckedCopy: Sized + std::fmt::Display { LL | trait UncheckedCopy: Sized + std::fmt::Display {
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Self: std::ops::Deref` is not satisfied error[E0277]: the trait bound `Self: Deref` is not satisfied
--> $DIR/defaults-unsound-62211-1.rs:21:5 --> $DIR/defaults-unsound-62211-1.rs:20:5
| |
LL | type Output: Copy LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^ ------ required by a bound in this | ^^^^^^^^^^^^^^^^^^^^-------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| _____| | | |
| | | | required by this bound in `UncheckedCopy::Output`
LL | | | the trait `Deref` is not implemented for `Self`
LL | |
LL | |
LL | |
LL | | + Deref<Target = str>
| | ------------------- required by this bound in `UncheckedCopy::Output`
LL | | + AddAssign<&'static str>
LL | | + From<Self>
LL | | + Display = Self;
| |_________________________^ the trait `std::ops::Deref` is not implemented for `Self`
| |
help: consider further restricting `Self` help: consider further restricting `Self`
| |
@ -45,46 +28,32 @@ LL | trait UncheckedCopy: Sized + Deref {
| ^^^^^^^ | ^^^^^^^
error[E0277]: cannot add-assign `&'static str` to `Self` error[E0277]: cannot add-assign `&'static str` to `Self`
--> $DIR/defaults-unsound-62211-1.rs:21:5 --> $DIR/defaults-unsound-62211-1.rs:20:5
| |
LL | type Output: Copy LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^ ------ required by a bound in this | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| _____| | | |
| | | | required by this bound in `UncheckedCopy::Output`
LL | | | no implementation for `Self += &'static str`
LL | |
LL | |
... |
LL | | + AddAssign<&'static str>
| | ----------------------- required by this bound in `UncheckedCopy::Output`
LL | | + From<Self>
LL | | + Display = Self;
| |_________________________^ no implementation for `Self += &'static str`
| |
help: consider further restricting `Self` help: consider further restricting `Self`
| |
LL | trait UncheckedCopy: Sized + std::ops::AddAssign<&'static str> { LL | trait UncheckedCopy: Sized + AddAssign<&'static str> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Self: std::marker::Copy` is not satisfied error[E0277]: the trait bound `Self: Copy` is not satisfied
--> $DIR/defaults-unsound-62211-1.rs:21:5 --> $DIR/defaults-unsound-62211-1.rs:20:5
| |
LL | type Output: Copy LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^ ---- required by this bound in `UncheckedCopy::Output` | ^^^^^^^^^^^^^----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| _____| | | |
| | | | required by this bound in `UncheckedCopy::Output`
LL | | | the trait `Copy` is not implemented for `Self`
LL | |
LL | |
... |
LL | | + From<Self>
LL | | + Display = Self;
| |_________________________^ the trait `std::marker::Copy` is not implemented for `Self`
| |
help: consider further restricting `Self` help: consider further restricting `Self`
| |
LL | trait UncheckedCopy: Sized + std::marker::Copy { LL | trait UncheckedCopy: Sized + Copy {
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View File

@ -18,6 +18,10 @@ trait UncheckedCopy: Sized {
// This Output is said to be Copy. Yet we default to Self // This Output is said to be Copy. Yet we default to Self
// and it's accepted, not knowing if Self ineed is Copy // and it's accepted, not knowing if Self ineed is Copy
type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
//~^ ERROR the trait bound `Self: Copy` is not satisfied
//~| ERROR the trait bound `Self: Deref` is not satisfied
//~| ERROR cannot add-assign `&'static str` to `Self`
//~| ERROR `Self` doesn't implement `std::fmt::Display`
// We said the Output type was Copy, so we can Copy it freely! // We said the Output type was Copy, so we can Copy it freely!
fn unchecked_copy(other: &Self::Output) -> Self::Output { fn unchecked_copy(other: &Self::Output) -> Self::Output {

View File

@ -1,19 +1,11 @@
error[E0277]: `Self` doesn't implement `std::fmt::Display` error[E0277]: `Self` doesn't implement `std::fmt::Display`
--> $DIR/defaults-unsound-62211-2.rs:21:5 --> $DIR/defaults-unsound-62211-2.rs:20:5
| |
LL | type Output: Copy LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^ ------ required by a bound in this | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^^^^^^^^
| _____| | | |
| | | | required by this bound in `UncheckedCopy::Output`
LL | | | `Self` cannot be formatted with the default formatter
LL | |
LL | |
... |
LL | | + From<Self>
LL | | + Display = Self;
| |___________-------_______^ `Self` cannot be formatted with the default formatter
| |
| required by this bound in `UncheckedCopy::Output`
| |
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
help: consider further restricting `Self` help: consider further restricting `Self`
@ -21,23 +13,14 @@ help: consider further restricting `Self`
LL | trait UncheckedCopy: Sized + std::fmt::Display { LL | trait UncheckedCopy: Sized + std::fmt::Display {
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Self: std::ops::Deref` is not satisfied error[E0277]: the trait bound `Self: Deref` is not satisfied
--> $DIR/defaults-unsound-62211-2.rs:21:5 --> $DIR/defaults-unsound-62211-2.rs:20:5
| |
LL | type Output: Copy LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^ ------ required by a bound in this | ^^^^^^^^^^^^^^^^^^^^-------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| _____| | | |
| | | | required by this bound in `UncheckedCopy::Output`
LL | | | the trait `Deref` is not implemented for `Self`
LL | |
LL | |
LL | |
LL | | + Deref<Target = str>
| | ------------------- required by this bound in `UncheckedCopy::Output`
LL | | + AddAssign<&'static str>
LL | | + From<Self>
LL | | + Display = Self;
| |_________________________^ the trait `std::ops::Deref` is not implemented for `Self`
| |
help: consider further restricting `Self` help: consider further restricting `Self`
| |
@ -45,46 +28,32 @@ LL | trait UncheckedCopy: Sized + Deref {
| ^^^^^^^ | ^^^^^^^
error[E0277]: cannot add-assign `&'static str` to `Self` error[E0277]: cannot add-assign `&'static str` to `Self`
--> $DIR/defaults-unsound-62211-2.rs:21:5 --> $DIR/defaults-unsound-62211-2.rs:20:5
| |
LL | type Output: Copy LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^ ------ required by a bound in this | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| _____| | | |
| | | | required by this bound in `UncheckedCopy::Output`
LL | | | no implementation for `Self += &'static str`
LL | |
LL | |
... |
LL | | + AddAssign<&'static str>
| | ----------------------- required by this bound in `UncheckedCopy::Output`
LL | | + From<Self>
LL | | + Display = Self;
| |_________________________^ no implementation for `Self += &'static str`
| |
help: consider further restricting `Self` help: consider further restricting `Self`
| |
LL | trait UncheckedCopy: Sized + std::ops::AddAssign<&'static str> { LL | trait UncheckedCopy: Sized + AddAssign<&'static str> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Self: std::marker::Copy` is not satisfied error[E0277]: the trait bound `Self: Copy` is not satisfied
--> $DIR/defaults-unsound-62211-2.rs:21:5 --> $DIR/defaults-unsound-62211-2.rs:20:5
| |
LL | type Output: Copy LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^ ---- required by this bound in `UncheckedCopy::Output` | ^^^^^^^^^^^^^----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| _____| | | |
| | | | required by this bound in `UncheckedCopy::Output`
LL | | | the trait `Copy` is not implemented for `Self`
LL | |
LL | |
... |
LL | | + From<Self>
LL | | + Display = Self;
| |_________________________^ the trait `std::marker::Copy` is not implemented for `Self`
| |
help: consider further restricting `Self` help: consider further restricting `Self`
| |
LL | trait UncheckedCopy: Sized + std::marker::Copy { LL | trait UncheckedCopy: Sized + Copy {
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View File

@ -7,9 +7,9 @@ LL | type Ty = Vec<[u8]>;
::: $SRC_DIR/alloc/src/vec.rs:LL:COL ::: $SRC_DIR/alloc/src/vec.rs:LL:COL
| |
LL | pub struct Vec<T> { LL | pub struct Vec<T> {
| - required by this bound in `std::vec::Vec` | - required by this bound in `Vec`
| |
= help: the trait `std::marker::Sized` is not implemented for `[u8]` = help: the trait `Sized` is not implemented for `[u8]`
error: aborting due to previous error error: aborting due to previous error

View File

@ -1,17 +1,17 @@
error[E0277]: the trait bound `(dyn std::string::ToString + 'static): std::default::Default` is not satisfied error[E0277]: the trait bound `(dyn ToString + 'static): Default` is not satisfied
--> $DIR/issue-43924.rs:7:5 --> $DIR/issue-43924.rs:7:5
| |
LL | type Out: Default + ToString + ?Sized = dyn ToString; LL | type Out: Default + ToString + ?Sized = dyn ToString;
| ^^^^^^^^^^-------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^-------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | | | | |
| | required by this bound in `Foo::Out` | | required by this bound in `Foo::Out`
| the trait `std::default::Default` is not implemented for `(dyn std::string::ToString + 'static)` | the trait `Default` is not implemented for `(dyn ToString + 'static)`
error[E0599]: no function or associated item named `default` found for trait object `(dyn std::string::ToString + 'static)` in the current scope error[E0599]: no function or associated item named `default` found for trait object `(dyn ToString + 'static)` in the current scope
--> $DIR/issue-43924.rs:14:39 --> $DIR/issue-43924.rs:14:39
| |
LL | assert_eq!(<() as Foo<u32>>::Out::default().to_string(), "false"); LL | assert_eq!(<() as Foo<u32>>::Out::default().to_string(), "false");
| ^^^^^^^ function or associated item not found in `(dyn std::string::ToString + 'static)` | ^^^^^^^ function or associated item not found in `(dyn ToString + 'static)`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -5,7 +5,6 @@ LL | fn get_future() -> impl Future<Output = ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
| |
= help: the trait `Future` is not implemented for `()` = help: the trait `Future` is not implemented for `()`
= note: the return type of a function must have a statically known size
error[E0698]: type inside `async fn` body must be known in this context error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/async-error-span.rs:13:9 --> $DIR/async-error-span.rs:13:9

View File

@ -27,33 +27,18 @@ error[E0609]: no field `0` on type `impl Future`
| |
LL | let _: i32 = tuple().0; LL | let _: i32 = tuple().0;
| ^ | ^
|
help: consider awaiting before field access
|
LL | let _: i32 = tuple().await.0;
| ^^^^^^
error[E0609]: no field `a` on type `impl Future` error[E0609]: no field `a` on type `impl Future`
--> $DIR/issue-61076.rs:60:28 --> $DIR/issue-61076.rs:60:28
| |
LL | let _: i32 = struct_().a; LL | let _: i32 = struct_().a;
| ^ | ^
|
help: consider awaiting before field access
|
LL | let _: i32 = struct_().await.a;
| ^^^^^^
error[E0599]: no method named `method` found for opaque type `impl Future` in the current scope error[E0599]: no method named `method` found for opaque type `impl Future` in the current scope
--> $DIR/issue-61076.rs:62:15 --> $DIR/issue-61076.rs:62:15
| |
LL | struct_().method(); LL | struct_().method();
| ^^^^^^ method not found in `impl Future` | ^^^^^^ method not found in `impl Future`
|
help: consider awaiting before this method call
|
LL | struct_().await.method();
| ^^^^^^
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/issue-61076.rs:69:9 --> $DIR/issue-61076.rs:69:9
@ -66,10 +51,6 @@ LL | Tuple(_) => {}
| |
= note: expected opaque type `impl Future` = note: expected opaque type `impl Future`
found struct `Tuple` found struct `Tuple`
help: consider awaiting on the future
|
LL | match tuple().await {
| ^^^^^^
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View File

@ -3,15 +3,6 @@ error: future cannot be sent between threads safely
| |
LL | pub fn foo() -> impl Future + Send { LL | pub fn foo() -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
...
LL | / async move {
LL | | match client.status() {
LL | | 200 => {
LL | | let _x = get().await;
... |
LL | | }
LL | | }
| |_____- this returned value is of type `impl Future`
| |
= help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)` = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await

View File

@ -3,9 +3,6 @@ error: future cannot be sent between threads safely
| |
LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send { LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
LL |
LL | async { (ty, ty1) }
| ------------------- this returned value is of type `impl Future`
| |
note: captured value is not `Send` note: captured value is not `Send`
--> $DIR/issue-70818.rs:6:18 --> $DIR/issue-70818.rs:6:18

View File

@ -15,12 +15,12 @@ error[E0277]: the size for values of type `<u32 as T<'_>>::V` cannot be known at
LL | (&|_| ()) as &dyn for<'x> Fn(<u32 as T<'x>>::V); LL | (&|_| ()) as &dyn for<'x> Fn(<u32 as T<'x>>::V);
| ^ doesn't have a size known at compile-time | ^ doesn't have a size known at compile-time
| |
= help: the trait `std::marker::Sized` is not implemented for `<u32 as T<'_>>::V` = help: the trait `Sized` is not implemented for `<u32 as T<'_>>::V`
= help: unsized locals are gated as an unstable feature = help: unsized locals are gated as an unstable feature
help: consider further restricting the associated type help: consider further restricting the associated type
| |
LL | fn main() where <u32 as T<'_>>::V: std::marker::Sized { LL | fn main() where <u32 as T<'_>>::V: Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: function arguments must have a statically known size, borrowed types always have a known size help: function arguments must have a statically known size, borrowed types always have a known size
| |
LL | (&|&_| ()) as &dyn for<'x> Fn(<u32 as T<'x>>::V); LL | (&|&_| ()) as &dyn for<'x> Fn(<u32 as T<'x>>::V);

View File

@ -5,7 +5,6 @@ LL | fn will_ice(something: &u32) -> impl Iterator<Item = &u32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator
| |
= help: the trait `Iterator` is not implemented for `()` = help: the trait `Iterator` is not implemented for `()`
= note: the return type of a function must have a statically known size
error: aborting due to previous error error: aborting due to previous error

View File

@ -1,4 +1,3 @@
// ignore-tidy-linelength
// compile-flags: -Zsave-analysis // compile-flags: -Zsave-analysis
// This is also a regression test for #69415 and the above flag is needed. // This is also a regression test for #69415 and the above flag is needed.
@ -15,7 +14,7 @@ impl Tr1 for S1 { type As1 = S2; }
trait _Tr3 { trait _Tr3 {
type A: Iterator<Item: Copy>; type A: Iterator<Item: Copy>;
//~^ ERROR associated type bounds are unstable //~^ ERROR associated type bounds are unstable
//~| ERROR the trait bound `<<Self as _Tr3>::A as std::iter::Iterator>::Item: std::marker::Copy` is not satisfied //~| ERROR the trait bound `<<Self as _Tr3>::A as Iterator>::Item: Copy` is not satisfied
type B: Iterator<Item: 'static>; type B: Iterator<Item: 'static>;
//~^ ERROR associated type bounds are unstable //~^ ERROR associated type bounds are unstable

View File

@ -1,5 +1,5 @@
error[E0658]: associated type bounds are unstable error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:16:22 --> $DIR/feature-gate-associated_type_bounds.rs:15:22
| |
LL | type A: Iterator<Item: Copy>; LL | type A: Iterator<Item: Copy>;
| ^^^^^^^^^^ | ^^^^^^^^^^
@ -8,7 +8,7 @@ LL | type A: Iterator<Item: Copy>;
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:20:22 --> $DIR/feature-gate-associated_type_bounds.rs:19:22
| |
LL | type B: Iterator<Item: 'static>; LL | type B: Iterator<Item: 'static>;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
@ -17,7 +17,7 @@ LL | type B: Iterator<Item: 'static>;
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:24:20 --> $DIR/feature-gate-associated_type_bounds.rs:23:20
| |
LL | struct _St1<T: Tr1<As1: Tr2>> { LL | struct _St1<T: Tr1<As1: Tr2>> {
| ^^^^^^^^ | ^^^^^^^^
@ -26,7 +26,7 @@ LL | struct _St1<T: Tr1<As1: Tr2>> {
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:31:18 --> $DIR/feature-gate-associated_type_bounds.rs:30:18
| |
LL | enum _En1<T: Tr1<As1: Tr2>> { LL | enum _En1<T: Tr1<As1: Tr2>> {
| ^^^^^^^^ | ^^^^^^^^
@ -35,7 +35,7 @@ LL | enum _En1<T: Tr1<As1: Tr2>> {
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:38:19 --> $DIR/feature-gate-associated_type_bounds.rs:37:19
| |
LL | union _Un1<T: Tr1<As1: Tr2>> { LL | union _Un1<T: Tr1<As1: Tr2>> {
| ^^^^^^^^ | ^^^^^^^^
@ -44,7 +44,7 @@ LL | union _Un1<T: Tr1<As1: Tr2>> {
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:45:37 --> $DIR/feature-gate-associated_type_bounds.rs:44:37
| |
LL | type _TaWhere1<T> where T: Iterator<Item: Copy> = T; LL | type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
| ^^^^^^^^^^ | ^^^^^^^^^^
@ -53,7 +53,7 @@ LL | type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:48:22 --> $DIR/feature-gate-associated_type_bounds.rs:47:22
| |
LL | fn _apit(_: impl Tr1<As1: Copy>) {} LL | fn _apit(_: impl Tr1<As1: Copy>) {}
| ^^^^^^^^^ | ^^^^^^^^^
@ -62,7 +62,7 @@ LL | fn _apit(_: impl Tr1<As1: Copy>) {}
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:50:26 --> $DIR/feature-gate-associated_type_bounds.rs:49:26
| |
LL | fn _apit_dyn(_: &dyn Tr1<As1: Copy>) {} LL | fn _apit_dyn(_: &dyn Tr1<As1: Copy>) {}
| ^^^^^^^^^ | ^^^^^^^^^
@ -71,7 +71,7 @@ LL | fn _apit_dyn(_: &dyn Tr1<As1: Copy>) {}
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:53:24 --> $DIR/feature-gate-associated_type_bounds.rs:52:24
| |
LL | fn _rpit() -> impl Tr1<As1: Copy> { S1 } LL | fn _rpit() -> impl Tr1<As1: Copy> { S1 }
| ^^^^^^^^^ | ^^^^^^^^^
@ -80,7 +80,7 @@ LL | fn _rpit() -> impl Tr1<As1: Copy> { S1 }
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:56:31 --> $DIR/feature-gate-associated_type_bounds.rs:55:31
| |
LL | fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) } LL | fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
| ^^^^^^^^^ | ^^^^^^^^^
@ -89,7 +89,7 @@ LL | fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:59:23 --> $DIR/feature-gate-associated_type_bounds.rs:58:23
| |
LL | const _cdef: impl Tr1<As1: Copy> = S1; LL | const _cdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^ | ^^^^^^^^^
@ -98,7 +98,7 @@ LL | const _cdef: impl Tr1<As1: Copy> = S1;
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:65:24 --> $DIR/feature-gate-associated_type_bounds.rs:64:24
| |
LL | static _sdef: impl Tr1<As1: Copy> = S1; LL | static _sdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^ | ^^^^^^^^^
@ -107,7 +107,7 @@ LL | static _sdef: impl Tr1<As1: Copy> = S1;
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0658]: associated type bounds are unstable error[E0658]: associated type bounds are unstable
--> $DIR/feature-gate-associated_type_bounds.rs:72:21 --> $DIR/feature-gate-associated_type_bounds.rs:71:21
| |
LL | let _: impl Tr1<As1: Copy> = S1; LL | let _: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^ | ^^^^^^^^^
@ -116,7 +116,7 @@ LL | let _: impl Tr1<As1: Copy> = S1;
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-associated_type_bounds.rs:59:14 --> $DIR/feature-gate-associated_type_bounds.rs:58:14
| |
LL | const _cdef: impl Tr1<As1: Copy> = S1; LL | const _cdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
@ -124,7 +124,7 @@ LL | const _cdef: impl Tr1<As1: Copy> = S1;
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-associated_type_bounds.rs:65:15 --> $DIR/feature-gate-associated_type_bounds.rs:64:15
| |
LL | static _sdef: impl Tr1<As1: Copy> = S1; LL | static _sdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
@ -132,28 +132,28 @@ LL | static _sdef: impl Tr1<As1: Copy> = S1;
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
error[E0562]: `impl Trait` not allowed outside of function and inherent method return types error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
--> $DIR/feature-gate-associated_type_bounds.rs:72:12 --> $DIR/feature-gate-associated_type_bounds.rs:71:12
| |
LL | let _: impl Tr1<As1: Copy> = S1; LL | let _: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
| |
= help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
error[E0277]: the trait bound `<<Self as _Tr3>::A as std::iter::Iterator>::Item: std::marker::Copy` is not satisfied error[E0277]: the trait bound `<<Self as _Tr3>::A as Iterator>::Item: Copy` is not satisfied
--> $DIR/feature-gate-associated_type_bounds.rs:16:28 --> $DIR/feature-gate-associated_type_bounds.rs:15:28
| |
LL | type A: Iterator<Item: Copy>; LL | type A: Iterator<Item: Copy>;
| ^^^^ the trait `std::marker::Copy` is not implemented for `<<Self as _Tr3>::A as std::iter::Iterator>::Item` | ^^^^ the trait `Copy` is not implemented for `<<Self as _Tr3>::A as Iterator>::Item`
| |
::: $SRC_DIR/core/src/marker.rs:LL:COL ::: $SRC_DIR/core/src/marker.rs:LL:COL
| |
LL | pub trait Copy: Clone { LL | pub trait Copy: Clone {
| --------------------- required by this bound in `std::marker::Copy` | --------------------- required by this bound in `Copy`
| |
help: consider further restricting the associated type help: consider further restricting the associated type
| |
LL | trait _Tr3 where <<Self as _Tr3>::A as std::iter::Iterator>::Item: std::marker::Copy { LL | trait _Tr3 where <<Self as _Tr3>::A as Iterator>::Item: Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 17 previous errors error: aborting due to 17 previous errors

View File

@ -15,7 +15,7 @@ impl PointerFamily<u32> for Foo {
//~^ ERROR generic associated types are unstable //~^ ERROR generic associated types are unstable
type Pointer2<U32> = Box<U32>; type Pointer2<U32> = Box<U32>;
//~^ ERROR generic associated types are unstable //~^ ERROR generic associated types are unstable
//~| ERROR the trait bound `U32: std::clone::Clone` is not satisfied //~| ERROR the trait bound `U32: Clone` is not satisfied
} }
trait Bar { trait Bar {

View File

@ -61,16 +61,16 @@ LL | type Assoc where Self: Sized = Foo;
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information = note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
= help: add `#![feature(generic_associated_types)]` to the crate attributes to enable = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable
error[E0277]: the trait bound `U32: std::clone::Clone` is not satisfied error[E0277]: the trait bound `U32: Clone` is not satisfied
--> $DIR/feature-gate-generic_associated_types.rs:16:5 --> $DIR/feature-gate-generic_associated_types.rs:16:5
| |
LL | type Pointer2<U32> = Box<U32>; LL | type Pointer2<U32> = Box<U32>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `U32` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `U32`
| |
help: consider restricting type parameter `U32` help: consider restricting type parameter `U32`
| |
LL | type Pointer2<U32: std::clone::Clone> = Box<U32>; LL | type Pointer2<U32: Clone> = Box<U32>;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^
error: aborting due to 8 previous errors error: aborting due to 8 previous errors

View File

@ -1,16 +1,16 @@
// E0277 should point exclusively at line 6, not the entire for loop span // E0277 should point exclusively at line 6, not the entire for loop span
// ignore-tidy-linelength
fn main() { fn main() {
for c in "asdf" { for c in "asdf" {
//~^ ERROR `&str` is not an iterator //~^ ERROR `&str` is not an iterator
//~| NOTE `&str` is not an iterator //~| NOTE `&str` is not an iterator
//~| HELP the trait `Iterator` is not implemented for `&str` //~| HELP the trait `Iterator` is not implemented for `&str`
//~| NOTE required because of the requirements on the impl of `IntoIterator` for `&str`
//~| NOTE required by `into_iter` //~| NOTE required by `into_iter`
//~| NOTE in this expansion of desugaring of `for` loop //~| NOTE in this expansion of desugaring of `for` loop
//~| NOTE in this expansion of desugaring of `for` loop //~| NOTE in this expansion of desugaring of `for` loop
//~| NOTE in this expansion of desugaring of `for` loop //~| NOTE in this expansion of desugaring of `for` loop
//~| NOTE in this expansion of desugaring of `for` loop
println!(); println!();
} }
} }

View File

@ -1,10 +1,11 @@
error[E0277]: `&str` is not an iterator error[E0277]: `&str` is not an iterator
--> $DIR/for-c-in-str.rs:6:14 --> $DIR/for-c-in-str.rs:4:14
| |
LL | for c in "asdf" { LL | for c in "asdf" {
| ^^^^^^ `&str` is not an iterator; try calling `.chars()` or `.bytes()` | ^^^^^^ `&str` is not an iterator; try calling `.chars()` or `.bytes()`
| |
= help: the trait `Iterator` is not implemented for `&str` = help: the trait `Iterator` is not implemented for `&str`
= note: required because of the requirements on the impl of `IntoIterator` for `&str`
= note: required by `into_iter` = note: required by `into_iter`
error: aborting due to previous error error: aborting due to previous error

View File

@ -5,6 +5,7 @@ LL | for x in bogus {
| ^^^^^ `MyStruct` is not an iterator | ^^^^^ `MyStruct` is not an iterator
| |
= help: the trait `Iterator` is not implemented for `MyStruct` = help: the trait `Iterator` is not implemented for `MyStruct`
= note: required because of the requirements on the impl of `IntoIterator` for `MyStruct`
= note: required by `into_iter` = note: required by `into_iter`
error: aborting due to previous error error: aborting due to previous error

View File

@ -20,7 +20,7 @@ LL | Pin::new(&mut gen).resume(());
::: $SRC_DIR/core/src/ops/generator.rs:LL:COL ::: $SRC_DIR/core/src/ops/generator.rs:LL:COL
| |
LL | pub enum GeneratorState<Y, R> { LL | pub enum GeneratorState<Y, R> {
| - required by this bound in `std::ops::GeneratorState` | - required by this bound in `GeneratorState`
| |
= help: the trait `Sized` is not implemented for `str` = help: the trait `Sized` is not implemented for `str`

View File

@ -13,7 +13,7 @@ pub struct FooImpl;
impl Foo for FooImpl { impl Foo for FooImpl {
type Bar = (); type Bar = ();
//~^ ERROR the trait bound `(): std::convert::AsRef<()>` is not satisfied //~^ ERROR the trait bound `(): AsRef<()>` is not satisfied
fn foo(&self) -> Pin<Box<dyn Future<Output = Self::Bar> + '_>> { fn foo(&self) -> Pin<Box<dyn Future<Output = Self::Bar> + '_>> {
panic!() panic!()
} }

View File

@ -1,8 +1,8 @@
error[E0277]: the trait bound `(): std::convert::AsRef<()>` is not satisfied error[E0277]: the trait bound `(): AsRef<()>` is not satisfied
--> $DIR/cross-crate-bounds.rs:15:5 --> $DIR/cross-crate-bounds.rs:15:5
| |
LL | type Bar = (); LL | type Bar = ();
| ^^^^^^^^^^^^^^ the trait `std::convert::AsRef<()>` is not implemented for `()` | ^^^^^^^^^^^^^^ the trait `AsRef<()>` is not implemented for `()`
| |
::: $DIR/auxiliary/foo_defn.rs:6:15 ::: $DIR/auxiliary/foo_defn.rs:6:15
| |

View File

@ -24,8 +24,25 @@ note: but lifetime parameter must outlive the lifetime `'a` as defined on the as
LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ()); LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ());
| ^^ | ^^
error[E0478]: lifetime bound not satisfied
--> $DIR/impl_bounds.rs:17:5
|
LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime `'a` as defined on the associated item at 17:12
--> $DIR/impl_bounds.rs:17:12
|
LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ());
| ^^
note: but lifetime parameter must outlive the lifetime `'b` as defined on the associated item at 17:16
--> $DIR/impl_bounds.rs:17:16
|
LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ());
| ^^
error[E0277]: the trait bound `T: Copy` is not satisfied error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/impl_bounds.rs:19:5 --> $DIR/impl_bounds.rs:20:5
| |
LL | type C where Self: Copy = String; LL | type C where Self: Copy = String;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`

View File

@ -43,7 +43,7 @@ impl<T> Bar for T where T: Foo {
// can use the bound on `Foo::Item` for this, but that requires // can use the bound on `Foo::Item` for this, but that requires
// `wf(<T as Foo>::Item)`, which is an invalid cycle. // `wf(<T as Foo>::Item)`, which is an invalid cycle.
type Assoc = OnlySized<<T as Foo>::Item>; type Assoc = OnlySized<<T as Foo>::Item>;
//~^ ERROR overflow evaluating the requirement `<T as Foo>::Item: std::marker::Sized` //~^ ERROR overflow evaluating the requirement `<T as Foo>::Item: Sized`
} }
fn foo<T: Print>() { fn foo<T: Print>() {

View File

@ -7,7 +7,7 @@ LL | #![feature(generic_associated_types)]
= note: `#[warn(incomplete_features)]` on by default = note: `#[warn(incomplete_features)]` on by default
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information = note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
error[E0275]: overflow evaluating the requirement `<T as Foo>::Item: std::marker::Sized` error[E0275]: overflow evaluating the requirement `<T as Foo>::Item: Sized`
--> $DIR/projection-bound-cycle-generic.rs:45:5 --> $DIR/projection-bound-cycle-generic.rs:45:5
| |
LL | struct OnlySized<T> where T: Sized { f: T } LL | struct OnlySized<T> where T: Sized { f: T }

View File

@ -45,7 +45,7 @@ impl<T> Bar for T where T: Foo {
// can use the bound on `Foo::Item` for this, but that requires // can use the bound on `Foo::Item` for this, but that requires
// `wf(<T as Foo>::Item)`, which is an invalid cycle. // `wf(<T as Foo>::Item)`, which is an invalid cycle.
type Assoc = OnlySized<<T as Foo>::Item>; type Assoc = OnlySized<<T as Foo>::Item>;
//~^ ERROR overflow evaluating the requirement `<T as Foo>::Item: std::marker::Sized` //~^ ERROR overflow evaluating the requirement `<T as Foo>::Item: Sized`
} }
fn foo<T: Print>() { fn foo<T: Print>() {

View File

@ -7,7 +7,7 @@ LL | #![feature(generic_associated_types)]
= note: `#[warn(incomplete_features)]` on by default = note: `#[warn(incomplete_features)]` on by default
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information = note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
error[E0275]: overflow evaluating the requirement `<T as Foo>::Item: std::marker::Sized` error[E0275]: overflow evaluating the requirement `<T as Foo>::Item: Sized`
--> $DIR/projection-bound-cycle.rs:47:5 --> $DIR/projection-bound-cycle.rs:47:5
| |
LL | struct OnlySized<T> where T: Sized { f: T } LL | struct OnlySized<T> where T: Sized { f: T }

View File

@ -3,8 +3,6 @@ error[E0277]: the trait bound `impl Future: Copy` is not satisfied
| |
LL | type E = impl std::marker::Copy; LL | type E = impl std::marker::Copy;
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future` | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future`
|
= note: the return type of a function must have a statically known size
error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
--> $DIR/issue-55872-2.rs:15:28 --> $DIR/issue-55872-2.rs:15:28

View File

@ -7,7 +7,7 @@ LL | #![feature(impl_trait_in_bindings)]
= note: `#[warn(incomplete_features)]` on by default = note: `#[warn(incomplete_features)]` on by default
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
error[E0282]: type annotations needed for `impl std::future::Future` error[E0282]: type annotations needed for `impl Future`
--> $DIR/cannot-infer-async-enabled-impl-trait-bindings.rs:13:20 --> $DIR/cannot-infer-async-enabled-impl-trait-bindings.rs:13:20
| |
LL | let fut = async { LL | let fut = async {

View File

@ -11,7 +11,6 @@ LL | fn test_ref(x: &u32) -> impl std::future::Future<Output = u32> + '_ {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `u32` is not a future | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `u32` is not a future
| |
= help: the trait `Future` is not implemented for `u32` = help: the trait `Future` is not implemented for `u32`
= note: the return type of a function must have a statically known size
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -4,9 +4,9 @@ error[E0277]: the size for values of type `dyn Iterator<Item = &'a mut u8>` cann
LL | for item in *things { *item = 0 } LL | for item in *things { *item = 0 }
| ^^^^^^^ doesn't have a size known at compile-time | ^^^^^^^ doesn't have a size known at compile-time
| |
= help: the trait `std::marker::Sized` is not implemented for `dyn std::iter::Iterator<Item = &'a mut u8>` = help: the trait `Sized` is not implemented for `dyn Iterator<Item = &'a mut u8>`
= note: required because of the requirements on the impl of `std::iter::IntoIterator` for `dyn std::iter::Iterator<Item = &'a mut u8>` = note: required because of the requirements on the impl of `IntoIterator` for `dyn Iterator<Item = &'a mut u8>`
= note: required by `std::iter::IntoIterator::into_iter` = note: required by `into_iter`
error: aborting due to previous error error: aborting due to previous error

View File

@ -7,14 +7,8 @@ LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher
note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 28:5... note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 28:5...
--> $DIR/issue-20831-debruijn.rs:28:5 --> $DIR/issue-20831-debruijn.rs:28:5
| |
LL | / fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) { LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
LL | | // Not obvious, but there is an implicit lifetime here -------^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | |
LL | | //
... |
LL | | self.sub = t;
LL | | }
| |_____^
note: ...but the lifetime must also be valid for the lifetime `'a` as defined on the impl at 26:6... note: ...but the lifetime must also be valid for the lifetime `'a` as defined on the impl at 26:6...
--> $DIR/issue-20831-debruijn.rs:26:6 --> $DIR/issue-20831-debruijn.rs:26:6
| |

View File

@ -1,4 +1,4 @@
error[E0275]: overflow evaluating the requirement `<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<T as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: std::marker::Sized` error[E0275]: overflow evaluating the requirement `<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<T as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: Sized`
--> $DIR/issue-23122-2.rs:8:5 --> $DIR/issue-23122-2.rs:8:5
| |
LL | type Next = <GetNext<T::Next> as Next>::Next; LL | type Next = <GetNext<T::Next> as Next>::Next;

View File

@ -13,9 +13,9 @@ error[E0277]: `bool` is not an iterator
LL | for _ in false {} LL | for _ in false {}
| ^^^^^ `bool` is not an iterator | ^^^^^ `bool` is not an iterator
| |
= help: the trait `std::iter::Iterator` is not implemented for `bool` = help: the trait `Iterator` is not implemented for `bool`
= note: required because of the requirements on the impl of `std::iter::IntoIterator` for `bool` = note: required because of the requirements on the impl of `IntoIterator` for `bool`
= note: required by `std::iter::IntoIterator::into_iter` = note: required by `into_iter`
error[E0277]: `()` is not an iterator error[E0277]: `()` is not an iterator
--> $DIR/issue-28098.rs:9:28 --> $DIR/issue-28098.rs:9:28
@ -59,6 +59,7 @@ LL | for _ in false {}
| ^^^^^ `bool` is not an iterator | ^^^^^ `bool` is not an iterator
| |
= help: the trait `Iterator` is not implemented for `bool` = help: the trait `Iterator` is not implemented for `bool`
= note: required because of the requirements on the impl of `IntoIterator` for `bool`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `()` is not an iterator error[E0277]: `()` is not an iterator

View File

@ -15,9 +15,9 @@ LL | for _ in HashMap::new().iter().cloned() {}
| |
= note: expected tuple `(&_, &_)` = note: expected tuple `(&_, &_)`
found reference `&_` found reference `&_`
= note: required because of the requirements on the impl of `std::iter::Iterator` for `std::iter::Cloned<std::collections::hash_map::Iter<'_, _, _>>` = note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
= note: required because of the requirements on the impl of `std::iter::IntoIterator` for `std::iter::Cloned<std::collections::hash_map::Iter<'_, _, _>>` = note: required because of the requirements on the impl of `IntoIterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
= note: required by `std::iter::IntoIterator::into_iter` = note: required by `into_iter`
error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as Iterator>::Item == &_` error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as Iterator>::Item == &_`
--> $DIR/issue-33941.rs:4:14 --> $DIR/issue-33941.rs:4:14
@ -28,6 +28,7 @@ LL | for _ in HashMap::new().iter().cloned() {}
= note: expected tuple `(&_, &_)` = note: expected tuple `(&_, &_)`
found reference `&_` found reference `&_`
= note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>` = note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
= note: required by `std::iter::Iterator::next`
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View File

@ -1,10 +1,12 @@
trait Trait {} trait Trait {}
fn get_function<'a>() -> &'a dyn Fn() -> dyn Trait { panic!("") } fn get_function<'a>() -> &'a dyn Fn() -> dyn Trait {
panic!("")
}
fn main() { fn main() {
// This isn't great. The issue here is that `dyn Trait` is not sized, so // This isn't great. The issue here is that `dyn Trait` is not sized, so
// `dyn Fn() -> dyn Trait` is not well-formed. // `dyn Fn() -> dyn Trait` is not well-formed.
let t: &dyn Trait = &get_function()(); let t: &dyn Trait = &get_function()();
//~^ ERROR expected function, found `&dyn std::ops::Fn() -> (dyn Trait + 'static)` //~^ ERROR expected function, found `&dyn Fn() -> (dyn Trait + 'static)`
} }

View File

@ -1,8 +1,8 @@
error[E0618]: expected function, found `&dyn std::ops::Fn() -> (dyn Trait + 'static)` error[E0618]: expected function, found `&dyn Fn() -> (dyn Trait + 'static)`
--> $DIR/issue-41139.rs:8:27 --> $DIR/issue-41139.rs:10:26
| |
LL | fn get_function<'a>() -> &'a dyn Fn() -> dyn Trait { panic!("") } LL | fn get_function<'a>() -> &'a dyn Fn() -> dyn Trait {
| ----------------------------------------------------------------- `get_function` defined here returns `&dyn std::ops::Fn() -> (dyn Trait + 'static)` | -------------------------------------------------- `get_function` defined here returns `&dyn Fn() -> (dyn Trait + 'static)`
... ...
LL | let t: &dyn Trait = &get_function()(); LL | let t: &dyn Trait = &get_function()();
| ^^^^^^^^^^^^^^-- | ^^^^^^^^^^^^^^--

View File

@ -1,11 +1,11 @@
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/issue-43784-associated-type.rs:14:5 --> $DIR/issue-43784-associated-type.rs:14:5
| |
LL | type Assoc: Partial<Self>; LL | type Assoc: Partial<Self>;
| ------------- required by this bound in `Complete::Assoc` | ------------- required by this bound in `Complete::Assoc`
... ...
LL | type Assoc = T; LL | type Assoc = T;
| ^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | ^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
| |
help: consider restricting type parameter `T` help: consider restricting type parameter `T`
| |

View File

@ -24,11 +24,11 @@ LL | foo((), drop)
LL | pub fn drop<T>(_x: T) {} LL | pub fn drop<T>(_x: T) {}
| - required by this bound in `std::mem::drop` | - required by this bound in `std::mem::drop`
| |
= help: the trait `std::marker::Sized` is not implemented for `<() as Trait<'_>>::Item` = help: the trait `Sized` is not implemented for `<() as Trait<'_>>::Item`
help: consider further restricting the associated type help: consider further restricting the associated type
| |
LL | fn main() where <() as Trait<'_>>::Item: std::marker::Sized { LL | fn main() where <() as Trait<'_>>::Item: Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -6,6 +6,7 @@ LL | for _ in [0..1] {}
| |
= help: the trait `Iterator` is not implemented for `[std::ops::Range<{integer}>; 1]` = help: the trait `Iterator` is not implemented for `[std::ops::Range<{integer}>; 1]`
= note: `[start..end]` is an array of one `Range`; you might have meant to have a `Range` without the brackets: `start..end` = note: `[start..end]` is an array of one `Range`; you might have meant to have a `Range` without the brackets: `start..end`
= note: required because of the requirements on the impl of `IntoIterator` for `[std::ops::Range<{integer}>; 1]`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `[RangeInclusive<{integer}>; 1]` is not an iterator error[E0277]: `[RangeInclusive<{integer}>; 1]` is not an iterator
@ -16,6 +17,7 @@ LL | for _ in [0..=1] {}
| |
= help: the trait `Iterator` is not implemented for `[RangeInclusive<{integer}>; 1]` = help: the trait `Iterator` is not implemented for `[RangeInclusive<{integer}>; 1]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeInclusive<{integer}>; 1]`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `[RangeFrom<{integer}>; 1]` is not an iterator error[E0277]: `[RangeFrom<{integer}>; 1]` is not an iterator
@ -26,6 +28,7 @@ LL | for _ in [0..] {}
| |
= help: the trait `Iterator` is not implemented for `[RangeFrom<{integer}>; 1]` = help: the trait `Iterator` is not implemented for `[RangeFrom<{integer}>; 1]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeFrom<{integer}>; 1]`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `[RangeTo<{integer}>; 1]` is not an iterator error[E0277]: `[RangeTo<{integer}>; 1]` is not an iterator
@ -36,6 +39,7 @@ LL | for _ in [..1] {}
| |
= help: the trait `Iterator` is not implemented for `[RangeTo<{integer}>; 1]` = help: the trait `Iterator` is not implemented for `[RangeTo<{integer}>; 1]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeTo<{integer}>; 1]`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `[RangeToInclusive<{integer}>; 1]` is not an iterator error[E0277]: `[RangeToInclusive<{integer}>; 1]` is not an iterator
@ -46,6 +50,7 @@ LL | for _ in [..=1] {}
| |
= help: the trait `Iterator` is not implemented for `[RangeToInclusive<{integer}>; 1]` = help: the trait `Iterator` is not implemented for `[RangeToInclusive<{integer}>; 1]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeToInclusive<{integer}>; 1]`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `[std::ops::Range<{integer}>; 1]` is not an iterator error[E0277]: `[std::ops::Range<{integer}>; 1]` is not an iterator
@ -56,6 +61,7 @@ LL | for _ in [start..end] {}
| |
= help: the trait `Iterator` is not implemented for `[std::ops::Range<{integer}>; 1]` = help: the trait `Iterator` is not implemented for `[std::ops::Range<{integer}>; 1]`
= note: `[start..end]` is an array of one `Range`; you might have meant to have a `Range` without the brackets: `start..end` = note: `[start..end]` is an array of one `Range`; you might have meant to have a `Range` without the brackets: `start..end`
= note: required because of the requirements on the impl of `IntoIterator` for `[std::ops::Range<{integer}>; 1]`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `[std::ops::Range<{integer}>; 1]` is not an iterator error[E0277]: `[std::ops::Range<{integer}>; 1]` is not an iterator
@ -66,6 +72,7 @@ LL | for _ in array_of_range {}
| |
= help: the trait `Iterator` is not implemented for `[std::ops::Range<{integer}>; 1]` = help: the trait `Iterator` is not implemented for `[std::ops::Range<{integer}>; 1]`
= note: `[start..end]` is an array of one `Range`; you might have meant to have a `Range` without the brackets: `start..end` = note: `[start..end]` is an array of one `Range`; you might have meant to have a `Range` without the brackets: `start..end`
= note: required because of the requirements on the impl of `IntoIterator` for `[std::ops::Range<{integer}>; 1]`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `[std::ops::Range<{integer}>; 2]` is not an iterator error[E0277]: `[std::ops::Range<{integer}>; 2]` is not an iterator
@ -76,6 +83,7 @@ LL | for _ in [0..1, 2..3] {}
| |
= help: the trait `Iterator` is not implemented for `[std::ops::Range<{integer}>; 2]` = help: the trait `Iterator` is not implemented for `[std::ops::Range<{integer}>; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[std::ops::Range<{integer}>; 2]`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `[RangeInclusive<{integer}>; 1]` is not an iterator error[E0277]: `[RangeInclusive<{integer}>; 1]` is not an iterator
@ -86,6 +94,7 @@ LL | for _ in [0..=1] {}
| |
= help: the trait `Iterator` is not implemented for `[RangeInclusive<{integer}>; 1]` = help: the trait `Iterator` is not implemented for `[RangeInclusive<{integer}>; 1]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[RangeInclusive<{integer}>; 1]`
= note: required by `into_iter` = note: required by `into_iter`
error: aborting due to 9 previous errors error: aborting due to 9 previous errors

View File

@ -6,6 +6,7 @@ LL | for _ in [1, 2] {}
| |
= help: the trait `Iterator` is not implemented for `[{integer}; 2]` = help: the trait `Iterator` is not implemented for `[{integer}; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[{integer}; 2]`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `[{integer}; 2]` is not an iterator error[E0277]: `[{integer}; 2]` is not an iterator
@ -16,6 +17,7 @@ LL | for _ in x {}
| |
= help: the trait `Iterator` is not implemented for `[{integer}; 2]` = help: the trait `Iterator` is not implemented for `[{integer}; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[{integer}; 2]`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `[{float}; 2]` is not an iterator error[E0277]: `[{float}; 2]` is not an iterator
@ -26,6 +28,7 @@ LL | for _ in [1.0, 2.0] {}
| |
= help: the trait `Iterator` is not implemented for `[{float}; 2]` = help: the trait `Iterator` is not implemented for `[{float}; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[{float}; 2]`
= note: required by `into_iter` = note: required by `into_iter`
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View File

@ -6,6 +6,7 @@ LL | for _ in 42 {}
| |
= help: the trait `Iterator` is not implemented for `{integer}` = help: the trait `Iterator` is not implemented for `{integer}`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
= note: required because of the requirements on the impl of `IntoIterator` for `{integer}`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `u8` is not an iterator error[E0277]: `u8` is not an iterator
@ -16,6 +17,7 @@ LL | for _ in 42 as u8 {}
| |
= help: the trait `Iterator` is not implemented for `u8` = help: the trait `Iterator` is not implemented for `u8`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
= note: required because of the requirements on the impl of `IntoIterator` for `u8`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `i8` is not an iterator error[E0277]: `i8` is not an iterator
@ -26,6 +28,7 @@ LL | for _ in 42 as i8 {}
| |
= help: the trait `Iterator` is not implemented for `i8` = help: the trait `Iterator` is not implemented for `i8`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
= note: required because of the requirements on the impl of `IntoIterator` for `i8`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `u16` is not an iterator error[E0277]: `u16` is not an iterator
@ -36,6 +39,7 @@ LL | for _ in 42 as u16 {}
| |
= help: the trait `Iterator` is not implemented for `u16` = help: the trait `Iterator` is not implemented for `u16`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
= note: required because of the requirements on the impl of `IntoIterator` for `u16`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `i16` is not an iterator error[E0277]: `i16` is not an iterator
@ -46,6 +50,7 @@ LL | for _ in 42 as i16 {}
| |
= help: the trait `Iterator` is not implemented for `i16` = help: the trait `Iterator` is not implemented for `i16`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
= note: required because of the requirements on the impl of `IntoIterator` for `i16`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `u32` is not an iterator error[E0277]: `u32` is not an iterator
@ -56,6 +61,7 @@ LL | for _ in 42 as u32 {}
| |
= help: the trait `Iterator` is not implemented for `u32` = help: the trait `Iterator` is not implemented for `u32`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
= note: required because of the requirements on the impl of `IntoIterator` for `u32`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `i32` is not an iterator error[E0277]: `i32` is not an iterator
@ -66,6 +72,7 @@ LL | for _ in 42 as i32 {}
| |
= help: the trait `Iterator` is not implemented for `i32` = help: the trait `Iterator` is not implemented for `i32`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
= note: required because of the requirements on the impl of `IntoIterator` for `i32`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `u64` is not an iterator error[E0277]: `u64` is not an iterator
@ -76,6 +83,7 @@ LL | for _ in 42 as u64 {}
| |
= help: the trait `Iterator` is not implemented for `u64` = help: the trait `Iterator` is not implemented for `u64`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
= note: required because of the requirements on the impl of `IntoIterator` for `u64`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `i64` is not an iterator error[E0277]: `i64` is not an iterator
@ -86,6 +94,7 @@ LL | for _ in 42 as i64 {}
| |
= help: the trait `Iterator` is not implemented for `i64` = help: the trait `Iterator` is not implemented for `i64`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
= note: required because of the requirements on the impl of `IntoIterator` for `i64`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `usize` is not an iterator error[E0277]: `usize` is not an iterator
@ -96,6 +105,7 @@ LL | for _ in 42 as usize {}
| |
= help: the trait `Iterator` is not implemented for `usize` = help: the trait `Iterator` is not implemented for `usize`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
= note: required because of the requirements on the impl of `IntoIterator` for `usize`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `isize` is not an iterator error[E0277]: `isize` is not an iterator
@ -106,6 +116,7 @@ LL | for _ in 42 as isize {}
| |
= help: the trait `Iterator` is not implemented for `isize` = help: the trait `Iterator` is not implemented for `isize`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
= note: required because of the requirements on the impl of `IntoIterator` for `isize`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `{float}` is not an iterator error[E0277]: `{float}` is not an iterator
@ -115,6 +126,7 @@ LL | for _ in 42.0 {}
| ^^^^ `{float}` is not an iterator | ^^^^ `{float}` is not an iterator
| |
= help: the trait `Iterator` is not implemented for `{float}` = help: the trait `Iterator` is not implemented for `{float}`
= note: required because of the requirements on the impl of `IntoIterator` for `{float}`
= note: required by `into_iter` = note: required by `into_iter`
error: aborting due to 12 previous errors error: aborting due to 12 previous errors

View File

@ -5,6 +5,7 @@ LL | for _ in ..10 {}
| ^^^^ `RangeTo<{integer}>` is not an iterator | ^^^^ `RangeTo<{integer}>` is not an iterator
| |
= help: the trait `Iterator` is not implemented for `RangeTo<{integer}>` = help: the trait `Iterator` is not implemented for `RangeTo<{integer}>`
= note: required because of the requirements on the impl of `IntoIterator` for `RangeTo<{integer}>`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `RangeToInclusive<{integer}>` is not an iterator error[E0277]: `RangeToInclusive<{integer}>` is not an iterator
@ -14,6 +15,7 @@ LL | for _ in ..=10 {}
| ^^^^^ `RangeToInclusive<{integer}>` is not an iterator | ^^^^^ `RangeToInclusive<{integer}>` is not an iterator
| |
= help: the trait `Iterator` is not implemented for `RangeToInclusive<{integer}>` = help: the trait `Iterator` is not implemented for `RangeToInclusive<{integer}>`
= note: required because of the requirements on the impl of `IntoIterator` for `RangeToInclusive<{integer}>`
= note: required by `into_iter` = note: required by `into_iter`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -5,6 +5,7 @@ LL | for _ in "".to_owned() {}
| ^^^^^^^^^^^^^ `String` is not an iterator | ^^^^^^^^^^^^^ `String` is not an iterator
| |
= help: the trait `Iterator` is not implemented for `String` = help: the trait `Iterator` is not implemented for `String`
= note: required because of the requirements on the impl of `IntoIterator` for `String`
= note: required by `into_iter` = note: required by `into_iter`
error[E0277]: `&str` is not an iterator error[E0277]: `&str` is not an iterator
@ -14,6 +15,7 @@ LL | for _ in "" {}
| ^^ `&str` is not an iterator; try calling `.chars()` or `.bytes()` | ^^ `&str` is not an iterator; try calling `.chars()` or `.bytes()`
| |
= help: the trait `Iterator` is not implemented for `&str` = help: the trait `Iterator` is not implemented for `&str`
= note: required because of the requirements on the impl of `IntoIterator` for `&str`
= note: required by `into_iter` = note: required by `into_iter`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -24,6 +24,7 @@ LL | | }.hi() {
| |__________^ `bool` is not an iterator | |__________^ `bool` is not an iterator
| |
= help: the trait `Iterator` is not implemented for `bool` = help: the trait `Iterator` is not implemented for `bool`
= note: required because of the requirements on the impl of `IntoIterator` for `bool`
= note: required by `into_iter` = note: required by `into_iter`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -21,18 +21,14 @@ mod m {
// "Private-in-public in associated types is hard error" in RFC 2145 // "Private-in-public in associated types is hard error" in RFC 2145
// applies only to the aliased types, not bounds. // applies only to the aliased types, not bounds.
pub trait PubTr { pub trait PubTr {
type Alias1: PrivTr;
//~^ WARN private trait `PrivTr` in public interface //~^ WARN private trait `PrivTr` in public interface
//~| WARN this was previously accepted //~| WARN this was previously accepted
//~| WARN private type `Priv` in public interface
//~| WARN private type `Priv` in public interface
//~| WARN this was previously accepted
//~| WARN this was previously accepted
type Alias1: PrivTr;
type Alias2: PubTrAux1<Priv> = u8; type Alias2: PubTrAux1<Priv> = u8;
//~^ WARN private type `m::Priv` in public interface //~^ WARN private type `Priv` in public interface
//~| WARN this was previously accepted //~| WARN this was previously accepted
type Alias3: PubTrAux2<A = Priv> = u8; type Alias3: PubTrAux2<A = Priv> = u8;
//~^ WARN private type `m::Priv` in public interface //~^ WARN private type `Priv` in public interface
//~| WARN this was previously accepted //~| WARN this was previously accepted
type Alias4 = Priv; type Alias4 = Priv;

View File

@ -8,7 +8,7 @@ LL | type A = Priv;
| ^^^^^^^^^^^^^^ can't leak private type | ^^^^^^^^^^^^^^ can't leak private type
warning: private trait `PrivTr` in public interface (error E0445) warning: private trait `PrivTr` in public interface (error E0445)
--> $DIR/private-in-public-assoc-ty.rs:23:5 --> $DIR/private-in-public-assoc-ty.rs:24:9
| |
LL | type Alias1: PrivTr; LL | type Alias1: PrivTr;
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
@ -18,7 +18,7 @@ LL | type Alias1: PrivTr;
= note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
warning: private type `Priv` in public interface (error E0446) warning: private type `Priv` in public interface (error E0446)
--> $DIR/private-in-public-assoc-ty.rs:23:5 --> $DIR/private-in-public-assoc-ty.rs:27:9
| |
LL | type Alias2: PubTrAux1<Priv> = u8; LL | type Alias2: PubTrAux1<Priv> = u8;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -27,7 +27,7 @@ LL | type Alias2: PubTrAux1<Priv> = u8;
= note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
warning: private type `Priv` in public interface (error E0446) warning: private type `Priv` in public interface (error E0446)
--> $DIR/private-in-public-assoc-ty.rs:23:5 --> $DIR/private-in-public-assoc-ty.rs:30:9
| |
LL | type Alias3: PubTrAux2<A = Priv> = u8; LL | type Alias3: PubTrAux2<A = Priv> = u8;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -32,9 +32,8 @@ impl PublicType {
pub trait MyPubTrait { pub trait MyPubTrait {
type Foo: OtherTrait; type Foo: OtherTrait;
//~^ ERROR trait `priv_dep::OtherTrait` from private dependency 'priv_dep' in public interface
} }
//~^^^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface //~^^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
pub struct AllowedPrivType { pub struct AllowedPrivType {
#[allow(exported_private_dependencies)] #[allow(exported_private_dependencies)]

View File

@ -17,7 +17,7 @@ LL | pub fn pub_fn(param: OtherType) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: trait `OtherTrait` from private dependency 'priv_dep' in public interface error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:33:1 --> $DIR/pub-priv1.rs:34:5
| |
LL | type Foo: OtherTrait; LL | type Foo: OtherTrait;
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^

View File

@ -4,7 +4,8 @@ error[E0283]: type annotations needed
LL | l.iter().map(f).collect()? LL | l.iter().map(f).collect()?
| ^^^^^^^ cannot infer type | ^^^^^^^ cannot infer type
| |
= note: cannot satisfy `<_ as Try>::Ok == _` = note: cannot satisfy `_: Try`
= note: required by `into_result`
help: consider specifying the type argument in the method call help: consider specifying the type argument in the method call
| |
LL | l.iter().map(f).collect::<B>()? LL | l.iter().map(f).collect::<B>()?

View File

@ -11,6 +11,8 @@ LL | for i in false..true {}
| ^^^^^^^^^^^ the trait `Step` is not implemented for `bool` | ^^^^^^^^^^^ the trait `Step` is not implemented for `bool`
| |
= note: required because of the requirements on the impl of `Iterator` for `std::ops::Range<bool>` = note: required because of the requirements on the impl of `Iterator` for `std::ops::Range<bool>`
= note: required because of the requirements on the impl of `IntoIterator` for `std::ops::Range<bool>`
= note: required by `into_iter`
error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
--> $DIR/range-1.rs:14:17 --> $DIR/range-1.rs:14:17

View File

@ -4,8 +4,9 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` d
LL | / fn bar<'a, 'b>() LL | / fn bar<'a, 'b>()
LL | | LL | |
LL | | LL | |
LL | | where <() as Project<'a, 'b>>::Item : Eq LL | | where
| |____________________________________________^ LL | | <() as Project<'a, 'b>>::Item: Eq,
| |______________________________________^
| |
note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 24:8... note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 24:8...
--> $DIR/regions-normalize-in-where-clause-list.rs:24:8 --> $DIR/regions-normalize-in-where-clause-list.rs:24:8
@ -23,43 +24,14 @@ note: ...so that the types are compatible
LL | / fn bar<'a, 'b>() LL | / fn bar<'a, 'b>()
LL | | LL | |
LL | | LL | |
LL | | where <() as Project<'a, 'b>>::Item : Eq LL | | where
| |____________________________________________^ LL | | <() as Project<'a, 'b>>::Item: Eq,
| |______________________________________^
= note: expected `Project<'a, 'b>` = note: expected `Project<'a, 'b>`
found `Project<'_, '_>` found `Project<'_, '_>`
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/regions-normalize-in-where-clause-list.rs:22:1 --> $DIR/regions-normalize-in-where-clause-list.rs:24:4
|
LL | / fn bar<'a, 'b>()
LL | |
LL | |
LL | | where <() as Project<'a, 'b>>::Item : Eq
| |____________________________________________^
|
note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 22:8...
--> $DIR/regions-normalize-in-where-clause-list.rs:22:8
|
LL | fn bar<'a, 'b>()
| ^^
note: ...but the lifetime must also be valid for the lifetime `'b` as defined on the function body at 22:12...
--> $DIR/regions-normalize-in-where-clause-list.rs:22:12
|
LL | fn bar<'a, 'b>()
| ^^
note: ...so that the types are compatible
--> $DIR/regions-normalize-in-where-clause-list.rs:22:1
|
LL | / fn bar<'a, 'b>()
LL | |
LL | |
LL | | where <() as Project<'a, 'b>>::Item : Eq
| |____________________________________________^
= note: expected `Project<'a, 'b>`
found `Project<'_, '_>`
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/regions-normalize-in-where-clause-list.rs:22:4
| |
LL | fn bar<'a, 'b>() LL | fn bar<'a, 'b>()
| ^^^ | ^^^

View File

@ -8,6 +8,7 @@ LL | for (i, _) in &v.iter().enumerate() {
| help: consider removing the leading `&`-reference | help: consider removing the leading `&`-reference
| |
= help: the trait `Iterator` is not implemented for `&Enumerate<std::slice::Iter<'_, {integer}>>` = help: the trait `Iterator` is not implemented for `&Enumerate<std::slice::Iter<'_, {integer}>>`
= note: required because of the requirements on the impl of `IntoIterator` for `&Enumerate<std::slice::Iter<'_, {integer}>>`
= note: required by `into_iter` = note: required by `into_iter`
error: aborting due to previous error error: aborting due to previous error

View File

@ -8,6 +8,7 @@ LL | for (i, _) in & & & & &v.iter().enumerate() {
| help: consider removing 5 leading `&`-references | help: consider removing 5 leading `&`-references
| |
= help: the trait `Iterator` is not implemented for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` = help: the trait `Iterator` is not implemented for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>`
= note: required because of the requirements on the impl of `IntoIterator` for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>`
= note: required by `into_iter` = note: required by `into_iter`
error: aborting due to previous error error: aborting due to previous error

View File

@ -12,6 +12,7 @@ LL | | .enumerate() {
| |_____________________^ `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterator | |_____________________^ `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterator
| |
= help: the trait `Iterator` is not implemented for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` = help: the trait `Iterator` is not implemented for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>`
= note: required because of the requirements on the impl of `IntoIterator` for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>`
= note: required by `into_iter` = note: required by `into_iter`
error: aborting due to previous error error: aborting due to previous error

View File

@ -10,5 +10,5 @@ fn f<T: X + ?Sized>() {
fn main() { fn main() {
f::<dyn X<Y = str>>(); f::<dyn X<Y = str>>();
//~^ ERROR the trait bound `str: std::clone::Clone` is not satisfied //~^ ERROR the trait bound `str: Clone` is not satisfied
} }

View File

@ -1,11 +1,11 @@
error[E0277]: the trait bound `str: std::clone::Clone` is not satisfied error[E0277]: the trait bound `str: Clone` is not satisfied
--> $DIR/check-trait-object-bounds-1.rs:12:5 --> $DIR/check-trait-object-bounds-1.rs:12:5
| |
LL | fn f<T: X + ?Sized>() { LL | fn f<T: X + ?Sized>() {
| - required by this bound in `f` | - required by this bound in `f`
... ...
LL | f::<dyn X<Y = str>>(); LL | f::<dyn X<Y = str>>();
| ^^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `str` | ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str`
error: aborting due to previous error error: aborting due to previous error

View File

@ -11,5 +11,5 @@ fn f<T: for<'r> X<'r> + ?Sized>() {
fn main() { fn main() {
f::<dyn for<'x> X<'x, F = i32>>(); f::<dyn for<'x> X<'x, F = i32>>();
//~^ expected a `std::ops::FnOnce<(&i32,)>` closure, found `i32` //~^ expected a `FnOnce<(&i32,)>` closure, found `i32`
} }

View File

@ -1,4 +1,4 @@
error[E0277]: expected a `std::ops::FnOnce<(&i32,)>` closure, found `i32` error[E0277]: expected a `FnOnce<(&i32,)>` closure, found `i32`
--> $DIR/check-trait-object-bounds-2.rs:13:5 --> $DIR/check-trait-object-bounds-2.rs:13:5
| |
LL | fn f<T: for<'r> X<'r> + ?Sized>() { LL | fn f<T: for<'r> X<'r> + ?Sized>() {
@ -7,7 +7,7 @@ LL | fn f<T: for<'r> X<'r> + ?Sized>() {
LL | f::<dyn for<'x> X<'x, F = i32>>(); LL | f::<dyn for<'x> X<'x, F = i32>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(&i32,)>` closure, found `i32` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(&i32,)>` closure, found `i32`
| |
= help: the trait `for<'r> std::ops::FnOnce<(&'r i32,)>` is not implemented for `i32` = help: the trait `for<'r> FnOnce<(&'r i32,)>` is not implemented for `i32`
error: aborting due to previous error error: aborting due to previous error

View File

@ -13,5 +13,5 @@ fn f<T: X + ?Sized>() {
fn main() { fn main() {
f::<dyn X<Y = str>>(); f::<dyn X<Y = str>>();
//~^ ERROR the trait bound `str: std::clone::Clone` is not satisfied //~^ ERROR the trait bound `str: Clone` is not satisfied
} }

View File

@ -1,11 +1,11 @@
error[E0277]: the trait bound `str: std::clone::Clone` is not satisfied error[E0277]: the trait bound `str: Clone` is not satisfied
--> $DIR/check-trait-object-bounds-4.rs:15:5 --> $DIR/check-trait-object-bounds-4.rs:15:5
| |
LL | fn f<T: X + ?Sized>() { LL | fn f<T: X + ?Sized>() {
| - required by this bound in `f` | - required by this bound in `f`
... ...
LL | f::<dyn X<Y = str>>(); LL | f::<dyn X<Y = str>>();
| ^^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `str` | ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str`
error: aborting due to previous error error: aborting due to previous error

View File

@ -1,4 +1,4 @@
error[E0275]: overflow evaluating the requirement `SalsaStorage: std::panic::RefUnwindSafe` error[E0275]: overflow evaluating the requirement `SalsaStorage: RefUnwindSafe`
--> $DIR/cycle-cache-err-60010.rs:69:5 --> $DIR/cycle-cache-err-60010.rs:69:5
| |
LL | fn parse(&self) { LL | fn parse(&self) {
@ -8,28 +8,12 @@ LL | SourceDatabase::parse(db);
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
| |
= note: required because it appears within the type `*const SalsaStorage` = note: required because it appears within the type `*const SalsaStorage`
= note: required because it appears within the type `std::ptr::Unique<SalsaStorage>` = note: required because it appears within the type `Unique<SalsaStorage>`
= note: required because it appears within the type `std::boxed::Box<SalsaStorage>` = note: required because it appears within the type `Box<SalsaStorage>`
= note: required because it appears within the type `Runtime<RootDatabase>` = note: required because it appears within the type `Runtime<RootDatabase>`
= note: required because it appears within the type `RootDatabase` = note: required because it appears within the type `RootDatabase`
= note: required because of the requirements on the impl of `SourceDatabase` for `RootDatabase` = note: required because of the requirements on the impl of `SourceDatabase` for `RootDatabase`
error[E0275]: overflow evaluating the requirement `Runtime<RootDatabase>: RefUnwindSafe` error: aborting due to previous error
--> $DIR/cycle-cache-err-60010.rs:31:20
|
LL | trait Database {
| -------- required by a bound in this
LL | type Storage;
| ------------- required by this bound in `Database`
...
LL | type Storage = SalsaStorage;
| ^^^^^^^^^^^^
|
= note: required because it appears within the type `RootDatabase`
= note: required because of the requirements on the impl of `SourceDatabase` for `RootDatabase`
= note: required because of the requirements on the impl of `Query<RootDatabase>` for `ParseQuery`
= note: required because it appears within the type `SalsaStorage`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0275`. For more information about this error, try `rustc --explain E0275`.

View File

@ -9,8 +9,8 @@ LL | type X = Self;
| |
help: consider further restricting this bound help: consider further restricting this bound
| |
LL | impl<T: Magic + std::marker::Sync> Magic for T { LL | impl<T: Magic + Sync> Magic for T {
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^
error[E0275]: overflow evaluating the requirement `*mut (): Magic` error[E0275]: overflow evaluating the requirement `*mut (): Magic`
--> $DIR/traits-inductive-overflow-two-traits.rs:20:5 --> $DIR/traits-inductive-overflow-two-traits.rs:20:5

View File

@ -14,7 +14,9 @@ pub fn main() {
let res: Result<i32, i32> = try { }; //~ ERROR type mismatch let res: Result<i32, i32> = try { }; //~ ERROR type mismatch
let res: () = try { }; //~ the trait bound `(): Try` is not satisfied let res: () = try { };
//~^ ERROR the trait bound `(): Try` is not satisfied
//~| ERROR the trait bound `(): Try` is not satisfied
let res: i32 = try { 5 }; //~ ERROR the trait bound `i32: Try` is not satisfied let res: i32 = try { 5 }; //~ ERROR the trait bound `i32: Try` is not satisfied
} }

View File

@ -26,18 +26,24 @@ LL | let res: Result<i32, i32> = try { };
| ^ expected `i32`, found `()` | ^ expected `i32`, found `()`
error[E0277]: the trait bound `(): Try` is not satisfied error[E0277]: the trait bound `(): Try` is not satisfied
--> $DIR/try-block-bad-type.rs:17:23 --> $DIR/try-block-bad-type.rs:17:25
| |
LL | let res: () = try { }; LL | let res: () = try { };
| ^^^ the trait `Try` is not implemented for `()` | ^ the trait `Try` is not implemented for `()`
| |
= note: required by `from_ok` = note: required by `from_ok`
error[E0277]: the trait bound `(): Try` is not satisfied
--> $DIR/try-block-bad-type.rs:17:25
|
LL | let res: () = try { };
| ^ the trait `Try` is not implemented for `()`
error[E0277]: the trait bound `i32: Try` is not satisfied error[E0277]: the trait bound `i32: Try` is not satisfied
--> $DIR/try-block-bad-type.rs:19:24 --> $DIR/try-block-bad-type.rs:21:26
| |
LL | let res: i32 = try { 5 }; LL | let res: i32 = try { 5 };
| ^^^^^ the trait `Try` is not implemented for `i32` | ^ the trait `Try` is not implemented for `i32`
| |
= note: required by `from_ok` = note: required by `from_ok`

View File

@ -1,8 +1,8 @@
error[E0277]: the trait bound `bool: Try` is not satisfied error[E0277]: the trait bound `bool: Try` is not satisfied
--> $DIR/try-block-in-while.rs:6:15 --> $DIR/try-block-in-while.rs:6:17
| |
LL | while try { false } {} LL | while try { false } {}
| ^^^^^^^^^ the trait `Try` is not implemented for `bool` | ^^^^^ the trait `Try` is not implemented for `bool`
| |
= note: required by `from_ok` = note: required by `from_ok`

View File

@ -4,7 +4,7 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
type X<T> = impl Clone; type X<T> = impl Clone;
//~^ ERROR the trait bound `T: std::clone::Clone` is not satisfied //~^ ERROR the trait bound `T: Clone` is not satisfied
fn f<T: Clone>(t: T) -> X<T> { fn f<T: Clone>(t: T) -> X<T> {
t t

View File

@ -1,13 +1,13 @@
error[E0277]: the trait bound `T: std::clone::Clone` is not satisfied error[E0277]: the trait bound `T: Clone` is not satisfied
--> $DIR/bounds-are-checked-2.rs:6:13 --> $DIR/bounds-are-checked-2.rs:6:13
| |
LL | type X<T> = impl Clone; LL | type X<T> = impl Clone;
| ^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `T` | ^^^^^^^^^^ the trait `Clone` is not implemented for `T`
| |
help: consider restricting type parameter `T` help: consider restricting type parameter `T`
| |
LL | type X<T: std::clone::Clone> = impl Clone; LL | type X<T: Clone> = impl Clone;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^
error: aborting due to previous error error: aborting due to previous error

View File

@ -12,8 +12,8 @@ error[E0308]: mismatched types
LL | type X<'a> = impl Into<&'static str> + From<&'a str>; LL | type X<'a> = impl Into<&'static str> + From<&'a str>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
| |
= note: expected trait `std::convert::From<&'a str>` = note: expected trait `From<&'a str>`
found trait `std::convert::From<&'static str>` found trait `From<&'static str>`
note: the lifetime `'a` as defined on the item at 6:8... note: the lifetime `'a` as defined on the item at 6:8...
--> $DIR/bounds-are-checked.rs:6:8 --> $DIR/bounds-are-checked.rs:6:8
| |

View File

@ -6,6 +6,8 @@ fn main() {}
// test that unused generic parameters are ok // test that unused generic parameters are ok
type Two<T, U> = impl Debug; type Two<T, U> = impl Debug;
//~^ ERROR `T` doesn't implement `Debug`
//~| ERROR `U` doesn't implement `Debug`
fn two<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> { fn two<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
(t, u) (t, u)

View File

@ -1,14 +1,39 @@
error: concrete type differs from previous defining opaque type use error: concrete type differs from previous defining opaque type use
--> $DIR/generic_duplicate_param_use5.rs:14:1 --> $DIR/generic_duplicate_param_use5.rs:16:1
| |
LL | fn three<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> { LL | fn three<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(T, U)`, got `(U, T)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(T, U)`, got `(U, T)`
| |
note: previous use here note: previous use here
--> $DIR/generic_duplicate_param_use5.rs:10:1 --> $DIR/generic_duplicate_param_use5.rs:12:1
| |
LL | fn two<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> { LL | fn two<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error error[E0277]: `T` doesn't implement `Debug`
--> $DIR/generic_duplicate_param_use5.rs:8:18
|
LL | type Two<T, U> = impl Debug;
| ^^^^^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required because of the requirements on the impl of `Debug` for `(T, U)`
help: consider restricting type parameter `T`
|
LL | type Two<T: Debug, U> = impl Debug;
| ^^^^^^^
error[E0277]: `U` doesn't implement `Debug`
--> $DIR/generic_duplicate_param_use5.rs:8:18
|
LL | type Two<T, U> = impl Debug;
| ^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required because of the requirements on the impl of `Debug` for `(T, U)`
help: consider restricting type parameter `U`
|
LL | type Two<T, U: Debug> = impl Debug;
| ^^^^^^^
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -6,12 +6,13 @@ fn main() {}
// test that unused generic parameters are ok // test that unused generic parameters are ok
type Two<T, U> = impl Debug; type Two<T, U> = impl Debug;
//~^ ERROR `T` doesn't implement `Debug`
fn two<T: Copy + Debug, U: Debug>(t: T, u: U) -> Two<T, U> { fn two<T: Copy + Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
(t, t) (t, t)
} }
fn three<T: Copy + Debug, U: Debug>(t: T, u: U) -> Two<T, U> { fn three<T: Copy + Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
//~^ concrete type differs from previous //~^ ERROR concrete type differs from previous
(u, t) (u, t)
} }

View File

@ -1,14 +1,27 @@
error: concrete type differs from previous defining opaque type use error: concrete type differs from previous defining opaque type use
--> $DIR/generic_duplicate_param_use6.rs:14:1 --> $DIR/generic_duplicate_param_use6.rs:15:1
| |
LL | fn three<T: Copy + Debug, U: Debug>(t: T, u: U) -> Two<T, U> { LL | fn three<T: Copy + Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(T, T)`, got `(U, T)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(T, T)`, got `(U, T)`
| |
note: previous use here note: previous use here
--> $DIR/generic_duplicate_param_use6.rs:10:1 --> $DIR/generic_duplicate_param_use6.rs:11:1
| |
LL | fn two<T: Copy + Debug, U: Debug>(t: T, u: U) -> Two<T, U> { LL | fn two<T: Copy + Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error error[E0277]: `T` doesn't implement `Debug`
--> $DIR/generic_duplicate_param_use6.rs:8:18
|
LL | type Two<T, U> = impl Debug;
| ^^^^^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required because of the requirements on the impl of `Debug` for `(T, T)`
help: consider restricting type parameter `T`
|
LL | type Two<T: Debug, U> = impl Debug;
| ^^^^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -5,6 +5,7 @@ use std::fmt::Debug;
fn main() {} fn main() {}
type Two<T, U> = impl Debug; type Two<T, U> = impl Debug;
//~^ ERROR `T` doesn't implement `Debug`
fn two<T: Debug, U: Debug>(t: T, _: U) -> Two<T, U> { fn two<T: Debug, U: Debug>(t: T, _: U) -> Two<T, U> {
(t, 4u32) (t, 4u32)

View File

@ -1,14 +1,27 @@
error: concrete type differs from previous defining opaque type use error: concrete type differs from previous defining opaque type use
--> $DIR/generic_duplicate_param_use8.rs:13:1 --> $DIR/generic_duplicate_param_use8.rs:14:1
| |
LL | fn three<T: Debug, U: Debug>(_: T, u: U) -> Two<T, U> { LL | fn three<T: Debug, U: Debug>(_: T, u: U) -> Two<T, U> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(T, u32)`, got `(U, u32)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(T, u32)`, got `(U, u32)`
| |
note: previous use here note: previous use here
--> $DIR/generic_duplicate_param_use8.rs:9:1 --> $DIR/generic_duplicate_param_use8.rs:10:1
| |
LL | fn two<T: Debug, U: Debug>(t: T, _: U) -> Two<T, U> { LL | fn two<T: Debug, U: Debug>(t: T, _: U) -> Two<T, U> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error error[E0277]: `T` doesn't implement `Debug`
--> $DIR/generic_duplicate_param_use8.rs:7:18
|
LL | type Two<T, U> = impl Debug;
| ^^^^^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required because of the requirements on the impl of `Debug` for `(T, u32)`
help: consider restricting type parameter `T`
|
LL | type Two<T: Debug, U> = impl Debug;
| ^^^^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -5,6 +5,9 @@ use std::fmt::Debug;
fn main() {} fn main() {}
type Two<A, B> = impl Debug; type Two<A, B> = impl Debug;
//~^ ERROR the trait bound `A: Foo` is not satisfied in `(A, B, <A as Foo>::Bar)`
//~| ERROR `A` doesn't implement `Debug`
//~| ERROR `B` doesn't implement `Debug`
trait Foo { trait Foo {
type Bar: Debug; type Bar: Debug;

View File

@ -1,14 +1,51 @@
error: concrete type differs from previous defining opaque type use error: concrete type differs from previous defining opaque type use
--> $DIR/generic_duplicate_param_use9.rs:18:1 --> $DIR/generic_duplicate_param_use9.rs:21:1
| |
LL | fn three<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> { LL | fn three<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(A, B, <A as Foo>::Bar)`, got `(A, B, i32)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(A, B, <A as Foo>::Bar)`, got `(A, B, i32)`
| |
note: previous use here note: previous use here
--> $DIR/generic_duplicate_param_use9.rs:14:1 --> $DIR/generic_duplicate_param_use9.rs:17:1
| |
LL | fn two<T: Debug + Foo, U: Debug>(t: T, u: U) -> Two<T, U> { LL | fn two<T: Debug + Foo, U: Debug>(t: T, u: U) -> Two<T, U> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error error[E0277]: the trait bound `A: Foo` is not satisfied in `(A, B, <A as Foo>::Bar)`
--> $DIR/generic_duplicate_param_use9.rs:7:18
|
LL | type Two<A, B> = impl Debug;
| ^^^^^^^^^^ within `(A, B, <A as Foo>::Bar)`, the trait `Foo` is not implemented for `A`
|
= note: required because it appears within the type `(A, B, <A as Foo>::Bar)`
help: consider restricting type parameter `A`
|
LL | type Two<A: Foo, B> = impl Debug;
| ^^^^^
error[E0277]: `A` doesn't implement `Debug`
--> $DIR/generic_duplicate_param_use9.rs:7:18
|
LL | type Two<A, B> = impl Debug;
| ^^^^^^^^^^ `A` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required because of the requirements on the impl of `Debug` for `(A, B, <A as Foo>::Bar)`
help: consider restricting type parameter `A`
|
LL | type Two<A: Debug, B> = impl Debug;
| ^^^^^^^
error[E0277]: `B` doesn't implement `Debug`
--> $DIR/generic_duplicate_param_use9.rs:7:18
|
LL | type Two<A, B> = impl Debug;
| ^^^^^^^^^^ `B` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required because of the requirements on the impl of `Debug` for `(A, B, <A as Foo>::Bar)`
help: consider restricting type parameter `B`
|
LL | type Two<A, B: Debug> = impl Debug;
| ^^^^^^^
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -8,7 +8,8 @@ fn main() {
type WrongGeneric<T> = impl 'static; type WrongGeneric<T> = impl 'static;
//~^ ERROR the parameter type `T` may not live long enough //~^ ERROR the parameter type `T` may not live long enough
//~^^ ERROR: at least one trait must be specified //~| ERROR the parameter type `T` may not live long enough
//~| ERROR: at least one trait must be specified
fn wrong_generic<T>(t: T) -> WrongGeneric<T> { fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
t t

View File

@ -27,7 +27,16 @@ LL | type WrongGeneric<T> = impl 'static;
LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> { LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
| - help: consider adding an explicit lifetime bound...: `T: 'static` | - help: consider adding an explicit lifetime bound...: `T: 'static`
error: aborting due to 3 previous errors error[E0310]: the parameter type `T` may not live long enough
--> $DIR/generic_type_does_not_live_long_enough.rs:9:24
|
LL | type WrongGeneric<T> = impl 'static;
| ^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `T: 'static`...
= note: ...so that the type `T` will meet its required lifetime bounds
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0308, E0310. Some errors have detailed explanations: E0308, E0310.
For more information about an error, try `rustc --explain E0308`. For more information about an error, try `rustc --explain E0308`.

View File

@ -16,6 +16,10 @@ struct X;
impl Foo for X { impl Foo for X {
type Bar = impl Baz<Self, Self>; type Bar = impl Baz<Self, Self>;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| ERROR mismatched types
//~| ERROR mismatched types
//~| ERROR mismatched types
//~| ERROR mismatched types
fn bar(&self) -> Self::Bar { fn bar(&self) -> Self::Bar {
|x| x |x| x

View File

@ -7,6 +7,42 @@ LL | type Bar = impl Baz<Self, Self>;
= note: expected type `FnOnce<(&X,)>` = note: expected type `FnOnce<(&X,)>`
found type `FnOnce<(&X,)>` found type `FnOnce<(&X,)>`
error: aborting due to previous error error[E0308]: mismatched types
--> $DIR/issue-57611-trait-alias.rs:17:16
|
LL | type Bar = impl Baz<Self, Self>;
| ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected type `for<'r> Fn<(&'r X,)>`
found type `Fn<(&'<empty> X,)>`
error[E0308]: mismatched types
--> $DIR/issue-57611-trait-alias.rs:17:16
|
LL | type Bar = impl Baz<Self, Self>;
| ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected type `FnOnce<(&X,)>`
found type `FnOnce<(&'<empty> X,)>`
error[E0308]: mismatched types
--> $DIR/issue-57611-trait-alias.rs:17:16
|
LL | type Bar = impl Baz<Self, Self>;
| ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected type `for<'r> Fn<(&'r X,)>`
found type `Fn<(&'<empty> X,)>`
error[E0308]: mismatched types
--> $DIR/issue-57611-trait-alias.rs:17:16
|
LL | type Bar = impl Baz<Self, Self>;
| ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected type `FnOnce<(&X,)>`
found type `FnOnce<(&'<empty> X,)>`
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0308`. For more information about this error, try `rustc --explain E0308`.

View File

@ -5,6 +5,7 @@ LL | <i32 as Add<u32>>::add(1, 2);
| ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32` | ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32`
| |
= help: the trait `Add<u32>` is not implemented for `i32` = help: the trait `Add<u32>` is not implemented for `i32`
= note: required by `add`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/ufcs-qpath-self-mismatch.rs:6:28 --> $DIR/ufcs-qpath-self-mismatch.rs:6:28