Skip to content

Commit 012091f

Browse files
committed
---
yaml --- r: 125924 b: refs/heads/try c: ca18c12 h: refs/heads/master v: v3
1 parent 1cf2a37 commit 012091f

File tree

29 files changed

+183
-522
lines changed

29 files changed

+183
-522
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: f2fa55903e378368ed9173560f03a0ef16e371c2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 9fc8394d3bce22ab483f98842434c84c396212ae
5-
refs/heads/try: 7aa407958b8ab2aec16b0182f0103ad92380b5dc
5+
refs/heads/try: ca18c12243589fc3662d9d6b6f75686518994f2b
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/mk/grammar.mk

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SG = $(S)src/grammar/
1313
B = $(CFG_BUILD_DIR)/$(CFG_BUILD)/stage2/
1414
L = $(B)lib/rustlib/$(CFG_BUILD)/lib
1515
LD = $(CFG_BUILD)/stage2/lib/rustlib/$(CFG_BUILD)/lib/
16-
RUSTC = $(STAGE2_T_$(CFG_BUILD)_H_$(CFG_BUILD))
16+
RUSTC = $(B)bin/rustc
1717

1818
# Run the reference lexer against libsyntax and compare the tokens and spans.
1919
# If "// ignore-lexer-test" is present in the file, it will be ignored.
@@ -37,25 +37,19 @@ $(BG)RustLexer.class: $(SG)RustLexer.g4
3737
$(BG)verify: $(SG)verify.rs rustc-stage2-H-$(CFG_BUILD) $(LD)stamp.regex_macros $(LD)stamp.rustc
3838
$(Q)$(RUSTC) -O --out-dir $(BG) -L $(L) $(SG)verify.rs
3939

40+
check-lexer: $(BG) $(BG)RustLexer.class $(BG)verify
4041
ifdef CFG_JAVAC
4142
ifdef CFG_ANTLR4
4243
ifdef CFG_GRUN
43-
check-lexer: $(BG) $(BG)RustLexer.class $(BG)verify
4444
$(info Verifying libsyntax against the reference lexer ...)
4545
$(Q)$(SG)check.sh $(S) "$(BG)" \
4646
"$(CFG_GRUN)" "$(BG)verify" "$(BG)RustLexer.tokens"
4747
else
48-
$(info cfg: grun not available, skipping lexer test...)
49-
check-lexer:
50-
48+
$(info grun not available, skipping lexer test...)
5149
endif
5250
else
53-
$(info cfg: antlr4 not available, skipping lexer test...)
54-
check-lexer:
55-
51+
$(info antlr4 not available, skipping lexer test...)
5652
endif
5753
else
58-
$(info cfg: javac not available, skipping lexer test...)
59-
check-lexer:
60-
54+
$(info javac not available, skipping lexer test...)
6155
endif

branches/try/mk/tests.mk

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -171,41 +171,28 @@ endif
171171
# Main test targets
172172
######################################################################
173173

174-
# The main testing target. Tests lots of stuff.
175174
check: cleantmptestlogs cleantestlibs check-notidy tidy
176175

177-
# As above but don't bother running tidy.
178176
check-notidy: cleantmptestlogs cleantestlibs all check-stage2
179177
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
180178

181-
# A slightly smaller set of tests for smoke testing.
182179
check-lite: cleantestlibs cleantmptestlogs \
183180
$(foreach crate,$(TEST_TARGET_CRATES),check-stage2-$(crate)) \
184181
check-stage2-rpass \
185182
check-stage2-rfail check-stage2-cfail check-stage2-rmake
186183
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
187184

188-
# Only check the 'reference' tests: rpass/cfail/rfail/rmake.
189185
check-ref: cleantestlibs cleantmptestlogs check-stage2-rpass \
190186
check-stage2-rfail check-stage2-cfail check-stage2-rmake
191187
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
192188

193-
# Only check the docs.
194189
check-docs: cleantestlibs cleantmptestlogs check-stage2-docs
195190
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
196191

197192
# NOTE: Remove after reprogramming windows bots
198193
check-fast: check-lite
199194

