mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-13 04:26:48 +00:00
Addressed more points raised in review.
This commit is contained in:
parent
20096628c6
commit
783b713b5d
@ -51,13 +51,8 @@ struct PredicateSet<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> PredicateSet<'a, 'gcx, 'tcx> {
|
||||
fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> PredicateSet<'a, 'gcx, 'tcx> {
|
||||
PredicateSet { tcx: tcx, set: Default::default() }
|
||||
}
|
||||
|
||||
fn contains(&mut self, pred: &ty::Predicate<'tcx>) -> bool {
|
||||
// See the `insert` method for why we use `anonymize_predicate` here.
|
||||
self.set.contains(&anonymize_predicate(self.tcx, pred))
|
||||
fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self {
|
||||
Self { tcx: tcx, set: Default::default() }
|
||||
}
|
||||
|
||||
fn insert(&mut self, pred: &ty::Predicate<'tcx>) -> bool {
|
||||
@ -73,11 +68,6 @@ impl<'a, 'gcx, 'tcx> PredicateSet<'a, 'gcx, 'tcx> {
|
||||
// regions before we throw things into the underlying set.
|
||||
self.set.insert(anonymize_predicate(self.tcx, pred))
|
||||
}
|
||||
|
||||
fn remove(&mut self, pred: &ty::Predicate<'tcx>) -> bool {
|
||||
// See the `insert` method for why we use `anonymize_predicate` here.
|
||||
self.set.remove(&anonymize_predicate(self.tcx, pred))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx, T: AsRef<ty::Predicate<'tcx>>> Extend<T> for PredicateSet<'a, 'gcx, 'tcx> {
|
||||
@ -135,7 +125,7 @@ impl<'cx, 'gcx, 'tcx> Elaborator<'cx, 'gcx, 'tcx> {
|
||||
FilterToTraits::new(self)
|
||||
}
|
||||
|
||||
fn push(&mut self, predicate: &ty::Predicate<'tcx>) {
|
||||
fn elaborate(&mut self, predicate: &ty::Predicate<'tcx>) {
|
||||
let tcx = self.visited.tcx;
|
||||
match *predicate {
|
||||
ty::Predicate::Trait(ref data) => {
|
||||
@ -153,7 +143,7 @@ impl<'cx, 'gcx, 'tcx> Elaborator<'cx, 'gcx, 'tcx> {
|
||||
// This is necessary to prevent infinite recursion in some
|
||||
// cases. One common case is when people define
|
||||
// `trait Sized: Sized { }` rather than `trait Sized { }`.
|
||||
predicates.retain(|p| self.visited.insert(p));
|
||||
predicates.retain(|pred| self.visited.insert(pred));
|
||||
|
||||
self.stack.extend(predicates);
|
||||
}
|
||||
@ -251,15 +241,12 @@ impl<'cx, 'gcx, 'tcx> Iterator for Elaborator<'cx, 'gcx, 'tcx> {
|
||||
|
||||
fn next(&mut self) -> Option<ty::Predicate<'tcx>> {
|
||||
// Extract next item from top-most stack frame, if any.
|
||||
let next_predicate = match self.stack.pop() {
|
||||
Some(predicate) => predicate,
|
||||
None => {
|
||||
// No more stack frames. Done.
|
||||
return None;
|
||||
}
|
||||
};
|
||||
self.push(&next_predicate);
|
||||
return Some(next_predicate);
|
||||
if let Some(pred) = self.stack.pop() {
|
||||
self.elaborate(&pred);
|
||||
Some(pred)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,31 +281,29 @@ pub fn transitive_bounds<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>,
|
||||
/// Expansion is done via a DFS (depth-first search), and the `visited` field
|
||||
/// is used to avoid cycles.
|
||||
pub struct TraitAliasExpander<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
|
||||
tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
||||
stack: Vec<TraitAliasExpansionInfo<'tcx>>,
|
||||
/// The set of predicates visited from the root directly to the current point in the
|
||||
/// expansion tree (only containing trait aliases).
|
||||
visited: PredicateSet<'a, 'gcx, 'tcx>,
|
||||
}
|
||||
|
||||
/// Stores information about the expansion of a trait via a path of zero or more trait aliases.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TraitAliasExpansionInfo<'tcx> {
|
||||
pub items: SmallVec<[(ty::PolyTraitRef<'tcx>, Span); 4]>,
|
||||
pub path: SmallVec<[(ty::PolyTraitRef<'tcx>, Span); 4]>,
|
||||
}
|
||||
|
||||
impl<'tcx> TraitAliasExpansionInfo<'tcx> {
|
||||
fn new(trait_ref: ty::PolyTraitRef<'tcx>, span: Span) -> Self {
|
||||
Self {
|
||||
items: smallvec![(trait_ref, span)]
|
||||
path: smallvec![(trait_ref, span)]
|
||||
}
|
||||
}
|
||||
|
||||
fn push(&self, trait_ref: ty::PolyTraitRef<'tcx>, span: Span) -> Self {
|
||||
let mut items = self.items.clone();
|
||||
items.push((trait_ref, span));
|
||||
fn clone_and_push(&self, trait_ref: ty::PolyTraitRef<'tcx>, span: Span) -> Self {
|
||||
let mut path = self.path.clone();
|
||||
path.push((trait_ref, span));
|
||||
|
||||
Self {
|
||||
items
|
||||
path
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,11 +312,11 @@ impl<'tcx> TraitAliasExpansionInfo<'tcx> {
|
||||
}
|
||||
|
||||
pub fn top(&self) -> &(ty::PolyTraitRef<'tcx>, Span) {
|
||||
self.items.last().unwrap()
|
||||
self.path.last().unwrap()
|
||||
}
|
||||
|
||||
pub fn bottom(&self) -> &(ty::PolyTraitRef<'tcx>, Span) {
|
||||
self.items.first().unwrap()
|
||||
self.path.first().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
@ -340,21 +325,25 @@ impl<'tcx> TraitAliasExpansionInfo<'tcx> {
|
||||
pub trait TraitAliasExpansionInfoDignosticBuilder {
|
||||
fn label_with_exp_info<'tcx>(&mut self,
|
||||
info: &TraitAliasExpansionInfo<'tcx>,
|
||||
top_label: &str
|
||||
top_label: &str,
|
||||
use_desc: &str
|
||||
) -> &mut Self;
|
||||
}
|
||||
|
||||
impl<'a> TraitAliasExpansionInfoDignosticBuilder for DiagnosticBuilder<'a> {
|
||||
fn label_with_exp_info<'tcx>(&mut self,
|
||||
info: &TraitAliasExpansionInfo<'tcx>,
|
||||
top_label: &str
|
||||
top_label: &str,
|
||||
use_desc: &str
|
||||
) -> &mut Self {
|
||||
self.span_label(info.top().1, top_label);
|
||||
if info.items.len() > 1 {
|
||||
for (_, sp) in info.items[1..(info.items.len() - 1)].iter().rev() {
|
||||
self.span_label(*sp, "referenced here");
|
||||
if info.path.len() > 1 {
|
||||
for (_, sp) in info.path.iter().rev().skip(1).take(info.path.len() - 2) {
|
||||
self.span_label(*sp, format!("referenced here ({})", use_desc));
|
||||
}
|
||||
}
|
||||
self.span_label(info.bottom().1,
|
||||
format!("trait alias used in trait object type ({})", use_desc));
|
||||
self
|
||||
}
|
||||
}
|
||||
@ -367,7 +356,7 @@ pub fn expand_trait_aliases<'cx, 'gcx, 'tcx>(
|
||||
.into_iter()
|
||||
.map(|(trait_ref, span)| TraitAliasExpansionInfo::new(trait_ref, span))
|
||||
.collect();
|
||||
TraitAliasExpander { stack: items, visited: PredicateSet::new(tcx) }
|
||||
TraitAliasExpander { tcx, stack: items }
|
||||
}
|
||||
|
||||
impl<'cx, 'gcx, 'tcx> TraitAliasExpander<'cx, 'gcx, 'tcx> {
|
||||
@ -376,23 +365,25 @@ impl<'cx, 'gcx, 'tcx> TraitAliasExpander<'cx, 'gcx, 'tcx> {
|
||||
/// Otherwise, immediately returns `true` if `item` is a regular trait, or `false` if it is a
|
||||
/// trait alias.
|
||||
/// The return value indicates whether `item` should be yielded to the user.
|
||||
fn push(&mut self, item: &TraitAliasExpansionInfo<'tcx>) -> bool {
|
||||
let tcx = self.visited.tcx;
|
||||
fn expand(&mut self, item: &TraitAliasExpansionInfo<'tcx>) -> bool {
|
||||
let tcx = self.tcx;
|
||||
let trait_ref = item.trait_ref();
|
||||
let pred = trait_ref.to_predicate();
|
||||
|
||||
debug!("expand_trait_aliases: trait_ref={:?}", trait_ref);
|
||||
|
||||
// Don't recurse unless this bound is a trait alias and isn't currently in the DFS stack of
|
||||
// already-visited predicates.
|
||||
// Don't recurse if this bound is not a trait alias.
|
||||
let is_alias = tcx.is_trait_alias(trait_ref.def_id());
|
||||
if !is_alias || self.visited.contains(&pred) {
|
||||
return !is_alias;
|
||||
if !is_alias {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Remove the current predicate from the stack of already-visited ones, since we're doing
|
||||
// a DFS.
|
||||
self.visited.remove(&pred);
|
||||
// Don't recurse if this trait alias is already on the stack for the DFS search.
|
||||
let anon_pred = anonymize_predicate(tcx, &pred);
|
||||
if item.path.iter().rev().skip(1)
|
||||
.any(|(tr, _)| anonymize_predicate(tcx, &tr.to_predicate()) == anon_pred) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get components of trait alias.
|
||||
let predicates = tcx.super_predicates_of(trait_ref.def_id());
|
||||
@ -403,16 +394,13 @@ impl<'cx, 'gcx, 'tcx> TraitAliasExpander<'cx, 'gcx, 'tcx> {
|
||||
.filter_map(|(pred, span)| {
|
||||
pred.subst_supertrait(tcx, &trait_ref)
|
||||
.to_opt_poly_trait_ref()
|
||||
.map(|trait_ref| item.push(trait_ref, *span))
|
||||
.map(|trait_ref| item.clone_and_push(trait_ref, *span))
|
||||
})
|
||||
.collect();
|
||||
debug!("expand_trait_aliases: items={:?}", items);
|
||||
|
||||
self.stack.extend(items);
|
||||
|
||||
// Record predicate into set of already-visited.
|
||||
self.visited.insert(&pred);
|
||||
|
||||
false
|
||||
}
|
||||
}
|
||||
@ -426,7 +414,7 @@ impl<'cx, 'gcx, 'tcx> Iterator for TraitAliasExpander<'cx, 'gcx, 'tcx> {
|
||||
|
||||
fn next(&mut self) -> Option<TraitAliasExpansionInfo<'tcx>> {
|
||||
while let Some(item) = self.stack.pop() {
|
||||
if self.push(&item) {
|
||||
if self.expand(&item) {
|
||||
return Some(item);
|
||||
}
|
||||
}
|
||||
|
@ -648,14 +648,14 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
|
||||
// careful!
|
||||
if default_needs_object_self(param) {
|
||||
struct_span_err!(tcx.sess, span, E0393,
|
||||
"the type parameter `{}` must be explicitly \
|
||||
specified",
|
||||
param.name)
|
||||
.span_label(span,
|
||||
format!("missing reference to `{}`", param.name))
|
||||
.note(&format!("because of the default `Self` reference, \
|
||||
type parameters must be specified on object \
|
||||
types"))
|
||||
"the type parameter `{}` must be explicitly specified",
|
||||
param.name
|
||||
)
|
||||
.span_label(span, format!(
|
||||
"missing reference to `{}`", param.name))
|
||||
.note(&format!(
|
||||
"because of the default `Self` reference, type parameters \
|
||||
must be specified on object types"))
|
||||
.emit();
|
||||
tcx.types.err.into()
|
||||
} else {
|
||||
@ -987,7 +987,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
|
||||
);
|
||||
potential_assoc_types.extend(cur_potential_assoc_types.into_iter().flatten());
|
||||
(trait_ref, trait_bound.span)
|
||||
}).collect();
|
||||
})
|
||||
.collect();
|
||||
|
||||
// Expand trait aliases recursively and check that only one regular (non-auto) trait
|
||||
// is used and no 'maybe' bounds are used.
|
||||
@ -995,12 +996,15 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
|
||||
let (mut auto_traits, regular_traits): (Vec<_>, Vec<_>) =
|
||||
expanded_traits.partition(|i| tcx.trait_is_auto(i.trait_ref().def_id()));
|
||||
if regular_traits.len() > 1 {
|
||||
let extra_trait = ®ular_traits[1];
|
||||
struct_span_err!(tcx.sess, extra_trait.bottom().1, E0225,
|
||||
let first_trait = ®ular_traits[0];
|
||||
let additional_trait = ®ular_traits[1];
|
||||
struct_span_err!(tcx.sess, additional_trait.bottom().1, E0225,
|
||||
"only auto traits can be used as additional traits in a trait object"
|
||||
)
|
||||
.label_with_exp_info(extra_trait, "additional non-auto trait")
|
||||
.span_label(regular_traits[0].top().1, "first non-auto trait")
|
||||
.label_with_exp_info(additional_trait, "additional non-auto trait",
|
||||
"additional use")
|
||||
.label_with_exp_info(first_trait, "first non-auto trait",
|
||||
"first use")
|
||||
.emit();
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,12 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
--> $DIR/bad-sized.rs:4:24
|
||||
|
|
||||
LL | let x: Vec<Trait + Sized> = Vec::new();
|
||||
| ----- ^^^^^ additional non-auto trait
|
||||
| |
|
||||
| ----- ^^^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
|
||||
--> $DIR/bad-sized.rs:4:12
|
||||
|
@ -1,21 +1,27 @@
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/E0225.rs:6:32
|
||||
--> $DIR/E0225.rs:6:36
|
||||
|
|
||||
LL | let _: Box<std::io::Read + std::io::Write>;
|
||||
| ------------- ^^^^^^^^^^^^^^ additional non-auto trait
|
||||
| |
|
||||
| first non-auto trait
|
||||
LL | let _: Box<dyn std::io::Read + std::io::Write>;
|
||||
| ------------- ^^^^^^^^^^^^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/E0225.rs:8:16
|
||||
--> $DIR/E0225.rs:8:20
|
||||
|
|
||||
LL | trait Foo = std::io::Read + std::io::Write;
|
||||
| ------------- -------------- additional non-auto trait
|
||||
| |
|
||||
| first non-auto trait
|
||||
...
|
||||
LL | let _: Box<Foo>;
|
||||
| ^^^
|
||||
LL | let _: Box<dyn Foo>;
|
||||
| ^^^
|
||||
| |
|
||||
| trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -18,10 +18,16 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
--> $DIR/issue-22560.rs:6:13
|
||||
|
|
||||
LL | type Test = Add +
|
||||
| --- first non-auto trait
|
||||
| ---
|
||||
| |
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
...
|
||||
LL | Sub;
|
||||
| ^^^ additional non-auto trait
|
||||
| ^^^
|
||||
| |
|
||||
| additional non-auto trait
|
||||
| trait alias used in trait object type (additional use)
|
||||
|
||||
error[E0191]: the value of the associated types `Output` (from the trait `std::ops::Add`), `Output` (from the trait `std::ops::Sub`) must be specified
|
||||
--> $DIR/issue-22560.rs:3:13
|
||||
|
@ -2,9 +2,12 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
--> $DIR/issue-32963.rs:8:25
|
||||
|
|
||||
LL | size_of_copy::<Misc+Copy>();
|
||||
| ---- ^^^^ additional non-auto trait
|
||||
| |
|
||||
| ---- ^^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0277]: the trait bound `dyn Misc: std::marker::Copy` is not satisfied
|
||||
--> $DIR/issue-32963.rs:8:5
|
||||
|
@ -8,7 +8,9 @@ LL | trait _0 = Obj;
|
||||
| first non-auto trait
|
||||
...
|
||||
LL | type _T00 = dyn _0 + _0;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:19:22
|
||||
@ -18,9 +20,13 @@ LL | trait _0 = Obj;
|
||||
| |
|
||||
| additional non-auto trait
|
||||
| first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | type _T01 = dyn _1 + _0;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:22:22
|
||||
@ -31,10 +37,15 @@ LL | trait _0 = Obj;
|
||||
| additional non-auto trait
|
||||
| first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here
|
||||
| --
|
||||
| |
|
||||
| referenced here (additional use)
|
||||
| referenced here (first use)
|
||||
...
|
||||
LL | type _T02 = dyn _1 + _1;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:25:23
|
||||
@ -42,21 +53,28 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
LL | trait _0 = Obj;
|
||||
| --- additional non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | type _T03 = dyn Obj + _1;
|
||||
| --- ^^
|
||||
| --- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:28:22
|
||||
|
|
||||
LL | trait _0 = Obj;
|
||||
| --- first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | type _T04 = dyn _1 + Obj;
|
||||
| ^^^ additional non-auto trait
|
||||
| -- ^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:37:17
|
||||
@ -67,13 +85,18 @@ LL | trait _0 = Obj;
|
||||
| additional non-auto trait
|
||||
| first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | trait _2 = _0 + _1;
|
||||
| -- referenced here
|
||||
| -- -- referenced here (additional use)
|
||||
| |
|
||||
| referenced here (first use)
|
||||
...
|
||||
LL | type _T10 = dyn _2 + _3;
|
||||
| ^^
|
||||
| |
|
||||
| trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:40:22
|
||||
@ -82,12 +105,14 @@ LL | trait _0 = Obj;
|
||||
| --- additional non-auto trait
|
||||
...
|
||||
LL | trait _2 = _0 + _1;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
LL | trait _3 = Obj;
|
||||
| --- first non-auto trait
|
||||
...
|
||||
LL | type _T11 = dyn _3 + _2;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:43:23
|
||||
@ -96,12 +121,13 @@ LL | trait _0 = Obj;
|
||||
| --- additional non-auto trait
|
||||
...
|
||||
LL | trait _2 = _0 + _1;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | type _T12 = dyn Obj + _2;
|
||||
| --- ^^
|
||||
| --- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:46:17
|
||||
@ -112,25 +138,34 @@ LL | trait _0 = Obj;
|
||||
| additional non-auto trait
|
||||
| first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | trait _2 = _0 + _1;
|
||||
| -- referenced here
|
||||
| -- -- referenced here (additional use)
|
||||
| |
|
||||
| referenced here (first use)
|
||||
...
|
||||
LL | type _T13 = dyn _2 + Obj;
|
||||
| ^^
|
||||
| |
|
||||
| trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:49:22
|
||||
|
|
||||
LL | trait _0 = Obj;
|
||||
| --- first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | trait _3 = Obj;
|
||||
| --- additional non-auto trait
|
||||
...
|
||||
LL | type _T14 = dyn _1 + _3;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:52:22
|
||||
@ -138,27 +173,33 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
LL | trait _0 = Obj;
|
||||
| --- additional non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | trait _3 = Obj;
|
||||
| --- first non-auto trait
|
||||
...
|
||||
LL | type _T15 = dyn _3 + _1;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:55:22
|
||||
|
|
||||
LL | trait _0 = Obj;
|
||||
| --- first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | trait _3 = Obj;
|
||||
| --- additional non-auto trait
|
||||
LL | trait _4 = _3;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | type _T16 = dyn _1 + _4;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:58:22
|
||||
@ -166,13 +207,17 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
LL | trait _0 = Obj;
|
||||
| --- additional non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | trait _3 = Obj;
|
||||
| --- first non-auto trait
|
||||
LL | trait _4 = _3;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | type _T17 = dyn _4 + _1;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:65:22
|
||||
@ -184,7 +229,9 @@ LL | trait _5 = Obj + Send;
|
||||
| first non-auto trait
|
||||
LL |
|
||||
LL | type _T20 = dyn _5 + _5;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:68:23
|
||||
@ -193,9 +240,10 @@ LL | trait _5 = Obj + Send;
|
||||
| --- additional non-auto trait
|
||||
...
|
||||
LL | type _T21 = dyn Obj + _5;
|
||||
| --- ^^
|
||||
| --- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:71:22
|
||||
@ -204,7 +252,11 @@ LL | trait _5 = Obj + Send;
|
||||
| --- first non-auto trait
|
||||
...
|
||||
LL | type _T22 = dyn _5 + Obj;
|
||||
| ^^^ additional non-auto trait
|
||||
| -- ^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:74:36
|
||||
@ -213,7 +265,11 @@ LL | trait _5 = Obj + Send;
|
||||
| --- first non-auto trait
|
||||
...
|
||||
LL | type _T23 = dyn _5 + Send + Sync + Obj;
|
||||
| ^^^ additional non-auto trait
|
||||
| -- ^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:81:17
|
||||
@ -225,10 +281,15 @@ LL | trait _5 = Obj + Send;
|
||||
| first non-auto trait
|
||||
...
|
||||
LL | trait _6 = _5 + _5; // ==> Obj + Send + Obj + Send
|
||||
| -- referenced here
|
||||
| -- -- referenced here (additional use)
|
||||
| |
|
||||
| referenced here (first use)
|
||||
LL |
|
||||
LL | type _T30 = dyn _6;
|
||||
| ^^
|
||||
| |
|
||||
| trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:84:17
|
||||
@ -240,10 +301,15 @@ LL | trait _5 = Obj + Send;
|
||||
| first non-auto trait
|
||||
...
|
||||
LL | trait _6 = _5 + _5; // ==> Obj + Send + Obj + Send
|
||||
| -- referenced here
|
||||
| -- -- referenced here (additional use)
|
||||
| |
|
||||
| referenced here (first use)
|
||||
...
|
||||
LL | type _T31 = dyn _6 + Send;
|
||||
| ^^
|
||||
| |
|
||||
| trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:87:24
|
||||
@ -255,10 +321,15 @@ LL | trait _5 = Obj + Send;
|
||||
| first non-auto trait
|
||||
...
|
||||
LL | trait _6 = _5 + _5; // ==> Obj + Send + Obj + Send
|
||||
| -- referenced here
|
||||
| -- -- referenced here (additional use)
|
||||
| |
|
||||
| referenced here (first use)
|
||||
...
|
||||
LL | type _T32 = dyn Send + _6;
|
||||
| ^^
|
||||
| |
|
||||
| trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:95:22
|
||||
@ -266,8 +337,17 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
LL | trait _5 = Obj + Send;
|
||||
| --- first non-auto trait
|
||||
...
|
||||
LL | trait _7 = _5 + Sync;
|
||||
| -- referenced here (first use)
|
||||
LL | trait _8 = Unpin + _7;
|
||||
| -- referenced here (first use)
|
||||
LL |
|
||||
LL | type _T40 = dyn _8 + Obj;
|
||||
| ^^^ additional non-auto trait
|
||||
| -- ^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:98:23
|
||||
@ -276,14 +356,15 @@ LL | trait _5 = Obj + Send;
|
||||
| --- additional non-auto trait
|
||||
...
|
||||
LL | trait _7 = _5 + Sync;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
LL | trait _8 = Unpin + _7;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | type _T41 = dyn Obj + _8;
|
||||
| --- ^^
|
||||
| --- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:101:22
|
||||
@ -291,47 +372,62 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
LL | trait _3 = Obj;
|
||||
| --- additional non-auto trait
|
||||
LL | trait _4 = _3;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | trait _5 = Obj + Send;
|
||||
| --- first non-auto trait
|
||||
...
|
||||
LL | trait _7 = _5 + Sync;
|
||||
| -- referenced here (first use)
|
||||
LL | trait _8 = Unpin + _7;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | type _T42 = dyn _8 + _4;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:104:22
|
||||
|
|
||||
LL | trait _3 = Obj;
|
||||
| --- first non-auto trait
|
||||
LL | trait _4 = _3;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | trait _5 = Obj + Send;
|
||||
| --- additional non-auto trait
|
||||
...
|
||||
LL | trait _7 = _5 + Sync;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
LL | trait _8 = Unpin + _7;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | type _T43 = dyn _4 + _8;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:107:36
|
||||
|
|
||||
LL | trait _3 = Obj;
|
||||
| --- first non-auto trait
|
||||
LL | trait _4 = _3;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | trait _5 = Obj + Send;
|
||||
| --- additional non-auto trait
|
||||
...
|
||||
LL | trait _7 = _5 + Sync;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
LL | trait _8 = Unpin + _7;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | type _T44 = dyn _4 + Send + Sync + _8;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:117:18
|
||||
@ -341,7 +437,9 @@ LL | trait _9 = for<'a> ObjL<'a>;
|
||||
LL | trait _10 = for<'b> ObjL<'b>;
|
||||
| ---------------- additional non-auto trait
|
||||
LL | type _T50 = _9 + _10;
|
||||
| ^^^
|
||||
| -- ^^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-duplicates.rs:123:19
|
||||
@ -351,7 +449,9 @@ LL | trait _11 = ObjT<for<'a> fn(&'a u8)>;
|
||||
LL | trait _12 = ObjT<for<'b> fn(&'b u8)>;
|
||||
| ------------------------ additional non-auto trait
|
||||
LL | type _T60 = _11 + _12;
|
||||
| ^^^
|
||||
| --- ^^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error: aborting due to 27 previous errors
|
||||
|
||||
|
@ -5,7 +5,11 @@ LL | trait _0 = ObjA;
|
||||
| ---- first non-auto trait
|
||||
...
|
||||
LL | type _T00 = dyn _0 + ObjB;
|
||||
| ^^^^ additional non-auto trait
|
||||
| -- ^^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:19:24
|
||||
@ -14,9 +18,10 @@ LL | trait _0 = ObjA;
|
||||
| ---- additional non-auto trait
|
||||
...
|
||||
LL | type _T01 = dyn ObjB + _0;
|
||||
| ---- ^^
|
||||
| ---- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:22:24
|
||||
@ -24,21 +29,28 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
LL | trait _0 = ObjA;
|
||||
| ---- additional non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | type _T02 = dyn ObjB + _1;
|
||||
| ---- ^^
|
||||
| ---- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:25:22
|
||||
|
|
||||
LL | trait _0 = ObjA;
|
||||
| ---- first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | type _T03 = dyn _1 + ObjB;
|
||||
| ^^^^ additional non-auto trait
|
||||
| -- ^^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:34:22
|
||||
@ -49,10 +61,12 @@ LL | trait _2 = ObjB;
|
||||
| additional non-auto trait
|
||||
| first non-auto trait
|
||||
LL | trait _3 = _2;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | type _T10 = dyn _2 + _3;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:37:22
|
||||
@ -62,9 +76,13 @@ LL | trait _2 = ObjB;
|
||||
| |
|
||||
| additional non-auto trait
|
||||
| first non-auto trait
|
||||
LL | trait _3 = _2;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | type _T11 = dyn _3 + _2;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:40:22
|
||||
@ -75,12 +93,14 @@ LL | trait _2 = ObjB;
|
||||
| additional non-auto trait
|
||||
| first non-auto trait
|
||||
LL | trait _3 = _2;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
LL | trait _4 = _3;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | type _T12 = dyn _2 + _4;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:43:22
|
||||
@ -90,9 +110,15 @@ LL | trait _2 = ObjB;
|
||||
| |
|
||||
| additional non-auto trait
|
||||
| first non-auto trait
|
||||
LL | trait _3 = _2;
|
||||
| -- referenced here (first use)
|
||||
LL | trait _4 = _3;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | type _T13 = dyn _4 + _2;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:50:22
|
||||
@ -100,25 +126,31 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
LL | trait _0 = ObjA;
|
||||
| ---- additional non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- first non-auto trait
|
||||
LL |
|
||||
LL | type _T20 = dyn _5 + _1;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:53:22
|
||||
|
|
||||
LL | trait _0 = ObjA;
|
||||
| ---- first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- additional non-auto trait
|
||||
...
|
||||
LL | type _T21 = dyn _1 + _5;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:56:22
|
||||
@ -127,7 +159,11 @@ LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- first non-auto trait
|
||||
...
|
||||
LL | type _T22 = dyn _5 + ObjA;
|
||||
| ^^^^ additional non-auto trait
|
||||
| -- ^^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:59:24
|
||||
@ -136,9 +172,10 @@ LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- additional non-auto trait
|
||||
...
|
||||
LL | type _T23 = dyn ObjA + _5;
|
||||
| ---- ^^
|
||||
| ---- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:62:29
|
||||
@ -146,25 +183,31 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
LL | trait _0 = ObjA;
|
||||
| ---- additional non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- first non-auto trait
|
||||
...
|
||||
LL | type _T24 = dyn Send + _5 + _1 + Sync;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:65:29
|
||||
|
|
||||
LL | trait _0 = ObjA;
|
||||
| ---- first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- additional non-auto trait
|
||||
...
|
||||
LL | type _T25 = dyn _1 + Sync + _5 + Send;
|
||||
| ^^
|
||||
| -- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:68:36
|
||||
@ -173,7 +216,11 @@ LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- first non-auto trait
|
||||
...
|
||||
LL | type _T26 = dyn Sync + Send + _5 + ObjA;
|
||||
| ^^^^ additional non-auto trait
|
||||
| -- ^^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:71:38
|
||||
@ -182,111 +229,172 @@ LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- additional non-auto trait
|
||||
...
|
||||
LL | type _T27 = dyn Send + Sync + ObjA + _5;
|
||||
| ---- ^^
|
||||
| ---- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:80:17
|
||||
|
|
||||
LL | trait _0 = ObjA;
|
||||
| ---- first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- additional non-auto trait
|
||||
...
|
||||
LL | trait _6 = _1 + _5;
|
||||
| -- referenced here
|
||||
| -- -- referenced here (additional use)
|
||||
| |
|
||||
| referenced here (first use)
|
||||
...
|
||||
LL | type _T30 = dyn _6;
|
||||
| ^^
|
||||
| |
|
||||
| trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:83:17
|
||||
|
|
||||
LL | trait _0 = ObjA;
|
||||
| ---- first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- additional non-auto trait
|
||||
...
|
||||
LL | trait _6 = _1 + _5;
|
||||
| -- referenced here
|
||||
| -- -- referenced here (additional use)
|
||||
| |
|
||||
| referenced here (first use)
|
||||
...
|
||||
LL | type _T31 = dyn _6 + Send;
|
||||
| ^^
|
||||
| |
|
||||
| trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:86:24
|
||||
|
|
||||
LL | trait _0 = ObjA;
|
||||
| ---- first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- additional non-auto trait
|
||||
...
|
||||
LL | trait _6 = _1 + _5;
|
||||
| -- referenced here
|
||||
| -- -- referenced here (additional use)
|
||||
| |
|
||||
| referenced here (first use)
|
||||
...
|
||||
LL | type _T32 = dyn Send + _6;
|
||||
| ^^
|
||||
| |
|
||||
| trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:89:17
|
||||
|
|
||||
LL | trait _0 = ObjA;
|
||||
| ---- first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- additional non-auto trait
|
||||
...
|
||||
LL | trait _6 = _1 + _5;
|
||||
| -- referenced here
|
||||
| -- -- referenced here (additional use)
|
||||
| |
|
||||
| referenced here (first use)
|
||||
LL | trait _7 = _6;
|
||||
| -- referenced here
|
||||
| --
|
||||
| |
|
||||
| referenced here (additional use)
|
||||
| referenced here (first use)
|
||||
LL | trait _8 = _7;
|
||||
| -- referenced here
|
||||
| --
|
||||
| |
|
||||
| referenced here (additional use)
|
||||
| referenced here (first use)
|
||||
...
|
||||
LL | type _T33 = dyn _8;
|
||||
| ^^
|
||||
| |
|
||||
| trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:92:17
|
||||
|
|
||||
LL | trait _0 = ObjA;
|
||||
| ---- first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- additional non-auto trait
|
||||
...
|
||||
LL | trait _6 = _1 + _5;
|
||||
| -- referenced here
|
||||
| -- -- referenced here (additional use)
|
||||
| |
|
||||
| referenced here (first use)
|
||||
LL | trait _7 = _6;
|
||||
| -- referenced here
|
||||
| --
|
||||
| |
|
||||
| referenced here (additional use)
|
||||
| referenced here (first use)
|
||||
LL | trait _8 = _7;
|
||||
| -- referenced here
|
||||
| --
|
||||
| |
|
||||
| referenced here (additional use)
|
||||
| referenced here (first use)
|
||||
...
|
||||
LL | type _T34 = dyn _8 + Send;
|
||||
| ^^
|
||||
| |
|
||||
| trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:95:24
|
||||
|
|
||||
LL | trait _0 = ObjA;
|
||||
| ---- first non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- additional non-auto trait
|
||||
...
|
||||
LL | trait _6 = _1 + _5;
|
||||
| -- referenced here
|
||||
| -- -- referenced here (additional use)
|
||||
| |
|
||||
| referenced here (first use)
|
||||
LL | trait _7 = _6;
|
||||
| -- referenced here
|
||||
| --
|
||||
| |
|
||||
| referenced here (additional use)
|
||||
| referenced here (first use)
|
||||
LL | trait _8 = _7;
|
||||
| -- referenced here
|
||||
| --
|
||||
| |
|
||||
| referenced here (additional use)
|
||||
| referenced here (first use)
|
||||
...
|
||||
LL | type _T35 = dyn Send + _8;
|
||||
| ^^
|
||||
| |
|
||||
| trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:103:23
|
||||
@ -294,8 +402,17 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- first non-auto trait
|
||||
...
|
||||
LL | trait _9 = _5 + Sync;
|
||||
| -- referenced here (first use)
|
||||
LL | trait _10 = Unpin + _9;
|
||||
| -- referenced here (first use)
|
||||
LL |
|
||||
LL | type _T40 = dyn _10 + ObjA;
|
||||
| ^^^^ additional non-auto trait
|
||||
| --- ^^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:106:24
|
||||
@ -304,14 +421,15 @@ LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- additional non-auto trait
|
||||
...
|
||||
LL | trait _9 = _5 + Sync;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
LL | trait _10 = Unpin + _9;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | type _T41 = dyn ObjA + _10;
|
||||
| ---- ^^^
|
||||
| ---- ^^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:109:23
|
||||
@ -319,13 +437,20 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
LL | trait _0 = ObjA;
|
||||
| ---- additional non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- first non-auto trait
|
||||
...
|
||||
LL | trait _9 = _5 + Sync;
|
||||
| -- referenced here (first use)
|
||||
LL | trait _10 = Unpin + _9;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | type _T42 = dyn _10 + _1;
|
||||
| ^^
|
||||
| --- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:112:37
|
||||
@ -333,8 +458,17 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- first non-auto trait
|
||||
...
|
||||
LL | trait _9 = _5 + Sync;
|
||||
| -- referenced here (first use)
|
||||
LL | trait _10 = Unpin + _9;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | type _T43 = dyn Send + _10 + Sync + ObjA;
|
||||
| ^^^^ additional non-auto trait
|
||||
| --- ^^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:115:24
|
||||
@ -343,14 +477,15 @@ LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- additional non-auto trait
|
||||
...
|
||||
LL | trait _9 = _5 + Sync;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
LL | trait _10 = Unpin + _9;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | type _T44 = dyn ObjA + _10 + Send + Sync;
|
||||
| ---- ^^^
|
||||
| ---- ^^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/trait-alias-no-extra-traits.rs:118:37
|
||||
@ -358,13 +493,20 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
LL | trait _0 = ObjA;
|
||||
| ---- additional non-auto trait
|
||||
LL | trait _1 = _0;
|
||||
| -- referenced here
|
||||
| -- referenced here (additional use)
|
||||
...
|
||||
LL | trait _5 = Sync + ObjB + Send;
|
||||
| ---- first non-auto trait
|
||||
...
|
||||
LL | trait _9 = _5 + Sync;
|
||||
| -- referenced here (first use)
|
||||
LL | trait _10 = Unpin + _9;
|
||||
| -- referenced here (first use)
|
||||
...
|
||||
LL | type _T45 = dyn Sync + Send + _10 + _1;
|
||||
| ^^
|
||||
| --- ^^ trait alias used in trait object type (additional use)
|
||||
| |
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error: aborting due to 28 previous errors
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// run-pass
|
||||
|
||||
// This test hecks that trait objects involving trait aliases are well-formed.
|
||||
// This test checks that trait objects involving trait aliases are well-formed.
|
||||
|
||||
#![feature(trait_alias)]
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
error[E0224]: at least one non-builtin trait is required for an object type
|
||||
--> $DIR/trait-alias-maybe-bound.rs:12:12
|
||||
--> $DIR/trait-alias-only-maybe-bound.rs:13:12
|
||||
|
|
||||
LL | type _T0 = dyn _1;
|
||||
| ^^^^^^
|
||||
|
||||
error[E0224]: at least one non-builtin trait is required for an object type
|
||||
--> $DIR/trait-alias-maybe-bound.rs:24:12
|
||||
--> $DIR/trait-alias-only-maybe-bound.rs:19:12
|
||||
|
|
||||
LL | type _T3 = dyn _2;
|
||||
LL | type _T1 = dyn _2;
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -2,41 +2,56 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
|
||||
--> $DIR/wf-trait-object-no-duplicates.rs:8:21
|
||||
|
|
||||
LL | type _0 = dyn Obj + Obj;
|
||||
| --- ^^^ additional non-auto trait
|
||||
| |
|
||||
| --- ^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/wf-trait-object-no-duplicates.rs:13:28
|
||||
|
|
||||
LL | type _1 = dyn Send + Obj + Obj;
|
||||
| --- ^^^ additional non-auto trait
|
||||
| |
|
||||
| --- ^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/wf-trait-object-no-duplicates.rs:16:28
|
||||
|
|
||||
LL | type _2 = dyn Obj + Send + Obj;
|
||||
| --- ^^^ additional non-auto trait
|
||||
| |
|
||||
| --- ^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/wf-trait-object-no-duplicates.rs:26:34
|
||||
|
|
||||
LL | type _4 = dyn for<'a> ObjL<'a> + for<'b> ObjL<'b>;
|
||||
| ---------------- ^^^^^^^^^^^^^^^^ additional non-auto trait
|
||||
| |
|
||||
| ---------------- ^^^^^^^^^^^^^^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error[E0225]: only auto traits can be used as additional traits in a trait object
|
||||
--> $DIR/wf-trait-object-no-duplicates.rs:30:42
|
||||
|
|
||||
LL | type _5 = dyn ObjT<for<'a> fn(&'a u8)> + ObjT<for<'b> fn(&'b u8)>;
|
||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^ additional non-auto trait
|
||||
| |
|
||||
| ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| | |
|
||||
| | additional non-auto trait
|
||||
| | trait alias used in trait object type (additional use)
|
||||
| first non-auto trait
|
||||
| trait alias used in trait object type (first use)
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0224]: at least one non-builtin trait is required for an object type
|
||||
--> $DIR/wf-trait-object-maybe-bound.rs:4:11
|
||||
--> $DIR/wf-trait-object-only-maybe-bound.rs:3:11
|
||||
|
|
||||
LL | type _0 = dyn ?Sized;
|
||||
| ^^^^^^^^^^
|
||||
|
Loading…
Reference in New Issue
Block a user