Skip to content

Commit ffbeaf4

Browse files
committed
---
yaml --- r: 128847 b: refs/heads/try c: 6c5d97a h: refs/heads/master i: 128845: 00368a5 128843: 59183f4 128839: bdb0630 128831: ebf7a8f v: v3
1 parent 0b7b982 commit ffbeaf4

File tree

10 files changed

+56
-176
lines changed

10 files changed

+56
-176
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: 07d86b46a949a94223da714e35b343243e4ecce4
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a86d9ad15e339ab343a12513f9c90556f677b9ca
5-
refs/heads/try: 02f9fd87ec56b1e84d45c96abe388f555e28faed
5+
refs/heads/try: 6c5d97a5da043c785b2fb38c0fd13c85ab265122
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/doc/rust.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,8 +1928,6 @@ interpreted:
19281928

19291929
### Miscellaneous attributes
19301930

1931-
- `export_name` - on statics and functions, this determines the name of the
1932-
exported symbol.
19331931
- `link_section` - on statics and functions, this specifies the section of the
19341932
object file that this item's contents will be placed into.
19351933
- `macro_export` - export a macro for cross-crate usage.

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@ impl LintPass for UnusedAttribute {
568568
// FIXME: #14406 these are processed in trans, which happens after the
569569
// lint pass
570570
"cold",
571-
"export_name",
572571
"inline",
573572
"link",
574573
"link_name",
@@ -579,7 +578,6 @@ impl LintPass for UnusedAttribute {
579578
"packed",
580579
"static_assert",
581580
"thread_local",
582-
"no_debug",
583581

584582
// not used anywhere (!?) but apparently we want to keep them around
585583
"comment",

branches/try/src/librustc/middle/trans/base.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1947,10 +1947,12 @@ pub fn trans_named_tuple_constructor<'a>(mut bcx: &'a Block<'a>,
19471947
};
19481948

19491949
if !type_is_zero_size(ccx, result_ty) {
1950+
let repr = adt::represent_type(ccx, result_ty);
1951+
19501952
match args {
19511953
callee::ArgExprs(exprs) => {
19521954
let fields = exprs.iter().map(|x| *x).enumerate().collect::<Vec<_>>();
1953-
bcx = expr::trans_adt(bcx, result_ty, disr, fields.as_slice(),
1955+
bcx = expr::trans_adt(bcx, &*repr, disr, fields.as_slice(),
19541956
None, expr::SaveIn(llresult));
19551957
}
19561958
_ => ccx.sess().bug("expected expr as arguments for variant/struct tuple constructor")

branches/try/src/librustc/middle/trans/controlflow.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,12 @@ pub fn trans_for<'a>(
330330
// Check the discriminant; if the `None` case, exit the loop.
331331
let option_representation = adt::represent_type(loopback_bcx_out.ccx(),
332332
method_result_type);
333-
let i8_type = Type::i8(loopback_bcx_out.ccx());
334333
let lldiscriminant = adt::trans_get_discr(loopback_bcx_out,
335334
&*option_representation,
336335
option_datum.val,
337-
Some(i8_type));
338-
let llzero = C_u8(loopback_bcx_out.ccx(), 0);
339-
let llcondition = ICmp(loopback_bcx_out, IntNE, lldiscriminant, llzero);
336+
None);
337+
let i1_type = Type::i1(loopback_bcx_out.ccx());
338+
let llcondition = Trunc(loopback_bcx_out, lldiscriminant, i1_type);
340339
CondBr(loopback_bcx_out, llcondition, body_bcx_in.llbb, cleanup_llbb);
341340

342341
// Now we're in the body. Unpack the `Option` value into the programmer-

branches/try/src/librustc/middle/trans/debuginfo.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,10 +1128,6 @@ pub fn create_function_debug_context(cx: &CrateContext,
11281128

11291129
let (ident, fn_decl, generics, top_level_block, span, has_path) = match fnitem {
11301130
ast_map::NodeItem(ref item) => {
1131-
if contains_nodebug_attribute(item.attrs.as_slice()) {
1132-
return FunctionDebugContext { repr: FunctionWithoutDebugInfo };
1133-
}
1134-
11351131
match item.node {
11361132
ast::ItemFn(fn_decl, _, _, ref generics, top_level_block) => {
11371133
(item.ident, fn_decl, generics, top_level_block, item.span, true)
@@ -1145,12 +1141,6 @@ pub fn create_function_debug_context(cx: &CrateContext,
11451141
ast_map::NodeImplItem(ref item) => {
11461142
match **item {
11471143
ast::MethodImplItem(ref method) => {
1148-
if contains_nodebug_attribute(method.attrs.as_slice()) {
1149-
return FunctionDebugContext {
1150-
repr: FunctionWithoutDebugInfo
1151-
};
1152-
}
1153-
11541144
(method.pe_ident(),
11551145
method.pe_fn_decl(),
11561146
method.pe_generics(),
@@ -1183,12 +1173,6 @@ pub fn create_function_debug_context(cx: &CrateContext,
11831173
ast_map::NodeTraitItem(ref trait_method) => {
11841174
match **trait_method {
11851175
ast::ProvidedMethod(ref method) => {
1186-
if contains_nodebug_attribute(method.attrs.as_slice()) {
1187-
return FunctionDebugContext {
1188-
repr: FunctionWithoutDebugInfo
1189-
};
1190-
}
1191-
11921176
(method.pe_ident(),
11931177
method.pe_fn_decl(),
11941178
method.pe_generics(),
@@ -3185,16 +3169,6 @@ fn set_debug_location(cx: &CrateContext, debug_location: DebugLocation) {
31853169
// Utility Functions
31863170
//=-----------------------------------------------------------------------------
31873171

3188-
fn contains_nodebug_attribute(attributes: &[ast::Attribute]) -> bool {
3189-
attributes.iter().any(|attr| {
3190-
let meta_item: &ast::MetaItem = &*attr.node.value;
3191-
match meta_item.node {
3192-
ast::MetaWord(ref value) => value.get() == "no_debug",
3193-
_ => false
3194-
}
3195-
})
3196-
}
3197-
31983172
/// Return codemap::Loc corresponding to the beginning of the span
31993173
fn span_start(cx: &CrateContext, span: Span) -> codemap::Loc {
32003174
cx.sess().codemap().lookup_char_pos(span.lo)

branches/try/src/librustc/middle/trans/expr.rs

Lines changed: 49 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -746,17 +746,18 @@ fn trans_rvalue_dps_unadjusted<'a>(bcx: &'a Block<'a>,
746746
controlflow::trans_block(bcx, &**blk, dest)
747747
}
748748
ast::ExprStruct(_, ref fields, base) => {
749-
trans_struct(bcx,
750-
fields.as_slice(),
751-
base,
752-
expr.span,
753-
expr.id,
754-
dest)
749+
trans_rec_or_struct(bcx,
750+
fields.as_slice(),
751+
base,
752+
expr.span,
753+
expr.id,
754+
dest)
755755
}
756756
ast::ExprTup(ref args) => {
757+
let repr = adt::represent_type(bcx.ccx(), expr_ty(bcx, expr));
757758
let numbered_fields: Vec<(uint, Gc<ast::Expr>)> =
758759
args.iter().enumerate().map(|(i, arg)| (i, *arg)).collect();
759-
trans_adt(bcx, expr_ty(bcx, expr), 0, numbered_fields.as_slice(), None, dest)
760+
trans_adt(bcx, &*repr, 0, numbered_fields.as_slice(), None, dest)
760761
}
761762
ast::ExprLit(lit) => {
762763
match lit.node {
@@ -1041,13 +1042,16 @@ pub fn with_field_tys<R>(tcx: &ty::ctxt,
10411042
}
10421043
}
10431044

1044-
fn trans_struct<'a>(bcx: &'a Block<'a>,
1045-
fields: &[ast::Field],
1046-
base: Option<Gc<ast::Expr>>,
1047-
expr_span: codemap::Span,
1048-
id: ast::NodeId,
1049-
dest: Dest) -> &'a Block<'a> {
1045+
fn trans_rec_or_struct<'a>(
1046+
bcx: &'a Block<'a>,
1047+
fields: &[ast::Field],
1048+
base: Option<Gc<ast::Expr>>,
1049+
expr_span: codemap::Span,
1050+
id: ast::NodeId,
1051+
dest: Dest)
1052+
-> &'a Block<'a> {
10501053
let _icx = push_ctxt("trans_rec");
1054+
let bcx = bcx;
10511055

10521056
let ty = node_id_type(bcx, id);
10531057
let tcx = bcx.tcx();
@@ -1088,7 +1092,8 @@ fn trans_struct<'a>(bcx: &'a Block<'a>,
10881092
}
10891093
};
10901094

1091-
trans_adt(bcx, ty, discr, numbered_fields.as_slice(), optbase, dest)
1095+
let repr = adt::represent_type(bcx.ccx(), ty);
1096+
trans_adt(bcx, &*repr, discr, numbered_fields.as_slice(), optbase, dest)
10921097
})
10931098
}
10941099

@@ -1116,71 +1121,60 @@ pub struct StructBaseInfo {
11161121
* - `optbase` contains information on the base struct (if any) from
11171122
* which remaining fields are copied; see comments on `StructBaseInfo`.
11181123
*/
1119-
pub fn trans_adt<'a>(mut bcx: &'a Block<'a>,
1120-
ty: ty::t,
1124+
pub fn trans_adt<'a>(bcx: &'a Block<'a>,
1125+
repr: &adt::Repr,
11211126
discr: ty::Disr,
11221127
fields: &[(uint, Gc<ast::Expr>)],
11231128
optbase: Option<StructBaseInfo>,
11241129
dest: Dest) -> &'a Block<'a> {
11251130
let _icx = push_ctxt("trans_adt");
11261131
let fcx = bcx.fcx;
1127-
let repr = adt::represent_type(bcx.ccx(), ty);
1128-
1129-
// If we don't care about the result, just make a
1130-
// temporary stack slot
1132+
let mut bcx = bcx;
11311133
let addr = match dest {
1132-
SaveIn(pos) => pos,
1133-
Ignore => alloc_ty(bcx, ty, "temp"),
1134+
Ignore => {
1135+
for &(_i, ref e) in fields.iter() {
1136+
bcx = trans_into(bcx, &**e, Ignore);
1137+
}
1138+
for sbi in optbase.iter() {
1139+
// FIXME #7261: this moves entire base, not just certain fields
1140+
bcx = trans_into(bcx, &*sbi.expr, Ignore);
1141+
}
1142+
return bcx;
1143+
}
1144+
SaveIn(pos) => pos
11341145
};
11351146

11361147
// This scope holds intermediates that must be cleaned should
11371148
// failure occur before the ADT as a whole is ready.
11381149
let custom_cleanup_scope = fcx.push_custom_cleanup_scope();
11391150

1140-
// First we trans the base, if we have one, to the dest
1141-
for base in optbase.iter() {
1142-
assert_eq!(discr, 0);
1143-
1144-
match ty::expr_kind(bcx.tcx(), &*base.expr) {
1145-
ty::LvalueExpr => {
1146-
let base_datum = unpack_datum!(bcx, trans_to_lvalue(bcx, &*base.expr, "base"));
1147-
for &(i, t) in base.fields.iter() {
1148-
let datum = base_datum.get_element(
1149-
t, |srcval| adt::trans_field_ptr(bcx, &*repr, srcval, discr, i));
1150-
let dest = adt::trans_field_ptr(bcx, &*repr, addr, discr, i);
1151-
bcx = datum.store_to(bcx, dest);
1152-
}
1153-
},
1154-
ty::RvalueDpsExpr | ty::RvalueDatumExpr => {
1155-
bcx = trans_into(bcx, &*base.expr, SaveIn(addr));
1156-
},
1157-
ty::RvalueStmtExpr => bcx.tcx().sess.bug("unexpected expr kind for struct base expr")
1158-
}
1159-
}
1160-
1161-
// Now, we just overwrite the fields we've explicity specified
11621151
for &(i, ref e) in fields.iter() {
1163-
let dest = adt::trans_field_ptr(bcx, &*repr, addr, discr, i);
1152+
let dest = adt::trans_field_ptr(bcx, repr, addr, discr, i);
11641153
let e_ty = expr_ty_adjusted(bcx, &**e);
11651154
bcx = trans_into(bcx, &**e, SaveIn(dest));
11661155
let scope = cleanup::CustomScope(custom_cleanup_scope);
11671156
fcx.schedule_lifetime_end(scope, dest);
11681157
fcx.schedule_drop_mem(scope, dest, e_ty);
11691158
}
11701159

1171-
adt::trans_set_discr(bcx, &*repr, addr, discr);
1160+
for base in optbase.iter() {
1161+
// FIXME #6573: is it sound to use the destination's repr on the base?
1162+
// And, would it ever be reasonable to be here with discr != 0?
1163+
let base_datum = unpack_datum!(bcx, trans_to_lvalue(bcx, &*base.expr, "base"));
1164+
for &(i, t) in base.fields.iter() {
1165+
let datum = base_datum.get_element(
1166+
t,
1167+
|srcval| adt::trans_field_ptr(bcx, repr, srcval, discr, i));
1168+
let dest = adt::trans_field_ptr(bcx, repr, addr, discr, i);
1169+
bcx = datum.store_to(bcx, dest);
1170+
}
1171+
}
1172+
1173+
adt::trans_set_discr(bcx, repr, addr, discr);
11721174

11731175
fcx.pop_custom_cleanup_scope(custom_cleanup_scope);
11741176

1175-
// If we don't care about the result drop the temporary we made
1176-
match dest {
1177-
SaveIn(_) => bcx,
1178-
Ignore => {
1179-
bcx = glue::drop_ty(bcx, addr, ty);
1180-
base::call_lifetime_end(bcx, addr);
1181-
bcx
1182-
}
1183-
}
1177+
return bcx;
11841178
}
11851179

11861180

branches/try/src/test/auxiliary/macro_crate_test.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use syntax::ast::{TokenTree, Item, MetaItem};
1919
use syntax::codemap::Span;
2020
use syntax::ext::base::*;
2121
use syntax::parse::token;
22-
use syntax::parse;
2322
use rustc::plugin::Registry;
2423

2524
use std::gc::{Gc, GC};
@@ -33,7 +32,6 @@ macro_rules! unexported_macro (() => (3i))
3332
pub fn plugin_registrar(reg: &mut Registry) {
3433
reg.register_macro("make_a_1", expand_make_a_1);
3534
reg.register_macro("forged_ident", expand_forged_ident);
36-
reg.register_macro("identity", expand_identity);
3735
reg.register_syntax_extension(
3836
token::intern("into_foo"),
3937
ItemModifier(expand_into_foo));
@@ -47,16 +45,6 @@ fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree])
4745
MacExpr::new(quote_expr!(cx, 1i))
4846
}
4947

50-
// See Issue #15750
51-
fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree])
52-
-> Box<MacResult> {
53-
// Parse an expression and emit it unchanged.
54-
let mut parser = parse::new_parser_from_tts(cx.parse_sess(),
55-
cx.cfg(), Vec::from_slice(tts));
56-
let expr = parser.parse_expr();
57-
MacExpr::new(quote_expr!(&mut *cx, $expr))
58-
}
59-
6048
fn expand_into_foo(cx: &mut ExtCtxt, sp: Span, attr: Gc<MetaItem>, it: Gc<Item>)
6149
-> Gc<Item> {
6250
box(GC) Item {

branches/try/src/test/debuginfo/no-debug-attribute.rs

Lines changed: 0 additions & 45 deletions
This file was deleted.

branches/try/src/test/run-pass-fulldeps/macro-crate-does-hygiene-work.rs

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)