Skip to content

Commit 16d6232

Browse files
---
yaml --- r: 137564 b: refs/heads/master c: 895aac9 h: refs/heads/master v: v3
1 parent 7bd0e90 commit 16d6232

File tree

22 files changed

+174
-219
lines changed

22 files changed

+174
-219
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 63fe80e1ffd036e99e1c707116774ac10203e2f1
2+
refs/heads/master: 895aac9935f8804bf4a3669bbba1caea29c656f2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: cd53dac86b43e0b46f06ab265b71526242a2fc5e

trunk/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" ]

trunk/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) \

trunk/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

trunk/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+
}

trunk/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+
}

trunk/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,

trunk/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 a fragment of Rust code as an argument, write `$` followed by a name
90+
To take as an argument a fragment of Rust code, 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:

trunk/src/doc/guide.md

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5212,8 +5212,8 @@ We can check this out using a special flag to `rustc`. This code, in a file
52125212

52135213
```{rust}
52145214
fn main() {
5215-
let x = 5i;
5216-
println!("x is: {}", x);
5215+
let x = "Hello";
5216+
println!("x is: {:s}", x);
52175217
}
52185218
```
52195219

@@ -5225,19 +5225,32 @@ give us this huge result:
52255225
#![no_std]
52265226
#![feature(globs)]
52275227
#[phase(plugin, link)]
5228-
extern crate "std" as std;
5229-
extern crate "native" as rt;
5230-
#[prelude_import]
5228+
extern crate std = "std";
5229+
extern crate rt = "native";
52315230
use std::prelude::*;
52325231
fn main() {
5233-
let x = 5i;
5232+
let x = "Hello";
52345233
match (&x,) {
52355234
(__arg0,) => {
52365235
#[inline]
52375236
#[allow(dead_code)]
5238-
static __STATIC_FMTSTR: [&'static str, ..1u] = ["x is: "];
5237+
static __STATIC_FMTSTR: [::std::fmt::rt::Piece<'static>, ..2u] =
5238+
[::std::fmt::rt::String("x is: "),
5239+
::std::fmt::rt::Argument(::std::fmt::rt::Argument{position:
5240+
::std::fmt::rt::ArgumentNext,
5241+
format:
5242+
::std::fmt::rt::FormatSpec{fill:
5243+
' ',
5244+
align:
5245+
::std::fmt::rt::AlignUnknown,
5246+
flags:
5247+
0u,
5248+
precision:
5249+
::std::fmt::rt::CountImplied,
5250+
width:
5251+
::std::fmt::rt::CountImplied,},})];
52395252
let __args_vec =
5240-
&[::std::fmt::argument(::std::fmt::secret_show, __arg0)];
5253+
&[::std::fmt::argument(::std::fmt::secret_string, __arg0)];
52415254
let __args =
52425255
unsafe {
52435256
::std::fmt::Arguments::new(__STATIC_FMTSTR, __args_vec)
@@ -5248,16 +5261,45 @@ fn main() {
52485261
}
52495262
```
52505263

5264+
Intense. Here's a trimmed down version that's a bit easier to read:
5265+
5266+
```{rust,ignore}
5267+
fn main() {
5268+
let x = 5i;
5269+
match (&x,) {
5270+
(__arg0,) => {
5271+
static __STATIC_FMTSTR: =
5272+
[String("x is: "),
5273+
Argument(Argument {
5274+
position: ArgumentNext,
5275+
format: FormatSpec {
5276+
fill: ' ',
5277+
align: AlignUnknown,
5278+
flags: 0u,
5279+
precision: CountImplied,
5280+
width: CountImplied,
5281+
},
5282+
},
5283+
];
5284+
let __args_vec = &[argument(secret_string, __arg0)];
5285+
let __args = unsafe { Arguments::new(__STATIC_FMTSTR, __args_vec) };
5286+
5287+
println_args(&__args)
5288+
}
5289+
};
5290+
}
5291+
```
5292+
52515293
Whew! This isn't too terrible. You can see that we still `let x = 5i`,
52525294
but then things get a little bit hairy. Three more bindings get set: a
52535295
static format string, an argument vector, and the arguments. We then
52545296
invoke the `println_args` function with the generated arguments.
52555297

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`.
5298+
This is the code (well, the full version) that Rust actually compiles. You can
5299+
see all of the extra information that's here. We get all of the type safety and
5300+
options that it provides, but at compile time, and without needing to type all
5301+
of this out. This is how macros are powerful. Without them, you would need to
5302+
type all of this by hand to get a type checked `println`.
52615303

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

trunk/src/doc/reference.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ grammar as double-quoted strings. Other tokens have exact rules given.
187187

188188
The keywords are the following strings, organized by first letter:
189189

190-
<div id="keywords">
191-
| | | | |
192190
|----------|--------|--------|-------|
193191
| as | | | |
194192
|----------|--------|--------|-------|
@@ -218,7 +216,6 @@ The keywords are the following strings, organized by first letter:
218216
|----------|--------|--------|-------|
219217
| while | | | |
220218
|----------|--------|--------|-------|
221-
</div>
222219

223220
Each of these keywords has special meaning in its grammar, and all of them are
224221
excluded from the `ident` rule.

trunk/src/doc/rust.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,5 +392,3 @@ pre.rust { position: relative; }
392392
background-color: #fff !important;
393393
}
394394
}
395-
396-
#keywords table td { border: none; }

trunk/src/etc/vim/syntax/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ syn match rustMacroRepeatCount ".\?[*+]" contained
5454
syn match rustMacroVariable "$\w\+"
5555

5656
" Reserved (but not yet used) keywords {{{2
57-
syn keyword rustReservedKeyword alignof be do offsetof priv pure sizeof typeof unsized yield abstract final override
57+
syn keyword rustReservedKeyword alignof be do offsetof priv pure sizeof typeof unsized yield
5858

5959
" Built-in types {{{2
6060
syn keyword rustType int uint float char bool u8 u16 u32 u64 f32

trunk/src/libcollections/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ use vec::Vec;
7575
pub use core::str::{from_utf8, CharEq, Chars, CharOffsets};
7676
pub use core::str::{Bytes, CharSplits};
7777
pub use core::str::{CharSplitsN, AnyLines, MatchIndices, StrSplits};
78-
pub use core::str::{Utf16CodeUnits, eq_slice, is_utf8, is_utf16, Utf16Items};
78+
pub use core::str::{eq_slice, is_utf8, is_utf16, Utf16Items};
7979
pub use core::str::{Utf16Item, ScalarValue, LoneSurrogate, utf16_items};
8080
pub use core::str::{truncate_utf16_at_nul, utf8_char_width, CharRange};
8181
pub use core::str::{Str, StrSlice};

trunk/src/libcollections/string.rs

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use slice::CloneableVector;
2828
use str;
2929
use str::{CharRange, StrAllocating, MaybeOwned, Owned};
3030
use str::Slice as MaybeOwnedSlice; // So many `Slice`s...
31-
use vec::{DerefVec, Vec, as_vec};
31+
use vec::Vec;
3232

3333
/// A growable string stored as a UTF-8 encoded buffer.
3434
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord)]
@@ -973,24 +973,6 @@ impl ops::Slice<uint, str> for String {
973973
}
974974
}
975975

976-
/// Wrapper type providing a `&String` reference via `Deref`.
977-
#[experimental]
978-
pub struct DerefString<'a> {
979-
x: DerefVec<'a, u8>
980-
}
981-
982-
impl<'a> Deref<String> for DerefString<'a> {
983-
fn deref<'b>(&'b self) -> &'b String {
984-
unsafe { mem::transmute(&*self.x) }
985-
}
986-
}
987-
988-
/// Convert a string slice to a wrapper type providing a `&String` reference.
989-
#[experimental]
990-
pub fn as_string<'a>(x: &'a str) -> DerefString<'a> {
991-
DerefString { x: as_vec(x.as_bytes()) }
992-
}
993-
994976
/// Unsafe operations
995977
#[unstable = "waiting on raw module conventions"]
996978
pub mod raw {
@@ -1057,15 +1039,9 @@ mod tests {
10571039
use {Mutable, MutableSeq};
10581040
use str;
10591041
use str::{Str, StrSlice, Owned};
1060-
use super::{as_string, String};
1042+
use super::String;
10611043
use vec::Vec;
10621044

1063-
#[test]
1064-
fn test_as_string() {
1065-
let x = "foo";
1066-
assert_eq!(x, as_string(x).as_slice());
1067-
}
1068-
10691045
#[test]
10701046
fn test_from_str() {
10711047
let owned: Option<::std::string::String> = from_str("string");

0 commit comments

Comments
 (0)