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;
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,
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))
(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)?;
}
// 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(())
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)
}
}
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() {
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() { }
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() {
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() { }
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() { }
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() {
}
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() {
// 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 {
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
}
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)
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() { }
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() { }
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() { }
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`
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`
}
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 };
}
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() {}
// 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
#[derive(Clone)]
struct C {
x: NoCloneOrEq
- //~^ ERROR `NoCloneOrEq : std::clone::Clone` is not satisfied
+ //~^ ERROR `NoCloneOrEq: std::clone::Clone` is not satisfied
}
#[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() {}
// 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;
// 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
}
//~| found `Bar1`
//~| expected trait ToBar
//~| found struct `Bar1`
- //~| ERROR `ToBar : std::marker::Sized` is not satisfied
+ //~| ERROR `ToBar: std::marker::Sized` is not satisfied
}
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
}
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
}
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() { }
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() { }
// 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
}
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);
}
}
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() { }
// 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)
fn main() {
format!("{:X}", "3");
- //~^ ERROR: `str : std::fmt::UpperHex` is not satisfied
+ //~^ ERROR: `str: std::fmt::UpperHex` is not satisfied
}
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 }
}
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
fn main() {
() <- 0;
- //~^ ERROR: `() : std::ops::Placer<_>` is not satisfied
+ //~^ ERROR: `(): std::ops::Placer<_>` is not satisfied
}
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
}
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
}
}
{
for
&mut something
-//~^ ERROR `[T] : std::marker::Sized` is not satisfied
+//~^ ERROR `[T]: std::marker::Sized` is not satisfied
in arg2
{
}
}
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
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
}
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() {}
}
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() {
}
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!()
// 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 {
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() {}
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
}
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
}
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
}
}
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)
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
}
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() {}
#[derive(Hash)]
struct Foo(Bar);
-//~^ error: `Bar : std::hash::Hash` is not satisfied
+//~^ error: `Bar: std::hash::Hash` is not satisfied
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>>
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>>
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
}
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
};
}
fn bot<T>() -> T { loop {} }
fn main() {
- do_fold(bot(), ()); //~ ERROR `() : InOut<_>` is not satisfied
+ do_fold(bot(), ()); //~ ERROR `(): InOut<_>` is not satisfied
}
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() {}
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()
}
// 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
}
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`
}
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() {}
}
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 }
}
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
}
// 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() { }
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
}
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() {
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
}
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
}
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);
});
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
}
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
}
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
}
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
}
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
}
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
}
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() {}
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() {}
// 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
}
//~^ 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.
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
}
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
}
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() {}
--- /dev/null
+// 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
+}
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) {}
// 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> {
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}
}
}
// 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() { }
}
impl<T> Foo<T> {
-//~^ ERROR `T : Trait` is not satisfied
+//~^ ERROR `T: Trait` is not satisfied
fn uhoh() {}
}
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);
}
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`
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() {
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() {
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() {
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() {
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() {
// 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
}
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
}
is_mytrait::<MyS>();
is_mytrait::<(MyS2, MyS)>();
- //~^ ERROR `MyS2 : MyTrait` is not satisfied
+ //~^ ERROR `MyS2: MyTrait` is not satisfied
}
is_mytrait::<MyS>();
is_mytrait::<MyS2>();
- //~^ ERROR `MyS2 : MyTrait` is not satisfied
+ //~^ ERROR `MyS2: MyTrait` is not satisfied
}
fn main() {
is_send::<MySendable>();
is_send::<MyNotSendable>();
- //~^ ERROR `MyNotSendable : std::marker::Send` is not satisfied
+ //~^ ERROR `MyNotSendable: std::marker::Send` is not satisfied
}
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
}
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>();
}
fn main() {
is_defaulted::<&'static i32>();
is_defaulted::<&'static u32>();
- //~^ ERROR `u32 : Signed` is not satisfied
+ //~^ ERROR `u32: Signed` is not satisfied
}
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
}
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() {
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.
}
fn main() {
let us = UnsafeCell::new(MySync{u: UnsafeCell::new(0)});
test(us);
- //~^ ERROR `std::cell::UnsafeCell<MySync<_>> : std::marker::Sync` is not satisfied
+ //~^ ERROR `std::cell::UnsafeCell<MySync<_>>: std::marker::Sync` is not satisfied
let uns = UnsafeCell::new(NoSync);
test(uns);
- //~^ ERROR `std::cell::UnsafeCell<NoSync> : std::marker::Sync` is not satisfied
+ //~^ ERROR `std::cell::UnsafeCell<NoSync>: std::marker::Sync` is not satisfied
let ms = MySync{u: uns};
test(ms);
- //~^ ERROR `std::cell::UnsafeCell<NoSync> : std::marker::Sync` is not satisfied
+ //~^ ERROR `std::cell::UnsafeCell<NoSync>: std::marker::Sync` is not satisfied
test(NoSync);
- //~^ ERROR `NoSync : std::marker::Sync` is not satisfied
+ //~^ ERROR `NoSync: std::marker::Sync` is not satisfied
}
fn main() {
<i32 as Add<u32>>::add(1, 2);
- //~^ ERROR `i32 : std::ops::Add<u32>` is not satisfied
+ //~^ ERROR `i32: std::ops::Add<u32>` is not satisfied
<i32 as Add<i32>>::add(1u32, 2);
//~^ ERROR mismatched types
<i32 as Add<i32>>::add(1, 2u32);
// except according to those terms.
fn bar<T: Sized>() { }
-fn foo<T: ?Sized>() { bar::<T>() } //~ ERROR `T : std::marker::Sized` is not satisfied
+fn foo<T: ?Sized>() { bar::<T>() } //~ ERROR `T: std::marker::Sized` is not satisfied
fn main() { }
enum Foo<U> { FooSome(U), FooNone }
fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
-//~^ ERROR `T : std::marker::Sized` is not satisfied
+//~^ ERROR `T: std::marker::Sized` is not satisfied
//
// Not OK: `T` is not sized.
enum Bar<U: ?Sized> { BarSome(U), BarNone }
fn bar1<T: ?Sized>() { not_sized::<Bar<T>>() }
fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
-//~^ ERROR `T : std::marker::Sized` is not satisfied
+//~^ ERROR `T: std::marker::Sized` is not satisfied
//
// Not OK: `Bar<T>` is not sized, but it should be.
struct Foo<T> { data: T }
fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
-//~^ ERROR `T : std::marker::Sized` is not satisfied
+//~^ ERROR `T: std::marker::Sized` is not satisfied
//
// Not OK: `T` is not sized.
struct Bar<T: ?Sized> { data: T }
fn bar1<T: ?Sized>() { not_sized::<Bar<T>>() }
fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
-//~^ ERROR `T : std::marker::Sized` is not satisfied
+//~^ ERROR `T: std::marker::Sized` is not satisfied
//
// Not OK: `Bar<T>` is not sized, but it should be.
}
struct S4<Y: ?Sized>(Box<Y>);
impl<X: ?Sized> T2<X> for S4<X> {
- //~^ ERROR `X : std::marker::Sized` is not satisfied
+ //~^ ERROR `X: std::marker::Sized` is not satisfied
}
fn main() { }
// Unbounded.
fn f1<X: ?Sized>(x: &X) {
f2::<X>(x);
- //~^ ERROR `X : std::marker::Sized` is not satisfied
+ //~^ ERROR `X: std::marker::Sized` is not satisfied
}
fn f2<X>(x: &X) {
}
}
fn f3<X: ?Sized + T>(x: &X) {
f4::<X>(x);
- //~^ ERROR `X : std::marker::Sized` is not satisfied
+ //~^ ERROR `X: std::marker::Sized` is not satisfied
}
fn f4<X: T>(x: &X) {
}
fn f6<X: ?Sized>(x: &X) {}
fn f7<X: ?Sized>(x1: &E<X>, x2: &E<X>) {
f5(x1);
- //~^ ERROR `X : std::marker::Sized` is not satisfied
+ //~^ ERROR `X: std::marker::Sized` is not satisfied
f6(x2); // ok
}
fn f8<X: ?Sized>(x1: &S<X>, x2: &S<X>) {
f5(x1);
- //~^ ERROR `X : std::marker::Sized` is not satisfied
+ //~^ ERROR `X: std::marker::Sized` is not satisfied
f6(x2); // ok
}
// Test some tuples.
fn f9<X: ?Sized>(x1: Box<S<X>>, x2: Box<E<X>>) {
f5(&(*x1, 34));
- //~^ ERROR `X : std::marker::Sized` is not satisfied
+ //~^ ERROR `X: std::marker::Sized` is not satisfied
}
fn f10<X: ?Sized>(x1: Box<S<X>>, x2: Box<E<X>>) {
f5(&(32, *x2));
- //~^ ERROR `X : std::marker::Sized` is not satisfied
+ //~^ ERROR `X: std::marker::Sized` is not satisfied
}
pub fn main() {
// Test `?Sized` types not allowed in fields (except the last one).
struct S1<X: ?Sized> {
- f1: X, //~ ERROR `X : std::marker::Sized` is not satisfied
+ f1: X, //~ ERROR `X: std::marker::Sized` is not satisfied
f2: isize,
}
struct S2<X: ?Sized> {
f: isize,
- g: X, //~ ERROR `X : std::marker::Sized` is not satisfied
+ g: X, //~ ERROR `X: std::marker::Sized` is not satisfied
h: isize,
}
struct S3 {
- f: str, //~ ERROR `str : std::marker::Sized` is not satisfied
+ f: str, //~ ERROR `str: std::marker::Sized` is not satisfied
g: [usize]
}
struct S4 {
- f: [u8], //~ ERROR `[u8] : std::marker::Sized` is not satisfied
+ f: [u8], //~ ERROR `[u8]: std::marker::Sized` is not satisfied
g: usize
}
enum E<X: ?Sized> {
- V1(X, isize), //~ERROR `X : std::marker::Sized` is not satisfied
+ V1(X, isize), //~ERROR `X: std::marker::Sized` is not satisfied
}
enum F<X: ?Sized> {
- V2{f1: X, f: isize}, //~ERROR `X : std::marker::Sized` is not satisfied
+ V2{f1: X, f: isize}, //~ERROR `X: std::marker::Sized` is not satisfied
}
pub fn main() {
fn f1<X: ?Sized>(x: &X) {
let _: X; // <-- this is OK, no bindings created, no initializer.
let _: (isize, (X, isize)); // same
- let y: X; //~ERROR `X : std::marker::Sized` is not satisfied
- let y: (isize, (X, isize)); //~ERROR `X : std::marker::Sized` is not satisfied
+ let y: X; //~ERROR `X: std::marker::Sized` is not satisfied
+ let y: (isize, (X, isize)); //~ERROR `X: std::marker::Sized` is not satisfied
}
fn f2<X: ?Sized + T>(x: &X) {
- let y: X; //~ERROR `X : std::marker::Sized` is not satisfied
- let y: (isize, (X, isize)); //~ERROR `X : std::marker::Sized` is not satisfied
+ let y: X; //~ERROR `X: std::marker::Sized` is not satisfied
+ let y: (isize, (X, isize)); //~ERROR `X: std::marker::Sized` is not satisfied
}
fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
- let y: X = *x1; //~ERROR `X : std::marker::Sized` is not satisfied
- let y = *x2; //~ERROR `X : std::marker::Sized` is not satisfied
- let (y, z) = (*x3, 4); //~ERROR `X : std::marker::Sized` is not satisfied
+ let y: X = *x1; //~ERROR `X: std::marker::Sized` is not satisfied
+ let y = *x2; //~ERROR `X: std::marker::Sized` is not satisfied
+ let (y, z) = (*x3, 4); //~ERROR `X: std::marker::Sized` is not satisfied
}
fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
- let y: X = *x1; //~ERROR `X : std::marker::Sized` is not satisfied
- let y = *x2; //~ERROR `X : std::marker::Sized` is not satisfied
- let (y, z) = (*x3, 4); //~ERROR `X : std::marker::Sized` is not satisfied
+ let y: X = *x1; //~ERROR `X: std::marker::Sized` is not satisfied
+ let y = *x2; //~ERROR `X: std::marker::Sized` is not satisfied
+ let (y, z) = (*x3, 4); //~ERROR `X: std::marker::Sized` is not satisfied
}
-fn g1<X: ?Sized>(x: X) {} //~ERROR `X : std::marker::Sized` is not satisfied
-fn g2<X: ?Sized + T>(x: X) {} //~ERROR `X : std::marker::Sized` is not satisfied
+fn g1<X: ?Sized>(x: X) {} //~ERROR `X: std::marker::Sized` is not satisfied
+fn g2<X: ?Sized + T>(x: X) {} //~ERROR `X: std::marker::Sized` is not satisfied
pub fn main() {
}
struct S3<Y: ?Sized>(Box<Y>);
impl<X: ?Sized + T> T1<X> for S3<X> {
- //~^ ERROR `X : std::marker::Sized` is not satisfied
+ //~^ ERROR `X: std::marker::Sized` is not satisfied
}
fn main() { }
fn call_it<B:TraitB>(b: B) -> isize {
let y = 4;
- b.gimme_an_a(y) //~ ERROR `_ : TraitA` is not satisfied
+ b.gimme_an_a(y) //~ ERROR `_: TraitA` is not satisfied
}
fn main() {
impl<T> Foo for T {
type Bar = MySet<T>;
- //~^ ERROR the trait bound `T : MyHash` is not satisfied
+ //~^ ERROR the trait bound `T: MyHash` is not satisfied
}
#[rustc_error]
fn fails_copy(self) {
require_copy(self.x);
- //~^ ERROR the trait bound `T : std::marker::Copy` is not satisfied
+ //~^ ERROR the trait bound `T: std::marker::Copy` is not satisfied
}
}
fn fails_copy(self) {
require_copy(self.x);
- //~^ ERROR the trait bound `T : std::marker::Copy` is not satisfied
+ //~^ ERROR the trait bound `T: std::marker::Copy` is not satisfied
}
}
fn main() {
1.method::<X>();
- //~^ ERROR the trait bound `X : Foo<X>` is not satisfied
+ //~^ ERROR the trait bound `X: Foo<X>` is not satisfied
}
fn main() {
let x = Foo { value: Bar };
x.equals(&x);
- //~^ ERROR `Bar : std::cmp::Eq` is not satisfied
+ //~^ ERROR `Bar: std::cmp::Eq` is not satisfied
}
fn main() {
drop(equal(&Struct, &Struct))
- //~^ ERROR the trait bound `Struct : std::cmp::Eq` is not satisfied
+ //~^ ERROR the trait bound `Struct: std::cmp::Eq` is not satisfied
}
fn main() {
foo(&X);
- //~^ error: `for<'a> &'a _ : Bar` is not satisfied
+ //~^ error: `for<'a> &'a _: Bar` is not satisfied
}