Skip to content

Commit 12c4e65

Browse files
committed
---
yaml --- r: 138244 b: refs/heads/try c: 2eb4f43 h: refs/heads/master v: v3
1 parent 243432b commit 12c4e65

File tree

123 files changed

+715
-1111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+715
-1111
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: 93e589c8726d91c084932af370742c15d97a0c24
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
5-
refs/heads/try: f418f400bc118c5a2883533ee335b1ffa876e408
5+
refs/heads/try: 2eb4f43a9ef9810ed046c7414b28258c9fe4dd24
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/mk/tests.mk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ check-notidy: cleantmptestlogs cleantestlibs all check-stage2
183183

184184
# A slightly smaller set of tests for smoke testing.
185185
check-lite: cleantestlibs cleantmptestlogs \
186-
check-stage2-debuginfo-lldb \
186+
$(foreach crate,$(TEST_TARGET_CRATES),check-stage2-$(crate)) \
187+
check-stage2-rpass \
188+
check-stage2-rfail check-stage2-cfail check-stage2-rmake
187189
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
188190

189191
# Only check the 'reference' tests: rpass/cfail/rfail/rmake.
@@ -582,6 +584,9 @@ ifeq ($(CFG_LLDB),)
582584
CTEST_DISABLE_debuginfo-lldb = "no lldb found"
583585
endif
584586

587+
# Completely disable LLDB tests for now
588+
CTEST_DISABLE_debuginfo-lldb = "LLDB tests are not enabled yet"
589+
585590
ifeq ($(CFG_CLANG),)
586591
CTEST_DISABLE_codegen = "no clang found"
587592
endif

branches/try/src/compiletest/compiletest.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::io::fs;
2525
use std::from_str::FromStr;
2626
use getopts::{optopt, optflag, reqopt};
2727
use common::Config;
28-
use common::{Pretty, DebugInfoGdb, Codegen};
28+
use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Codegen};
2929
use util::logv;
3030
use regex::Regex;
3131

@@ -235,6 +235,16 @@ pub fn run_tests(config: &Config) {
235235
os::setenv("RUST_TEST_TASKS","1");
236236
}
237237

238+
match config.mode {
239+
DebugInfoLldb => {
240+
// Some older versions of LLDB seem to have problems with multiple
241+
// instances running in parallel, so only run one test task at a
242+
// time.
243+
os::setenv("RUST_TEST_TASKS", "1");
244+
}
245+
_ => { /* proceed */ }
246+
}
247+
238248
let opts = test_opts(config);
239249
let tests = make_tests(config);
240250
// sadly osx needs some file descriptor limits raised for running tests in

branches/try/src/compiletest/runtest.rs

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -653,15 +653,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
653653
script_str.push_str("version\n");
654654

655655
// Switch LLDB into "Rust mode"
656-
let rust_src_root = find_rust_src_root(config)
657-
.expect("Could not find Rust source root");
658-
let rust_pp_module_rel_path = Path::new("./src/etc/lldb_rust_formatters.py");
659-
let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path)
660-
.as_str()
661-
.unwrap()
662-
.to_string();
663-
664-
script_str.push_str(format!("command script import {}\n", rust_pp_module_abs_path[])[]);
656+
script_str.push_str("command script import ./src/etc/lldb_rust_formatters.py\n");
665657
script_str.push_str("type summary add --no-value ");
666658
script_str.push_str("--python-function lldb_rust_formatters.print_val ");
667659
script_str.push_str("-x \".*\" --category Rust\n");
@@ -691,27 +683,18 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
691683
let debugger_script = make_out_name(config, testfile, "debugger.script");
692684

693685
// Let LLDB execute the script via lldb_batchmode.py
694-
let debugger_run_result = run_lldb(config,
695-
&exe_file,
696-
&debugger_script,
697-
&rust_src_root);
686+
let debugger_run_result = run_lldb(config, &exe_file, &debugger_script);
698687

699688
if !debugger_run_result.status.success() {
700689
fatal_proc_rec("Error while running LLDB", &debugger_run_result);
701690
}
702691

