Skip to content

Commit 7ad82e3

Browse files
committed
---
yaml --- r: 131902 b: refs/heads/dist-snap c: b35d1a8 h: refs/heads/master v: v3
1 parent f25c83a commit 7ad82e3

File tree

4 files changed

+29
-11
lines changed

4 files changed

+29
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 457a3c991d79b971be07fce75f9d0c12848fb37c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: d3adccda4e0a90e4163c261d6b9ab4de7cfd0ccb
9+
refs/heads/dist-snap: b35d1a8368c7afe0d43dd3e451e884c035afc517
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libcollections/vec.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,21 @@ impl<T:Clone> Clone for Vec<T> {
363363
}
364364
}
365365

366+
impl<T> Index<uint,T> for Vec<T> {
367+
#[inline]
368+
fn index<'a>(&'a self, index: &uint) -> &'a T {
369+
self.get(*index)
370+
}
371+
}
372+
373+
// FIXME(#12825) Indexing will always try IndexMut first and that causes issues.
374+
/*impl<T> IndexMut<uint,T> for Vec<T> {
375+
#[inline]
376+
fn index_mut<'a>(&'a mut self, index: &uint) -> &'a mut T {
377+
self.get_mut(*index)
378+
}
379+
}*/
380+
366381
impl<T> FromIterator<T> for Vec<T> {
367382
#[inline]
368383
fn from_iter<I:Iterator<T>>(mut iterator: I) -> Vec<T> {
@@ -1847,6 +1862,19 @@ mod tests {
18471862
v.truncate(0);
18481863
}
18491864

1865+
#[test]
1866+
fn test_index() {
1867+
let vec = vec!(1i, 2, 3);
1868+
assert!(vec[1] == 2);
1869+
}
1870+
1871+
#[test]
1872+
#[should_fail]
1873+
fn test_index_out_of_bounds() {
1874+
let vec = vec!(1i, 2, 3);
1875+
let _ = vec[3];
1876+
}
1877+
18501878
#[bench]
18511879
fn bench_new(b: &mut Bencher) {
18521880
b.iter(|| {

branches/dist-snap/src/librustc/driver/config.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,6 @@ cgoptions!(
332332
"prefer dynamic linking to static linking"),
333333
no_integrated_as: bool = (false, parse_bool,
334334
"use an external assembler rather than LLVM's integrated one"),
335-
no_redzone: bool = (false, parse_bool,
336-
"disable the use of the redzone"),
337335
relocation_model: String = ("pic".to_string(), parse_string,
338336
"choose the relocation model to use (llc -relocation-model for details)"),
339337
metadata: Vec<String> = (Vec::new(), parse_list,

branches/dist-snap/src/librustc/middle/trans/base.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,6 @@ fn decl_fn(ccx: &CrateContext, name: &str, cc: llvm::CallConv,
193193
_ => {}
194194
}
195195

196-
if ccx.tcx.sess.opts.cg.no_redzone {
197-
unsafe {
198-
llvm::LLVMAddFunctionAttribute(llfn,
199-
llvm::FunctionIndex as c_uint,
200-
llvm::NoRedZoneAttribute as uint64_t)
201-
}
202-
}
203-
204196
llvm::SetFunctionCallConv(llfn, cc);
205197
// Function addresses in Rust are never significant, allowing functions to be merged.
206198
llvm::SetUnnamedAddr(llfn, true);

0 commit comments

Comments
 (0)