Skip to content

Commit 505ff38

Browse files
committed
---
yaml --- r: 175290 b: refs/heads/master c: 796d009 h: refs/heads/master v: v3
1 parent e13bc7c commit 505ff38

Some content is hidden

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

61 files changed

+1666
-5693
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: d909dad0667db82576e2d1bc2df1f0f30023d0e8
2+
refs/heads/master: 796d00948a890fde67d9f92d1cc6e8c5edc2c879
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 777435990e0e91df6b72ce80c9b6fa485eeb5daa
55
refs/heads/try: 08f6380a9f0b866796080094f44fe25ea5636547

trunk/mk/crates.mk

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
TARGET_CRATES := libc std flate arena term \
5353
serialize getopts collections test rand \
54-
log regex graphviz core rbml alloc \
54+
log graphviz core rbml alloc \
5555
unicode rustc_bitflags
5656
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_resolve rustc_driver \
5757
rustc_trans rustc_back rustc_llvm rustc_privacy
@@ -95,16 +95,15 @@ DEPS_term := std log
9595
DEPS_getopts := std
9696
DEPS_collections := core alloc unicode
9797
DEPS_num := std
98-
DEPS_test := std getopts serialize rbml term regex native:rust_test_helpers
98+
DEPS_test := std getopts serialize rbml term native:rust_test_helpers
9999
DEPS_rand := core
100-
DEPS_log := std regex
101-
DEPS_regex := std
100+
DEPS_log := std
102101
DEPS_fmt_macros = std
103102

104103
TOOL_DEPS_compiletest := test getopts
105104
TOOL_DEPS_rustdoc := rustdoc
106105
TOOL_DEPS_rustc := rustc_driver
107-
TOOL_DEPS_rustbook := std regex rustdoc
106+
TOOL_DEPS_rustbook := std rustdoc
108107
TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs
109108
TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs
110109
TOOL_SOURCE_rustc := $(S)src/driver/driver.rs
@@ -130,9 +129,8 @@ DOC_CRATES := $(filter-out rustc, \
130129
$(filter-out rustc_driver, \
131130
$(filter-out rustc_privacy, \
132131
$(filter-out log, \
133-
$(filter-out regex, \
134132
$(filter-out getopts, \
135-
$(filter-out syntax, $(CRATES))))))))))))
133+
$(filter-out syntax, $(CRATES)))))))))))
136134
COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_resolve \
137135
rustc_typeck rustc_driver syntax rustc_privacy
138136

trunk/src/compiletest/common.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ pub use self::Mode::*;
1111

1212
use std::fmt;
1313
use std::str::FromStr;
14-
use regex::Regex;
1514

1615
#[derive(Clone, PartialEq, Debug)]
1716
pub enum Mode {
@@ -101,10 +100,7 @@ pub struct Config {
101100
pub run_ignored: bool,
102101

103102
// Only run tests that match this filter
104-
pub filter: Option<Regex>,
105-
106-
// Precompiled regex for finding expected errors in cfail
107-
pub cfail_regex: Regex,
103+
pub filter: Option<String>,
108104

109105
// Write out a parseable log of tests that were run
110106
pub logfile: Option<Path>,

trunk/src/compiletest/compiletest.rs

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ extern crate getopts;
2222

2323
#[macro_use]
2424
extern crate log;
25-
extern crate regex;
2625

2726
use std::os;
2827
use std::io;
@@ -33,7 +32,6 @@ use getopts::{optopt, optflag, reqopt};
3332
use common::Config;
3433
use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Codegen};
3534
use util::logv;
36-
use regex::Regex;
3735

3836
pub mod procsrv;
3937
pub mod util;
@@ -116,14 +114,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
116114
}
117115

