Skip to content

Commit bae4760

Browse files
committed
---
yaml --- r: 135916 b: refs/heads/try c: 57a05cf h: refs/heads/master v: v3
1 parent 755474d commit bae4760

File tree

12 files changed

+68
-15
lines changed

12 files changed

+68
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 8794107f74682607f368776cc8b78820629778e6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ae81c89f34f1ac2cdb596cf216612e94822a8466
5-
refs/heads/try: e723051a2eb840a710f2b79afc1b42b0b707d0e4
5+
refs/heads/try: 57a05cf49b3149427e3fe190c07f8343a29ad86c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/etc/emacs/rust-mode-tests.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ Convert the line-column information from that list into a buffer position value.
623623
(move-to-column column)
624624
(point))))
625625

626-
;;; TODO: Maybe add an ERT explainer function (something that shows the
626+
;;; FIXME: Maybe add an ERT explainer function (something that shows the
627627
;;; surrounding code of the final point, not just the position).
628628
(defun rust-test-motion (source-code init-pos final-pos manip-func &optional &rest args)
629629
"Test that MANIP-FUNC moves point from INIT-POS to FINAL-POS.

branches/try/src/etc/kate/rust.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE language SYSTEM "language.dtd"
33
[
4-
<!-- TODO: Kate's regex engine has very limited support for
4+
<!-- FIXME: Kate's regex engine has very limited support for
55
predefined char classes, so making rustIdent consistent with actual
66
Rust identifiers will be a bit difficult -->
77
<!ENTITY rustIdent "[a-zA-Z_][a-zA-Z_0-9]*">

branches/try/src/etc/vim/syntax/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ syn keyword rustTodo contained TODO FIXME XXX NB NOTE
216216

217217
" Folding rules {{{2
218218
" Trivial folding rules to begin with.
219-
" TODO: use the AST to make really good folding
219+
" FIXME: use the AST to make really good folding
220220
syn region rustFoldBraces start="{" end="}" transparent fold
221221

222222
" Default highlighting {{{1

branches/try/src/librustc/lint/builtin.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ impl LintPass for UnusedAttribute {
593593
"static_assert",
594594
"thread_local",
595595
"no_debug",
596+
"unsafe_no_drop_flag",
596597

597598
// used in resolve
598599
"prelude_import",

branches/try/src/librustc/metadata/common.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ pub static tag_reachable_extern_fn_id: uint = 0x91;
214214

215215
pub static tag_items_data_item_stability: uint = 0x92;
216216

217+
pub static tag_items_data_item_repr: uint = 0x93;
218+
217219
#[deriving(Clone, Show)]
218220
pub struct LinkMeta {
219221
pub crate_name: String,

branches/try/src/librustc/metadata/csearch.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,12 @@ pub fn get_stability(cstore: &cstore::CStore,
350350
decoder::get_stability(&*cdata, def.node)
351351
}
352352

353+
pub fn get_repr_attrs(cstore: &cstore::CStore, def: ast::DefId)
354+
-> Vec<attr::ReprAttr> {
355+
let cdata = cstore.get_crate_data(def.krate);
356+
decoder::get_repr_attrs(&*cdata, def.node)
357+
}
358+
353359
pub fn is_associated_type(cstore: &cstore::CStore, def: ast::DefId) -> bool {
354360
let cdata = cstore.get_crate_data(def.krate);
355361
decoder::is_associated_type(&*cdata, def.node)

branches/try/src/librustc/metadata/decoder.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,17 @@ pub fn get_stability(cdata: Cmd, id: ast::NodeId) -> Option<attr::Stability> {
384384
})
385385
}
386386

387+
pub fn get_repr_attrs(cdata: Cmd, id: ast::NodeId) -> Vec<attr::ReprAttr> {
388+
let item = lookup_item(id, cdata.data());
389+
match reader::maybe_get_doc(item, tag_items_data_item_repr).map(|doc| {
390+
let mut decoder = reader::Decoder::new(doc);
391+
Decodable::decode(&mut decoder).unwrap()
392+
}) {
393+
Some(attrs) => attrs,
394+
None => Vec::new(),
395+
}
396+
}
397+
387398
pub fn get_impl_trait(cdata: Cmd,
388399
id: ast::NodeId,
389400
tcx: &ty::ctxt) -> Option<Rc<ty::TraitRef>>

branches/try/src/librustc/metadata/encoder.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ fn encode_enum_variant_info(ecx: &EncodeContext,
332332
encode_parent_item(rbml_w, local_def(id));
333333
encode_visibility(rbml_w, variant.node.vis);
334334
encode_attributes(rbml_w, variant.node.attrs.as_slice());
335+
encode_repr_attrs(rbml_w, ecx, variant.node.attrs.as_slice());
335336

336337
let stab = stability::lookup(ecx.tcx, ast_util::local_def(variant.node.id));
337338
encode_stability(rbml_w, stab);
@@ -948,6 +949,19 @@ fn encode_method_argument_names(rbml_w: &mut Encoder,
948949
rbml_w.end_tag();
949950
}
950951

952+
fn encode_repr_attrs(rbml_w: &mut Encoder,
953+
ecx: &EncodeContext,
954+
attrs: &[Attribute]) {
955+
let mut repr_attrs = Vec::new();
956+
for attr in attrs.iter() {
957+
repr_attrs.extend(attr::find_repr_attrs(ecx.tcx.sess.diagnostic(),
958+
attr).into_iter());
959+
}
960+
rbml_w.start_tag(tag_items_data_item_repr);
961+
repr_attrs.encode(rbml_w);
962+
rbml_w.end_tag();
963+
}
964+
951965
fn encode_inlined_item(ecx: &EncodeContext,
952966
rbml_w: &mut Encoder,
953967
ii: InlinedItemRef) {
@@ -1137,6 +1151,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
11371151
encode_bounds_and_type(rbml_w, ecx, &lookup_item_type(tcx, def_id));
11381152
encode_name(rbml_w, item.ident.name);
11391153
encode_attributes(rbml_w, item.attrs.as_slice());
1154+
encode_repr_attrs(rbml_w, ecx, item.attrs.as_slice());
11401155
for v in (*enum_definition).variants.iter() {
11411156
encode_variant_id(rbml_w, local_def(v.node.id));
11421157
}
@@ -1183,6 +1198,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
11831198
encode_path(rbml_w, path.clone());
11841199
encode_stability(rbml_w, stab);
11851200
encode_visibility(rbml_w, vis);
1201+
encode_repr_attrs(rbml_w, ecx, item.attrs.as_slice());
11861202

11871203
/* Encode def_ids for each field and method
11881204
for methods, write all the stuff get_trait_method

branches/try/src/librustc/middle/ty.rs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,9 @@ pub struct ctxt<'tcx> {
583583
/// Caches the results of trait selection. This cache is used
584584
/// for things that do not have to do with the parameters in scope.
585585
pub selection_cache: traits::SelectionCache,
586+
587+
/// Caches the representation hints for struct definitions.
588+
pub repr_hint_cache: RefCell<DefIdMap<Rc<Vec<attr::ReprAttr>>>>,
586589
}
587590

588591
pub enum tbox_flag {
@@ -1533,6 +1536,7 @@ pub fn mk_ctxt<'tcx>(s: Session,
15331536
associated_types: RefCell::new(DefIdMap::new()),
15341537
trait_associated_types: RefCell::new(DefIdMap::new()),
15351538
selection_cache: traits::SelectionCache::new(),
1539+
repr_hint_cache: RefCell::new(DefIdMap::new()),
15361540
}
15371541
}
15381542

@@ -4330,7 +4334,7 @@ pub fn ty_dtor(cx: &ctxt, struct_id: DefId) -> DtorKind {
43304334
}
43314335

43324336
pub fn has_dtor(cx: &ctxt, struct_id: DefId) -> bool {
4333-
ty_dtor(cx, struct_id).is_present()
4337+
cx.destructor_for_type.borrow().contains_key(&struct_id)
43344338
}
43354339

43364340
pub fn with_path<T>(cx: &ctxt, id: ast::DefId, f: |ast_map::PathElems| -> T) -> T {
@@ -4517,14 +4521,26 @@ pub fn lookup_simd(tcx: &ctxt, did: DefId) -> bool {
45174521
}
45184522

45194523
/// Obtain the representation annotation for a struct definition.
4520-
pub fn lookup_repr_hints(tcx: &ctxt, did: DefId) -> Vec<attr::ReprAttr> {
4521-
let mut acc = Vec::new();
4524+
pub fn lookup_repr_hints(tcx: &ctxt, did: DefId) -> Rc<Vec<attr::ReprAttr>> {
4525+
match tcx.repr_hint_cache.borrow().find(&did) {
4526+
None => {}
4527+
Some(ref hints) => return (*hints).clone(),
4528+
}
45224529

4523-
ty::each_attr(tcx, did, |meta| {
4524-
acc.extend(attr::find_repr_attrs(tcx.sess.diagnostic(), meta).into_iter());
4525-
true
4526-
});
4530+
let acc = if did.krate == LOCAL_CRATE {
4531+
let mut acc = Vec::new();
4532+
ty::each_attr(tcx, did, |meta| {
4533+
acc.extend(attr::find_repr_attrs(tcx.sess.diagnostic(),
4534+
meta).into_iter());
4535+
true
4536+
});
4537+
acc
4538+
} else {
4539+
csearch::get_repr_attrs(&tcx.sess.cstore, did)
4540+
};
45274541

4542+
let acc = Rc::new(acc);
4543+
tcx.repr_hint_cache.borrow_mut().insert(did, acc.clone());
45284544
acc
45294545
}
45304546

branches/try/src/libsyntax/attr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ fn int_type_of_word(s: &str) -> Option<IntType> {
508508
}
509509
}
510510

511-
#[deriving(PartialEq, Show)]
511+
#[deriving(PartialEq, Show, Encodable, Decodable)]
512512
pub enum ReprAttr {
513513
ReprAny,
514514
ReprInt(Span, IntType),
@@ -527,7 +527,7 @@ impl ReprAttr {
527527
}
528528
}
529529

530-
#[deriving(Eq, Hash, PartialEq, Show)]
530+
#[deriving(Eq, Hash, PartialEq, Show, Encodable, Decodable)]
531531
pub enum IntType {
532532
SignedInt(ast::IntTy),
533533
UnsignedInt(ast::UintTy)

branches/try/src/test/debuginfo/issue12886.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// ignore-windows failing on 64-bit bots FIXME #17638
1213

1314
// compile-flags:-g
14-
// gdb-command:break issue12886.rs:29
15+
// gdb-command:break issue12886.rs:30
1516
// gdb-command:run
1617
// gdb-command:next
17-
// gdb-check:[...]30[...]s
18+
// gdb-check:[...]31[...]s
1819
// gdb-command:continue
1920

2021
// IF YOU MODIFY THIS FILE, BE CAREFUL TO ADAPT THE LINE NUMBERS IN THE DEBUGGER COMMANDS

0 commit comments

Comments
 (0)