mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Rollup merge of #125391 - nnethercote:serialize-rs-tweaks, r=compiler-errors
Minor serialize/span tweaks r? ``@jackh726``
This commit is contained in:
commit
0646c7d066
@ -13,7 +13,7 @@ pub fn type_decodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2:
|
||||
quote! {}
|
||||
};
|
||||
|
||||
s.add_impl_generic(parse_quote! {#decoder_ty: ::rustc_type_ir::codec::TyDecoder #bound });
|
||||
s.add_impl_generic(parse_quote! { #decoder_ty: ::rustc_type_ir::codec::TyDecoder #bound });
|
||||
s.add_bounds(synstructure::AddBounds::Fields);
|
||||
s.underscore_const(true);
|
||||
|
||||
@ -34,7 +34,7 @@ pub fn meta_decodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2:
|
||||
|
||||
pub fn decodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream {
|
||||
let decoder_ty = quote! { __D };
|
||||
s.add_impl_generic(parse_quote! {#decoder_ty: ::rustc_span::SpanDecoder});
|
||||
s.add_impl_generic(parse_quote! { #decoder_ty: ::rustc_span::SpanDecoder });
|
||||
s.add_bounds(synstructure::AddBounds::Generics);
|
||||
s.underscore_const(true);
|
||||
|
||||
@ -43,7 +43,7 @@ pub fn decodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::Toke
|
||||
|
||||
pub fn decodable_generic_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream {
|
||||
let decoder_ty = quote! { __D };
|
||||
s.add_impl_generic(parse_quote! {#decoder_ty: ::rustc_serialize::Decoder});
|
||||
s.add_impl_generic(parse_quote! { #decoder_ty: ::rustc_serialize::Decoder });
|
||||
s.add_bounds(synstructure::AddBounds::Generics);
|
||||
s.underscore_const(true);
|
||||
|
||||
@ -120,7 +120,7 @@ fn decode_field(field: &syn::Field) -> proc_macro2::TokenStream {
|
||||
let __decoder = quote! { __decoder };
|
||||
// Use the span of the field for the method call, so
|
||||
// that backtraces will point to the field.
|
||||
quote_spanned! {field_span=> #decode_inner_method(#__decoder) }
|
||||
quote_spanned! { field_span=> #decode_inner_method(#__decoder) }
|
||||
}
|
||||
|
||||
pub fn type_encodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream {
|
||||
@ -133,7 +133,7 @@ pub fn type_encodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2:
|
||||
};
|
||||
|
||||
let encoder_ty = quote! { __E };
|
||||
s.add_impl_generic(parse_quote! {#encoder_ty: ::rustc_type_ir::codec::TyEncoder #bound });
|
||||
s.add_impl_generic(parse_quote! { #encoder_ty: ::rustc_type_ir::codec::TyEncoder #bound });
|
||||
s.add_bounds(synstructure::AddBounds::Fields);
|
||||
s.underscore_const(true);
|
||||
|
||||
@ -142,7 +142,7 @@ pub fn type_encodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2:
|
||||
|
||||
pub fn meta_encodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream {
|
||||
if !s.ast().generics.lifetimes().any(|lt| lt.lifetime.ident == "tcx") {
|
||||
s.add_impl_generic(parse_quote! {'tcx});
|
||||
s.add_impl_generic(parse_quote! { 'tcx });
|
||||
}
|
||||
s.add_impl_generic(parse_quote! { '__a });
|
||||
let encoder_ty = quote! { EncodeContext<'__a, 'tcx> };
|
||||
@ -154,7 +154,7 @@ pub fn meta_encodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2:
|
||||
|
||||
pub fn encodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream {
|
||||
let encoder_ty = quote! { __E };
|
||||
s.add_impl_generic(parse_quote! { #encoder_ty: ::rustc_span::SpanEncoder});
|
||||
s.add_impl_generic(parse_quote! { #encoder_ty: ::rustc_span::SpanEncoder });
|
||||
s.add_bounds(synstructure::AddBounds::Generics);
|
||||
s.underscore_const(true);
|
||||
|
||||
@ -163,7 +163,7 @@ pub fn encodable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::Toke
|
||||
|
||||
pub fn encodable_generic_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream {
|
||||
let encoder_ty = quote! { __E };
|
||||
s.add_impl_generic(parse_quote! { #encoder_ty: ::rustc_serialize::Encoder});
|
||||
s.add_impl_generic(parse_quote! { #encoder_ty: ::rustc_serialize::Encoder });
|
||||
s.add_bounds(synstructure::AddBounds::Generics);
|
||||
s.underscore_const(true);
|
||||
|
||||
|
@ -40,6 +40,7 @@ use std::cell::RefCell;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::fmt;
|
||||
use std::hash::Hash;
|
||||
use tracing::{debug, trace};
|
||||
|
||||
/// A `SyntaxContext` represents a chain of pairs `(ExpnId, Transparency)` named "marks".
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
|
@ -33,15 +33,16 @@
|
||||
#![feature(rustdoc_internals)]
|
||||
// tidy-alphabetical-end
|
||||
|
||||
// The code produced by the `Encodable`/`Decodable` derive macros refer to
|
||||
// `rustc_span::Span{Encoder,Decoder}`. That's fine outside this crate, but doesn't work inside
|
||||
// this crate without this line making `rustc_span` available.
|
||||
extern crate self as rustc_span;
|
||||
|
||||
#[macro_use]
|
||||
extern crate tracing;
|
||||
|
||||
use rustc_data_structures::{outline, AtomicRef};
|
||||
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
|
||||
use rustc_serialize::opaque::{FileEncoder, MemDecoder};
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||
use tracing::debug;
|
||||
|
||||
mod caching_source_map_view;
|
||||
pub mod source_map;
|
||||
|
@ -16,6 +16,7 @@ use rustc_macros::{Decodable, Encodable};
|
||||
use std::fs;
|
||||
use std::io::{self, BorrowedBuf, Read};
|
||||
use std::path;
|
||||
use tracing::{debug, instrument, trace};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
Loading…
Reference in New Issue
Block a user