Auto merge of #82053 - JohnTitor:rollup-ymi9q0g, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #81811 (Fix doc test for Vec::retain(), now passes clippy::eval_order_dependence)
 - #81900 (Organize trait test files)
 - #81995 (Fix suggestion to introduce explicit lifetime)
 - #82031 (Drop an unnecessary intermediate variable)
 - #82033 (Refactor `get_word_attr` to return only `Option`)
 - #82040 (Add test to prevent src link regression)
 - #82041 (Add docs for shared_from_slice From impls)
 - #82050 (Added tests to drain an empty vec)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2021-02-13 07:58:44 +00:00
commit dd4851d503
300 changed files with 491 additions and 309 deletions

View File

@ -2248,13 +2248,18 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
"...",
);
if let Some(infer::RelateParamBound(_, t)) = origin {
let return_impl_trait = self
.in_progress_typeck_results
.map(|typeck_results| typeck_results.borrow().hir_owner)
.and_then(|owner| self.tcx.return_type_impl_trait(owner))
.is_some();
let t = self.resolve_vars_if_possible(t);
match t.kind() {
// We've got:
// fn get_later<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
// suggest:
// fn get_later<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
ty::Closure(_, _substs) | ty::Opaque(_, _substs) => {
ty::Closure(_, _substs) | ty::Opaque(_, _substs) if return_impl_trait => {
new_binding_suggestion(&mut err, type_param_span, bound_kind);
}
_ => {

View File

@ -260,8 +260,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// local crate or were inlined into it along with some function.
// This may change if abstract return types of some sort are
// implemented.
let tcx = self.tcx;
self.typeck_results
.borrow()
.closure_min_captures_flattened(closure_id)
@ -276,7 +274,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
match capture {
ty::UpvarCapture::ByValue(_) => upvar_ty,
ty::UpvarCapture::ByRef(borrow) => tcx.mk_ref(
ty::UpvarCapture::ByRef(borrow) => self.tcx.mk_ref(
borrow.region,
ty::TypeAndMut { ty: upvar_ty, mutbl: borrow.kind.to_mutbl_lossy() },
),

View File

@ -1652,6 +1652,16 @@ impl<T> From<T> for Rc<T> {
#[stable(feature = "shared_from_slice", since = "1.21.0")]
impl<T: Clone> From<&[T]> for Rc<[T]> {
/// Allocate a reference-counted slice and fill it by cloning `v`'s items.
///
/// # Example
///
/// ```
/// # use std::rc::Rc;
/// let original: &[i32] = &[1, 2, 3];
/// let shared: Rc<[i32]> = Rc::from(original);
/// assert_eq!(&[1, 2, 3], &shared[..]);
/// ```
#[inline]
fn from(v: &[T]) -> Rc<[T]> {
<Self as RcFromSlice<T>>::from_slice(v)
@ -1660,6 +1670,15 @@ impl<T: Clone> From<&[T]> for Rc<[T]> {
#[stable(feature = "shared_from_slice", since = "1.21.0")]
impl From<&str> for Rc<str> {
/// Allocate a reference-counted string slice and copy `v` into it.
///
/// # Example
///
/// ```
/// # use std::rc::Rc;
/// let shared: Rc<str> = Rc::from("statue");
/// assert_eq!("statue", &shared[..]);
/// ```
#[inline]
fn from(v: &str) -> Rc<str> {
let rc = Rc::<[u8]>::from(v.as_bytes());
@ -1669,6 +1688,16 @@ impl From<&str> for Rc<str> {
#[stable(feature = "shared_from_slice", since = "1.21.0")]
impl From<String> for Rc<str> {
/// Allocate a reference-counted string slice and copy `v` into it.
///
/// # Example
///
/// ```
/// # use std::rc::Rc;
/// let original: String = "statue".to_owned();
/// let shared: Rc<str> = Rc::from(original);
/// assert_eq!("statue", &shared[..]);
/// ```
#[inline]
fn from(v: String) -> Rc<str> {
Rc::from(&v[..])
@ -1677,6 +1706,16 @@ impl From<String> for Rc<str> {
#[stable(feature = "shared_from_slice", since = "1.21.0")]
impl<T: ?Sized> From<Box<T>> for Rc<T> {
/// Move a boxed object to a new, reference counted, allocation.
///
/// # Example
///
/// ```
/// # use std::rc::Rc;
/// let original: Box<i32> = Box::new(1);
/// let shared: Rc<i32> = Rc::from(original);
/// assert_eq!(1, *shared);
/// ```
#[inline]
fn from(v: Box<T>) -> Rc<T> {
Rc::from_box(v)
@ -1685,6 +1724,16 @@ impl<T: ?Sized> From<Box<T>> for Rc<T> {
#[stable(feature = "shared_from_slice", since = "1.21.0")]
impl<T> From<Vec<T>> for Rc<[T]> {
/// Allocate a reference-counted slice and move `v`'s items into it.
///
/// # Example
///
/// ```
/// # use std::rc::Rc;
/// let original: Box<Vec<i32>> = Box::new(vec![1, 2, 3]);
/// let shared: Rc<Vec<i32>> = Rc::from(original);
/// assert_eq!(vec![1, 2, 3], *shared);
/// ```
#[inline]
fn from(mut v: Vec<T>) -> Rc<[T]> {
unsafe {

View File

@ -2285,6 +2285,16 @@ impl<T> From<T> for Arc<T> {
#[stable(feature = "shared_from_slice", since = "1.21.0")]
impl<T: Clone> From<&[T]> for Arc<[T]> {
/// Allocate a reference-counted slice and fill it by cloning `v`'s items.
///
/// # Example
///
/// ```
/// # use std::sync::Arc;
/// let original: &[i32] = &[1, 2, 3];
/// let shared: Arc<[i32]> = Arc::from(original);
/// assert_eq!(&[1, 2, 3], &shared[..]);
/// ```
#[inline]
fn from(v: &[T]) -> Arc<[T]> {
<Self as ArcFromSlice<T>>::from_slice(v)
@ -2293,6 +2303,15 @@ impl<T: Clone> From<&[T]> for Arc<[T]> {
#[stable(feature = "shared_from_slice", since = "1.21.0")]
impl From<&str> for Arc<str> {
/// Allocate a reference-counted `str` and copy `v` into it.
///
/// # Example
///
/// ```
/// # use std::sync::Arc;
/// let shared: Arc<str> = Arc::from("eggplant");
/// assert_eq!("eggplant", &shared[..]);
/// ```
#[inline]
fn from(v: &str) -> Arc<str> {
let arc = Arc::<[u8]>::from(v.as_bytes());
@ -2302,6 +2321,16 @@ impl From<&str> for Arc<str> {
#[stable(feature = "shared_from_slice", since = "1.21.0")]
impl From<String> for Arc<str> {
/// Allocate a reference-counted `str` and copy `v` into it.
///
/// # Example
///
/// ```
/// # use std::sync::Arc;
/// let unique: String = "eggplant".to_owned();
/// let shared: Arc<str> = Arc::from(unique);
/// assert_eq!("eggplant", &shared[..]);
/// ```
#[inline]
fn from(v: String) -> Arc<str> {
Arc::from(&v[..])
@ -2310,6 +2339,16 @@ impl From<String> for Arc<str> {
#[stable(feature = "shared_from_slice", since = "1.21.0")]
impl<T: ?Sized> From<Box<T>> for Arc<T> {
/// Move a boxed object to a new, reference-counted allocation.
///
/// # Example
///
/// ```
/// # use std::sync::Arc;
/// let unique: Box<str> = Box::from("eggplant");
/// let shared: Arc<str> = Arc::from(unique);
/// assert_eq!("eggplant", &shared[..]);
/// ```
#[inline]
fn from(v: Box<T>) -> Arc<T> {
Arc::from_box(v)
@ -2318,6 +2357,16 @@ impl<T: ?Sized> From<Box<T>> for Arc<T> {
#[stable(feature = "shared_from_slice", since = "1.21.0")]
impl<T> From<Vec<T>> for Arc<[T]> {
/// Allocate a reference-counted slice and move `v`'s items into it.
///
/// # Example
///
/// ```
/// # use std::sync::Arc;
/// let unique: Vec<i32> = vec![1, 2, 3];
/// let shared: Arc<[i32]> = Arc::from(unique);
/// assert_eq!(&[1, 2, 3], &shared[..]);
/// ```
#[inline]
fn from(mut v: Vec<T>) -> Arc<[T]> {
unsafe {

View File

@ -1385,13 +1385,14 @@ impl<T, A: Allocator> Vec<T, A> {
/// assert_eq!(vec, [2, 4]);
/// ```
///
/// The exact order may be useful for tracking external state, like an index.
/// Because the elements are visited exactly once in the original order,
/// external state may be used to decide which elements to keep.
///
/// ```
/// let mut vec = vec![1, 2, 3, 4, 5];
/// let keep = [false, true, true, false, true];
/// let mut i = 0;
/// vec.retain(|_| (keep[i], i += 1).0);
/// let mut iter = keep.iter();
/// vec.retain(|_| *iter.next().unwrap());
/// assert_eq!(vec, [2, 3, 5]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]

View File

@ -609,6 +609,17 @@ fn test_move_items_zero_sized() {
assert_eq!(vec2, [(), (), ()]);
}
#[test]
fn test_drain_empty_vec() {
let mut vec: Vec<i32> = vec![];
let mut vec2: Vec<i32> = vec![];
for i in vec.drain(..) {
vec2.push(i);
}
assert!(vec.is_empty());
assert!(vec2.is_empty());
}
#[test]
fn test_drain_items() {
let mut vec = vec![1, 2, 3];

View File

@ -2161,18 +2161,20 @@ fn clean_use_statement(
return Vec::new();
}
let (doc_meta_item, please_inline) = import.attrs.lists(sym::doc).get_word_attr(sym::inline);
let inline_attr = import.attrs.lists(sym::doc).get_word_attr(sym::inline);
let pub_underscore = import.vis.node.is_pub() && name == kw::Underscore;
if pub_underscore && please_inline {
rustc_errors::struct_span_err!(
cx.tcx.sess,
doc_meta_item.unwrap().span(),
E0780,
"anonymous imports cannot be inlined"
)
.span_label(import.span, "anonymous import")
.emit();
if pub_underscore {
if let Some(ref inline) = inline_attr {
rustc_errors::struct_span_err!(
cx.tcx.sess,
inline.span(),
E0780,
"anonymous imports cannot be inlined"
)
.span_label(import.span, "anonymous import")
.emit();
}
}
// We consider inlining the documentation of `pub use` statements, but we
@ -2205,7 +2207,7 @@ fn clean_use_statement(
}
Import::new_glob(resolve_use_source(cx, path), true)
} else {
if !please_inline {
if inline_attr.is_none() {
if let Res::Def(DefKind::Mod, did) = path.res {
if !did.is_local() && did.index == CRATE_DEF_INDEX {
// if we're `pub use`ing an extern crate root, don't inline it unless we

View File

@ -438,7 +438,7 @@ impl AttributesExt for [ast::Attribute] {
crate trait NestedAttributesExt {
/// Returns `true` if the attribute list contains a specific `Word`
fn has_word(self, word: Symbol) -> bool;
fn get_word_attr(self, word: Symbol) -> (Option<ast::NestedMetaItem>, bool);
fn get_word_attr(self, word: Symbol) -> Option<ast::NestedMetaItem>;
}
impl<I: Iterator<Item = ast::NestedMetaItem> + IntoIterator<Item = ast::NestedMetaItem>>
@ -448,11 +448,8 @@ impl<I: Iterator<Item = ast::NestedMetaItem> + IntoIterator<Item = ast::NestedMe
self.into_iter().any(|attr| attr.is_word() && attr.has_name(word))
}
fn get_word_attr(mut self, word: Symbol) -> (Option<ast::NestedMetaItem>, bool) {
match self.find(|attr| attr.is_word() && attr.has_name(word)) {
Some(a) => (Some(a), true),
None => (None, false),
}
fn get_word_attr(mut self, word: Symbol) -> Option<ast::NestedMetaItem> {
self.find(|attr| attr.is_word() && attr.has_name(word))
}
}

View File

@ -0,0 +1,6 @@
#![crate_name = "foo"]
// This test ensures that the [src] link is present on traits items.
// @has foo/trait.Iterator.html '//h3[@id="method.zip"]/a[@class="srclink"]' "[src]"
pub use std::iter::Iterator;

View File

@ -0,0 +1,17 @@
error[E0311]: the parameter type `T` may not live long enough
--> $DIR/missing-lifetimes-in-signature-2.rs:20:5
|
LL | / foo.bar(move |_| {
LL | |
LL | | t.test();
LL | | });
| |______^
|
note: the parameter type `T` must be valid for the anonymous lifetime #2 defined on the function body at 19:1...
--> $DIR/missing-lifetimes-in-signature-2.rs:19:1
|
LL | fn func<T: Test>(foo: &Foo, t: T) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -0,0 +1,26 @@
// Regression test for #81650
struct Foo<'a> {
x: &'a mut &'a i32,
}
impl<'a> Foo<'a> {
fn bar<F, T>(&self, f: F)
where
F: FnOnce(&Foo<'a>) -> T,
F: 'a,
{}
}
trait Test {
fn test(&self);
}
fn func<T: Test>(foo: &Foo, t: T) {
foo.bar(move |_| {
//~^ ERROR the parameter type `T` may not live long enough
t.test();
});
}
fn main() {}

View File

@ -0,0 +1,21 @@
error[E0311]: the parameter type `T` may not live long enough
--> $DIR/missing-lifetimes-in-signature-2.rs:20:9
|
LL | fn func<T: Test>(foo: &Foo, t: T) {
| -- help: consider adding an explicit lifetime bound...: `T: 'a +`
LL | foo.bar(move |_| {
| ^^^
|
note: the parameter type `T` must be valid for the anonymous lifetime #2 defined on the function body at 19:1...
--> $DIR/missing-lifetimes-in-signature-2.rs:19:1
|
LL | fn func<T: Test>(foo: &Foo, t: T) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature-2.rs:20:13: 23:6]` will meet its required lifetime bounds
--> $DIR/missing-lifetimes-in-signature-2.rs:20:9
|
LL | foo.bar(move |_| {
| ^^^
error: aborting due to previous error

View File

@ -1,16 +1,16 @@
error[E0034]: multiple applicable items in scope
--> $DIR/trait-alias-ambiguous.rs:21:7
--> $DIR/ambiguous.rs:21:7
|
LL | t.foo();
| ^^^ multiple `foo` found
|
note: candidate #1 is defined in an impl of the trait `A` for the type `u8`
--> $DIR/trait-alias-ambiguous.rs:8:9
--> $DIR/ambiguous.rs:8:9
|
LL | fn foo(&self) {}
| ^^^^^^^^^^^^^
note: candidate #2 is defined in an impl of the trait `B` for the type `u8`
--> $DIR/trait-alias-ambiguous.rs:11:9
--> $DIR/ambiguous.rs:11:9
|
LL | fn foo(&self) {}
| ^^^^^^^^^^^^^

View File

@ -1,11 +1,11 @@
// aux-build:trait_alias.rs
// aux-build:send_sync.rs
#![feature(trait_alias)]
extern crate trait_alias;
extern crate send_sync;
use std::rc::Rc;
use trait_alias::SendSync;
use send_sync::SendSync;
fn use_alias<T: SendSync>() {}

View File

@ -1,5 +1,5 @@
error[E0277]: `Rc<u32>` cannot be sent between threads safely
--> $DIR/trait-alias-cross-crate.rs:14:17
--> $DIR/cross-crate.rs:14:17
|
LL | fn use_alias<T: SendSync>() {}
| -------- required by this bound in `use_alias`
@ -10,7 +10,7 @@ LL | use_alias::<Rc<u32>>();
= help: the trait `Send` is not implemented for `Rc<u32>`
error[E0277]: `Rc<u32>` cannot be shared between threads safely
--> $DIR/trait-alias-cross-crate.rs:14:17
--> $DIR/cross-crate.rs:14:17
|
LL | fn use_alias<T: SendSync>() {}
| -------- required by this bound in `use_alias`

View File

@ -1,5 +1,5 @@
error[E0404]: expected trait, found trait alias `DefaultAlias`
--> $DIR/trait-alias-impl.rs:5:6
--> $DIR/impl.rs:5:6
|
LL | impl DefaultAlias for () {}
| ^^^^^^^^^^^^ not a trait

View File

@ -1,12 +1,12 @@
// run-pass
// aux-build:trait_alias.rs
// aux-build:greeter.rs
#![feature(trait_alias)]
extern crate trait_alias;
extern crate greeter;
// Import only the alias, not the real trait.
use trait_alias::{Greet, Hi};
use greeter::{Greet, Hi};
fn main() {
let hi = Hi;

View File

@ -1,5 +1,5 @@
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:16:22
--> $DIR/no-duplicates.rs:16:22
|
LL | trait _0 = Obj;
| ---
@ -16,7 +16,7 @@ LL | type _T00 = dyn _0 + _0;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:19:22
--> $DIR/no-duplicates.rs:19:22
|
LL | trait _0 = Obj;
| ---
@ -35,7 +35,7 @@ LL | type _T01 = dyn _1 + _0;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:22:22
--> $DIR/no-duplicates.rs:22:22
|
LL | trait _0 = Obj;
| ---
@ -57,7 +57,7 @@ LL | type _T02 = dyn _1 + _1;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:25:23
--> $DIR/no-duplicates.rs:25:23
|
LL | trait _0 = Obj;
| --- additional non-auto trait
@ -73,7 +73,7 @@ LL | type _T03 = dyn Obj + _1;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:28:22
--> $DIR/no-duplicates.rs:28:22
|
LL | trait _0 = Obj;
| --- first non-auto trait
@ -89,7 +89,7 @@ LL | type _T04 = dyn _1 + Obj;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:37:17
--> $DIR/no-duplicates.rs:37:17
|
LL | trait _0 = Obj;
| ---
@ -114,7 +114,7 @@ LL | type _T10 = dyn _2 + _3;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:40:22
--> $DIR/no-duplicates.rs:40:22
|
LL | trait _0 = Obj;
| --- additional non-auto trait
@ -133,7 +133,7 @@ LL | type _T11 = dyn _3 + _2;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:43:23
--> $DIR/no-duplicates.rs:43:23
|
LL | trait _0 = Obj;
| --- additional non-auto trait
@ -150,7 +150,7 @@ LL | type _T12 = dyn Obj + _2;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:46:17
--> $DIR/no-duplicates.rs:46:17
|
LL | trait _0 = Obj;
| ---
@ -175,7 +175,7 @@ LL | type _T13 = dyn _2 + Obj;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:49:22
--> $DIR/no-duplicates.rs:49:22
|
LL | trait _0 = Obj;
| --- first non-auto trait
@ -194,7 +194,7 @@ LL | type _T14 = dyn _1 + _3;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:52:22
--> $DIR/no-duplicates.rs:52:22
|
LL | trait _0 = Obj;
| --- additional non-auto trait
@ -213,7 +213,7 @@ LL | type _T15 = dyn _3 + _1;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:55:22
--> $DIR/no-duplicates.rs:55:22
|
LL | trait _0 = Obj;
| --- first non-auto trait
@ -234,7 +234,7 @@ LL | type _T16 = dyn _1 + _4;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:58:22
--> $DIR/no-duplicates.rs:58:22
|
LL | trait _0 = Obj;
| --- additional non-auto trait
@ -255,7 +255,7 @@ LL | type _T17 = dyn _4 + _1;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:65:22
--> $DIR/no-duplicates.rs:65:22
|
LL | trait _5 = Obj + Send;
| ---
@ -272,7 +272,7 @@ LL | type _T20 = dyn _5 + _5;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:68:23
--> $DIR/no-duplicates.rs:68:23
|
LL | trait _5 = Obj + Send;
| --- additional non-auto trait
@ -286,7 +286,7 @@ LL | type _T21 = dyn Obj + _5;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:71:22
--> $DIR/no-duplicates.rs:71:22
|
LL | trait _5 = Obj + Send;
| --- first non-auto trait
@ -300,7 +300,7 @@ LL | type _T22 = dyn _5 + Obj;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:74:36
--> $DIR/no-duplicates.rs:74:36
|
LL | trait _5 = Obj + Send;
| --- first non-auto trait
@ -314,7 +314,7 @@ LL | type _T23 = dyn _5 + Send + Sync + Obj;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:81:17
--> $DIR/no-duplicates.rs:81:17
|
LL | trait _5 = Obj + Send;
| ---
@ -337,7 +337,7 @@ LL | type _T30 = dyn _6;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:84:17
--> $DIR/no-duplicates.rs:84:17
|
LL | trait _5 = Obj + Send;
| ---
@ -360,7 +360,7 @@ LL | type _T31 = dyn _6 + Send;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:87:24
--> $DIR/no-duplicates.rs:87:24
|
LL | trait _5 = Obj + Send;
| ---
@ -383,7 +383,7 @@ LL | type _T32 = dyn Send + _6;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:95:22
--> $DIR/no-duplicates.rs:95:22
|
LL | trait _5 = Obj + Send;
| --- first non-auto trait
@ -402,7 +402,7 @@ LL | type _T40 = dyn _8 + Obj;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:98:23
--> $DIR/no-duplicates.rs:98:23
|
LL | trait _5 = Obj + Send;
| --- additional non-auto trait
@ -421,7 +421,7 @@ LL | type _T41 = dyn Obj + _8;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:101:22
--> $DIR/no-duplicates.rs:101:22
|
LL | trait _3 = Obj;
| --- additional non-auto trait
@ -445,7 +445,7 @@ LL | type _T42 = dyn _8 + _4;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:104:22
--> $DIR/no-duplicates.rs:104:22
|
LL | trait _3 = Obj;
| --- first non-auto trait
@ -469,7 +469,7 @@ LL | type _T43 = dyn _4 + _8;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:107:36
--> $DIR/no-duplicates.rs:107:36
|
LL | trait _3 = Obj;
| --- first non-auto trait
@ -493,7 +493,7 @@ LL | type _T44 = dyn _4 + Send + Sync + _8;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:117:22
--> $DIR/no-duplicates.rs:117:22
|
LL | trait _9 = for<'a> ObjL<'a>;
| ---------------- first non-auto trait
@ -508,7 +508,7 @@ LL | type _T50 = dyn _9 + _10;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:123:23
--> $DIR/no-duplicates.rs:123:23
|
LL | trait _11 = ObjT<for<'a> fn(&'a u8)>;
| ------------------------ first non-auto trait

View File

@ -1,5 +1,5 @@
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:16:22
--> $DIR/no-extra-traits.rs:16:22
|
LL | trait _0 = ObjA;
| ---- first non-auto trait
@ -13,7 +13,7 @@ LL | type _T00 = dyn _0 + ObjB;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:19:24
--> $DIR/no-extra-traits.rs:19:24
|
LL | trait _0 = ObjA;
| ---- additional non-auto trait
@ -27,7 +27,7 @@ LL | type _T01 = dyn ObjB + _0;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:22:24
--> $DIR/no-extra-traits.rs:22:24
|
LL | trait _0 = ObjA;
| ---- additional non-auto trait
@ -43,7 +43,7 @@ LL | type _T02 = dyn ObjB + _1;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:25:22
--> $DIR/no-extra-traits.rs:25:22
|
LL | trait _0 = ObjA;
| ---- first non-auto trait
@ -59,7 +59,7 @@ LL | type _T03 = dyn _1 + ObjB;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:34:22
--> $DIR/no-extra-traits.rs:34:22
|
LL | trait _2 = ObjB;
| ----
@ -78,7 +78,7 @@ LL | type _T10 = dyn _2 + _3;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:37:22
--> $DIR/no-extra-traits.rs:37:22
|
LL | trait _2 = ObjB;
| ----
@ -97,7 +97,7 @@ LL | type _T11 = dyn _3 + _2;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:40:22
--> $DIR/no-extra-traits.rs:40:22
|
LL | trait _2 = ObjB;
| ----
@ -118,7 +118,7 @@ LL | type _T12 = dyn _2 + _4;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:43:22
--> $DIR/no-extra-traits.rs:43:22
|
LL | trait _2 = ObjB;
| ----
@ -139,7 +139,7 @@ LL | type _T13 = dyn _4 + _2;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:50:22
--> $DIR/no-extra-traits.rs:50:22
|
LL | trait _0 = ObjA;
| ---- additional non-auto trait
@ -158,7 +158,7 @@ LL | type _T20 = dyn _5 + _1;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:53:22
--> $DIR/no-extra-traits.rs:53:22
|
LL | trait _0 = ObjA;
| ---- first non-auto trait
@ -177,7 +177,7 @@ LL | type _T21 = dyn _1 + _5;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:56:22
--> $DIR/no-extra-traits.rs:56:22
|
LL | trait _5 = Sync + ObjB + Send;
| ---- first non-auto trait
@ -191,7 +191,7 @@ LL | type _T22 = dyn _5 + ObjA;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:59:24
--> $DIR/no-extra-traits.rs:59:24
|
LL | trait _5 = Sync + ObjB + Send;
| ---- additional non-auto trait
@ -205,7 +205,7 @@ LL | type _T23 = dyn ObjA + _5;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:62:29
--> $DIR/no-extra-traits.rs:62:29
|
LL | trait _0 = ObjA;
| ---- additional non-auto trait
@ -224,7 +224,7 @@ LL | type _T24 = dyn Send + _5 + _1 + Sync;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:65:29
--> $DIR/no-extra-traits.rs:65:29
|
LL | trait _0 = ObjA;
| ---- first non-auto trait
@ -243,7 +243,7 @@ LL | type _T25 = dyn _1 + Sync + _5 + Send;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:68:36
--> $DIR/no-extra-traits.rs:68:36
|
LL | trait _5 = Sync + ObjB + Send;
| ---- first non-auto trait
@ -257,7 +257,7 @@ LL | type _T26 = dyn Sync + Send + _5 + ObjA;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:71:38
--> $DIR/no-extra-traits.rs:71:38
|
LL | trait _5 = Sync + ObjB + Send;
| ---- additional non-auto trait
@ -271,7 +271,7 @@ LL | type _T27 = dyn Send + Sync + ObjA + _5;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:80:17
--> $DIR/no-extra-traits.rs:80:17
|
LL | trait _0 = ObjA;
| ---- first non-auto trait
@ -296,7 +296,7 @@ LL | type _T30 = dyn _6;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:83:17
--> $DIR/no-extra-traits.rs:83:17
|
LL | trait _0 = ObjA;
| ---- first non-auto trait
@ -321,7 +321,7 @@ LL | type _T31 = dyn _6 + Send;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:86:24
--> $DIR/no-extra-traits.rs:86:24
|
LL | trait _0 = ObjA;
| ---- first non-auto trait
@ -346,7 +346,7 @@ LL | type _T32 = dyn Send + _6;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:89:17
--> $DIR/no-extra-traits.rs:89:17
|
LL | trait _0 = ObjA;
| ---- first non-auto trait
@ -381,7 +381,7 @@ LL | type _T33 = dyn _8;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:92:17
--> $DIR/no-extra-traits.rs:92:17
|
LL | trait _0 = ObjA;
| ---- first non-auto trait
@ -416,7 +416,7 @@ LL | type _T34 = dyn _8 + Send;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:95:24
--> $DIR/no-extra-traits.rs:95:24
|
LL | trait _0 = ObjA;
| ---- first non-auto trait
@ -451,7 +451,7 @@ LL | type _T35 = dyn Send + _8;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:103:23
--> $DIR/no-extra-traits.rs:103:23
|
LL | trait _5 = Sync + ObjB + Send;
| ---- first non-auto trait
@ -470,7 +470,7 @@ LL | type _T40 = dyn _10 + ObjA;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:106:24
--> $DIR/no-extra-traits.rs:106:24
|
LL | trait _5 = Sync + ObjB + Send;
| ---- additional non-auto trait
@ -489,7 +489,7 @@ LL | type _T41 = dyn ObjA + _10;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:109:23
--> $DIR/no-extra-traits.rs:109:23
|
LL | trait _0 = ObjA;
| ---- additional non-auto trait
@ -513,7 +513,7 @@ LL | type _T42 = dyn _10 + _1;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:112:37
--> $DIR/no-extra-traits.rs:112:37
|
LL | trait _5 = Sync + ObjB + Send;
| ---- first non-auto trait
@ -532,7 +532,7 @@ LL | type _T43 = dyn Send + _10 + Sync + ObjA;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:115:24
--> $DIR/no-extra-traits.rs:115:24
|
LL | trait _5 = Sync + ObjB + Send;
| ---- additional non-auto trait
@ -551,7 +551,7 @@ LL | type _T44 = dyn ObjA + _10 + Send + Sync;
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:118:37
--> $DIR/no-extra-traits.rs:118:37
|
LL | trait _0 = ObjA;
| ---- additional non-auto trait

View File

@ -1,5 +1,5 @@
error[E0038]: the trait `Eq` cannot be made into an object
--> $DIR/trait-alias-object-fail.rs:7:13
--> $DIR/object-fail.rs:7:13
|
LL | let _: &dyn EqAlias = &123;
| ^^^^^^^^^^^ `Eq` cannot be made into an object
@ -11,7 +11,7 @@ LL | pub trait Eq: PartialEq<Self> {
| ^^^^^^^^^^^^^^^ the trait cannot be made into an object because it uses `Self` as a type parameter
error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified
--> $DIR/trait-alias-object-fail.rs:9:17
--> $DIR/object-fail.rs:9:17
|
LL | let _: &dyn IteratorAlias = &vec![123].into_iter();
| ^^^^^^^^^^^^^ help: specify the associated type: `IteratorAlias<Item = Type>`

View File

@ -1,11 +1,11 @@
error[E0224]: at least one trait is required for an object type
--> $DIR/trait-alias-only-maybe-bound.rs:13:12
--> $DIR/only-maybe-bound.rs:13:12
|
LL | type _T0 = dyn _1;
| ^^^^^^
error[E0224]: at least one trait is required for an object type
--> $DIR/trait-alias-only-maybe-bound.rs:19:12
--> $DIR/only-maybe-bound.rs:19:12
|
LL | type _T1 = dyn _2;
| ^^^^^^

View File

@ -1,23 +1,23 @@
error: trait aliases cannot be `auto`
--> $DIR/trait-alias-syntax-fail.rs:4:1
--> $DIR/syntax-fail.rs:4:1
|
LL | auto trait A = Foo;
| ^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `auto`
error: trait aliases cannot be `unsafe`
--> $DIR/trait-alias-syntax-fail.rs:5:1
--> $DIR/syntax-fail.rs:5:1
|
LL | unsafe trait B = Foo;
| ^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `unsafe`
error: bounds are not allowed on trait aliases
--> $DIR/trait-alias-syntax-fail.rs:7:8
--> $DIR/syntax-fail.rs:7:8
|
LL | trait C: Ord = Eq;
| ^^^^^
error: bounds are not allowed on trait aliases
--> $DIR/trait-alias-syntax-fail.rs:8:8
--> $DIR/syntax-fail.rs:8:8
|
LL | trait D: = Eq;
| ^

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/trait-alias-wf.rs:5:14
--> $DIR/wf.rs:5:14
|
LL | trait A<T: Foo> {}
| --- required by this bound in `A`

View File

@ -1,5 +1,5 @@
error[E0574]: expected struct, variant or union type, found trait `TraitNotAStruct`
--> $DIR/trait-as-struct-constructor.rs:4:5
--> $DIR/as-struct-constructor.rs:4:5
|
LL | TraitNotAStruct{ value: 0 };
| ^^^^^^^^^^^^^^^ not a struct, variant or union type

View File

@ -1,5 +1,5 @@
error[E0271]: type mismatch resolving `<std::vec::IntoIter<i32> as Iterator>::Item == u32`
--> $DIR/traits-assoc-type-in-supertrait-bad.rs:12:16
--> $DIR/assoc-type-in-superbad.rs:12:16
|
LL | type Key = u32;
| ^^^ expected `i32`, found `u32`

View File

@ -1,5 +1,5 @@
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/trait-bounds-not-on-bare-trait.rs:7:12
--> $DIR/not-on-bare-trait.rs:7:12
|
LL | fn foo(_x: Foo + Send) {
| ^^^^^^^^^^ help: use `dyn`: `dyn Foo + Send`
@ -7,7 +7,7 @@ LL | fn foo(_x: Foo + Send) {
= note: `#[warn(bare_trait_objects)]` on by default
error[E0277]: the size for values of type `(dyn Foo + Send + 'static)` cannot be known at compilation time
--> $DIR/trait-bounds-not-on-bare-trait.rs:7:8
--> $DIR/not-on-bare-trait.rs:7:8
|
LL | fn foo(_x: Foo + Send) {
| ^^ doesn't have a size known at compile-time

View File

@ -1,23 +1,23 @@
error[E0226]: only a single explicit lifetime bound is permitted
--> $DIR/trait-bounds-not-on-struct.rs:25:25
--> $DIR/not-on-struct.rs:25:25
|
LL | fn e() -> 'static + A + 'static {
| ^^^^^^^
error[E0226]: only a single explicit lifetime bound is permitted
--> $DIR/trait-bounds-not-on-struct.rs:29:53
--> $DIR/not-on-struct.rs:29:53
|
LL | fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) {
| ^^
error[E0404]: expected trait, found struct `Foo`
--> $DIR/trait-bounds-not-on-struct.rs:8:16
--> $DIR/not-on-struct.rs:8:16
|
LL | fn foo(_x: Box<Foo + Send>) { }
| ^^^ not a trait
|
help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
--> $DIR/trait-bounds-not-on-struct.rs:8:22
--> $DIR/not-on-struct.rs:8:22
|
LL | fn foo(_x: Box<Foo + Send>) { }
| --- ^^^^ ...because of this bound
@ -25,19 +25,19 @@ LL | fn foo(_x: Box<Foo + Send>) { }
| expected this type to be a trait...
error[E0404]: expected trait, found struct `Vec`
--> $DIR/trait-bounds-not-on-struct.rs:10:29
--> $DIR/not-on-struct.rs:10:29
|
LL | type TypeAlias<T> = Box<dyn Vec<T>>;
| ^^^^^^ not a trait
error[E0404]: expected trait, found struct `A`
--> $DIR/trait-bounds-not-on-struct.rs:13:11
--> $DIR/not-on-struct.rs:13:11
|
LL | fn a() -> A + 'static {
| ^ not a trait
|
help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
--> $DIR/trait-bounds-not-on-struct.rs:13:15
--> $DIR/not-on-struct.rs:13:15
|
LL | fn a() -> A + 'static {
| - ^^^^^^^ ...because of this bound
@ -49,13 +49,13 @@ LL | fn a() -> A {
| --
error[E0404]: expected trait, found enum `Result`
--> $DIR/trait-bounds-not-on-struct.rs:16:34
--> $DIR/not-on-struct.rs:16:34
|
LL | fn b<'a,T,E>(iter: Iterator<Item=Result<T,E> + 'a>) {
| ^^^^^^^^^^^ not a trait
|
help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
--> $DIR/trait-bounds-not-on-struct.rs:16:48
--> $DIR/not-on-struct.rs:16:48
|
LL | fn b<'a,T,E>(iter: Iterator<Item=Result<T,E> + 'a>) {
| ----------- ^^ ...because of this bound
@ -67,13 +67,13 @@ LL | fn b<'a,T,E>(iter: Iterator<Item=Result<T,E>>) {
| --
error[E0404]: expected trait, found struct `A`
--> $DIR/trait-bounds-not-on-struct.rs:19:21
--> $DIR/not-on-struct.rs:19:21
|
LL | fn c() -> 'static + A {
| ^ not a trait
|
help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
--> $DIR/trait-bounds-not-on-struct.rs:19:11
--> $DIR/not-on-struct.rs:19:11
|
LL | fn c() -> 'static + A {
| ^^^^^^^ - expected this type to be a trait...
@ -85,13 +85,13 @@ LL | fn c() -> A {
| --
error[E0404]: expected trait, found enum `Result`
--> $DIR/trait-bounds-not-on-struct.rs:22:39
--> $DIR/not-on-struct.rs:22:39
|
LL | fn d<'a,T,E>(iter: Iterator<Item='a + Result<T,E>>) {
| ^^^^^^^^^^^ not a trait
|
help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
--> $DIR/trait-bounds-not-on-struct.rs:22:34
--> $DIR/not-on-struct.rs:22:34
|
LL | fn d<'a,T,E>(iter: Iterator<Item='a + Result<T,E>>) {
| ^^ ----------- expected this type to be a trait...
@ -103,13 +103,13 @@ LL | fn d<'a,T,E>(iter: Iterator<Item=Result<T,E>>) {
| --
error[E0404]: expected trait, found struct `A`
--> $DIR/trait-bounds-not-on-struct.rs:25:21
--> $DIR/not-on-struct.rs:25:21
|
LL | fn e() -> 'static + A + 'static {
| ^ not a trait
|
help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
--> $DIR/trait-bounds-not-on-struct.rs:25:11
--> $DIR/not-on-struct.rs:25:11
|
LL | fn e() -> 'static + A + 'static {
| ^^^^^^^ - ^^^^^^^ ...because of these bounds
@ -121,13 +121,13 @@ LL | fn e() -> A {
| ---
error[E0404]: expected trait, found enum `Result`
--> $DIR/trait-bounds-not-on-struct.rs:29:39
--> $DIR/not-on-struct.rs:29:39
|
LL | fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) {
| ^^^^^^^^^^^ not a trait
|
help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
--> $DIR/trait-bounds-not-on-struct.rs:29:34
--> $DIR/not-on-struct.rs:29:34
|
LL | fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) {
| ^^ ----------- ^^ ...because of these bounds
@ -139,7 +139,7 @@ LL | fn f<'a,T,E>(iter: Iterator<Item=Result<T,E>>) {
| -- --
error[E0404]: expected trait, found struct `Traitor`
--> $DIR/trait-bounds-not-on-struct.rs:35:11
--> $DIR/not-on-struct.rs:35:11
|
LL | trait Trait {}
| ----------- similarly named trait `Trait` defined here
@ -147,7 +147,7 @@ LL | fn g() -> Traitor + 'static {
| ^^^^^^^ not a trait
|
help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
--> $DIR/trait-bounds-not-on-struct.rs:35:21
--> $DIR/not-on-struct.rs:35:21
|
LL | fn g() -> Traitor + 'static {
| ------- ^^^^^^^ ...because of this bound

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `u32: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:13:15
--> $DIR/on-structs-and-enums-in-fns.rs:13:15
|
LL | struct Foo<T:Trait> {
| ----- required by this bound in `Foo`
@ -8,7 +8,7 @@ LL | fn explode(x: Foo<u32>) {}
| ^^^^^^^^ the trait `Trait` is not implemented for `u32`
error[E0277]: the trait bound `f32: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:16:14
--> $DIR/on-structs-and-enums-in-fns.rs:16:14
|
LL | enum Bar<T:Trait> {
| ----- required by this bound in `Bar`

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `u16: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-in-impls.rs:20:6
--> $DIR/on-structs-and-enums-in-impls.rs:20:6
|
LL | struct Foo<T:Trait> {
| ----- required by this bound in `Foo`

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `usize: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-locals.rs:15:14
--> $DIR/on-structs-and-enums-locals.rs:15:14
|
LL | struct Foo<T:Trait> {
| ----- required by this bound in `Foo`
@ -8,7 +8,7 @@ LL | let baz: Foo<usize> = loop { };
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
error[E0277]: the trait bound `{integer}: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-locals.rs:10:15
--> $DIR/on-structs-and-enums-locals.rs:10:15
|
LL | struct Foo<T:Trait> {
| ------------------- required by `Foo`

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `usize: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-static.rs:9:11
--> $DIR/on-structs-and-enums-static.rs:9:11
|
LL | struct Foo<T:Trait> {
| ----- required by this bound in `Foo`

View File

@ -0,0 +1,14 @@
// aux-build:on_structs_and_enums_xc.rs
extern crate on_structs_and_enums_xc;
use on_structs_and_enums_xc::{Bar, Foo, Trait};
fn explode(x: Foo<usize>) {}
//~^ ERROR E0277
fn kaboom(y: Bar<f32>) {}
//~^ ERROR E0277
fn main() {
}

View File

@ -1,21 +1,21 @@
error[E0277]: the trait bound `usize: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-xc.rs:7:15
--> $DIR/on-structs-and-enums-xc.rs:7:15
|
LL | fn explode(x: Foo<usize>) {}
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
|
::: $DIR/auxiliary/trait_bounds_on_structs_and_enums_xc.rs:5:18
::: $DIR/auxiliary/on_structs_and_enums_xc.rs:5:18
|
LL | pub struct Foo<T:Trait> {
| ----- required by this bound in `Foo`
error[E0277]: the trait bound `f32: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-xc.rs:10:14
--> $DIR/on-structs-and-enums-xc.rs:10:14
|
LL | fn kaboom(y: Bar<f32>) {}
| ^^^^^^^^ the trait `Trait` is not implemented for `f32`
|
::: $DIR/auxiliary/trait_bounds_on_structs_and_enums_xc.rs:9:16
::: $DIR/auxiliary/on_structs_and_enums_xc.rs:9:16
|
LL | pub enum Bar<T:Trait> {
| ----- required by this bound in `Bar`

View File

@ -0,0 +1,15 @@
// aux-build:on_structs_and_enums_xc.rs
extern crate on_structs_and_enums_xc;
use on_structs_and_enums_xc::{Bar, Foo, Trait};
fn main() {
let foo = Foo {
//~^ ERROR E0277
x: 3
};
let bar: Bar<f64> = return;
//~^ ERROR E0277
let _ = bar;
}

View File

@ -1,16 +1,16 @@
error[E0277]: the trait bound `f64: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-xc1.rs:12:14
--> $DIR/on-structs-and-enums-xc1.rs:12:14
|
LL | let bar: Bar<f64> = return;
| ^^^^^^^^ the trait `Trait` is not implemented for `f64`
|
::: $DIR/auxiliary/trait_bounds_on_structs_and_enums_xc.rs:9:16
::: $DIR/auxiliary/on_structs_and_enums_xc.rs:9:16
|
LL | pub enum Bar<T:Trait> {
| ----- required by this bound in `Bar`
error[E0277]: the trait bound `{integer}: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-xc1.rs:8:15
--> $DIR/on-structs-and-enums-xc1.rs:8:15
|
LL | let foo = Foo {
| ^^^ the trait `Trait` is not implemented for `{integer}`

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `T: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:13:9
--> $DIR/on-structs-and-enums.rs:13:9
|
LL | struct Foo<T:Trait> {
| ----- required by this bound in `Foo`
@ -13,7 +13,7 @@ LL | impl<T: Trait> Foo<T> {
| ^^^^^^^
error[E0277]: the trait bound `isize: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:19:8
--> $DIR/on-structs-and-enums.rs:19:8
|
LL | struct Foo<T:Trait> {
| ----- required by this bound in `Foo`
@ -22,7 +22,7 @@ LL | a: Foo<isize>,
| ^^^^^^^^^^ the trait `Trait` is not implemented for `isize`
error[E0277]: the trait bound `usize: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:23:10
--> $DIR/on-structs-and-enums.rs:23:10
|
LL | enum Bar<T:Trait> {
| ----- required by this bound in `Bar`
@ -31,7 +31,7 @@ LL | Quux(Bar<usize>),
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
error[E0277]: the trait bound `U: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:27:8
--> $DIR/on-structs-and-enums.rs:27:8
|
LL | struct Foo<T:Trait> {
| ----- required by this bound in `Foo`
@ -45,7 +45,7 @@ LL | struct Badness<U: Trait> {
| ^^^^^^^
error[E0277]: the trait bound `V: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:31:21
--> $DIR/on-structs-and-enums.rs:31:21
|
LL | enum Bar<T:Trait> {
| ----- required by this bound in `Bar`
@ -59,7 +59,7 @@ LL | enum MoreBadness<V: Trait> {
| ^^^^^^^
error[E0277]: the trait bound `i32: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:35:5
--> $DIR/on-structs-and-enums.rs:35:5
|
LL | struct Foo<T:Trait> {
| ----- required by this bound in `Foo`
@ -68,7 +68,7 @@ LL | Foo<i32>,
| ^^^^^^^^ the trait `Trait` is not implemented for `i32`
error[E0277]: the trait bound `u8: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:39:29
--> $DIR/on-structs-and-enums.rs:39:29
|
LL | enum Bar<T:Trait> {
| ----- required by this bound in `Bar`

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `Foo: main::a::Bar` is not satisfied
--> $DIR/trait-bounds-same-crate-name.rs:31:20
--> $DIR/same-crate-name.rs:31:20
|
LL | a::try_foo(foo);
| ^^^ the trait `main::a::Bar` is not implemented for `Foo`
@ -17,7 +17,7 @@ LL | impl Bar for Foo {}
= note: perhaps two different versions of crate `crate_a2` are being used?
error[E0277]: the trait bound `DoesNotImplementTrait: main::a::Bar` is not satisfied
--> $DIR/trait-bounds-same-crate-name.rs:38:20
--> $DIR/same-crate-name.rs:38:20
|
LL | a::try_foo(implements_no_traits);
| ^^^^^^^^^^^^^^^^^^^^ the trait `main::a::Bar` is not implemented for `DoesNotImplementTrait`
@ -28,7 +28,7 @@ LL | pub fn try_foo(x: impl Bar) {}
| --- required by this bound in `try_foo`
error[E0277]: the trait bound `ImplementsWrongTraitConditionally<isize>: main::a::Bar` is not satisfied
--> $DIR/trait-bounds-same-crate-name.rs:45:20
--> $DIR/same-crate-name.rs:45:20
|
LL | a::try_foo(other_variant_implements_mismatched_trait);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `main::a::Bar` is not implemented for `ImplementsWrongTraitConditionally<isize>`
@ -46,7 +46,7 @@ LL | impl Bar for ImplementsWrongTraitConditionally<isize> {}
= note: perhaps two different versions of crate `crate_a2` are being used?
error[E0277]: the trait bound `ImplementsTraitForUsize<isize>: main::a::Bar` is not satisfied
--> $DIR/trait-bounds-same-crate-name.rs:51:20
--> $DIR/same-crate-name.rs:51:20
|
LL | a::try_foo(other_variant_implements_correct_trait);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `main::a::Bar` is not implemented for `ImplementsTraitForUsize<isize>`

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/trait-bounds-sugar.rs:12:7
--> $DIR/sugar.rs:12:7
|
LL | a(x);
| ^ expected trait `Foo + Send`, found trait `Foo + Sync`

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `Struct: Trait<isize>` is not satisfied
--> $DIR/trait-coercion-generic-bad.rs:16:36
--> $DIR/coercion-generic-bad.rs:16:36
|
LL | let s: Box<dyn Trait<isize>> = Box::new(Struct { person: "Fred" });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<isize>` is not implemented for `Struct`

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