Skip to main content

rustc_dump_inferred_outlives

Attribute rustc_dump_inferred_outlives 

Source
Expand description

Dumps the inferred outlives-clauses of the annotated item.

See also the inferred_outlives_of query.

See AttributeKind::RustcDumpInferredOutlives for the internal representation of this attribute.

§Example

//@ dont-require-annotations: ERROR
//@ compile-flags: --crate-type lib -Z ui-testing=no

#![feature(rustc_attrs)]

trait Trait<'x, T>
where
    T: 'x,
{
    type Type;
}

#[rustc_dump_inferred_outlives]
struct Foo<'a, A, B>
where
    A: Trait<'a, B>,
{
    foo: <A as Trait<'a, B>>::Type,
}

produces:

error: rustc_dump_inferred_outlives
 --> $DIR/rustc_dump_inferred_outlives.rs:14:1
  |
14 | struct Foo<'a, A, B>
  | ^^^^^^^^^^^^^^^^^^^^
  |
  = note: B: 'a

error: aborting due to 1 previous error