Expand description
Dumps the list of ty::Clauses as computed by the clauses_of query.
See AttributeKind::RustcDumpClauses for the internal representation of this attribute.
§Example
ⓘ
//@ dont-require-annotations: ERROR
//@ compile-flags: --crate-type lib -Z ui-testing=no
//@ normalize-stderr: "DefId\((\d+):(\d+)" -> "DefId(..:.."
//@ normalize-stderr: "\[[A-Fa-f0-9]{4}\]" -> "[....]"
#![feature(negative_impls)]
#![feature(rustc_attrs)]
#[rustc_dump_clauses]
fn function<T: Send>(_t: T) {}
#[rustc_dump_clauses]
trait Trait: Sync {
#[rustc_dump_clauses]
type Assoc;
}
#[rustc_dump_clauses]
struct X<'a, T: ?Sized, I: Iterator> {
x: &'a T,
y: &'a I::Item,
}
#[rustc_dump_clauses]
impl<T: ?Sized, I> !Sync for X<'_, T, I> {}produces:
error: rustc_dump_clauses
--> $DIR/rustc_dump_clauses.rs:10:1
|
10 | fn function<T: Send>(_t: T) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: Binder { value: TraitClause(<T as std::marker::Sized>, polarity:Positive), bound_vars: [] }
= note: Binder { value: TraitClause(<T as std::marker::Send>, polarity:Positive), bound_vars: [] }
error: rustc_dump_clauses
--> $DIR/rustc_dump_clauses.rs:13:1
|
13 | trait Trait: Sync {
| ^^^^^^^^^^^^^^^^^
|
= note: Binder { value: TraitClause(<Self as std::marker::MetaSized>, polarity:Positive), bound_vars: [] }
= note: Binder { value: TraitClause(<Self as std::marker::Sync>, polarity:Positive), bound_vars: [] }
= note: Binder { value: TraitClause(<Self as Trait>, polarity:Positive), bound_vars: [] }
error: rustc_dump_clauses
--> $DIR/rustc_dump_clauses.rs:19:1
|
19 | struct X<'a, T: ?Sized, I: Iterator> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: Binder { value: TraitClause(<T as std::marker::MetaSized>, polarity:Positive), bound_vars: [] }
= note: Binder { value: TraitClause(<I as std::marker::Sized>, polarity:Positive), bound_vars: [] }
= note: Binder { value: TraitClause(<I as std::iter::Iterator>, polarity:Positive), bound_vars: [] }
= note: Binder { value: OutlivesClause(T/#1, 'a/#0), bound_vars: [] }
= note: Binder { value: OutlivesClause(Alias(No, Alias { kind: Projection { def_id: DefId(..:.. ~ core[....]::iter::traits::iterator::Iterator::Item) }, args: [I/#2], .. }), 'a/#0), bound_vars: [] }
error: rustc_dump_clauses
--> $DIR/rustc_dump_clauses.rs:25:1
|
25 | impl<T: ?Sized, I> !Sync for X<'_, T, I> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: Binder { value: TraitClause(<T as std::marker::MetaSized>, polarity:Positive), bound_vars: [] }
= note: Binder { value: TraitClause(<I as std::marker::Sized>, polarity:Positive), bound_vars: [] }
error: rustc_dump_clauses
--> $DIR/rustc_dump_clauses.rs:15:5
|
15 | type Assoc;
| ^^^^^^^^^^
|
= note: Binder { value: TraitClause(<Self as std::marker::MetaSized>, polarity:Positive), bound_vars: [] }
= note: Binder { value: TraitClause(<Self as std::marker::Sync>, polarity:Positive), bound_vars: [] }
= note: Binder { value: TraitClause(<Self as Trait>, polarity:Positive), bound_vars: [] }
error: aborting due to 5 previous errors
§Example: super trait bounds are not elaborated
ⓘ
//@ dont-require-annotations: ERROR
//@ compile-flags: --crate-type lib -Z ui-testing=no
#![feature(rustc_attrs)]
#[rustc_dump_clauses]
fn foo<T: Copy>(t: &T) -> T {
*t
}produces:
error: rustc_dump_clauses
--> $DIR/rustc_dump_clauses_super_trait.rs:7:1
|
7 | fn foo<T: Copy>(t: &T) -> T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: Binder { value: TraitClause(<T as std::marker::Sized>, polarity:Positive), bound_vars: [] }
= note: Binder { value: TraitClause(<T as std::marker::Copy>, polarity:Positive), bound_vars: [] }
error: aborting due to 1 previous error