suggest adding a where-clause when that can help
suggest adding a where-clause when there is an unmet trait-bound that can be satisfied if some type can implement it.
This commit is contained in:
parent
513d9f208c
commit
8a461d940c
159 changed files with 420 additions and 297 deletions
|
@ -371,14 +371,13 @@ assert_eq!(6, answer);
|
|||
This gives us these long, related errors:
|
||||
|
||||
```text
|
||||
error: the trait `core::marker::Sized` is not implemented for the type
|
||||
`core::ops::Fn(i32) -> i32` [E0277]
|
||||
error: the predicate `core::ops::Fn(i32) -> i32 : core::marker::Sized` is not satisfied [E0277]
|
||||
fn factory() -> (Fn(i32) -> i32) {
|
||||
^~~~~~~~~~~~~~~~
|
||||
note: `core::ops::Fn(i32) -> i32` does not have a constant size known at compile-time
|
||||
fn factory() -> (Fn(i32) -> i32) {
|
||||
^~~~~~~~~~~~~~~~
|
||||
error: the trait `core::marker::Sized` is not implemented for the type `core::ops::Fn(i32) -> i32` [E0277]
|
||||
error: the predicate `core::ops::Fn(i32) -> i32 : core::marker::Sized` is not satisfied [E0277]
|
||||
let f = factory();
|
||||
^
|
||||
note: `core::ops::Fn(i32) -> i32` does not have a constant size known at compile-time
|
||||
|
|
|
@ -231,8 +231,8 @@ fn main() {
|
|||
This won't work, however, and will give us the error:
|
||||
|
||||
```text
|
||||
13:9: 13:22 error: the trait `core::marker::Send` is not
|
||||
implemented for the type `alloc::rc::Rc<collections::vec::Vec<i32>>`
|
||||
13:9: 13:22 error: the predicate `alloc::rc::Rc<collections::vec::Vec<i32>> : core::marker::Send`
|
||||
is not satisfied
|
||||
...
|
||||
13:9: 13:22 note: `alloc::rc::Rc<collections::vec::Vec<i32>>`
|
||||
cannot be sent between threads safely
|
||||
|
|
|
@ -154,7 +154,7 @@ print_area(5);
|
|||
We get a compile-time error:
|
||||
|
||||
```text
|
||||
error: the trait `HasArea` is not implemented for the type `_` [E0277]
|
||||
error: the predicate `_ : HasArea` is not satisfied [E0277]
|
||||
```
|
||||
|
||||
## Trait bounds on generic structs
|
||||
|
@ -496,7 +496,7 @@ impl FooBar for Baz {
|
|||
If we forget to implement `Foo`, Rust will tell us:
|
||||
|
||||
```text
|
||||
error: the trait `main::Foo` is not implemented for the type `main::Baz` [E0277]
|
||||
error: the predicate `main::Baz : main::Foo` is not satisfied [E0277]
|
||||
```
|
||||
|
||||
# Deriving
|
||||
|
|
|
@ -56,8 +56,8 @@ v[j];
|
|||
Indexing with a non-`usize` type gives an error that looks like this:
|
||||
|
||||
```text
|
||||
error: the trait `core::ops::Index<i32>` is not implemented for the type
|
||||
`collections::vec::Vec<_>` [E0277]
|
||||
error: the predicate `collections::vec::Vec<_> : core::ops::Index<i32>`
|
||||
is not satisfied [E0277]
|
||||
v[j];
|
||||
^~~~
|
||||
note: the type `collections::vec::Vec<_>` cannot be indexed by `i32`
|
||||
|
|
|
@ -64,7 +64,7 @@ fn main() {
|
|||
```
|
||||
|
||||
```text
|
||||
<anon>:10:5: 10:8 error: the trait `Trait` is not implemented for the type `&mut i32` [E0277]
|
||||
<anon>:10:5: 10:8 error: the predicate `&mut i32 : Trait` is not satisfied [E0277]
|
||||
<anon>:10 foo(t);
|
||||
^~~
|
||||
```
|
||||
|
|
|
@ -1006,8 +1006,7 @@ fn some_func<T: Foo>(foo: T) {
|
|||
fn main() {
|
||||
// we now call the method with the i32 type, which doesn't implement
|
||||
// the Foo trait
|
||||
some_func(5i32); // error: the trait `Foo` is not implemented for the
|
||||
// type `i32`
|
||||
some_func(5i32); // error: the predicate `i32 : Foo` is not satisfied
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -13,10 +13,12 @@ use super::{
|
|||
FulfillmentErrorCode,
|
||||
MismatchedProjectionTypes,
|
||||
Obligation,
|
||||
ObligationCause,
|
||||
ObligationCauseCode,
|
||||
OutputTypeParameterMismatch,
|
||||
TraitNotObjectSafe,
|
||||
PredicateObligation,
|
||||
SelectionContext,
|
||||
SelectionError,
|
||||
ObjectSafetyViolation,
|
||||
MethodViolationCode,
|
||||
|
@ -26,8 +28,9 @@ use super::{
|
|||
use fmt_macros::{Parser, Piece, Position};
|
||||
use middle::def_id::DefId;
|
||||
use infer::InferCtxt;
|
||||
use ty::{self, ToPredicate, ToPolyTraitRef, TraitRef, Ty, TyCtxt, TypeFoldable};
|
||||
use ty::{self, ToPredicate, ToPolyTraitRef, Ty, TyCtxt};
|
||||
use ty::fast_reject;
|
||||
use ty::fold::{TypeFoldable, TypeFolder};
|
||||
use util::nodemap::{FnvHashMap, FnvHashSet};
|
||||
|
||||
use std::cmp;
|
||||
|
@ -100,9 +103,10 @@ pub fn report_projection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
|
|||
}
|
||||
}
|
||||
|
||||
fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
|
||||
trait_ref: &TraitRef<'tcx>,
|
||||
span: Span) -> Option<String> {
|
||||
fn on_unimplemented_note<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
|
||||
trait_ref: ty::PolyTraitRef<'tcx>,
|
||||
span: Span) -> Option<String> {
|
||||
let trait_ref = trait_ref.skip_binder();
|
||||
let def_id = trait_ref.def_id;
|
||||
let mut report = None;
|
||||
for item in infcx.tcx.get_attrs(def_id).iter() {
|
||||
|
@ -357,14 +361,20 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
|
|||
let trait_ref = trait_predicate.to_poly_trait_ref();
|
||||
let mut err = struct_span_err!(
|
||||
infcx.tcx.sess, obligation.cause.span, E0277,
|
||||
"the trait `{}` is not implemented for the type `{}`",
|
||||
trait_ref, trait_ref.self_ty());
|
||||
"the predicate `{}` is not satisfied",
|
||||
trait_ref.to_predicate());
|
||||
|
||||
// Check if it has a custom "#[rustc_on_unimplemented]"
|
||||
// error message, report with that message if it does
|
||||
let custom_note = report_on_unimplemented(infcx, &trait_ref.0,
|
||||
obligation.cause.span);
|
||||
if let Some(s) = custom_note {
|
||||
// Try to report a good error message.
|
||||
|
||||
if !trait_ref.has_infer_types() &&
|
||||
predicate_can_apply(infcx, trait_ref)
|
||||
{
|
||||
err.fileline_help(obligation.cause.span, &format!(
|
||||
"consider adding a `where {}` bound",
|
||||
trait_ref.to_predicate()
|
||||
));
|
||||
} else if let Some(s) = on_unimplemented_note(infcx, trait_ref,
|
||||
obligation.cause.span) {
|
||||
err.fileline_note(obligation.cause.span, &s);
|
||||
} else {
|
||||
let simp = fast_reject::simplify_type(infcx.tcx,
|
||||
|
@ -644,6 +654,55 @@ pub fn maybe_report_ambiguity<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns whether the trait predicate may apply for *some* assignment
|
||||
/// to the type parameters.
|
||||
fn predicate_can_apply<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
|
||||
pred: ty::PolyTraitRef<'tcx>)
|
||||
-> bool
|
||||
{
|
||||
struct ParamToVarFolder<'a, 'tcx: 'a> {
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
var_map: FnvHashMap<Ty<'tcx>, Ty<'tcx>>
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> TypeFolder<'tcx> for ParamToVarFolder<'a, 'tcx>
|
||||
{
|
||||
fn tcx(&self) -> &TyCtxt<'tcx> { self.infcx.tcx }
|
||||
|
||||
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
if let ty::TyParam(..) = ty.sty {
|
||||
let infcx = self.infcx;
|
||||
self.var_map.entry(ty).or_insert_with(|| infcx.next_ty_var())
|
||||
} else {
|
||||
ty.super_fold_with(self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
infcx.probe(|_| {
|
||||
let mut selcx = SelectionContext::new(infcx);
|
||||
|
||||
let cleaned_pred = pred.fold_with(&mut ParamToVarFolder {
|
||||
infcx: infcx,
|
||||
var_map: FnvHashMap()
|
||||
});
|
||||
|
||||
let cleaned_pred = super::project::normalize(
|
||||
&mut selcx,
|
||||
ObligationCause::dummy(),
|
||||
&cleaned_pred
|
||||
).value;
|
||||
|
||||
let obligation = Obligation::new(
|
||||
ObligationCause::dummy(),
|
||||
cleaned_pred.to_predicate()
|
||||
);
|
||||
|
||||
selcx.evaluate_obligation(&obligation)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
fn need_type_info<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
|
||||
span: Span,
|
||||
ty: Ty<'tcx>)
|
||||
|
|
|
@ -31,5 +31,5 @@ trait Add<RHS=Self> {
|
|||
fn ice<A>(a: A) {
|
||||
let r = loop {};
|
||||
r = r + a;
|
||||
//~^ ERROR not implemented
|
||||
//~^ ERROR E0277
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ pub trait GetToInt
|
|||
fn foo<G>(g: G) -> isize
|
||||
where G : GetToInt
|
||||
{
|
||||
ToInt::to_int(&g.get()) //~ ERROR not implemented
|
||||
ToInt::to_int(&g.get()) //~ ERROR E0277
|
||||
}
|
||||
|
||||
fn bar<G : GetToInt>(g: G) -> isize
|
||||
|
|
|
@ -15,7 +15,7 @@ trait Get {
|
|||
|
||||
trait Other {
|
||||
fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
|
||||
//~^ ERROR the trait `Get` is not implemented for the type `Self`
|
||||
//~^ ERROR the predicate `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 `Foo<usize>` is not implemented for the type `T`
|
||||
//~^ ERROR the predicate `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 `Get` is not implemented for the type `T`
|
||||
//~^ ERROR the predicate `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 `Get` is not implemented for the type `Self`
|
||||
//~^ ERROR the predicate `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 `Get` is not implemented for the type `Self`
|
||||
//~^ ERROR the predicate `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 `Get` is not implemented for the type `(T, U)`
|
||||
//~^ ERROR the predicate `(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 the trait `Foo` is not implemented
|
||||
//~^ ERROR `u32 : Foo` is not satisfied
|
||||
}
|
||||
|
||||
pub fn f1_uint_int() {
|
||||
f1(2u32, 4i32);
|
||||
//~^ ERROR the trait `Foo` is not implemented
|
||||
//~^ 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 the trait `std::marker::Sized` is not implemented
|
||||
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 `std::marker::Send` is not implemented
|
||||
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 the trait `std::marker::Sized` is not implemented
|
||||
//~| ERROR the trait `std::marker::Sized` is not implemented
|
||||
//~| ERROR the trait `std::marker::Sized` is not implemented
|
||||
//~^ 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 the trait `std::marker::Send` is not implemented
|
||||
impl <T: Sync+'static> Foo for (T,) { } //~ ERROR `T : std::marker::Send` is not satisfied
|
||||
|
||||
impl <T: Send> Foo for (T,T) { } //~ ERROR the trait `std::marker::Sync` is not implemented
|
||||
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 the trait `std::marker::Send` is not implemented
|
||||
//~^ 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 the trait `std::marker::Send` is not implemented
|
||||
//~^ 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 the trait `std::marker::Send` is not implemented
|
||||
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 `std::marker::Sized` is not implemented for the type `[u8]`
|
||||
//~^ ERROR the predicate `[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 `std::marker::Sized` is not implemented for the type `str`
|
||||
//~^ ERROR the predicate `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 the trait `std::marker::Send` is not implemented for the type
|
||||
//~^ 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 the trait `std::marker::Sync` is not implemented for the type
|
||||
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 `Bar<u32>` is not implemented for the type `i32`
|
||||
fn vacuous<A>() //~ ERROR the predicate `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 the trait `std::clone::Clone` is not implemented for the type `NoCloneOrEq`
|
||||
//~^ ERROR `NoCloneOrEq : std::clone::Clone` is not satisfied
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ struct Error;
|
|||
|
||||
#[derive(Default)]
|
||||
struct Struct {
|
||||
x: Error //~ ERROR `std::default::Default` is not implemented
|
||||
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 the trait `std::marker::Sized` is not implemented
|
||||
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 the trait `std::marker::Sized` is not implemented
|
||||
//~^ ERROR `ToBar : std::marker::Sized` is not satisfied
|
||||
}
|
||||
|
|
|
@ -49,5 +49,5 @@ pub fn main() {
|
|||
//~| found `Bar1`
|
||||
//~| expected trait ToBar
|
||||
//~| found struct `Bar1`
|
||||
//~| ERROR the trait `std::marker::Sized` is not implemented for the type `ToBar`
|
||||
//~| 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 the trait `Bar` is not implemented for the type `Foo`
|
||||
//~^ 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 the trait `std::marker::Sized` is not implemented
|
||||
//~^ 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 `std::marker::Sized` is not implemented for the type `T`
|
||||
//~^ ERROR `T : std::marker::Sized` is not satisfied
|
||||
}
|
||||
|
||||
fn test2<T: ?Sized + Foo>(t: &T) {
|
||||
let v: &Foo = t as &Foo;
|
||||
//~^ ERROR `std::marker::Sized` is not implemented for the type `T`
|
||||
//~^ ERROR `T : std::marker::Sized` is not satisfied
|
||||
}
|
||||
|
||||
fn test3() {
|
||||
let _: &[&Foo] = &["hi"];
|
||||
//~^ ERROR `std::marker::Sized` is not implemented for the type `str`
|
||||
//~^ ERROR `str : std::marker::Sized` is not satisfied
|
||||
}
|
||||
|
||||
fn test4(x: &[u8]) {
|
||||
let _: &Foo = x as &Foo;
|
||||
//~^ ERROR `std::marker::Sized` is not implemented for the type `[u8]`
|
||||
//~^ 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 the trait `std::marker::Sized` is not implemented for the type `[isize]`
|
||||
//~^ ERROR `[isize] : std::marker::Sized` is not satisfied
|
||||
|
||||
impl Foo<isize> for [usize] { }
|
||||
//~^ ERROR the trait `std::marker::Sized` is not implemented for the type `[usize]`
|
||||
//~^ ERROR `[usize] : std::marker::Sized` is not satisfied
|
||||
|
||||
pub fn main() { }
|
||||
|
|
|
@ -13,5 +13,5 @@
|
|||
fn check_bound<T:Copy>(_: T) {}
|
||||
|
||||
fn main() {
|
||||
check_bound("nocopy".to_string()); //~ ERROR the trait `std::marker::Copy` is not implemented
|
||||
check_bound("nocopy".to_string()); //~ ERROR : std::marker::Copy` is not satisfied
|
||||
}
|
||||
|
|
|
@ -17,6 +17,6 @@ fn main() {
|
|||
// extern functions are extern "C" fn
|
||||
let _x: extern "C" fn() = f; // OK
|
||||
is_fn(f);
|
||||
//~^ ERROR the trait `std::ops::Fn<()>` is not implemented for the type `extern "C" fn()
|
||||
//~| ERROR the trait `std::ops::FnOnce<()>` is not implemented for the type `extern "C" fn()
|
||||
//~^ ERROR `extern "C" fn() {f} : std::ops::Fn<()>` is not satisfied
|
||||
//~| ERROR `extern "C" fn() {f} : std::ops::FnOnce<()>` is not satisfied
|
||||
}
|
||||
|
|
|
@ -34,6 +34,6 @@ fn main() {
|
|||
//~| found box
|
||||
|
||||
needs_fn(1);
|
||||
//~^ ERROR `std::ops::Fn<(isize,)>`
|
||||
//~| ERROR `std::ops::FnOnce<(isize,)>`
|
||||
//~^ ERROR : std::ops::Fn<(isize,)>`
|
||||
//~| ERROR : std::ops::FnOnce<(isize,)>`
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ pub fn main() {
|
|||
x: 1,
|
||||
y: 2,
|
||||
};
|
||||
for x in bogus { //~ ERROR `std::iter::Iterator` is not implemented for the type `MyStruct`
|
||||
for x in bogus { //~ ERROR `MyStruct : std::iter::Iterator`
|
||||
drop(x);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,6 @@ impl<'a> Foo<(&'a isize, &'a isize)> for SomeStruct
|
|||
}
|
||||
|
||||
fn a() { want_foo1::<SomeStruct>(); } // OK -- foo wants just one region
|
||||
fn b() { want_foo2::<SomeStruct>(); } //~ ERROR not implemented
|
||||
fn b() { want_foo2::<SomeStruct>(); } //~ ERROR E0277
|
||||
|
||||
fn main() { }
|
||||
|
|
|
@ -54,7 +54,7 @@ fn want_qux<B>(b: &B)
|
|||
where B : Qux
|
||||
{
|
||||
want_foo_for_any_tcx(b);
|
||||
want_bar_for_any_ccx(b); //~ ERROR not implemented
|
||||
want_bar_for_any_ccx(b); //~ ERROR E0277
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -25,7 +25,7 @@ fn want_foo_for_some_tcx<'x,F>(f: &'x F)
|
|||
where F : Foo<'x>
|
||||
{
|
||||
want_foo_for_some_tcx(f);
|
||||
want_foo_for_any_tcx(f); //~ ERROR not implemented
|
||||
want_foo_for_any_tcx(f); //~ ERROR E0277
|
||||
}
|
||||
|
||||
fn want_foo_for_any_tcx<F>(f: &F)
|
||||
|
@ -42,7 +42,7 @@ fn want_bar_for_some_ccx<'x,B>(b: &B)
|
|||
want_foo_for_any_tcx(b);
|
||||
|
||||
want_bar_for_some_ccx(b);
|
||||
want_bar_for_any_ccx(b); //~ ERROR not implemented
|
||||
want_bar_for_any_ccx(b); //~ ERROR E0277
|
||||
}
|
||||
|
||||
fn want_bar_for_any_ccx<B>(b: &B)
|
||||
|
|
|
@ -31,7 +31,7 @@ fn give_any() {
|
|||
struct StaticInt;
|
||||
impl Foo<&'static isize> for StaticInt { }
|
||||
fn give_static() {
|
||||
want_hrtb::<StaticInt>() //~ ERROR `for<'a> Foo<&'a isize>` is not implemented
|
||||
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> Bar<&'a isize>` is not implemented for the type `T`
|
||||
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: the trait `std::fmt::UpperHex` is not implemented
|
||||
//~^ 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 the trait `Clone2` is not implemented
|
||||
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: the trait `std::ops::Index<u8>` is not implemented
|
||||
[0][0u8]; //~ ERROR: `[_] : std::ops::Index<u8>` is not satisfied
|
||||
|
||||
[0][0]; // should infer to be a usize
|
||||
|
||||
|
|
|
@ -13,14 +13,14 @@ pub fn main() {
|
|||
let s: String = "abcdef".to_string();
|
||||
v[3_usize];
|
||||
v[3];
|
||||
v[3u8]; //~ERROR the trait `std::ops::Index<u8>` is not implemented
|
||||
v[3i8]; //~ERROR the trait `std::ops::Index<i8>` is not implemented
|
||||
v[3u32]; //~ERROR the trait `std::ops::Index<u32>` is not implemented
|
||||
v[3i32]; //~ERROR the trait `std::ops::Index<i32>` is not implemented
|
||||
v[3u8]; //~ERROR : std::ops::Index<u8>` is not satisfied
|
||||
v[3i8]; //~ERROR : std::ops::Index<i8>` is not satisfied
|
||||
v[3u32]; //~ERROR : std::ops::Index<u32>` is not satisfied
|
||||
v[3i32]; //~ERROR : std::ops::Index<i32>` is not satisfied
|
||||
s.as_bytes()[3_usize];
|
||||
s.as_bytes()[3];
|
||||
s.as_bytes()[3u8]; //~ERROR the trait `std::ops::Index<u8>` is not implemented
|
||||
s.as_bytes()[3i8]; //~ERROR the trait `std::ops::Index<i8>` is not implemented
|
||||
s.as_bytes()[3u32]; //~ERROR the trait `std::ops::Index<u32>` is not implemented
|
||||
s.as_bytes()[3i32]; //~ERROR the trait `std::ops::Index<i32>` is not implemented
|
||||
s.as_bytes()[3u8]; //~ERROR : std::ops::Index<u8>` is not satisfied
|
||||
s.as_bytes()[3i8]; //~ERROR : std::ops::Index<i8>` is not satisfied
|
||||
s.as_bytes()[3u32]; //~ERROR : std::ops::Index<u32>` is not satisfied
|
||||
s.as_bytes()[3i32]; //~ERROR : std::ops::Index<i32>` is not satisfied
|
||||
}
|
||||
|
|
|
@ -13,5 +13,5 @@
|
|||
|
||||
fn main() {
|
||||
() <- 0;
|
||||
//~^ ERROR: the trait `std::ops::Placer<_>` is not implemented
|
||||
//~^ ERROR: `() : std::ops::Placer<_>` is not satisfied
|
||||
}
|
||||
|
|
|
@ -10,5 +10,5 @@
|
|||
|
||||
fn main() {
|
||||
let _x = "test" as &::std::any::Any;
|
||||
//~^ ERROR the trait `std::marker::Sized` is not implemented for the type `str`
|
||||
//~^ ERROR `str : std::marker::Sized` is not satisfied
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: ChunksMut<'a,T>)
|
|||
{
|
||||
for
|
||||
&mut something
|
||||
//~^ ERROR the trait `std::marker::Sized` is not implemented for the type `[T]`
|
||||
//~^ 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 the trait `std::marker::Sync` is not implemented for the type
|
||||
//~^ 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 the trait `std::marker::Sized` is not implemented for the type `[_]`
|
||||
//~^ ERROR `[_] : std::marker::Sized` is not satisfied
|
||||
}
|
||||
|
|
|
@ -17,6 +17,6 @@ impl !Sync for Foo {}
|
|||
|
||||
static FOO: usize = 3;
|
||||
static BAR: Foo = Foo;
|
||||
//~^ ERROR: the trait `std::marker::Sync` is not implemented
|
||||
//~^ ERROR: `Foo : std::marker::Sync` is not satisfied
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -12,7 +12,7 @@ pub trait AbstractRenderer {}
|
|||
|
||||
fn _create_render(_: &()) ->
|
||||
AbstractRenderer
|
||||
//~^ ERROR: the trait `std::marker::Sized` is not implemented
|
||||
//~^ 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 the trait `HasState` is not implemented for the type `isize`
|
||||
//~^ 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: the trait `std::marker::Sized` is not implemented for the type
|
||||
//~^ 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 the trait `foo::core::clone::Clone` is not implemented for the type `foo::core::
|
||||
//~^ 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 the trait `bar::clone::Clone` is not implemented for the type `bar::sync::atomic::
|
||||
//~^ 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 the trait `core::clone::Clone` is not implemented for the type `core::sync::atomic::
|
||||
//~^ ERROR `core::sync::atomic::AtomicBool : core::clone::Clone` is not satisfied
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ trait From<Src> {
|
|||
}
|
||||
|
||||
trait To {
|
||||
fn to<Dst>( //~ ERROR the trait `std::marker::Sized` is not implemented
|
||||
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 the trait `std::cmp::Ord` is not implemented for the type `X`
|
||||
//~^ 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 the trait `std::marker::Sized` is not implemented for the type `std::iter::Iterator
|
||||
//~^ 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: the trait `std::hash::Hash` is not implemented for the type `Bar`
|
||||
//~^ 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 `Foo<usize>` is not implemented for the type `Bar`
|
||||
//~^ error: the predicate `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 `Foo<usize>` is not implemented for the type `Bar`
|
||||
//~^ error: the predicate `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: the trait `std::marker::Send` is not implemented for the type `std::rc::Rc<()>`
|
||||
//~^ 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 the trait `std::ops::Fn<()>` is not implemented
|
||||
//~| ERROR the trait `std::ops::FnOnce<()>` is not implemented
|
||||
//~^ ERROR `() : std::ops::Fn<()>` is not satisfied
|
||||
//~| ERROR `() : std::ops::FnOnce<()>` is not satisfied
|
||||
};
|
||||
}
|
||||
|
|
|
@ -22,6 +22,6 @@ impl<RHS: Scalar> Add <RHS> for Bob {
|
|||
|
||||
fn main() {
|
||||
let b = Bob + 3.5;
|
||||
b + 3 //~ ERROR: is not implemented
|
||||
b + 3 //~ ERROR E0277
|
||||
//~^ ERROR: mismatched types
|
||||
}
|
||||
|
|
|
@ -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 is not implemented for the type `()`
|
||||
do_fold(bot(), ()); //~ ERROR `() : InOut<_>` is not satisfied
|
||||
}
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
|
||||
fn main() {
|
||||
let _ = Iterator::next(&mut ());
|
||||
//~^ ERROR the trait `std::iter::Iterator` is not implemented
|
||||
//~^ ERROR `() : std::iter::Iterator` is not satisfied
|
||||
|
||||
for _ in false {}
|
||||
//~^ ERROR the trait `std::iter::Iterator` is not implemented
|
||||
//~^ ERROR `bool : std::iter::Iterator` is not satisfied
|
||||
|
||||
let _ = Iterator::next(&mut ());
|
||||
//~^ ERROR the trait `std::iter::Iterator` is not implemented
|
||||
//~^ 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 the trait `std::iter::Iterator` is not implemented
|
||||
//~^ ERROR `() : std::iter::Iterator` is not satisfied
|
||||
|
||||
let _ = Iterator::next(&mut ());
|
||||
//~^ ERROR the trait `std::iter::Iterator` is not implemented
|
||||
//~^ ERROR `() : std::iter::Iterator` is not satisfied
|
||||
|
||||
for _ in false {}
|
||||
//~^ ERROR the trait `std::iter::Iterator` is not implemented
|
||||
//~^ ERROR `bool : std::iter::Iterator` is not satisfied
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
trait I {}
|
||||
type K = I+'static;
|
||||
|
||||
fn foo(_x: K) {} //~ ERROR: the trait `std::marker::Sized` is not implemented
|
||||
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 the trait `std::marker::Sized` is not implemented
|
||||
//~^ ERROR the trait `std::marker::Sized` is not implemented
|
||||
-> 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 the trait `std::marker::Send` is not implemented
|
||||
//~^ 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 the trait `std::marker::Sync` is not implemented for the type
|
||||
//~| ERROR `std::cell::RefCell<isize> : std::marker::Sync` is not satisfied
|
||||
|
||||
fn main() { }
|
||||
|
|
|
@ -34,14 +34,14 @@ fn test<'a,T,U:Copy>(_: &'a isize) {
|
|||
assert_copy::<&'a [isize]>();
|
||||
|
||||
// ...unless they are mutable
|
||||
assert_copy::<&'static mut isize>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<&'a mut isize>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<&'static mut isize>(); //~ ERROR : std::marker::Copy` is not satisfied
|
||||
assert_copy::<&'a mut isize>(); //~ ERROR : std::marker::Copy` is not satisfied
|
||||
|
||||
// boxes are not ok
|
||||
assert_copy::<Box<isize>>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<String>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<Vec<isize> >(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<Box<&'a mut isize>>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<Box<isize>>(); //~ ERROR : std::marker::Copy` is not satisfied
|
||||
assert_copy::<String>(); //~ ERROR : std::marker::Copy` is not satisfied
|
||||
assert_copy::<Vec<isize> >(); //~ ERROR : std::marker::Copy` is not satisfied
|
||||
assert_copy::<Box<&'a mut isize>>(); //~ ERROR : std::marker::Copy` is not satisfied
|
||||
|
||||
// borrowed object types are generally ok
|
||||
assert_copy::<&'a Dummy>();
|
||||
|
@ -49,11 +49,11 @@ fn test<'a,T,U:Copy>(_: &'a isize) {
|
|||
assert_copy::<&'static (Dummy+Copy)>();
|
||||
|
||||
// owned object types are not ok
|
||||
assert_copy::<Box<Dummy>>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<Box<Dummy+Copy>>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<Box<Dummy>>(); //~ ERROR : std::marker::Copy` is not satisfied
|
||||
assert_copy::<Box<Dummy+Copy>>(); //~ ERROR : std::marker::Copy` is not satisfied
|
||||
|
||||
// mutable object types are not ok
|
||||
assert_copy::<&'a mut (Dummy+Copy)>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<&'a mut (Dummy+Copy)>(); //~ ERROR : std::marker::Copy` is not satisfied
|
||||
|
||||
// unsafe ptrs are ok
|
||||
assert_copy::<*const isize>();
|
||||
|
@ -71,10 +71,10 @@ fn test<'a,T,U:Copy>(_: &'a isize) {
|
|||
assert_copy::<MyStruct>();
|
||||
|
||||
// structs containing non-POD are not ok
|
||||
assert_copy::<MyNoncopyStruct>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<MyNoncopyStruct>(); //~ ERROR : std::marker::Copy` is not satisfied
|
||||
|
||||
// ref counted types are not ok
|
||||
assert_copy::<Rc<isize>>(); //~ ERROR `std::marker::Copy` is not implemented
|
||||
assert_copy::<Rc<isize>>(); //~ ERROR : std::marker::Copy` is not satisfied
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
@ -21,5 +21,5 @@ fn take_param<T:Foo>(foo: &T) { }
|
|||
fn main() {
|
||||
let x: Box<_> = box 3;
|
||||
take_param(&x);
|
||||
//~^ ERROR the trait `std::marker::Copy` is not implemented
|
||||
//~^ ERROR `Box<_> : std::marker::Copy` is not satisfied
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
|||
fn f<T>(val: T) {
|
||||
let t: S<T> = S(marker::PhantomData);
|
||||
let a = &t as &Gettable<T>;
|
||||
//~^ ERROR the trait `std::marker::Send` is not implemented
|
||||
//~^ ERROR : std::marker::Send` is not satisfied
|
||||
}
|
||||
|
||||
fn g<T>(val: T) {
|
||||
let t: S<T> = S(marker::PhantomData);
|
||||
let a: &Gettable<T> = &t;
|
||||
//~^ ERROR the trait `std::marker::Send` is not implemented
|
||||
//~^ ERROR : std::marker::Send` is not satisfied
|
||||
}
|
||||
|
||||
fn foo<'a>() {
|
||||
|
@ -44,7 +44,7 @@ fn foo<'a>() {
|
|||
fn foo2<'a>() {
|
||||
let t: Box<S<String>> = box S(marker::PhantomData);
|
||||
let a = t as Box<Gettable<String>>;
|
||||
//~^ ERROR the trait `std::marker::Copy` is not implemented
|
||||
//~^ ERROR : std::marker::Copy` is not satisfied
|
||||
}
|
||||
|
||||
fn foo3<'a>() {
|
||||
|
@ -52,7 +52,7 @@ fn foo3<'a>() {
|
|||
|
||||
let t: Box<S<Foo>> = box S(marker::PhantomData);
|
||||
let a: Box<Gettable<Foo>> = t;
|
||||
//~^ ERROR the trait `std::marker::Copy` is not implemented
|
||||
//~^ ERROR : std::marker::Copy` is not satisfied
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
@ -18,5 +18,5 @@ fn bar<F:FnOnce() + Send>(_: F) { }
|
|||
fn main() {
|
||||
let x = Rc::new(3);
|
||||
bar(move|| foo(x));
|
||||
//~^ ERROR `std::marker::Send` is not implemented
|
||||
//~^ ERROR : std::marker::Send` is not satisfied
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ trait Message : Send { }
|
|||
|
||||
fn object_ref_with_static_bound_not_ok() {
|
||||
assert_send::<&'static (Dummy+'static)>();
|
||||
//~^ ERROR the trait `std::marker::Sync` is not implemented
|
||||
//~^ ERROR : std::marker::Sync` is not satisfied
|
||||
}
|
||||
|
||||
fn box_object_with_no_bound_not_ok<'a>() {
|
||||
assert_send::<Box<Dummy>>(); //~ ERROR the trait `std::marker::Send` is not implemented
|
||||
assert_send::<Box<Dummy>>(); //~ ERROR : std::marker::Send` is not satisfied
|
||||
}
|
||||
|
||||
fn object_with_send_bound_ok() {
|
||||
|
|
|
@ -18,7 +18,7 @@ trait Dummy { }
|
|||
// careful with object types, who knows what they close over...
|
||||
fn test51<'a>() {
|
||||
assert_send::<&'a Dummy>();
|
||||
//~^ ERROR the trait `std::marker::Sync` is not implemented
|
||||
//~^ ERROR : std::marker::Sync` is not satisfied
|
||||
}
|
||||
fn test52<'a>() {
|
||||
assert_send::<&'a (Dummy+Sync)>();
|
||||
|
@ -37,7 +37,7 @@ fn test61() {
|
|||
// them not ok
|
||||
fn test_71<'a>() {
|
||||
assert_send::<Box<Dummy+'a>>();
|
||||
//~^ ERROR the trait `std::marker::Send` is not implemented
|
||||
//~^ ERROR : std::marker::Send` is not satisfied
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
@ -14,11 +14,11 @@ fn assert_send<T:Send>() { }
|
|||
trait Dummy { }
|
||||
|
||||
fn test50() {
|
||||
assert_send::<&'static Dummy>(); //~ ERROR the trait `std::marker::Sync` is not implemented
|
||||
assert_send::<&'static Dummy>(); //~ ERROR : std::marker::Sync` is not satisfied
|
||||
}
|
||||
|
||||
fn test53() {
|
||||
assert_send::<Box<Dummy>>(); //~ ERROR the trait `std::marker::Send` is not implemented
|
||||
assert_send::<Box<Dummy>>(); //~ ERROR : std::marker::Send` is not satisfied
|
||||
}
|
||||
|
||||
// ...unless they are properly bounded
|
||||
|
|
|
@ -19,7 +19,7 @@ fn test32() { assert_send::<Vec<isize> >(); }
|
|||
|
||||
// but not if they own a bad thing
|
||||
fn test40() {
|
||||
assert_send::<Box<*mut u8>>(); //~ ERROR `std::marker::Send` is not implemented
|
||||
assert_send::<Box<*mut u8>>(); //~ ERROR : std::marker::Send` is not satisfied
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
@ -14,7 +14,7 @@ fn assert_send<T:Send>() { }
|
|||
|
||||
fn test71<'a>() {
|
||||
assert_send::<*mut &'a isize>();
|
||||
//~^ ERROR the trait `core::marker::Send` is not implemented for the type
|
||||
//~^ 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 the trait `Map<usize, isize>` is not implemented
|
||||
//~^ ERROR `Box<Map<isize, isize>> : Map<usize, isize>` is not satisfied
|
||||
}
|
||||
|
|
|
@ -15,5 +15,5 @@ fn f<T: Sync>(_: T) {}
|
|||
fn main() {
|
||||
let x = RefCell::new(0);
|
||||
f(x);
|
||||
//~^ ERROR `std::marker::Sync` is not implemented
|
||||
//~^ ERROR `std::cell::RefCell<_> : std::marker::Sync` is not satisfied
|
||||
}
|
||||
|
|
|
@ -24,5 +24,5 @@ fn bar<T: Sync>(_: T) {}
|
|||
|
||||
fn main() {
|
||||
let x = Foo::A(NoSync);
|
||||
bar(&x); //~ ERROR the trait `std::marker::Sync` is not implemented
|
||||
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::marker::Send` is not implemented
|
||||
//~^ 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 `std::marker::Send` is not implemented
|
||||
//~^ 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::marker::Send` is not implemented
|
||||
//~^ 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 the trait `std::marker::Send` is not implemented
|
||||
//~^ 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 the trait `std::marker::Sync` is not implemented
|
||||
//~^ 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 the trait `std::marker::Sync` is not implemented
|
||||
//~^ ERROR `Foo : std::marker::Sync` is not satisfied
|
||||
}
|
||||
|
|
|
@ -18,5 +18,5 @@ use std::cell::RefCell;
|
|||
fn assert<T: RecoverSafe + ?Sized>() {}
|
||||
|
||||
fn main() {
|
||||
assert::<Arc<RefCell<i32>>>(); //~ ERROR: is not implemented
|
||||
assert::<Arc<RefCell<i32>>>(); //~ ERROR E0277
|
||||
}
|
||||
|
|
|
@ -17,5 +17,5 @@ use std::cell::UnsafeCell;
|
|||
fn assert<T: RecoverSafe + ?Sized>() {}
|
||||
|
||||
fn main() {
|
||||
assert::<*const UnsafeCell<i32>>(); //~ ERROR: is not implemented
|
||||
assert::<*const UnsafeCell<i32>>(); //~ ERROR E0277
|
||||
}
|
||||
|
|
|
@ -16,5 +16,5 @@ use std::panic::RecoverSafe;
|
|||
fn assert<T: RecoverSafe + ?Sized>() {}
|
||||
|
||||
fn main() {
|
||||
assert::<&mut i32>(); //~ ERROR: RecoverSafe` is not implemented
|
||||
assert::<&mut i32>(); //~ ERROR: RecoverSafe` is not satisfied
|
||||
}
|
||||
|
|
|
@ -16,19 +16,19 @@ fn test<T: Sync>() {}
|
|||
|
||||
fn main() {
|
||||
test::<Cell<i32>>();
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `std::cell::Cell<i32>`
|
||||
//~^ ERROR `std::cell::Cell<i32> : std::marker::Sync` is not satisfied
|
||||
test::<RefCell<i32>>();
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `std::cell::RefCell<i32>`
|
||||
//~^ ERROR `std::cell::RefCell<i32> : std::marker::Sync` is not satisfied
|
||||
|
||||
test::<Rc<i32>>();
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `std::rc::Rc<i32>`
|
||||
//~^ ERROR `std::rc::Rc<i32> : std::marker::Sync` is not satisfied
|
||||
test::<Weak<i32>>();
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `std::rc::Weak<i32>`
|
||||
//~^ ERROR `std::rc::Weak<i32> : std::marker::Sync` is not satisfied
|
||||
|
||||
test::<Receiver<i32>>();
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `std::sync::mpsc::Receiver<i32>`
|
||||
//~^ ERROR `std::sync::mpsc::Receiver<i32> : std::marker::Sync` is not satisfied
|
||||
test::<Sender<i32>>();
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `std::sync::mpsc::Sender<i32>`
|
||||
//~^ ERROR `std::sync::mpsc::Sender<i32> : std::marker::Sync` is not satisfied
|
||||
test::<SyncSender<i32>>();
|
||||
//~^ ERROR marker::Sync` is not implemented for the type `std::sync::mpsc::SyncSender<i32>`
|
||||
//~^ 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 the trait `Foo` is not implemented
|
||||
//~^ 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: the trait `std::marker::Sync` is not implemented for the type `T`
|
||||
is_zen(x) //~ error: `T : std::marker::Sync` is not satisfied
|
||||
}
|
||||
|
||||
fn nested_not_sync<T>(x: Nested<Guard<T>>) {
|
||||
is_zen(x) //~ error: the trait `std::marker::Sync` is not implemented for the type `T`
|
||||
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 the trait `std::marker::Sized` is not implemented
|
||||
//~| ERROR the trait `std::marker::Sized` is not implemented
|
||||
//~^ ERROR `[_] : std::marker::Sized` is not satisfied
|
||||
//~| ERROR `[_] : std::marker::Sized` is not satisfied
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue