Skip to content

Commit a59302a

Browse files
committed
---
yaml --- r: 137673 b: refs/heads/auto c: 158eaa6 h: refs/heads/master i: 137671: 749ca99 v: v3
1 parent 278a146 commit a59302a

Some content is hidden

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

56 files changed

+1122
-587
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: ba4081a5a8573875fed17545846f6f6902c8ba8d
16+
refs/heads/auto: 158eaa643b96f474c6aeb11a94d6ba444c1f3867
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/configure

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,13 +535,17 @@ probe CFG_LLDB lldb
535535

536536
if [ ! -z "$CFG_GDB" ]
537537
then
538-
# Extract the version
538+
# Store GDB's version
539539
CFG_GDB_VERSION=$($CFG_GDB --version 2>/dev/null | head -1)
540540
putvar CFG_GDB_VERSION
541541
fi
542542

543543
if [ ! -z "$CFG_LLDB" ]
544544
then
545+
# Store LLDB's version
546+
CFG_LLDB_VERSION=$($CFG_LLDB --version 2>/dev/null | head -1)
547+
putvar CFG_LLDB_VERSION
548+
545549
# If CFG_LLDB_PYTHON_DIR is not already set from the outside and valid, try to read it from
546550
# LLDB via the -P commandline options.
547551
if [ -z "$CFG_LLDB_PYTHON_DIR" ] || [ ! -d "$CFG_LLDB_PYTHON_DIR" ]

branches/auto/mk/tests.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
625625
--target $(2) \
626626
--host $(3) \
627627
--gdb-version="$(CFG_GDB_VERSION)" \
628+
--lldb-version="$(CFG_LLDB_VERSION)" \
628629
--android-cross-path=$(CFG_ANDROID_CROSS_PATH) \
629630
--adb-path=$(CFG_ADB) \
630631
--adb-test-dir=$(CFG_ADB_TEST_DIR) \

branches/auto/src/compiletest/common.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ pub struct Config {
133133
// Version of GDB
134134
pub gdb_version: Option<String>,
135135

136+
// Version of LLDB
137+
pub lldb_version: Option<String>,
138+
136139
// Path to the android tools
137140
pub android_cross_path: Path,
138141

branches/auto/src/compiletest/compiletest.rs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ pub fn parse_config(args: Vec<String> ) -> Config {
7171
optflag("", "jit", "run tests under the JIT"),
7272
optopt("", "target", "the target to build for", "TARGET"),
7373
optopt("", "host", "the host to build for", "HOST"),
74-
optopt("", "gdb-version", "the version of GDB used", "MAJOR.MINOR"),
74+
optopt("", "gdb-version", "the version of GDB used", "VERSION STRING"),
75+
optopt("", "lldb-version", "the version of LLDB used", "VERSION STRING"),
7576
optopt("", "android-cross-path", "Android NDK standalone path", "PATH"),
7677
optopt("", "adb-path", "path to the android debugger", "PATH"),
7778
optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH"),
@@ -149,6 +150,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
149150
target: opt_str2(matches.opt_str("target")),
150151
host: opt_str2(matches.opt_str("host")),
151152
gdb_version: extract_gdb_version(matches.opt_str("gdb-version")),
153+
lldb_version: extract_lldb_version(matches.opt_str("lldb-version")),
152154
android_cross_path: opt_path(matches, "android-cross-path"),
153155
adb_path: opt_str2(matches.opt_str("adb-path")),
154156
adb_test_dir: opt_str2(matches.opt_str("adb-test-dir")),
@@ -391,3 +393,37 @@ fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
391393
_ => None
392394
}
393395
}
396+
397+
fn extract_lldb_version(full_version_line: Option<String>) -> Option<String> {
398+
// Extract the major LLDB version from the given version string.
399+
// LLDB version strings are different for Apple and non-Apple platforms.
400+
// At the moment, this function only supports the Apple variant, which looks
401+
// like this:
402+
//
403+
// LLDB-179.5 (older versions)
404+
// lldb-300.2.51 (new versions)
405+
//
406+
// We are only interested in the major version number, so this function
407+
// will return `Some("179")` and `Some("300")` respectively.
408+
409+
match full_version_line {
410+
Some(ref full_version_line)
411+
if full_version_line.as_slice().trim().len() > 0 => {
412+
let full_version_line = full_version_line.as_slice().trim();
413+
414+
let re = Regex::new(r"[Ll][Ll][Dd][Bb]-([0-9]+)").unwrap();
415+
416+
match re.captures(full_version_line) {
417+
Some(captures) => {
418+
Some(captures.at(1).to_string())
419+
}
420+
None => {
421+
println!("Could not extract LLDB version from line '{}'",
422+
full_version_line);
423+
None
424+
}
425+
}
426+
},
427+
_ => None
428+
}
429+
}