200-
# Some less critical tests that are not prone to breakage.
201-
# Not run as part of the normal test suite, but tested by bors on checkin.
202-
check-secondary: check-lexer check-pretty
203-
204-
# check + check-secondary.
205-
check-all: check check-secondary
206-
207-
# Pretty-printing tests.
208-
check-pretty: check-stage2-T-$(CFG_BUILD)-H-$(CFG_BUILD)-pretty-exec
195+
check-syntax: check-lexer
209196

210197
.PHONY: cleantmptestlogs cleantestlibs
211198

branches/try/src/doc/guide-lifetimes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ value. We also call this _borrowing_ the local variable
7777
`on_the_stack`, because we have created an alias: that is, another
7878
name for the same data.
7979

80-
Likewise, in the case of `owned_box`,
80+
Likewise, in the case of `on_the_heap`,
8181
the `&` operator is used in conjunction with the `*` operator
8282
to take a reference to the contents of the box.
8383

branches/try/src/libcollections/smallintmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ impl<V> SmallIntMap<V> {
263263
}
264264
}
265265

266-
/// Empties the map, moving all values into the specified closure.
266+
/// Empties the hash map, moving all values into the specified closure.
267267
///
268268
/// # Example
269269
///

branches/try/src/libcore/fmt/num.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use iter::Iterator; // NOTE(stage0): Remove after snapshot.
2626
use option::{Some, None}; // NOTE(stage0): Remove after snapshot.
2727

2828
/// A type that represents a specific radix
29-
#[doc(hidden)]
3029
trait GenericRadix {
3130
/// The number of digits.
3231
fn base(&self) -> u8;

branches/try/src/librustc/front/std_inject.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,9 @@ impl<'a> fold::Folder for StandardLibraryInjector<'a> {
8686
*ty == config::CrateTypeExecutable
8787
});
8888
if use_start(&krate) && any_exe {
89-
let visible_rt_name = "rt";
90-
let actual_rt_name = "native";
91-
// Gensym the ident so it can't be named
92-
let visible_rt_name = token::gensym_ident(visible_rt_name);
93-
let actual_rt_name = token::intern_and_get_ident(actual_rt_name);
94-
9589
vis.push(ast::ViewItem {
96-
node: ast::ViewItemExternCrate(visible_rt_name,
97-
Some((actual_rt_name, ast::CookedStr)),
90+
node: ast::ViewItemExternCrate(token::str_to_ident("native"),
91+
None,
9892
ast::DUMMY_NODE_ID),
9993
attrs: Vec::new(),
10094
vis: ast::Inherited,

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

Lines changed: 45 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,11 @@ pub fn decl_rust_fn(ccx: &CrateContext, fn_ty: ty::t, name: &str) -> ValueRef {
281281

282282
let llfn = decl_fn(ccx, name, llvm::CCallConv, llfty, output);
283283
let attrs = get_fn_llvm_attributes(ccx, fn_ty);
284-
attrs.apply_llfn(llfn);
284+
for &(idx, attr) in attrs.iter() {
285+
unsafe {
286+
llvm::LLVMAddFunctionAttribute(llfn, idx as c_uint, attr);
287+
}
288+
}
285289

286290
llfn
287291
}
@@ -958,7 +962,7 @@ pub fn invoke<'a>(
958962
llargs.as_slice(),
959963
normal_bcx.llbb,
960964
landing_pad,
961-
Some(attributes));
965+
attributes.as_slice());
962966
return (llresult, normal_bcx);
963967
} else {
964968
debug!("calling {} at {}", llfn, bcx.llbb);
@@ -971,7 +975,7 @@ pub fn invoke<'a>(
971975
None => debuginfo::clear_source_location(bcx.fcx)
972976
};
973977

974-
let llresult = Call(bcx, llfn, llargs.as_slice(), Some(attributes));
978+
let llresult = Call(bcx, llfn, llargs.as_slice(), attributes.as_slice());
975979
return (llresult, bcx);
976980
}
977981
}
@@ -1077,7 +1081,7 @@ pub fn call_lifetime_start(cx: &Block, ptr: ValueRef) {
10771081
let llsize = C_u64(ccx, machine::llsize_of_alloc(ccx, val_ty(ptr).element_type()));
10781082
let ptr = PointerCast(cx, ptr, Type::i8p(ccx));
10791083
let lifetime_start = ccx.get_intrinsic(&"llvm.lifetime.start");
1080-
Call(cx, lifetime_start, [llsize, ptr], None);
1084+
Call(cx, lifetime_start, [llsize, ptr], []);
10811085
}
10821086

