improve the printing of substs and trait-refs

This commit is contained in:
Ariel Ben-Yehuda 2016-04-05 22:56:23 +03:00
parent 31247e5a0b
commit b23648fe4a
118 changed files with 350 additions and 291 deletions
src
librustc/util
test/compile-fail
associated-types-for-unimpl-trait.rsassociated-types-invalid-trait-ref-issue-18865.rsassociated-types-no-suitable-bound.rsassociated-types-no-suitable-supertrait-2.rsassociated-types-no-suitable-supertrait.rsassociated-types-path-2.rsassociated-types-unsized.rsbad-method-typaram-kind.rsbad-sized.rsbuiltin-superkinds-double-superkind.rsbuiltin-superkinds-in-metadata.rsbuiltin-superkinds-simple.rsbuiltin-superkinds-typaram-not-send.rscast-rfc0401.rsclosure-bounds-cant-promote-superkind-in-struct.rsclosure-bounds-subtype.rscross-fn-cache-hole.rsderiving-no-inner-impl-error-message.rsderiving-span-Default-struct.rsdestructure-trait-ref.rsdst-bad-assign-2.rsdst-bad-assign.rsdst-bad-coerce1.rsdst-bad-deep.rsdst-object-from-unsized-type.rsdst-sized-trait-param.rsextern-wrong-value-type.rsfor-loop-bogosity.rshrtb-just-for-static.rshrtb-perfect-forwarding.rsifmt-unimpl.rsimpl-bounds-checking.rsindexing-requires-a-uint.rsissue-14084.rsissue-14366.rsissue-14853.rsissue-15756.rsissue-16538.rsissue-17651.rsissue-17718-static-sync.rsissue-17959.rsissue-18107.rsissue-18611.rsissue-18919.rsissue-1920-1.rsissue-1920-2.rsissue-1920-3.rsissue-20005.rsissue-20162.rsissue-20605.rsissue-21160.rsissue-21659-show-relevant-trait-impls-1.rsissue-21659-show-relevant-trait-impls-2.rsissue-21763.rsissue-22034.rsissue-25076.rsissue-2611-4.rsissue-28098.rsissue-29147.rsissue-5035-2.rsissue-5883.rsissue-7013.rsissue-7364.rskindck-impl-type-params-2.rskindck-send-unsafe.rsmap-types.rsmutable-enum-indirect.rsno-send-res-ports.rsno_send-enum.rsno_send-rc.rsno_send-struct.rsno_share-enum.rsno_share-struct.rsnot-sync.rsobject-does-not-impl-trait.rsphantom-oibit.rsrange-1.rsreject-specialized-drops-8142.rsrepeat-to-run-dtor-twice.rsstr-idx.rsstr-mut-idx.rssubsts-verbose.rstrait-bounds-impl-comparison-1.rstrait-bounds-impl-comparison-2.rstrait-bounds-not-on-bare-trait.rstrait-bounds-on-structs-and-enums.rstrait-coercion-generic-bad.rstrait-suggest-where-clause.rstraits-negative-impls.rstraits-repeated-supertrait-ambig.rstypeck-default-trait-impl-constituent-types-2.rstypeck-default-trait-impl-constituent-types.rstypeck-default-trait-impl-negation-send.rstypeck-default-trait-impl-negation-sync.rstypeck-default-trait-impl-negation.rstypeck-default-trait-impl-precedence.rstypeck-default-trait-impl-supertrait.rstypeck-default-trait-impl-trait-where-clause-2.rstypeck-default-trait-impl-trait-where-clause.rs