branches/auto/src/compiletest/header.rs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,42 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
181181
}
182182
}
183183

184+
fn ignore_lldb(config: &Config, line: &str) -> bool {
185+
if config.mode != common::DebugInfoLldb {
186+
return false;
187+
}
188+
189+
if parse_name_directive(line, "ignore-lldb") {
190+
return true;
191+
}
192+
193+
match config.lldb_version {
194+
Some(ref actual_version) => {
195+
if line.contains("min-lldb-version") {
196+
let min_version = line.trim()
197+
.split(' ')
198+
.last()
199+
.expect("Malformed lldb version directive");
200+
// Ignore if actual version is smaller the minimum required
201+
// version
202+
lldb_version_to_int(actual_version.as_slice()) <
203+
lldb_version_to_int(min_version.as_slice())
204+
} else {
205+
false
206+
}
207+
}
208+
None => false
209+
}
210+
}
211+
184212
let val = iter_header(testfile, |ln| {
185213
!parse_name_directive(ln, "ignore-test") &&
186214
!parse_name_directive(ln, ignore_target(config).as_slice()) &&
187215
!parse_name_directive(ln, ignore_stage(config).as_slice()) &&
188216
!(config.mode == common::Pretty && parse_name_directive(ln, "ignore-pretty")) &&
189217
!(config.target != config.host && parse_name_directive(ln, "ignore-cross-compile")) &&
190218
!ignore_gdb(config, ln) &&
191-
!(config.mode == common::DebugInfoLldb && parse_name_directive(ln, "ignore-lldb"))
219+
!ignore_lldb(config, ln)
192220
});
193221

194222
!val
@@ -330,3 +358,12 @@ pub fn gdb_version_to_int(version_string: &str) -> int {
330358

331359
return major * 1000 + minor;
332360
}
361+
362+
pub fn lldb_version_to_int(version_string: &str) -> int {
363+
let error_string = format!(
364+
"Encountered LLDB version string with unexpected format: {}",
365+
version_string);
366+
let error_string = error_string.as_slice();
367+
let major: int = FromStr::from_str(version_string).expect(error_string);
368+
return major;
369+
}

branches/auto/src/compiletest/runtest.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,17 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
626626

627627
let exe_file = make_exe_name(config, testfile);
628628