10831087
pub fn call_lifetime_end(cx: &Block, ptr: ValueRef) {
@@ -1091,7 +1095,7 @@ pub fn call_lifetime_end(cx: &Block, ptr: ValueRef) {
10911095
let llsize = C_u64(ccx, machine::llsize_of_alloc(ccx, val_ty(ptr).element_type()));
10921096
let ptr = PointerCast(cx, ptr, Type::i8p(ccx));
10931097
let lifetime_end = ccx.get_intrinsic(&"llvm.lifetime.end");
1094-
Call(cx, lifetime_end, [llsize, ptr], None);
1098+
Call(cx, lifetime_end, [llsize, ptr], []);
10951099
}
10961100

10971101
pub fn call_memcpy(cx: &Block, dst: ValueRef, src: ValueRef, n_bytes: ValueRef, align: u32) {
@@ -1107,7 +1111,7 @@ pub fn call_memcpy(cx: &Block, dst: ValueRef, src: ValueRef, n_bytes: ValueRef,
11071111
let size = IntCast(cx, n_bytes, ccx.int_type);
11081112
let align = C_i32(ccx, align as i32);
11091113
let volatile = C_bool(ccx, false);
1110-
Call(cx, memcpy, [dst_ptr, src_ptr, size, align, volatile], None);
1114+
Call(cx, memcpy, [dst_ptr, src_ptr, size, align, volatile], []);
11111115
}
11121116

11131117
pub fn memcpy_ty(bcx: &Block, dst: ValueRef, src: ValueRef, t: ty::t) {
@@ -1152,7 +1156,7 @@ fn memzero(b: &Builder, llptr: ValueRef, ty: Type) {
11521156
let size = machine::llsize_of(ccx, ty);
11531157
let align = C_i32(ccx, llalign_of_min(ccx, ty) as i32);
11541158
let volatile = C_bool(ccx, false);
1155-
b.call(llintrinsicfn, [llptr, llzeroval, size, align, volatile], None);
1159+
b.call(llintrinsicfn, [llptr, llzeroval, size, align, volatile], []);
11561160
}
11571161

11581162
pub fn alloc_ty(bcx: &Block, t: ty::t, name: &str) -> ValueRef {
@@ -2036,7 +2040,7 @@ fn register_fn(ccx: &CrateContext,
20362040
}
20372041

20382042
pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t)
2039-
-> llvm::AttrBuilder {
2043+
-> Vec<(uint, u64)> {
20402044
use middle::ty::{BrAnon, ReLateBound};
20412045

20422046
let (fn_sig, abi, has_env) = match ty::get(fn_ty).sty {
@@ -2052,33 +2056,31 @@ pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t)
20522056
_ => fail!("expected closure or function.")
20532057
};
20542058

2055-
// Since index 0 is the return value of the llvm func, we start
2056-
// at either 1 or 2 depending on whether there's an env slot or not
2057-
let mut first_arg_offset = if has_env { 2 } else { 1 };
2058-
let mut attrs = llvm::AttrBuilder::new();
2059-
let ret_ty = fn_sig.output;
2060-
20612059
// These have an odd calling convention, so we skip them for now.
20622060
//
20632061
// FIXME(pcwalton): We don't have to skip them; just untuple the result.
20642062
if abi == RustCall {
2065-
return attrs;
2063+
return Vec::new()
20662064
}
20672065

2066+
// Since index 0 is the return value of the llvm func, we start
2067+
// at either 1 or 2 depending on whether there's an env slot or not
2068+
let mut first_arg_offset = if has_env { 2 } else { 1 };
2069+
let mut attrs = Vec::new();
2070+
let ret_ty = fn_sig.output;
2071+
20682072
// A function pointer is called without the declaration
20692073
// available, so we have to apply any attributes with ABI
20702074
// implications directly to the call instruction. Right now,
20712075
// the only attribute we need to worry about is `sret`.
20722076
if type_of::return_uses_outptr(ccx, ret_ty) {
2073-
let llret_sz = llsize_of_real(ccx, type_of::type_of(ccx, ret_ty));
2077+
attrs.push((1, llvm::StructRetAttribute as u64));
20742078

20752079
// The outptr can be noalias and nocapture because it's entirely
2076-
// invisible to the program. We also know it's nonnull as well
2077-
// as how many bytes we can dereference
2078-
attrs.arg(1, llvm::StructRetAttribute)
2079-
.arg(1, llvm::NoAliasAttribute)
2080-
.arg(1, llvm::NoCaptureAttribute)
2081-
.arg(1, llvm::DereferenceableAttribute(llret_sz));
2080+
// invisible to the program. We can also mark it as nonnull
2081+
attrs.push((1, llvm::NoAliasAttribute as u64));
2082+
attrs.push((1, llvm::NoCaptureAttribute as u64));
2083+
attrs.push((1, llvm::NonNullAttribute as u64));
20822084

20832085
// Add one more since there's an outptr
20842086
first_arg_offset += 1;
@@ -2092,28 +2094,27 @@ pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t)
20922094
ty::ty_str | ty::ty_vec(..) | ty::ty_trait(..) => true, _ => false
20932095
} => {}
20942096
ty::ty_uniq(_) => {
2095-
attrs.ret(llvm::NoAliasAttribute);
2097+
attrs.push((llvm::ReturnIndex as uint, llvm::NoAliasAttribute as u64));
20962098
}
20972099
_ => {}
20982100
}
20992101

2100-
// We can also mark the return value as `dereferenceable` in certain cases
2102+
// We can also mark the return value as `nonnull` in certain cases
21012103
match ty::get(ret_ty).sty {
21022104
// These are not really pointers but pairs, (pointer, len)
21032105
ty::ty_uniq(it) |
21042106
ty::ty_rptr(_, ty::mt { ty: it, .. }) if match ty::get(it).sty {
21052107
ty::ty_str | ty::ty_vec(..) | ty::ty_trait(..) => true, _ => false
21062108
} => {}
2107-
ty::ty_uniq(inner) | ty::ty_rptr(_, ty::mt { ty: inner, .. }) => {
2108-
let llret_sz = llsize_of_real(ccx, type_of::type_of(ccx, inner));
2109-
attrs.ret(llvm::DereferenceableAttribute(llret_sz));
2109+
ty::ty_uniq(_) | ty::ty_rptr(_, _) => {
2110+
attrs.push((llvm::ReturnIndex as uint, llvm::NonNullAttribute as u64));
21102111
}
21112112
_ => {}
21122113
}
21132114

21142115
match ty::get(ret_ty).sty {
21152116
ty::ty_bool => {
2116-
attrs.ret(llvm::ZExtAttribute);
2117+
attrs.push((llvm::ReturnIndex as uint, llvm::ZExtAttribute as u64));
21172118
}
21182119
_ => {}
21192120
}
@@ -2123,77 +2124,44 @@ pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t)
21232124
match ty::get(t).sty {
21242125
// this needs to be first to prevent fat pointers from falling through
21252126
_ if !type_is_immediate(ccx, t) => {
2126-
let llarg_sz = llsize_of_real(ccx, type_of::type_of(ccx, t));
2127-
21282127
// For non-immediate arguments the callee gets its own copy of
21292128
// the value on the stack, so there are no aliases. It's also
21302129
// program-invisible so can't possibly capture
2131-
attrs.arg(idx, llvm::NoAliasAttribute)
2132-
.arg(idx, llvm::NoCaptureAttribute)
2133-
.arg(idx, llvm::DereferenceableAttribute(llarg_sz));
2130+
attrs.push((idx, llvm::NoAliasAttribute as u64));
2131+
attrs.push((idx, llvm::NoCaptureAttribute as u64));
2132+
attrs.push((idx, llvm::NonNullAttribute as u64));
21342133
}
2135-
21362134
ty::ty_bool => {
2137-
attrs.arg(idx, llvm::ZExtAttribute);
2135+
attrs.push((idx, llvm::ZExtAttribute as u64));
21382136
}
2139-
21402137
// `~` pointer parameters never alias because ownership is transferred
2141-
ty::ty_uniq(inner) => {
2142-
let llsz = llsize_of_real(ccx, type_of::type_of(ccx, inner));
2143-
2144-
attrs.arg(idx, llvm::NoAliasAttribute)
2145-
.arg(idx, llvm::DereferenceableAttribute(llsz));
2146-
}
2147-
2148-
// The visit glue deals only with opaque pointers so we don't
2149-
// actually know the concrete type of Self thus we don't know how
2150-
// many bytes to mark as dereferenceable so instead we just mark
2151-
// it as nonnull which still holds true
2152-
ty::ty_rptr(b, ty::mt { ty: it, mutbl }) if match ty::get(it).sty {
2153-
ty::ty_param(_) => true, _ => false
2154-
} && mutbl == ast::MutMutable => {
2155-
attrs.arg(idx, llvm::NoAliasAttribute)
2156-
.arg(idx, llvm::NonNullAttribute);
2157-
2158-
match b {
2159-
ReLateBound(_, BrAnon(_)) => {
2160-
attrs.arg(idx, llvm::NoCaptureAttribute);
2161-
}
2162-
_ => {}
2163-
}
2138+
ty::ty_uniq(_) => {
2139+
attrs.push((idx, llvm::NoAliasAttribute as u64));
2140+
attrs.push((idx, llvm::NonNullAttribute as u64));
21642141
}
2165-
21662142
// `&mut` pointer parameters never alias other parameters, or mutable global data
21672143
// `&` pointer parameters never alias either (for LLVM's purposes) as long as the
21682144
// interior is safe
21692145
ty::ty_rptr(b, mt) if mt.mutbl == ast::MutMutable ||
21702146
!ty::type_contents(ccx.tcx(), mt.ty).interior_unsafe() => {
2171-
2172-
let llsz = llsize_of_real(ccx, type_of::type_of(ccx, mt.ty));
2173-
attrs.arg(idx, llvm::NoAliasAttribute)
2174-
.arg(idx, llvm::DereferenceableAttribute(llsz));
2175-
2147+
attrs.push((idx, llvm::NoAliasAttribute as u64));
2148+
attrs.push((idx, llvm::NonNullAttribute as u64));
21762149
match b {
21772150
ReLateBound(_, BrAnon(_)) => {
2178-
attrs.arg(idx, llvm::NoCaptureAttribute);
2151+
attrs.push((idx, llvm::NoCaptureAttribute as u64));
21792152
}
21802153
_ => {}
21812154
}
21822155
}
2183-
21842156
// When a reference in an argument has no named lifetime, it's impossible for that
21852157
// reference to escape this function (returned or stored beyond the call by a closure).
2186-
ty::ty_rptr(ReLateBound(_, BrAnon(_)), mt) => {
2187-
let llsz = llsize_of_real(ccx, type_of::type_of(ccx, mt.ty));
2188-
attrs.arg(idx, llvm::NoCaptureAttribute)
2189-
.arg(idx, llvm::DereferenceableAttribute(llsz));
2158+
ty::ty_rptr(ReLateBound(_, BrAnon(_)), _) => {
2159+
attrs.push((idx, llvm::NoCaptureAttribute as u64));
2160+
attrs.push((idx, llvm::NonNullAttribute as u64));
21902161
}
2191-
2192-
// & pointer parameters are also never null and we know exactly how
2193-
// many bytes we can dereference
2194-
ty::ty_rptr(_, mt) => {
2195-
let llsz = llsize_of_real(ccx, type_of::type_of(ccx, mt.ty));
2196-
attrs.arg(idx, llvm::DereferenceableAttribute(llsz));
2162+
// & pointer parameters are never null
2163+
ty::ty_rptr(_, _) => {
2164+
attrs.push((idx, llvm::NonNullAttribute as u64));
21972165
}
21982166
_ => ()
21992167
}

0 commit comments

Comments
 (0)