@ -19,6 +19,7 @@ use ty::TyClosure;
use ty::{TyBox, TyTrait, TyInt, TyUint, TyInfer};
use ty::{self, Ty, TyCtxt, TypeFoldable};
use std::cell::Cell;
use std::fmt;
use syntax::abi::Abi;
use syntax::parse::token;
@ -67,6 +68,45 @@ pub enum Ns {
Value
}
fn number_of_supplied_defaults<'tcx, GG>(tcx: &ty::TyCtxt<'tcx>,
substs: &subst::Substs,
space: subst::ParamSpace,
get_generics: GG)
-> usize
where GG: FnOnce(&TyCtxt<'tcx>) -> ty::Generics<'tcx>
{
let generics = get_generics(tcx);
let has_self = substs.self_ty().is_some();
let ty_params = generics.types.get_slice(space);
let tps = substs.types.get_slice(space);
if ty_params.last().map_or(false, |def| def.default.is_some()) {
let substs = tcx.lift(&substs);
ty_params.iter().zip(tps).rev().take_while(|&(def, &actual)| {
match def.default {
Some(default) => {
if !has_self && default.has_self_ty() {
// In an object type, there is no `Self`, and
// thus if the default value references Self,
// the user will be required to give an
// explicit value. We can't even do the
// substitution below to check without causing
// an ICE. (#18956).
false
} else {
let default = tcx.lift(&default);
substs.and_then(|substs| default.subst(tcx, substs))
== Some(actual)
}
}
None => false
}
}).count()
} else {
0
}
}
pub fn parameterized<GG>(f: &mut fmt::Formatter,
substs: &subst::Substs,
did: DefId,
@ -80,8 +120,8 @@ pub fn parameterized<GG>(f: &mut fmt::Formatter,
write!(f, "<{} as ", self_ty)?;
}
let (fn_trait_kind, verbose, last_name) = ty::tls::with(|tcx| {
let (did, last_name) = if ns == Ns::Value {
let (fn_trait_kind, verbose, item_name) = ty::tls::with(|tcx| {
let (did, item_name) = if ns == Ns::Value {
// Try to get the impl/trait parent, if this is an
// associated value item (method or constant).
tcx.trait_of_item(did).or_else(|| tcx.impl_of_method(did))
@ -90,97 +130,64 @@ pub fn parameterized<GG>(f: &mut fmt::Formatter,
(did, None)
};
write!(f, "{}", tcx.item_path_str(did))?;
Ok((tcx.lang_items.fn_trait_kind(did), tcx.sess.verbose(), last_name))
Ok((tcx.lang_items.fn_trait_kind(did), tcx.sess.verbose(), item_name))
})?;
let mut empty = true;
let mut start_or_continue = |f: &mut fmt::Formatter, start: &str, cont: &str| {
if empty {
empty = false;
write!(f, "{}", start)
} else {
write!(f, "{}", cont)
}
};
if verbose {
for region in &substs.regions {
start_or_continue(f, "<", ", ")?;
write!(f, "{:?}", region)?;
}
for &ty in &substs.types {
start_or_continue(f, "<", ", ")?;
write!(f, "{}", ty)?;
}
for projection in projections {
start_or_continue(f, "<", ", ")?;
write!(f, "{}={}",
projection.projection_ty.item_name,
projection.ty)?;
}
return start_or_continue(f, "", ">");
}
if fn_trait_kind.is_some() && projections.len() == 1 {
if !verbose && fn_trait_kind.is_some() && projections.len() == 1 {
let projection_ty = projections[0].ty;
if let TyTuple(ref args) = substs.types.get_slice(subst::TypeSpace)[0].sty {
return fn_sig(f, args, false, ty::FnConverging(projection_ty));
}
}
for &r in &substs.regions {
start_or_continue(f, "<", ", ")?;
let s = r.to_string();
if s.is_empty() {
// This happens when the value of the region
// parameter is not easily serialized. This may be
// because the user omitted it in the first place,
// or because it refers to some block in the code,
// etc. I'm not sure how best to serialize this.
write!(f, "'_")?;
let empty = Cell::new(true);
let start_or_continue = |f: &mut fmt::Formatter, start: &str, cont: &str| {
if empty.get() {
empty.set(false);
write!(f, "{}", start)
} else {
write!(f, "{}", s)?;
write!(f, "{}", cont)
}
};
let print_region = |f: &mut fmt::Formatter, region: &ty::Region| -> _ {
if verbose {
write!(f, "{:?}", region)
} else {
let s = region.to_string();
if s.is_empty() {
// This happens when the value of the region
// parameter is not easily serialized. This may be
// because the user omitted it in the first place,
// or because it refers to some block in the code,
// etc. I'm not sure how best to serialize this.
write!(f, "'_")
} else {
write!(f, "{}", s)
}
}
};
for region in substs.regions.get_slice(subst::TypeSpace) {
start_or_continue(f, "<", ", ")?;
print_region(f, region)?;
}
// It is important to execute this conditionally, only if -Z
// verbose is false. Otherwise, debug logs can sometimes cause
// ICEs trying to fetch the generics early in the pipeline. This
// is kind of a hacky workaround in that -Z verbose is required to
// avoid those ICEs.
let num_supplied_defaults = if verbose {
0
} else {
// It is important to execute this conditionally, only if -Z
// verbose is false. Otherwise, debug logs can sometimes cause
// ICEs trying to fetch the generics early in the pipeline. This
// is kind of a hacky workaround in that -Z verbose is required to
// avoid those ICEs.
ty::tls::with(|tcx| {
number_of_supplied_defaults(tcx, substs, subst::TypeSpace, get_generics)
})
};
let tps = substs.types.get_slice(subst::TypeSpace);
let num_defaults = ty::tls::with(|tcx| {
let generics = get_generics(tcx);
let has_self = substs.self_ty().is_some();
let ty_params = generics.types.get_slice(subst::TypeSpace);
if ty_params.last().map_or(false, |def| def.default.is_some()) {
let substs = tcx.lift(&substs);
ty_params.iter().zip(tps).rev().take_while(|&(def, &actual)| {
match def.default {
Some(default) => {
if !has_self && default.has_self_ty() {
// In an object type, there is no `Self`, and
// thus if the default value references Self,
// the user will be required to give an
// explicit value. We can't even do the
// substitution below to check without causing
// an ICE. (#18956).
false
} else {
let default = tcx.lift(&default);
substs.and_then(|substs| default.subst(tcx, substs)) == Some(actual)
}
}
None => false
}
}).count()
} else {
0
}
});
for &ty in &tps[..tps.len() - num_defaults] {
for &ty in &tps[..tps.len() - num_supplied_defaults] {
start_or_continue(f, "<", ", ")?;
write!(f, "{}", ty)?;
}
@ -196,21 +203,28 @@ pub fn parameterized<GG>(f: &mut fmt::Formatter,
// For values, also print their name and type parameters.
if ns == Ns::Value {
empty.set(true);
if substs.self_ty().is_some() {
write!(f, ">")?;
}
if let Some(name) = last_name {
write!(f, "::{}", name)?;
if let Some(item_name) = item_name {
write!(f, "::{}", item_name)?;
}
let tps = substs.types.get_slice(subst::FnSpace);
if !tps.is_empty() {
write!(f, "::<{}", tps[0])?;
for ty in &tps[1..] {
write!(f, ", {}", ty)?;
}
write!(f, ">")?;
for region in substs.regions.get_slice(subst::FnSpace) {
start_or_continue(f, "::<", ", ")?;
print_region(f, region)?;
}
// FIXME: consider being smart with defaults here too
for ty in substs.types.get_slice(subst::FnSpace) {
start_or_continue(f, "::<", ", ")?;
write!(f, "{}", ty)?;
}
start_or_continue(f, "", ">")?;
}
Ok(())
@ -997,9 +1011,7 @@ impl<'tcx> fmt::Debug for ty::TraitPredicate<'tcx> {
impl<'tcx> fmt::Display for ty::TraitPredicate<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{} : {}",
self.trait_ref.self_ty(),
self.trait_ref)
write!(f, "{}: {}", self.trait_ref.self_ty(), self.trait_ref)
}
}

@ -15,7 +15,7 @@ trait Get {
trait Other {
fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
//~^ ERROR the trait bound `Self : Get` is not satisfied
//~^ ERROR the trait bound `Self: Get` is not satisfied
}
fn main() {

@ -18,7 +18,7 @@ trait Foo<T> {
fn f<T:Foo<isize>>(t: &T) {
let u: <T as Foo<usize>>::Bar = t.get_bar();
//~^ ERROR the trait bound `T : Foo<usize>` is not satisfied
//~^ ERROR the trait bound `T: Foo<usize>` is not satisfied
}
fn main() { }

@ -19,7 +19,7 @@ struct Struct {
impl Struct {
fn uhoh<T>(foo: <T as Get>::Value) {}
//~^ ERROR the trait bound `T : Get` is not satisfied
//~^ ERROR the trait bound `T: Get` is not satisfied
}
fn main() {

@ -25,7 +25,7 @@ trait Get {
trait Other {
fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
//~^ ERROR the trait bound `Self : Get` is not satisfied
//~^ ERROR the trait bound `Self: Get` is not satisfied
}
fn main() { }

@ -25,12 +25,12 @@ trait Get {
trait Other {
fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
//~^ ERROR the trait bound `Self : Get` is not satisfied
//~^ ERROR the trait bound `Self: Get` is not satisfied
}
impl<T:Get> Other for T {
fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {}
//~^ ERROR the trait bound `(T, U) : Get` is not satisfied
//~^ ERROR the trait bound `(T, U): Get` is not satisfied
}
fn main() { }

@ -38,12 +38,12 @@ pub fn f1_int_uint() {
pub fn f1_uint_uint() {
f1(2u32, 4u32);
//~^ ERROR `u32 : Foo` is not satisfied
//~^ ERROR `u32: Foo` is not satisfied
}
pub fn f1_uint_int() {
f1(2u32, 4i32);
//~^ ERROR `u32 : Foo` is not satisfied
//~^ ERROR `u32: Foo` is not satisfied
}
pub fn f2_int() {

@ -14,7 +14,7 @@ trait Get {
}
fn foo<T:Get>(t: T) {
let x = t.get(); //~ ERROR `<T as Get>::Value : std::marker::Sized` is not
let x = t.get(); //~ ERROR `<T as Get>::Value: std::marker::Sized` is not
}
fn main() {

@ -9,7 +9,7 @@
// except according to those terms.
fn foo<T:'static>() {
1.bar::<T>(); //~ ERROR `T : std::marker::Send` is not satisfied
1.bar::<T>(); //~ ERROR `T: std::marker::Send` is not satisfied
}
trait bar {

@ -12,7 +12,7 @@ trait Trait {}
pub fn main() {
let x: Vec<Trait + Sized> = Vec::new();
//~^ ERROR `Trait + Sized : std::marker::Sized` is not satisfied
//~| ERROR `Trait + Sized : std::marker::Sized` is not satisfied
//~| ERROR `Trait + Sized : std::marker::Sized` is not satisfied
//~^ ERROR `Trait + Sized: std::marker::Sized` is not satisfied
//~| ERROR `Trait + Sized: std::marker::Sized` is not satisfied
//~| ERROR `Trait + Sized: std::marker::Sized` is not satisfied
}

@ -13,9 +13,9 @@
trait Foo : Send+Sync { }
impl <T: Sync+'static> Foo for (T,) { } //~ ERROR `T : std::marker::Send` is not satisfied
impl <T: Sync+'static> Foo for (T,) { } //~ ERROR `T: std::marker::Send` is not satisfied
impl <T: Send> Foo for (T,T) { } //~ ERROR `T : std::marker::Sync` is not satisfied
impl <T: Send> Foo for (T,T) { } //~ ERROR `T: std::marker::Sync` is not satisfied
impl <T: Send+Sync> Foo for (T,T,T) { } // (ok)

@ -22,6 +22,6 @@ struct X<T>(T);
impl <T:Sync> RequiresShare for X<T> { }
impl <T:Sync+'static> RequiresRequiresShareAndSend for X<T> { }
//~^ ERROR `T : std::marker::Send` is not satisfied
//~^ ERROR `T: std::marker::Send` is not satisfied
fn main() { }

@ -14,6 +14,6 @@
trait Foo : Send { }
impl Foo for std::rc::Rc<i8> { }
//~^ ERROR `std::rc::Rc<i8> : std::marker::Send` is not satisfied
//~^ ERROR `std::rc::Rc<i8>: std::marker::Send` is not satisfied
fn main() { }

@ -12,6 +12,6 @@
trait Foo : Send { }
impl <T: Sync+'static> Foo for T { } //~ ERROR `T : std::marker::Send` is not satisfied
impl <T: Sync+'static> Foo for T { } //~ ERROR `T: std::marker::Send` is not satisfied
fn main() { }

@ -91,7 +91,7 @@ fn main()
let _ = 42usize as *const [u8]; //~ ERROR casting
let _ = v as *const [u8]; //~ ERROR cannot cast
let _ = fat_v as *const Foo;
//~^ ERROR the trait bound `[u8] : std::marker::Sized` is not satisfied
//~^ ERROR the trait bound `[u8]: std::marker::Sized` is not satisfied
//~^^ HELP run `rustc --explain E0277` to see a detailed explanation
//~^^^ NOTE `[u8]` does not have a constant size known at compile-time
//~^^^^ NOTE required for the cast to the object type `Foo`
@ -106,7 +106,7 @@ fn main()
let a : *const str = "hello";
let _ = a as *const Foo;
//~^ ERROR the trait bound `str : std::marker::Sized` is not satisfied
//~^ ERROR the trait bound `str: std::marker::Sized` is not satisfied
//~^^ HELP run `rustc --explain E0277` to see a detailed explanation
//~^^^ NOTE `str` does not have a constant size known at compile-time
//~^^^^ NOTE required for the cast to the object type `Foo`

@ -13,7 +13,7 @@ struct X<F> where F: FnOnce() + 'static + Send {
}
fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static {
//~^ ERROR `F : std::marker::Send` is not satisfied
//~^ ERROR `F: std::marker::Send` is not satisfied
return X { field: blk };
}

@ -21,7 +21,7 @@ fn give_any<F>(f: F) where F: FnOnce() {
fn give_owned<F>(f: F) where F: FnOnce() + Send {
take_any(f);
take_const_owned(f); //~ ERROR `F : std::marker::Sync` is not satisfied
take_const_owned(f); //~ ERROR `F: std::marker::Sync` is not satisfied
}
fn main() {}

@ -23,7 +23,7 @@ trait Bar<X> { }
// We don't always check where clauses for sanity, but in this case
// wfcheck does report an error here:
fn vacuous<A>() //~ ERROR the trait bound `i32 : Bar<u32>` is not satisfied
fn vacuous<A>() //~ ERROR the trait bound `i32: Bar<u32>` is not satisfied
where i32: Foo<u32, A>
{
// ... the original intention was to check that we don't use that

@ -18,7 +18,7 @@ struct E {
#[derive(Clone)]
struct C {
x: NoCloneOrEq
//~^ ERROR `NoCloneOrEq : std::clone::Clone` is not satisfied
//~^ ERROR `NoCloneOrEq: std::clone::Clone` is not satisfied
}

@ -17,7 +17,7 @@ struct Error;
#[derive(Default)]
struct Struct {
x: Error //~ ERROR `Error : std::default::Default` is not satisfied
x: Error //~ ERROR `Error: std::default::Default` is not satisfied
}
fn main() {}

@ -35,7 +35,7 @@ fn main() {
// n == m
let &x = &1isize as &T; //~ ERROR type `&T` cannot be dereferenced
let &&x = &(&1isize as &T); //~ ERROR type `&T` cannot be dereferenced
let box x = box 1isize as Box<T>; //~ ERROR `T : std::marker::Sized` is not satisfied
let box x = box 1isize as Box<T>; //~ ERROR `T: std::marker::Sized` is not satisfied
// n > m
let &&x = &1isize as &T;

@ -44,5 +44,5 @@ pub fn main() {
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let z: Box<ToBar> = Box::new(Bar1 {f: 36});
f5.ptr = *z;
//~^ ERROR `ToBar : std::marker::Sized` is not satisfied
//~^ ERROR `ToBar: std::marker::Sized` is not satisfied
}

@ -49,5 +49,5 @@ pub fn main() {
//~| found `Bar1`
//~| expected trait ToBar
//~| found struct `Bar1`
//~| ERROR `ToBar : std::marker::Sized` is not satisfied
//~| ERROR `ToBar: std::marker::Sized` is not satisfied
}

@ -28,5 +28,5 @@ pub fn main() {
let f1 = Fat { ptr: Foo };
let f2: &Fat<Foo> = &f1;
let f3: &Fat<Bar> = f2;
//~^ ERROR `Foo : Bar` is not satisfied
//~^ ERROR `Foo: Bar` is not satisfied
}

@ -21,5 +21,5 @@ pub fn main() {
let f: Fat<[isize; 3]> = Fat { ptr: [5, 6, 7] };
let g: &Fat<[isize]> = &f;
let h: &Fat<Fat<[isize]>> = &Fat { ptr: *g };
//~^ ERROR `[isize] : std::marker::Sized` is not satisfied
//~^ ERROR `[isize]: std::marker::Sized` is not satisfied
}

@ -16,22 +16,22 @@ impl Foo for [u8] {}
fn test1<T: ?Sized + Foo>(t: &T) {
let u: &Foo = t;
//~^ ERROR `T : std::marker::Sized` is not satisfied
//~^ ERROR `T: std::marker::Sized` is not satisfied
}
fn test2<T: ?Sized + Foo>(t: &T) {
let v: &Foo = t as &Foo;
//~^ ERROR `T : std::marker::Sized` is not satisfied
//~^ ERROR `T: std::marker::Sized` is not satisfied
}
fn test3() {
let _: &[&Foo] = &["hi"];
//~^ ERROR `str : std::marker::Sized` is not satisfied
//~^ ERROR `str: std::marker::Sized` is not satisfied
}
fn test4(x: &[u8]) {
let _: &Foo = x as &Foo;
//~^ ERROR `[u8] : std::marker::Sized` is not satisfied
//~^ ERROR `[u8]: std::marker::Sized` is not satisfied
}
fn main() { }

@ -15,9 +15,9 @@
trait Foo<T> : Sized { fn take(self, x: &T) { } } // Note: T is sized
impl Foo<[isize]> for usize { }
//~^ ERROR `[isize] : std::marker::Sized` is not satisfied
//~^ ERROR `[isize]: std::marker::Sized` is not satisfied
impl Foo<isize> for [usize] { }
//~^ ERROR `[usize] : std::marker::Sized` is not satisfied
//~^ ERROR `[usize]: std::marker::Sized` is not satisfied
pub fn main() { }

@ -17,6 +17,6 @@ fn main() {
// extern functions are extern "C" fn
let _x: extern "C" fn() = f; // OK
is_fn(f);
//~^ ERROR `extern "C" fn() {f} : std::ops::Fn<()>` is not satisfied
//~| ERROR `extern "C" fn() {f} : std::ops::FnOnce<()>` is not satisfied
//~^ ERROR `extern "C" fn() {f}: std::ops::Fn<()>` is not satisfied
//~| ERROR `extern "C" fn() {f}: std::ops::FnOnce<()>` is not satisfied
}

@ -24,7 +24,7 @@ pub fn main() {
x: 1,
y: 2,
};
for x in bogus { //~ ERROR `MyStruct : std::iter::Iterator`
for x in bogus { //~ ERROR `MyStruct: std::iter::Iterator` is not satisfied
drop(x);
}
}

@ -31,7 +31,7 @@ fn give_any() {
struct StaticInt;
impl Foo<&'static isize> for StaticInt { }
fn give_static() {
want_hrtb::<StaticInt>() //~ ERROR `for<'a> StaticInt : Foo<&'a isize>` is not satisfied
want_hrtb::<StaticInt>() //~ ERROR `for<'a> StaticInt: Foo<&'a isize>` is not satisfied
}
fn main() { }

@ -53,7 +53,7 @@ fn foo_hrtb_bar_not<'b,T>(mut t: T)
// be implemented. Thus to satisfy `&mut T : for<'a> Foo<&'a
// isize>`, we require `T : for<'a> Bar<&'a isize>`, but the where
// clause only specifies `T : Bar<&'b isize>`.
foo_hrtb_bar_not(&mut t); //~ ERROR `for<'a> T : Bar<&'a isize>` is not satisfied
foo_hrtb_bar_not(&mut t); //~ ERROR `for<'a> T: Bar<&'a isize>` is not satisfied
}
fn foo_hrtb_bar_hrtb<T>(mut t: T)

@ -10,5 +10,5 @@
fn main() {
format!("{:X}", "3");
//~^ ERROR: `str : std::fmt::UpperHex` is not satisfied
//~^ ERROR: `str: std::fmt::UpperHex` is not satisfied
}

@ -17,7 +17,7 @@ trait Getter<T: Clone2> {
fn get(&self) -> T;
}
impl Getter<isize> for isize { //~ ERROR `isize : Clone2` is not satisfied
impl Getter<isize> for isize { //~ ERROR `isize: Clone2` is not satisfied
fn get(&self) -> isize { *self }
}

@ -13,7 +13,7 @@
fn main() {
fn bar<T>(_: T) {}
[0][0u8]; //~ ERROR: `[_] : std::ops::Index<u8>` is not satisfied
[0][0u8]; //~ ERROR: `[_]: std::ops::Index<u8>` is not satisfied
[0][0]; // should infer to be a usize

@ -13,5 +13,5 @@
fn main() {
() <- 0;
//~^ ERROR: `() : std::ops::Placer<_>` is not satisfied
//~^ ERROR: `(): std::ops::Placer<_>` is not satisfied
}

@ -10,5 +10,5 @@
fn main() {
let _x = "test" as &::std::any::Any;
//~^ ERROR `str : std::marker::Sized` is not satisfied
//~^ ERROR `str: std::marker::Sized` is not satisfied
}

@ -20,7 +20,7 @@ struct X { data: u32 }
impl Something for X {
fn yay<T: Str>(_:Option<X>, thing: &[T]) {
//~^ ERROR the requirement `T : Str` appears on the impl method
//~^ ERROR the requirement `T: Str` appears on the impl method
}
}

@ -15,7 +15,7 @@ fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: ChunksMut<'a,T>)
{
for
&mut something
//~^ ERROR `[T] : std::marker::Sized` is not satisfied
//~^ ERROR `[T]: std::marker::Sized` is not satisfied
in arg2
{
}

@ -19,7 +19,7 @@ mod Y {
}
static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
//~^ ERROR `*const usize : std::marker::Sync` is not satisfied
//~^ ERROR `*const usize: std::marker::Sync` is not satisfied
//~| ERROR cannot refer to other statics by value, use the address-of operator or a constant instead
//~| ERROR E0015

@ -14,5 +14,5 @@
fn main() {
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
(|| Box::new(*(&[0][..])))();
//~^ ERROR `[_] : std::marker::Sized` is not satisfied
//~^ ERROR `[_]: std::marker::Sized` is not satisfied
}

@ -17,6 +17,6 @@ impl !Sync for Foo {}
static FOO: usize = 3;
static BAR: Foo = Foo;
//~^ ERROR: `Foo : std::marker::Sync` is not satisfied
//~^ ERROR: `Foo: std::marker::Sync` is not satisfied
fn main() {}

@ -19,7 +19,7 @@ struct G<T: ?Sized> {
}
impl<T> Drop for G<T> {
//~^ ERROR: The requirement `T : core::marker::Sized` is added only by the Drop impl. [E0367]
//~^ ERROR: The requirement `T: core::marker::Sized` is added only by the Drop impl. [E0367]
fn drop(&mut self) {
if !self._ptr.is_null() {
}

@ -12,7 +12,7 @@ pub trait AbstractRenderer {}
fn _create_render(_: &()) ->
AbstractRenderer
//~^ ERROR: `AbstractRenderer + 'static : std::marker::Sized` is not satisfied
//~^ ERROR: `AbstractRenderer + 'static: std::marker::Sized` is not satisfied
{
match 0 {
_ => unimplemented!()

@ -9,7 +9,7 @@
// except according to those terms.
fn add_state(op: <isize as HasState>::State) {
//~^ ERROR `isize : HasState` is not satisfied
//~^ ERROR `isize: HasState` is not satisfied
}
trait HasState {

@ -11,7 +11,7 @@
type FuncType<'f> = Fn(&isize) -> isize + 'f;
fn ho_func(f: Option<FuncType>) {
//~^ ERROR: `for<'r> std::ops::Fn(&'r isize) -> isize : std::marker::Sized` is not satisfied
//~^ ERROR: `for<'r> std::ops::Fn(&'r isize) -> isize: std::marker::Sized` is not satisfied
}
fn main() {}

@ -18,5 +18,5 @@ fn assert_clone<T>() where T : Clone { }
fn main() {
assert_clone::<foo::core::sync::atomic::AtomicBool>();
//~^ ERROR `foo::core::sync::atomic::AtomicBool : foo::core::clone::Clone` is not satisfied
//~^ ERROR `foo::core::sync::atomic::AtomicBool: foo::core::clone::Clone` is not satisfied
}

@ -16,5 +16,5 @@ fn assert_clone<T>() where T : Clone { }
fn main() {
assert_clone::<bar::sync::atomic::AtomicBool>();
//~^ ERROR `bar::sync::atomic::AtomicBool : bar::clone::Clone` is not satisfied
//~^ ERROR `bar::sync::atomic::AtomicBool: bar::clone::Clone` is not satisfied
}

@ -20,5 +20,5 @@ fn assert_clone<T>() where T : Clone { }
fn main() {
assert_clone::<foo::core::sync::atomic::AtomicBool>();
//~^ ERROR `core::sync::atomic::AtomicBool : core::clone::Clone` is not satisfied
//~^ ERROR `core::sync::atomic::AtomicBool: core::clone::Clone` is not satisfied
}

@ -15,7 +15,7 @@ trait From<Src> {
}
trait To {
fn to<Dst>( //~ ERROR `Self : std::marker::Sized` is not satisfied
fn to<Dst>( //~ ERROR `Self: std::marker::Sized` is not satisfied
self
) -> <Dst as From<Self>>::Result where Dst: From<Self> {
From::from(self)

@ -13,5 +13,5 @@ struct X { x: i32 }
fn main() {
let mut b: Vec<X> = vec![];
b.sort();
//~^ ERROR `X : std::cmp::Ord` is not satisfied
//~^ ERROR `X: std::cmp::Ord` is not satisfied
}

@ -10,7 +10,7 @@
fn changer<'a>(mut things: Box<Iterator<Item=&'a mut u8>>) {
for item in *things { *item = 0 }
//~^ ERROR `std::iter::Iterator<Item=&mut u8> : std::marker::Sized` is not satisfied
//~^ ERROR `std::iter::Iterator<Item=&mut u8>: std::marker::Sized` is not satisfied
}
fn main() {}

@ -16,6 +16,6 @@ impl Bar {
#[derive(Hash)]
struct Foo(Bar);
//~^ error: `Bar : std::hash::Hash` is not satisfied
//~^ error: `Bar: std::hash::Hash` is not satisfied
fn main() {}

@ -32,7 +32,7 @@ fn main() {
let f1 = Bar;
f1.foo(1usize);
//~^ error: the trait bound `Bar : Foo<usize>` is not satisfied
//~^ error: the trait bound `Bar: Foo<usize>` is not satisfied
//~| help: the following implementations were found:
//~| help: <Bar as Foo<i32>>
//~| help: <Bar as Foo<u8>>

@ -36,7 +36,7 @@ fn main() {
let f1 = Bar;
f1.foo(1usize);
//~^ error: the trait bound `Bar : Foo<usize>` is not satisfied
//~^ error: the trait bound `Bar: Foo<usize>` is not satisfied
//~| help: the following implementations were found:
//~| help: <Bar as Foo<i8>>
//~| help: <Bar as Foo<i16>>

@ -17,5 +17,5 @@ fn foo<T: Send>() {}
fn main() {
foo::<HashMap<Rc<()>, Rc<()>>>();
//~^ ERROR: `std::rc::Rc<()> : std::marker::Send` is not satisfied
//~^ ERROR: `std::rc::Rc<()>: std::marker::Send` is not satisfied
}

@ -14,7 +14,7 @@ fn main() {
let ptr: *mut () = 0 as *mut _;
let _: &mut Fn() = unsafe {
&mut *(ptr as *mut Fn())
//~^ ERROR `() : std::ops::Fn<()>` is not satisfied
//~| ERROR `() : std::ops::FnOnce<()>` is not satisfied
//~^ ERROR `(): std::ops::Fn<()>` is not satisfied
//~| ERROR `(): std::ops::FnOnce<()>` is not satisfied
};
}

@ -17,5 +17,5 @@ fn do_fold<B, F: InOut<B, Out=B>>(init: B, f: F) {}
fn bot<T>() -> T { loop {} }
fn main() {
do_fold(bot(), ()); //~ ERROR `() : InOut<_>` is not satisfied
do_fold(bot(), ()); //~ ERROR `(): InOut<_>` is not satisfied
}

@ -21,7 +21,7 @@ struct E {
impl A for E {
fn b<F: Sync, G>(&self, _x: F) -> F { panic!() }
//~^ ERROR `F : std::marker::Sync` appears on the impl method
//~^ ERROR `F: std::marker::Sync` appears on the impl method
}
fn main() {}

@ -10,13 +10,13 @@
fn main() {
let _ = Iterator::next(&mut ());
//~^ ERROR `() : std::iter::Iterator` is not satisfied
//~^ ERROR `(): std::iter::Iterator` is not satisfied
for _ in false {}
//~^ ERROR `bool : std::iter::Iterator` is not satisfied
//~^ ERROR `bool: std::iter::Iterator` is not satisfied
let _ = Iterator::next(&mut ());
//~^ ERROR `() : std::iter::Iterator` is not satisfied
//~^ ERROR `(): std::iter::Iterator` is not satisfied
other()
}
@ -25,11 +25,11 @@ pub fn other() {
// check errors are still reported globally
let _ = Iterator::next(&mut ());
//~^ ERROR `() : std::iter::Iterator` is not satisfied
//~^ ERROR `(): std::iter::Iterator` is not satisfied
let _ = Iterator::next(&mut ());
//~^ ERROR `() : std::iter::Iterator` is not satisfied
//~^ ERROR `(): std::iter::Iterator` is not satisfied
for _ in false {}
//~^ ERROR `bool : std::iter::Iterator` is not satisfied
//~^ ERROR `bool: std::iter::Iterator` is not satisfied
}

@ -28,5 +28,5 @@ impl Foo for S5<u32> { fn xxx(&self) {} }
impl Foo for S5<u64> { fn xxx(&self) {} }
fn main() {
let _ = <S5<_>>::xxx; //~ ERROR cannot resolve `S5<_> : Foo`
let _ = <S5<_>>::xxx; //~ ERROR cannot resolve `S5<_>: Foo`
}

@ -11,6 +11,6 @@
trait I {}
type K = I+'static;
fn foo(_x: K) {} //~ ERROR: `I + 'static : std::marker::Sized` is not satisfied
fn foo(_x: K) {} //~ ERROR: `I + 'static: std::marker::Sized` is not satisfied
fn main() {}

@ -15,8 +15,8 @@ struct Struct {
}
fn new_struct(r: A+'static)
-> Struct { //~^ ERROR `A + 'static : std::marker::Sized` is not satisfied
//~^ ERROR `A + 'static : std::marker::Sized` is not satisfied
-> Struct { //~^ ERROR `A + 'static: std::marker::Sized` is not satisfied
//~^ ERROR `A + 'static: std::marker::Sized` is not satisfied
Struct { r: r }
}

@ -34,5 +34,5 @@ struct A {
fn main() {
let a = A {v: box B{v: None} as Box<Foo+Send>};
//~^ ERROR `std::rc::Rc<std::cell::RefCell<A>> : std::marker::Send` is not satisfied
//~^ ERROR `std::rc::Rc<std::cell::RefCell<A>>: std::marker::Send` is not satisfied
}

@ -16,6 +16,6 @@ use std::cell::RefCell;
// Regression test for issue 7364
static boxed: Box<RefCell<isize>> = box RefCell::new(0);
//~^ ERROR allocations are not allowed in statics
//~| ERROR `std::cell::RefCell<isize> : std::marker::Sync` is not satisfied
//~| ERROR `std::cell::RefCell<isize>: std::marker::Sync` is not satisfied
fn main() { }

@ -21,5 +21,5 @@ fn take_param<T:Foo>(foo: &T) { }
fn main() {
let x: Box<_> = box 3;
take_param(&x);
//~^ ERROR `Box<_> : std::marker::Copy` is not satisfied
//~^ ERROR `Box<_>: std::marker::Copy` is not satisfied
}

@ -14,7 +14,7 @@ fn assert_send<T:Send>() { }
fn test71<'a>() {
assert_send::<*mut &'a isize>();
//~^ ERROR `*mut &'a isize : core::marker::Send` is not satisfied
//~^ ERROR `*mut &'a isize: core::marker::Send` is not satisfied
}
fn main() {

@ -28,5 +28,5 @@ fn main() {
let x: Box<Map<isize, isize>> = x;
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let y: Box<Map<usize, isize>> = Box::new(x);
//~^ ERROR `Box<Map<isize, isize>> : Map<usize, isize>` is not satisfied
//~^ ERROR `Box<Map<isize, isize>>: Map<usize, isize>` is not satisfied
}

@ -24,5 +24,5 @@ fn bar<T: Sync>(_: T) {}
fn main() {
let x = Foo::A(NoSync);
bar(&x); //~ ERROR `NoSync : std::marker::Sync` is not satisfied
bar(&x); //~ ERROR `NoSync: std::marker::Sync` is not satisfied
}

@ -33,7 +33,7 @@ fn main() {
let x = foo(Port(Rc::new(())));
thread::spawn(move|| {
//~^ ERROR `std::rc::Rc<()> : std::marker::Send` is not satisfied
//~^ ERROR `std::rc::Rc<()>: std::marker::Send` is not satisfied
let y = x;
println!("{:?}", y);
});

@ -24,5 +24,5 @@ fn bar<T: Send>(_: T) {}
fn main() {
let x = Foo::A(NoSend);
bar(x);
//~^ ERROR `NoSend : std::marker::Send` is not satisfied
//~^ ERROR `NoSend: std::marker::Send` is not satisfied
}

@ -15,5 +15,5 @@ fn bar<T: Send>(_: T) {}
fn main() {
let x = Rc::new(5);
bar(x);
//~^ ERROR `std::rc::Rc<_> : std::marker::Send` is not satisfied
//~^ ERROR `std::rc::Rc<_>: std::marker::Send` is not satisfied
}

@ -23,5 +23,5 @@ fn bar<T: Send>(_: T) {}
fn main() {
let x = Foo { a: 5 };
bar(x);
//~^ ERROR `Foo : std::marker::Send` is not satisfied
//~^ ERROR `Foo: std::marker::Send` is not satisfied
}

@ -22,5 +22,5 @@ fn bar<T: Sync>(_: T) {}
fn main() {
let x = Foo::A(NoSync);
bar(x);
//~^ ERROR `NoSync : std::marker::Sync` is not satisfied
//~^ ERROR `NoSync: std::marker::Sync` is not satisfied
}

@ -20,5 +20,5 @@ fn bar<T: Sync>(_: T) {}
fn main() {
let x = Foo { a: 5 };
bar(x);
//~^ ERROR `Foo : std::marker::Sync` is not satisfied
//~^ ERROR `Foo: std::marker::Sync` is not satisfied
}

@ -16,19 +16,19 @@ fn test<T: Sync>() {}
fn main() {
test::<Cell<i32>>();
//~^ ERROR `std::cell::Cell<i32> : std::marker::Sync` is not satisfied
//~^ ERROR `std::cell::Cell<i32>: std::marker::Sync` is not satisfied
test::<RefCell<i32>>();
//~^ ERROR `std::cell::RefCell<i32> : std::marker::Sync` is not satisfied
//~^ ERROR `std::cell::RefCell<i32>: std::marker::Sync` is not satisfied
test::<Rc<i32>>();
//~^ ERROR `std::rc::Rc<i32> : std::marker::Sync` is not satisfied
//~^ ERROR `std::rc::Rc<i32>: std::marker::Sync` is not satisfied
test::<Weak<i32>>();
//~^ ERROR `std::rc::Weak<i32> : std::marker::Sync` is not satisfied
//~^ ERROR `std::rc::Weak<i32>: std::marker::Sync` is not satisfied
test::<Receiver<i32>>();
//~^ ERROR `std::sync::mpsc::Receiver<i32> : std::marker::Sync` is not satisfied
//~^ ERROR `std::sync::mpsc::Receiver<i32>: std::marker::Sync` is not satisfied
test::<Sender<i32>>();
//~^ ERROR `std::sync::mpsc::Sender<i32> : std::marker::Sync` is not satisfied
//~^ ERROR `std::sync::mpsc::Sender<i32>: std::marker::Sync` is not satisfied
test::<SyncSender<i32>>();
//~^ ERROR `std::sync::mpsc::SyncSender<i32> : std::marker::Sync` is not satisfied
//~^ ERROR `std::sync::mpsc::SyncSender<i32>: std::marker::Sync` is not satisfied
}

@ -14,5 +14,5 @@
trait Foo {}
fn take_foo<F:Foo>(f: F) {}
fn take_object(f: Box<Foo>) { take_foo(f); }
//~^ ERROR `Box<Foo> : Foo` is not satisfied
//~^ ERROR `Box<Foo>: Foo` is not satisfied
fn main() {}

@ -31,11 +31,11 @@ struct Nested<T>(T);
fn is_zen<T: Zen>(_: T) {}
fn not_sync<T>(x: Guard<T>) {
is_zen(x) //~ error: `T : std::marker::Sync` is not satisfied
is_zen(x) //~ error: `T: std::marker::Sync` is not satisfied
}
fn nested_not_sync<T>(x: Nested<Guard<T>>) {
is_zen(x) //~ error: `T : std::marker::Sync` is not satisfied
is_zen(x) //~ error: `T: std::marker::Sync` is not satisfied
}
fn main() {}

@ -22,6 +22,6 @@ pub fn main() {
// Unsized type.
let arr: &[_] = &[1, 2, 3];
let range = *arr..;
//~^ ERROR `[_] : std::marker::Sized` is not satisfied
//~| ERROR `[_] : std::marker::Sized` is not satisfied
//~^ ERROR `[_]: std::marker::Sized` is not satisfied
//~| ERROR `[_]: std::marker::Sized` is not satisfied
}

@ -47,7 +47,7 @@ impl Drop for P<i8> { fn drop(&mut self) { } } // REJECT
//~^ ERROR Implementations of Drop cannot be specialized
impl<Adds_bnd:Bound> Drop for Q<Adds_bnd> { fn drop(&mut self) { } } // REJECT
//~^ ERROR The requirement `Adds_bnd : Bound` is added only by the Drop impl.
//~^ ERROR The requirement `Adds_bnd: Bound` is added only by the Drop impl.
impl<'rbnd,Adds_rbnd:'rbnd> Drop for R<Adds_rbnd> { fn drop(&mut self) { } } // REJECT
//~^ ERROR The requirement `Adds_rbnd : 'rbnd` is added only by the Drop impl.

@ -25,5 +25,5 @@ impl Drop for Foo {
fn main() {
let a = Foo { x: 3 };
let _ = [ a; 5 ];
//~^ ERROR `Foo : std::marker::Copy` is not satisfied
//~^ ERROR `Foo: std::marker::Copy` is not satisfied
}

@ -10,5 +10,5 @@
pub fn main() {
let s: &str = "hello";
let c: u8 = s[4]; //~ ERROR `str : std::ops::Index<_>` is not satisfied
let c: u8 = s[4]; //~ ERROR `str: std::ops::Index<_>` is not satisfied
}

@ -12,11 +12,11 @@ fn bot<T>() -> T { loop {} }
fn mutate(s: &mut str) {
s[1..2] = bot();
//~^ ERROR `str : std::marker::Sized` is not satisfied
//~| ERROR `str : std::marker::Sized` is not satisfied
//~^ ERROR `str: std::marker::Sized` is not satisfied
//~| ERROR `str: std::marker::Sized` is not satisfied
s[1usize] = bot();
//~^ ERROR `str : std::ops::Index<usize>` is not satisfied
//~| ERROR `str : std::ops::IndexMut<usize>` is not satisfied
//~^ ERROR `str: std::ops::Index<usize>` is not satisfied
//~| ERROR `str: std::ops::IndexMut<usize>` is not satisfied
}
pub fn main() {}

@ -0,0 +1,47 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//
// compile-flags: -Z verbose
// TODO nikomatsakis: test with both verbose and without
trait Foo<'b, 'c, S=u32> {
fn bar<'a, T>() where T: 'a {}
fn baz() {}
}
impl<'a,'b,T,S> Foo<'a, 'b, S> for T {}
fn main() {}
fn foo<'z>() where &'z (): Sized {
let x: () = <i8 as Foo<'static, 'static, u8>>::bar::<'static, char>;
//~^ ERROR mismatched types
//~| expected `()`
//~| found `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::bar::<ReStatic, char>}`
let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>;
//~^ ERROR mismatched types
//~| expected `()`
//~| found `fn() {<i8 as Foo<ReStatic, ReStatic, u32>>::bar::<ReStatic, char>}`
let x: () = <i8 as Foo<'static, 'static, u8>>::baz;
//~^ ERROR mismatched types
//~| expected `()`
//~| found `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::baz}`
let x: () = foo::<'static>;
//~^ ERROR mismatched types
//~| expected `()`
//~| found `fn() {foo::<ReStatic>}`
<str as Foo<u8>>::bar;
//~^ ERROR `str: std::marker::Sized` is not satisfied
}

@ -34,15 +34,15 @@ trait Foo {
impl Foo for isize {
// invalid bound for T, was defined as Eq in trait
fn test_error1_fn<T: Ord>(&self) {}
//~^ ERROR the requirement `T : std::cmp::Ord` appears on the impl
//~^ ERROR the requirement `T: std::cmp::Ord` appears on the impl
// invalid bound for T, was defined as Eq + Ord in trait
fn test_error2_fn<T: Eq + B>(&self) {}
//~^ ERROR the requirement `T : B` appears on the impl
//~^ ERROR the requirement `T: B` appears on the impl
// invalid bound for T, was defined as Eq + Ord in trait
fn test_error3_fn<T: B + Eq>(&self) {}
//~^ ERROR the requirement `T : B` appears on the impl
//~^ ERROR the requirement `T: B` appears on the impl
// multiple bounds, same order as in trait
fn test3_fn<T: Ord + Eq>(&self) {}
@ -52,16 +52,16 @@ impl Foo for isize {
// parameters in impls must be equal or more general than in the defining trait
fn test_error5_fn<T: B>(&self) {}
//~^ ERROR the requirement `T : B` appears on the impl
//~^ ERROR the requirement `T: B` appears on the impl
// bound `std::cmp::Eq` not enforced by this implementation, but this is OK
fn test6_fn<T: A>(&self) {}
fn test_error7_fn<T: A + Eq>(&self) {}
//~^ ERROR the requirement `T : std::cmp::Eq` appears on the impl
//~^ ERROR the requirement `T: std::cmp::Eq` appears on the impl
fn test_error8_fn<T: C>(&self) {}
//~^ ERROR the requirement `T : C` appears on the impl
//~^ ERROR the requirement `T: C` appears on the impl
}
trait Getter<T> {

@ -21,7 +21,7 @@ trait IteratorUtil<A>: Sized
impl<A, T: Iterator<A>> IteratorUtil<A> for T {
fn zip<B, U: Iterator<B>>(self, other: U) -> ZipIterator<T, U> {
//~^ ERROR the requirement `U : Iterator<B>` appears on the impl method
//~^ ERROR the requirement `U: Iterator<B>` appears on the impl method
ZipIterator{a: self, b: other}
}
}

@ -15,7 +15,7 @@ trait Foo {
// This should emit the less confusing error, not the more confusing one.
fn foo(_x: Foo + Send) {
//~^ ERROR `Foo + Send + 'static : std::marker::Sized` is not satisfied
//~^ ERROR `Foo + Send + 'static: std::marker::Sized` is not satisfied
}
fn main() { }

@ -21,7 +21,7 @@ enum Bar<T:Trait> {
}
impl<T> Foo<T> {
//~^ ERROR `T : Trait` is not satisfied
//~^ ERROR `T: Trait` is not satisfied
fn uhoh() {}
}

@ -25,6 +25,6 @@ impl Trait<&'static str> for Struct {
fn main() {
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let s: Box<Trait<isize>> = Box::new(Struct { person: "Fred" });
//~^ ERROR `Struct : Trait<isize>` is not satisfied
//~^ ERROR `Struct: Trait<isize>` is not satisfied
s.f(1);
}

@ -15,49 +15,49 @@ struct Misc<T:?Sized>(T);
fn check<T: Iterator, U: ?Sized>() {
// suggest a where-clause, if needed
mem::size_of::<U>();
//~^ ERROR `U : std::marker::Sized` is not satisfied
//~^ ERROR `U: std::marker::Sized` is not satisfied
//~| HELP E0277
//~| HELP consider adding a `where U : std::marker::Sized` bound
//~| HELP consider adding a `where U: std::marker::Sized` bound
//~| NOTE required by `std::mem::size_of`
mem::size_of::<Misc<U>>();
//~^ ERROR `U : std::marker::Sized` is not satisfied
//~^ ERROR `U: std::marker::Sized` is not satisfied
//~| HELP E0277
//~| HELP consider adding a `where U : std::marker::Sized` bound
//~| HELP consider adding a `where U: std::marker::Sized` bound
//~| NOTE required because it appears within the type `Misc<U>`
//~| NOTE required by `std::mem::size_of`
// ... even if T occurs as a type parameter
<u64 as From<T>>::from;
//~^ ERROR `u64 : std::convert::From<T>` is not satisfied
//~^ ERROR `u64: std::convert::From<T>` is not satisfied
//~| HELP E0277
//~| HELP consider adding a `where u64 : std::convert::From<T>` bound
//~| HELP consider adding a `where u64: std::convert::From<T>` bound
//~| NOTE required by `std::convert::From::from`
<u64 as From<<T as Iterator>::Item>>::from;
//~^ ERROR `u64 : std::convert::From<<T as std::iter::Iterator>::Item>` is not satisfied
//~^ ERROR `u64: std::convert::From<<T as std::iter::Iterator>::Item>` is not satisfied
//~| HELP E0277
//~| HELP consider adding a `where u64 :
//~| HELP consider adding a `where u64:
//~| NOTE required by `std::convert::From::from`
// ... but not if there are inference variables
<Misc<_> as From<T>>::from;
//~^ ERROR `Misc<_> : std::convert::From<T>` is not satisfied
//~^ ERROR `Misc<_>: std::convert::From<T>` is not satisfied
//~| HELP E0277
//~| NOTE required by `std::convert::From::from`
// ... and also not if the error is not related to the type
mem::size_of::<[T]>();
//~^ ERROR `[T] : std::marker::Sized` is not satisfied
//~^ ERROR `[T]: std::marker::Sized` is not satisfied
//~| HELP E0277
//~| NOTE `[T]` does not have a constant size
//~| NOTE required by `std::mem::size_of`
mem::size_of::<[&U]>();
//~^ ERROR `[&U] : std::marker::Sized` is not satisfied
//~^ ERROR `[&U]: std::marker::Sized` is not satisfied
//~| HELP E0277
//~| NOTE `[&U]` does not have a constant size
//~| NOTE required by `std::mem::size_of`

@ -31,8 +31,8 @@ fn dummy() {
impl !Send for TestType {}
Outer(TestType);
//~^ ERROR `dummy::TestType : std::marker::Send` is not satisfied
//~| ERROR `dummy::TestType : std::marker::Send` is not satisfied
//~^ ERROR `dummy::TestType: std::marker::Send` is not satisfied
//~| ERROR `dummy::TestType: std::marker::Send` is not satisfied
}
fn dummy1b() {
@ -40,7 +40,7 @@ fn dummy1b() {
impl !Send for TestType {}
is_send(TestType);
//~^ ERROR `dummy1b::TestType : std::marker::Send` is not satisfied
//~^ ERROR `dummy1b::TestType: std::marker::Send` is not satisfied
}
fn dummy1c() {
@ -48,7 +48,7 @@ fn dummy1c() {
impl !Send for TestType {}
is_send((8, TestType));
//~^ ERROR `dummy1c::TestType : std::marker::Send` is not satisfied
//~^ ERROR `dummy1c::TestType: std::marker::Send` is not satisfied
}
fn dummy2() {
@ -56,7 +56,7 @@ fn dummy2() {
impl !Send for TestType {}
is_send(Box::new(TestType));
//~^ ERROR `dummy2::TestType : std::marker::Send` is not satisfied
//~^ ERROR `dummy2::TestType: std::marker::Send` is not satisfied
}
fn dummy3() {
@ -64,7 +64,7 @@ fn dummy3() {
impl !Send for TestType {}
is_send(Box::new(Outer2(TestType)));
//~^ ERROR `dummy3::TestType : std::marker::Send` is not satisfied
//~^ ERROR `dummy3::TestType: std::marker::Send` is not satisfied
}
fn main() {
@ -74,5 +74,5 @@ fn main() {
// This will complain about a missing Send impl because `Sync` is implement *just*
// for T that are `Send`. Look at #20366 and #19950
is_sync(Outer2(TestType));
//~^ ERROR `main::TestType : std::marker::Send` is not satisfied
//~^ ERROR `main::TestType: std::marker::Send` is not satisfied
}

@ -33,21 +33,21 @@ impl CompareTo<u64> for i64 {
impl CompareToInts for i64 { }
fn with_obj(c: &CompareToInts) -> bool {
c.same_as(22) //~ ERROR `CompareToInts : CompareTo<i32>` is not satisfied
c.same_as(22) //~ ERROR `CompareToInts: CompareTo<i32>` is not satisfied
}
fn with_trait<C:CompareToInts>(c: &C) -> bool {
c.same_as(22) //~ ERROR `C : CompareTo<i32>` is not satisfied
c.same_as(22) //~ ERROR `C: CompareTo<i32>` is not satisfied
}
fn with_ufcs1<C:CompareToInts>(c: &C) -> bool {
CompareToInts::same_as(c, 22) //~ ERROR `CompareToInts : CompareTo<i32>` is not satisfied
CompareToInts::same_as(c, 22) //~ ERROR `CompareToInts: CompareTo<i32>` is not satisfied
}
fn with_ufcs2<C:CompareToInts>(c: &C) -> bool {
CompareTo::same_as(c, 22) //~ ERROR `C : CompareTo<i32>` is not satisfied
CompareTo::same_as(c, 22) //~ ERROR `C: CompareTo<i32>` is not satisfied
}
fn main() {
assert_eq!(22_i64.same_as(22), true); //~ ERROR `i64 : CompareTo<i32>` is not satisfied
assert_eq!(22_i64.same_as(22), true); //~ ERROR `i64: CompareTo<i32>` is not satisfied
}

@ -26,5 +26,5 @@ fn main() {
is_mytrait::<MyS>();
is_mytrait::<(MyS2, MyS)>();
//~^ ERROR `MyS2 : MyTrait` is not satisfied
//~^ ERROR `MyS2: MyTrait` is not satisfied
}

@ -29,5 +29,5 @@ fn main() {
is_mytrait::<MyS>();
is_mytrait::<MyS2>();
//~^ ERROR `MyS2 : MyTrait` is not satisfied
//~^ ERROR `MyS2: MyTrait` is not satisfied
}

@ -27,5 +27,5 @@ fn is_send<T: Send>() {}
fn main() {
is_send::<MySendable>();
is_send::<MyNotSendable>();
//~^ ERROR `MyNotSendable : std::marker::Send` is not satisfied
//~^ ERROR `MyNotSendable: std::marker::Send` is not satisfied
}

@ -43,11 +43,11 @@ fn is_sync<T: Sync>() {}
fn main() {
is_sync::<MySync>();
is_sync::<MyNotSync>();
//~^ ERROR `MyNotSync : std::marker::Sync` is not satisfied
//~^ ERROR `MyNotSync: std::marker::Sync` is not satisfied
is_sync::<MyTypeWUnsafe>();
//~^ ERROR `std::cell::UnsafeCell<u8> : std::marker::Sync` is not satisfied
//~^ ERROR `std::cell::UnsafeCell<u8>: std::marker::Sync` is not satisfied
is_sync::<MyTypeManaged>();
//~^ ERROR `Managed : std::marker::Sync` is not satisfied
//~^ ERROR `Managed: std::marker::Sync` is not satisfied
}

@ -33,10 +33,10 @@ fn is_my_unsafe_trait<T: MyUnsafeTrait>() {}
fn main() {
is_my_trait::<ThisImplsTrait>();
is_my_trait::<ThisImplsUnsafeTrait>();
//~^ ERROR `ThisImplsUnsafeTrait : MyTrait` is not satisfied
//~^ ERROR `ThisImplsUnsafeTrait: MyTrait` is not satisfied
is_my_unsafe_trait::<ThisImplsTrait>();
//~^ ERROR `ThisImplsTrait : MyUnsafeTrait` is not satisfied
//~^ ERROR `ThisImplsTrait: MyUnsafeTrait` is not satisfied
is_my_unsafe_trait::<ThisImplsUnsafeTrait>();
}

@ -27,5 +27,5 @@ impl Signed for i32 { }
fn main() {
is_defaulted::<&'static i32>();
is_defaulted::<&'static u32>();
//~^ ERROR `u32 : Signed` is not satisfied
//~^ ERROR `u32: Signed` is not satisfied
}

@ -24,6 +24,6 @@ fn foo<T:MyTrait>() { bar::<T>() }
fn bar<T:NotImplemented>() { }
fn main() {
foo::<i32>(); //~ ERROR `i32 : NotImplemented` is not satisfied
bar::<i64>(); //~ ERROR `i64 : NotImplemented` is not satisfied
foo::<i32>(); //~ ERROR `i32: NotImplemented` is not satisfied
bar::<i64>(); //~ ERROR `i64: NotImplemented` is not satisfied
}

@ -29,7 +29,7 @@ fn bar<T:NotImplemented>() { }
fn test() {
bar::<Option<i32>>();
//~^ ERROR `std::option::Option<i32> : NotImplemented` is not satisfied
//~^ ERROR `std::option::Option<i32>: NotImplemented` is not satisfied
}
fn main() {

@ -26,7 +26,7 @@ impl NotImplemented for i32 {}
impl MyTrait for .. {}
fn foo<T:MyTrait>() {
//~^ ERROR `std::option::Option<T> : NotImplemented` is not satisfied
//~^ ERROR `std::option::Option<T>: NotImplemented` is not satisfied
// This should probably typecheck. This is #20671.
}

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