Skip to main content

rustc_dump_hidden_type_of_opaques

Attribute rustc_dump_hidden_type_of_opaques 

Source
Expand description

Dumps the hidden types of the opaque items in this crate.

This ends up calling the type_of query, which, for opaque types, reveals their hidden types.

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

§Example

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

#![feature(rustc_attrs)]
#![rustc_dump_hidden_type_of_opaques]

trait Foo {
    fn hello(&self) -> impl Sized;
}

fn hello<'s, T: Foo>(x: &'s T) -> impl Sized + use<'s, T> {
    x.hello()
}

produces:

error: <T as Foo>::hello::{anon_assoc#0}<'s/#1>
 --> $DIR/rustc_dump_hidden_type_of_opaques.rs:11:35
  |
11 | fn hello<'s, T: Foo>(x: &'s T) -> impl Sized + use<'s, T> {
  |                                   ^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error