Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f176bcf
Fix typo in Delimited::open_tt
ia0 Jul 24, 2019
804f0f3
Unify spanned and non-spanned Attribute ctors
Mark-Simulacrum Jul 30, 2019
0a42bad
Remove AttrId from Attribute constructors
Mark-Simulacrum Jul 30, 2019
b2c5065
Remove Span argument from ExtCtxt::attribute
Mark-Simulacrum Jul 30, 2019
f78bf50
Remove span argument from mk_attr_{inner,outer}
Mark-Simulacrum Jul 30, 2019
c9bd4a0
Replace a few Attribute constructors with mk_attr
Mark-Simulacrum Jul 30, 2019
0f98581
Replace AstBuilder with inherent methods
Mark-Simulacrum Jul 31, 2019
d4227f6
Use Ident::new over setting span position via builder
Mark-Simulacrum Jul 31, 2019
c146344
Decode AttrId via mk_attr_id
Mark-Simulacrum Jul 30, 2019
184fb08
rustbuild: RISC-V is no longer an experimental LLVM target
lenary Aug 2, 2019
9cb948f
rustbuild: WebAssembly is no longer an experimental LLVM backend
lenary Aug 2, 2019
2921de6
rustbuild: correct line length
lenary Aug 2, 2019
1b132a2
be less British
RalfJung Aug 2, 2019
1e24c73
dedup free-form Unsupported errors; add macros for free-form UB and U…
RalfJung Aug 2, 2019
8235b6f
dead_code: Properly inspect fields in struct patterns with type relat…
jakubadamw Aug 2, 2019
e5fc957
bless
RalfJung Aug 2, 2019
42a3281
Rollup merge of #62954 - ia0:fix_typo_span, r=Centril
Centril Aug 3, 2019
15b5aac
Rollup merge of #63146 - Mark-Simulacrum:clean-attr, r=petrochenkov
Centril Aug 3, 2019
6a38ef7
Rollup merge of #63218 - lenary:riscv-non-experimental, r=alexcrichton
Centril Aug 3, 2019
2fd9548
Rollup merge of #63227 - jakubadamw:issue-63151, r=estebank
Centril Aug 3, 2019
42dfdc5
Rollup merge of #63229 - RalfJung:miri-error, r=oli-obk
Centril Aug 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Decode AttrId via mk_attr_id
  • Loading branch information
Mark-Simulacrum committed Jul 31, 2019
commit c146344e32018a8b28c456352a873f9feafd6ff3
9 changes: 1 addition & 8 deletions src/librustc_metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -980,14 +980,7 @@ impl<'a, 'tcx> CrateMetadata {
}

fn get_attributes(&self, item: &Entry<'tcx>, sess: &Session) -> Vec<ast::Attribute> {
item.attributes
.decode((self, sess))
.map(|mut attr| {
// Need new unique IDs: old thread-local IDs won't map to new threads.
attr.id = attr::mk_attr_id();
attr
})
.collect()
item.attributes.decode((self, sess)).collect()
}

// Translate a DefId from the current compilation environment to a DefId
Expand Down
16 changes: 13 additions & 3 deletions src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2104,9 +2104,7 @@ pub enum AttrStyle {
Inner,
}

#[derive(
Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, PartialOrd, Ord, Copy,
)]
#[derive(Clone, PartialEq, Eq, Hash, Debug, PartialOrd, Ord, Copy)]
pub struct AttrId(pub usize);

impl Idx for AttrId {
Expand All @@ -2118,6 +2116,18 @@ impl Idx for AttrId {
}
}

impl rustc_serialize::Encodable for AttrId {
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
s.emit_unit()
}
}

impl rustc_serialize::Decodable for AttrId {
fn decode<D: Decoder>(d: &mut D) -> Result<AttrId, D::Error> {
d.read_nil().map(|_| crate::attr::mk_attr_id())
}
}

/// Metadata associated with an item.
/// Doc-comments are promoted to attributes that have `is_sugared_doc = true`.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
Expand Down