118116
let filter = if !matches.free.is_empty() {
119-
let s = matches.free[0].as_slice();
120-
match regex::Regex::new(s) {
121-
Ok(re) => Some(re),
122-
Err(e) => {
123-
println!("failed to parse filter /{}/: {:?}", s, e);
124-
panic!()
125-
}
126-
}
117+
Some(matches.free[0].clone())
127118
} else {
128119
None
129120
};
@@ -145,7 +136,6 @@ pub fn parse_config(args: Vec<String> ) -> Config {
145136
.as_slice()).expect("invalid mode"),
146137
run_ignored: matches.opt_present("ignored"),
147138
filter: filter,
148-
cfail_regex: Regex::new(errors::EXPECTED_PATTERN).unwrap(),
149139
logfile: matches.opt_str("logfile").map(|s| Path::new(s)),
150140
runtool: matches.opt_str("runtool"),
151141
host_rustcflags: matches.opt_str("host-rustcflags"),
@@ -248,6 +238,9 @@ pub fn run_tests(config: &Config) {
248238
// parallel (especially when we have lots and lots of child processes).
249239
// For context, see #8904
250240
io::test::raise_fd_limit();
241+
// Prevent issue #21352 UAC blocking .exe containing 'patch' etc. on Windows
242+
// If #11207 is resolved (adding manifest to .exe) this becomes unnecessary
243+
os::setenv("__COMPAT_LAYER", "RunAsInvoker");
251244
let res = test::run_tests_console(&opts, tests.into_iter().collect());
252245
match res {
253246
Ok(true) => {}
@@ -371,18 +364,24 @@ fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
371364
if full_version_line.as_slice().trim().len() > 0 => {
372365
let full_version_line = full_version_line.as_slice().trim();
373366

374-
let re = Regex::new(r"(^|[^0-9])([0-9]\.[0-9])([^0-9]|$)").unwrap();
375-
376-
match re.captures(full_version_line) {
377-
Some(captures) => {
378-
Some(captures.at(2).unwrap_or("").to_string())
367+
// used to be a regex "(^|[^0-9])([0-9]\.[0-9])([^0-9]|$)"
368+
for (pos, c) in full_version_line.char_indices() {
369+
if !c.is_digit(10) { continue }
370+
if pos + 2 >= full_version_line.len() { continue }
371+
if full_version_line.char_at(pos + 1) != '.' { continue }
372+
if !full_version_line.char_at(pos + 2).is_digit(10) { continue }
373+
if pos > 0 && full_version_line.char_at_reverse(pos).is_digit(10) {
374+
continue
379375
}
380-
None => {
381-
println!("Could not extract GDB version from line '{}'",
382-
full_version_line);
383-
None
376+
if pos + 3 < full_version_line.len() &&
377+
full_version_line.char_at(pos + 3).is_digit(10) {
378+
continue
384379
}
380+
return Some(full_version_line[pos..pos+3].to_string());
385381
}
382+
println!("Could not extract GDB version from line '{}'",
383+
full_version_line);
384+
None
386385
},
387386
_ => None
388387
}
@@ -405,18 +404,26 @@ fn extract_lldb_version(full_version_line: Option<String>) -> Option<String> {
405404
if full_version_line.as_slice().trim().len() > 0 => {
406405
let full_version_line = full_version_line.as_slice().trim();
407406

408-
let re = Regex::new(r"[Ll][Ll][Dd][Bb]-([0-9]+)").unwrap();
409-
410-
match re.captures(full_version_line) {
411-
Some(captures) => {
412-
Some(captures.at(1).unwrap_or("").to_string())
413-
}
414-
None => {
415-
println!("Could not extract LLDB version from line '{}'",
416-
full_version_line);
417-
None
418-
}
407+
for (pos, l) in full_version_line.char_indices() {
408+
if l != 'l' && l != 'L' { continue }
409+
if pos + 5 >= full_version_line.len() { continue }
410+
let l = full_version_line.char_at(pos + 1);
411+
if l != 'l' && l != 'L' { continue }
412+
let d = full_version_line.char_at(pos + 2);
413+
if d != 'd' && d != 'D' { continue }
414+
let b = full_version_line.char_at(pos + 3);
415+
if b != 'b' && b != 'B' { continue }
416+
let dash = full_version_line.char_at(pos + 4);
417+
if dash != '-' { continue }
418+
419+
let vers = full_version_line[pos + 5..].chars().take_while(|c| {
420+
c.is_digit(10)
421+
}).collect::<String>();
422+
if vers.len() > 0 { return Some(vers) }
419423
}
424+
println!("Could not extract LLDB version from line '{}'",
425+
full_version_line);
426+
None
420427
},
421428
_ => None
422429
}

trunk/src/compiletest/errors.rs

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,26 @@
99
// except according to those terms.
1010
use self::WhichLine::*;
1111

12-
use std::ascii::AsciiExt;
1312
use std::io::{BufferedReader, File};
14-
use regex::Regex;
1513

1614
pub struct ExpectedError {
1715
pub line: uint,
1816
pub kind: String,
1917
pub msg: String,
2018
}
2119

20+
#[derive(PartialEq, Show)]
21+
enum WhichLine { ThisLine, FollowPrevious(uint), AdjustBackward(uint) }
22+
2223
/// Looks for either "//~| KIND MESSAGE" or "//~^^... KIND MESSAGE"
2324
/// The former is a "follow" that inherits its target from the preceding line;
2425
/// the latter is an "adjusts" that goes that many lines up.
2526
///
2627
/// Goal is to enable tests both like: //~^^^ ERROR go up three
2728
/// and also //~^ ERROR message one for the preceding line, and
2829
/// //~| ERROR message two for that same line.
29-
30-
pub static EXPECTED_PATTERN : &'static str =
31-
r"//~(?P<follow>\|)?(?P<adjusts>\^*)\s*(?P<kind>\S*)\s*(?P<msg>.*)";
32-
33-
#[derive(PartialEq, Show)]
34-
enum WhichLine { ThisLine, FollowPrevious(uint), AdjustBackward(uint) }
35-
3630
// Load any test directives embedded in the file
37-
pub fn load_errors(re: &Regex, testfile: &Path) -> Vec<ExpectedError> {
31+
pub fn load_errors(testfile: &Path) -> Vec<ExpectedError> {
3832
let mut rdr = BufferedReader::new(File::open(testfile).unwrap());
3933

4034
// `last_nonfollow_error` tracks the most recently seen
@@ -50,7 +44,7 @@ pub fn load_errors(re: &Regex, testfile: &Path) -> Vec<ExpectedError> {
5044
rdr.lines().enumerate().filter_map(|(line_no, ln)| {
5145
parse_expected(last_nonfollow_error,
5246
line_no + 1,
53-
ln.unwrap().as_slice(), re)
47+
ln.unwrap().as_slice())
5448
.map(|(which, error)| {
5549
match which {
5650
FollowPrevious(_) => {}
@@ -63,30 +57,39 @@ pub fn load_errors(re: &Regex, testfile: &Path) -> Vec<ExpectedError> {
6357

6458
fn parse_expected(last_nonfollow_error: Option<uint>,
6559
line_num: uint,
66-
line: &str,
67-
re: &Regex) -> Option<(WhichLine, ExpectedError)> {
68-
re.captures(line).and_then(|caps| {
69-
let adjusts = caps.name("adjusts").unwrap_or("").len();
70-
let kind = caps.name("kind").unwrap_or("").to_ascii_lowercase();
71-
let msg = caps.name("msg").unwrap_or("").trim().to_string();
72-
let follow = caps.name("follow").unwrap_or("").len() > 0;
60+
line: &str) -> Option<(WhichLine, ExpectedError)> {
61+
let start = match line.find_str("//~") { Some(i) => i, None => return None };
62+
let (follow, adjusts) = if line.char_at(start + 3) == '|' {
63+
(true, 0)
64+
} else {
65+
(false, line[start + 3..].chars().take_while(|c| *c == '^').count())
66+
};
67+
let kind_start = start + 3 + adjusts + (follow as usize);
68+
let letters = line[kind_start..].chars();
69+
let kind = letters.skip_while(|c| c.is_whitespace())
70+
.take_while(|c| !c.is_whitespace())
71+
.map(|c| c.to_lowercase())
72+
.collect::<String>();
73+
let letters = line[kind_start..].chars();
74+
let msg = letters.skip_while(|c| c.is_whitespace())
75+
.skip_while(|c| !c.is_whitespace())
76+
.collect::<String>().trim().to_string();
7377

74-
let (which, line) = if follow {
75-
assert!(adjusts == 0, "use either //~| or //~^, not both.");
76-
let line = last_nonfollow_error.unwrap_or_else(|| {
77-
panic!("encountered //~| without preceding //~^ line.")
78-
});
79-
(FollowPrevious(line), line)
80-
} else {
81-
let which =
82-
if adjusts > 0 { AdjustBackward(adjusts) } else { ThisLine };
83-
let line = line_num - adjusts;
84-
(which, line)
85-
};
78+
let (which, line) = if follow {
79+
assert!(adjusts == 0, "use either //~| or //~^, not both.");
80+
let line = last_nonfollow_error.unwrap_or_else(|| {
81+
panic!("encountered //~| without preceding //~^ line.")
82+
});
83+
(FollowPrevious(line), line)
84+
} else {
85+
let which =
86+
if adjusts > 0 { AdjustBackward(adjusts) } else { ThisLine };
87+
let line = line_num - adjusts;
88+
(which, line)
89+
};
8690

87-
debug!("line={} which={:?} kind={:?} msg={:?}", line_num, which, kind, msg);
88-
Some((which, ExpectedError { line: line,
89-
kind: kind,
90-
msg: msg, }))
91-
})
91+
debug!("line={} which={:?} kind={:?} msg={:?}", line_num, which, kind, msg);
92+
Some((which, ExpectedError { line: line,
93+
kind: kind,
94+
msg: msg, }))
9295
}

trunk/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) {
9999
}
100100

101101
let output_to_check = get_output(props, &proc_res);
102-
let expected_errors = errors::load_errors(&config.cfail_regex, testfile);
102+
let expected_errors = errors::load_errors(testfile);
103103
if !expected_errors.is_empty() {
104104
if !props.error_patterns.is_empty() {
105105
fatal("both error pattern and expected errors specified");

trunk/src/doc/reference.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,15 @@ Rust syntax is restricted in two ways:
739739
* `concat!` : concatenates a comma-separated list of literals
740740
* `concat_idents!` : create a new identifier by concatenating the arguments
741741

742+
The following attributes are used for quasiquoting in procedural macros:
743+
744+
* `quote_expr!`
745+
* `quote_item!`
746+
* `quote_pat!`
747+
* `quote_stmt!`
748+
* `quote_tokens!`
749+
* `quote_ty!`
750+
742751
# Crates and source files
743752

744753
Rust is a *compiled* language. Its semantics obey a *phase distinction*
@@ -2028,6 +2037,9 @@ type int8_t = i8;
20282037
item](#language-items) for more details.
20292038
- `test` - indicates that this function is a test function, to only be compiled
20302039
in case of `--test`.
2040+
- `should_fail` - indicates that this test function should panic, inverting the success condition.
2041+
- `cold` - The function is unlikely to be executed, so optimize it (and calls
2042+
to it) differently.
20312043

20322044
### Static-only attributes
20332045

@@ -3135,18 +3147,17 @@ The precedence of Rust binary operators is ordered as follows, going from
31353147
strong to weak:
31363148

31373149
```{.text .precedence}
3138-
* / %
31393150
as
3151+
* / %
31403152
+ -
31413153
<< >>
31423154
&
31433155
^
31443156
|
3145-
< > <= >=
3146-
== !=
3157+
== != < > <= >=
31473158
&&
31483159
||
3149-
=
3160+
= ..
31503161
```
31513162

31523163
Operators at the same precedence level are evaluated left-to-right. [Unary

0 commit comments

Comments
 (0)