629+
match config.lldb_version {
630+
Some(ref version) => {
631+
println!("NOTE: compiletest thinks it is using LLDB version {}",
632+
version.as_slice());
633+
}
634+
_ => {
635+
println!("NOTE: compiletest does not know which version of \
636+
LLDB it is using");
637+
}
638+
}
639+
629640
// Parse debugger commands etc from test files
630641
let DebuggerCommands {
631642
commands,

branches/auto/src/doc/guide-macros.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ forbidden.
8787

8888
Otherwise, the invocation syntax is free-form.
8989

90-
To take as an argument a fragment of Rust code, write `$` followed by a name
90+
To take a fragment of Rust code as an argument, write `$` followed by a name
9191
(for use on the right-hand side), followed by a `:`, followed by a *fragment
9292
specifier*. The fragment specifier denotes the sort of fragment to match. The
9393
most common fragment specifiers are:

branches/auto/src/doc/guide.md

Lines changed: 28 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -914,12 +914,23 @@ or 'breaks up,' the tuple, and assigns the bits to three bindings.
914914

915915
This pattern is very powerful, and we'll see it repeated more later.
916916

917-
The last thing to say about tuples is that they are only equivalent if
918-
the arity, types, and values are all identical.
917+
There also a few things you can do with a tuple as a whole, without
918+
destructuring. You can assign one tuple into another, if they have the same
919+
arity and contained types.
920+
921+
```rust
922+
let mut x = (1i, 2i);
923+
let y = (2i, 3i);
924+
925+
x = y;
926+
```
927+
928+
You can also check for equality with `==`. Again, this will only compile if the
929+
tuples have the same type.
919930

920931
```rust
921932
let x = (1i, 2i, 3i);
922-
let y = (2i, 3i, 4i);
933+
let y = (2i, 2i, 4i);
923934

924935
if x == y {
925936
println!("yes");
@@ -928,7 +939,7 @@ if x == y {
928939
}
929940
```
930941

931-
This will print `no`, as the values aren't equal.
942+
This will print `no`, because some of the values aren't equal.
932943

933944
One other use of tuples is to return multiple values from a function:
934945

@@ -5201,8 +5212,8 @@ We can check this out using a special flag to `rustc`. This code, in a file
52015212

52025213
```{rust}
52035214
fn main() {
5204-
let x = "Hello";
5205-
println!("x is: {:s}", x);
5215+
let x = 5i;
5216+
println!("x is: {}", x);
52065217
}
52075218
```
52085219

@@ -5214,32 +5225,19 @@ give us this huge result:
52145225
#![no_std]
52155226
#![feature(globs)]
52165227
#[phase(plugin, link)]
5217-
extern crate std = "std";
5218-
extern crate rt = "native";
5228+
extern crate "std" as std;
5229+
extern crate "native" as rt;
5230+
#[prelude_import]
52195231
use std::prelude::*;
52205232
fn main() {
5221-
let x = "Hello";
5233+
let x = 5i;
52225234
match (&x,) {
52235235
(__arg0,) => {
52245236
#[inline]
52255237
#[allow(dead_code)]
5226-
static __STATIC_FMTSTR: [::std::fmt::rt::Piece<'static>, ..2u] =
5227-
[::std::fmt::rt::String("x is: "),
5228-
::std::fmt::rt::Argument(::std::fmt::rt::Argument{position:
5229-
::std::fmt::rt::ArgumentNext,
5230-
format:
5231-
::std::fmt::rt::FormatSpec{fill:
5232-
' ',
5233-
align:
5234-
::std::fmt::rt::AlignUnknown,
5235-
flags:
5236-
0u,
5237-
precision:
5238-
::std::fmt::rt::CountImplied,
5239-
width:
5240-
::std::fmt::rt::CountImplied,},})];
5238+
static __STATIC_FMTSTR: [&'static str, ..1u] = ["x is: "];
52415239
let __args_vec =
5242-
&[::std::fmt::argument(::std::fmt::secret_string, __arg0)];
5240+
&[::std::fmt::argument(::std::fmt::secret_show, __arg0)];
52435241
let __args =
52445242
unsafe {
52455243
::std::fmt::Arguments::new(__STATIC_FMTSTR, __args_vec)
@@ -5250,45 +5248,16 @@ fn main() {
52505248
}
52515249
```
52525250

5253-
Intense. Here's a trimmed down version that's a bit easier to read:
5254-
5255-
```{rust,ignore}
5256-
fn main() {
5257-
let x = 5i;
5258-
match (&x,) {
5259-
(__arg0,) => {
5260-
static __STATIC_FMTSTR: =
5261-
[String("x is: "),
5262-
Argument(Argument {
5263-
position: ArgumentNext,
5264-
format: FormatSpec {
5265-
fill: ' ',
5266-
align: AlignUnknown,
5267-
flags: 0u,
5268-
precision: CountImplied,
5269-
width: CountImplied,
5270-
},
5271-
},
5272-
];
5273-
let __args_vec = &[argument(secret_string, __arg0)];
5274-
let __args = unsafe { Arguments::new(__STATIC_FMTSTR, __args_vec) };
5275-
5276-
println_args(&__args)
5277-
}
5278-
};
5279-
}
5280-
```
5281-
52825251
Whew! This isn't too terrible. You can see that we still `let x = 5i`,
52835252
but then things get a little bit hairy. Three more bindings get set: a
52845253
static format string, an argument vector, and the arguments. We then
52855254
invoke the `println_args` function with the generated arguments.
52865255

5287-
This is the code (well, the full version) that Rust actually compiles. You can
5288-
see all of the extra information that's here. We get all of the type safety and
5289-
options that it provides, but at compile time, and without needing to type all
5290-
of this out. This is how macros are powerful. Without them, you would need to
5291-
type all of this by hand to get a type checked `println`.
5256+
This is the code that Rust actually compiles. You can see all of the extra
5257+
information that's here. We get all of the type safety and options that it
5258+
provides, but at compile time, and without needing to type all of this out.
5259+
This is how macros are powerful. Without them, you would need to type all of
5260+
this by hand to get a type checked `println`.
52925261

52935262
For more on macros, please consult [the Macros Guide](guide-macros.html).
52945263
Macros are a very advanced and still slightly experimental feature, but don't

0 commit comments

Comments
 (0)