703692
check_debugger_output(&debugger_run_result, check_lines.as_slice());
704693

705-
fn run_lldb(config: &Config,
706-
test_executable: &Path,
707-
debugger_script: &Path,
708-
rust_src_root: &Path)
709-
-> ProcRes {
694+
fn run_lldb(config: &Config, test_executable: &Path, debugger_script: &Path) -> ProcRes {
710695
// Prepare the lldb_batchmode which executes the debugger script
711-
let lldb_script_path = rust_src_root.join(Path::new("./src/etc/lldb_batchmode.py"));
712-
713696
let mut cmd = Command::new("python");
714-
cmd.arg(lldb_script_path)
697+
cmd.arg("./src/etc/lldb_batchmode.py")
715698
.arg(test_executable)
716699
.arg(debugger_script)
717700
.env_set_all([("PYTHONPATH", config.lldb_python_dir.clone().unwrap().as_slice())]);

branches/try/src/doc/guide.md

Lines changed: 50 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,102 +1496,87 @@ low-level details matter, they really matter. Just remember that `String`s
14961496
allocate memory and control their data, while `&str`s are a reference to
14971497
another string, and you'll be all set.
14981498

1499-
# Arrays, Vectors, and Slices
1499+
# Vectors
15001500

1501-
Like many programming languages, Rust has list types to represent a sequence of
1502-
things. The most basic is the **array**, a fixed-size list of elements of the
1503-
same type. By default, arrays are immutable.
1501+
Like many programming languages, Rust has a list type for when you want a list
1502+
of things. But similar to strings, Rust has different types to represent this
1503+
idea: `Vec<T>` (a 'vector'), `[T, .. N]` (an 'array'), and `&[T]` (a 'slice').
1504+
Whew!
15041505

1505-
```{rust}
1506-
let a = [1i, 2i, 3i];
1507-
let mut m = [1i, 2i, 3i];
1508-
```
1509-
1510-
You can create an array with a given number of elements, all initialized to the
1511-
same value, with `[val, ..N]` syntax. The compiler ensures that arrays are
1512-
always initialized.
1506+
Vectors are similar to `String`s: they have a dynamic length, and they
1507+
allocate enough memory to fit. You can create a vector with the `vec!` macro:
15131508

15141509
```{rust}
1515-
let a = [0i, ..20]; // Shorthand for array of 20 elements all initialized to 0
1510+
let nums = vec![1i, 2i, 3i];
15161511
```
15171512

1518-
Arrays have type `[T,..N]`. We'll talk about this `T` notation later, when we
1519-
cover generics.
1513+
Notice that unlike the `println!` macro we've used in the past, we use square
1514+
brackets (`[]`) with `vec!`. Rust allows you to use either in either situation,
1515+
this is just convention.
15201516

1521-
You can get the number of elements in an array `a` with `a.len()`, and use
1522-
`a.iter()` to iterate over them with a for loop. This code will print each
1523-
number in order:
1517+
You can create an array with just square brackets:
15241518

15251519
```{rust}
1526-
let a = [1i, 2, 3]; // Only the first item needs a type suffix
1527-
1528-
println!("a has {} elements", a.len());
1529-
for e in a.iter() {
1530-
println!("{}", e);
1531-
}
1520+
let nums = [1i, 2i, 3i];
1521+
let nums = [1i, ..20]; // Shorthand for an array of 20 elements all initialized to 1
15321522
```
15331523

1534-
You can access a particular element of an array with **subscript notation**:
1524+
So what's the difference? An array has a fixed size, so you can't add or
1525+
subtract elements:
15351526

1536-
```{rust}
1537-
let names = ["Graydon", "Brian", "Niko"];
1527+
```{rust,ignore}
1528+
let mut nums = vec![1i, 2i, 3i];
1529+
nums.push(4i); // works
15381530
1539-
println!("The second name is: {}", names[1]);
1531+
let mut nums = [1i, 2i, 3i];
1532+
nums.push(4i); // error: type `[int, .. 3]` does not implement any method
1533+
// in scope named `push`
15401534
```
15411535

1542-
Subscripts start at zero, like in most programming languages, so the first name
1543-
is `names[0]` and the second name is `names[1]`. The above example prints
1544-
`The second name is: Brian`. If you try to use a subscript that is not in the
1545-
array, you will get an error: array access is bounds-checked at run-time. Such
1546-
errant access is the source of many bugs in other systems programming
1547-
languages.
1536+
The `push()` method lets you append a value to the end of the vector. But
1537+
since arrays have fixed sizes, adding an element doesn't make any sense.
1538+
You can see how it has the exact type in the error message: `[int, .. 3]`.
1539+
An array of `int`s, with length 3.
15481540

1549-
A **vector** is a dynamic or "growable" array, implemented as the standard
1550-
library type [`Vec<T>`](std/vec/) (we'll talk about what the `<T>` means
1551-
later). Vectors are to arrays what `String` is to `&str`. You can create them
1552-
with the `vec!` macro:
1541+
Similar to `&str`, a slice is a reference to another array. We can get a
1542+
slice from a vector by using the `as_slice()` method:
15531543

15541544
```{rust}
1555-
let v = vec![1i, 2, 3];
1545+
let vec = vec![1i, 2i, 3i];
1546+
let slice = vec.as_slice();
15561547
```
15571548

1558-
(Notice that unlike the `println!` macro we've used in the past, we use square
1559-
brackets `[]` with `vec!`. Rust allows you to use either in either situation,
1560-
this is just convention.)
1561-
1562-
You can get the length of, iterate over, and subscript vectors just like
1563-
arrays. In addition, (mutable) vectors can grow automatically:
1549+
All three types implement an `iter()` method, which returns an iterator. We'll
1550+
talk more about the details of iterators later, but for now, the `iter()` method
1551+
allows you to write a `for` loop that prints out the contents of a vector, array,
1552+
or slice:
15641553

15651554
```{rust}
1566-
let mut nums = vec![1i, 2, 3];
1567-
nums.push(4);
1568-
println!("The length of nums is now {}", nums.len()); // Prints 4
1555+
let vec = vec![1i, 2i, 3i];
1556+
1557+
for i in vec.iter() {
1558+
println!("{}", i);
1559+
}
15691560
```
15701561

1571-
Vectors have many more useful methods.
1562+
This code will print each number in order, on its own line.
15721563

1573-
A **slice** is a reference to (or "view" into) an array. They are useful for
1574-
allowing safe, efficient access to a portion of an array without copying. For
1575-
example, you might want to reference just one line of a file read into memory.
1576-
By nature, a slice is not created directly, but from an existing variable.
1577-
Slices have a length, can be mutable or not, and in many ways behave like
1578-
arrays:
1564+
You can access a particular element of a vector, array, or slice by using
1565+
**subscript notation**:
15791566

15801567
```{rust}
1581-
let a = [0i, 1, 2, 3, 4];
1582-
let middle = a.slice(1, 4); // A slice of a: just the elements [1,2,3]
1568+
let names = ["Graydon", "Brian", "Niko"];
15831569
1584-
for e in middle.iter() {
1585-
println!("{}", e); // Prints 1, 2, 3
1586-
}
1570+
println!("The second name is: {}", names[1]);
15871571
```
15881572

1589-
You can also take a slice of a vector, `String`, or `&str`, because they are
1590-
backed by arrays. Slices have type `&[T]`, which we'll talk about when we cover
1591-
generics.
1573+
These subscripts start at zero, like in most programming languages, so the
1574+
first name is `names[0]` and the second name is `names[1]`. The above example
1575+
prints `The second name is: Brian`.
15921576

1593-
We have now learned all of the most basic Rust concepts. We're ready to start
1594-
building our guessing game, we just need to know one last thing: how to get
1577+
There's a whole lot more to vectors, but that's enough to get started. We have
1578+
now learned all of the most basic Rust concepts. We're ready to start building
1579+
our guessing game, but we need to know how to do one last thing first: get
15951580
input from the keyboard. You can't have a guessing game without the ability to
15961581
guess!
15971582

0 commit comments

Comments
 (0)