Skip to main content

rustc_query_system/query/
mod.rs

1use std::fmt::Debug;
2
3use rustc_errors::DiagInner;
4use rustc_macros::{Decodable, Encodable};
5
6/// Tracks 'side effects' for a particular query.
7/// This struct is saved to disk along with the query result,
8/// and loaded from disk if we mark the query as green.
9/// This allows us to 'replay' changes to global state
10/// that would otherwise only occur if we actually
11/// executed the query method.
12///
13/// Each side effect gets an unique dep node index which is added
14/// as a dependency of the query which had the effect.
15#[derive(#[automatically_derived]
impl ::core::fmt::Debug for QuerySideEffect {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            QuerySideEffect::Diagnostic(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Diagnostic", &__self_0),
        }
    }
}Debug, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for QuerySideEffect {
            fn encode(&self, __encoder: &mut __E) {
                match *self {
                    QuerySideEffect::Diagnostic(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for QuerySideEffect {
            fn decode(__decoder: &mut __D) -> Self {
                QuerySideEffect::Diagnostic(::rustc_serialize::Decodable::decode(__decoder))
            }
        }
    };Decodable)]
16pub enum QuerySideEffect {
17    /// Stores a diagnostic emitted during query execution.
18    /// This diagnostic will be re-emitted if we mark
19    /// the query as green, as that query will have the side
20    /// effect dep node as a dependency.
21    Diagnostic(DiagInner),
22}