Skip to content

Commit ecf82db

Browse files
committed
---
yaml --- r: 274930 b: refs/heads/stable c: 3eebec6 h: refs/heads/master
1 parent 5f9f501 commit ecf82db

File tree

10 files changed

+177
-101
lines changed

10 files changed

+177
-101
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: c244acceb45e0b739d8ad6a896870c93dbb9acec
32+
refs/heads/stable: 3eebec697ca4031b98aa32939701ed80e3a41706
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/doc/book/functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ You get this error:
6868

6969
```text
7070
expected one of `!`, `:`, or `@`, found `)`
71-
fn print_number(x, y) {
71+
fn print_sum(x, y) {
7272
```
7373

7474
This is a deliberate design decision. While full-program inference is possible,

branches/stable/src/doc/book/strings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The second, with a `\`, trims the spaces and the newline:
3939

4040
```rust
4141
let s = "foo\
42-
bar";
42+
bar";
4343

4444
assert_eq!("foobar", s);
4545
```
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/usr/bin/env python2
2+
3+
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
4+
# file at the top-level directory of this distribution and at
5+
# http://rust-lang.org/COPYRIGHT.
6+
#
7+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10+
# option. This file may not be copied, modified, or distributed
11+
# except according to those terms.
12+
13+
from __future__ import absolute_import, division, print_function
14+
import argparse
15+
import datetime
16+
import os.path as path
17+
18+
19+
def print_tests(tests):
20+
print('\n'.join([test_tostr(t) for t in tests]))
21+
22+
23+
def read_tests(f):
24+
basename, _ = path.splitext(path.basename(f))
25+
tests = []
26+
for lineno, line in enumerate(open(f), 1):
27+
fields = filter(None, map(str.strip, line.split('\t')))
28+
if not (4 <= len(fields) <= 5) \
29+
or 'E' not in fields[0] or fields[0][0] == '#':
30+
continue
31+
32+
opts, pat, text, sgroups = fields[0:4]
33+
groups = [] # groups as integer ranges
34+
if sgroups == 'NOMATCH':
35+
groups = [None]
36+
elif ',' in sgroups:
37+
noparen = map(lambda s: s.strip('()'), sgroups.split(')('))
38+
for g in noparen:
39+
s, e = map(str.strip, g.split(','))
40+
if s == '?' and e == '?':
41+
groups.append(None)
42+
else:
43+
groups.append((int(s), int(e)))
44+
else:
45+
# This skips tests that should result in an error.
46+
# There aren't many, so I think we can just capture those
47+
# manually. Possibly fix this in future.
48+
continue
49+
50+
if pat == 'SAME':
51+
pat = tests[-1][1]
52+
if '$' in opts:
53+
pat = pat.decode('string_escape')
54+
text = text.decode('string_escape')
55+
if 'i' in opts:
56+
pat = '(?i)%s' % pat
57+
58+
name = '%s_%d' % (basename, lineno)
59+
tests.append((name, pat, text, groups))
60+
return tests
61+
62+
63+
def test_tostr(t):
64+
lineno, pat, text, groups = t
65+
options = map(group_tostr, groups)
66+
return 'mat!{match_%s, r"%s", r"%s", %s}' \
67+
% (lineno, pat, '' if text == "NULL" else text, ', '.join(options))
68+
69+
70+
def group_tostr(g):
71+
if g is None:
72+
return 'None'
73+
else:
74+
return 'Some((%d, %d))' % (g[0], g[1])
75+
76+
77+
if __name__ == '__main__':
78+
parser = argparse.ArgumentParser(
79+
description='Generate match tests from an AT&T POSIX test file.')
80+
aa = parser.add_argument
81+
aa('files', nargs='+',
82+
help='A list of dat AT&T POSIX test files. See src/libregexp/testdata')
83+
args = parser.parse_args()
84+
85+
tests = []
86+
for f in args.files:
87+
tests += read_tests(f)
88+
89+
tpl = '''// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
90+
// file at the top-level directory of this distribution and at
91+
// http://rust-lang.org/COPYRIGHT.
92+
//
93+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
94+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
95+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
96+
// option. This file may not be copied, modified, or distributed
97+
// except according to those terms.
98+
99+
// ignore-tidy-linelength
100+
101+
// DO NOT EDIT. Automatically generated by 'src/etc/regexp-match-tests'
102+
// on {date}.
103+
'''
104+
print(tpl.format(date=str(datetime.datetime.now())))
105+
106+
for f in args.files:
107+
print('// Tests from %s' % path.basename(f))
108+
print_tests(read_tests(f))
109+
print('')

branches/stable/src/libcore/num/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ macro_rules! int_impl {
479479
}
480480
}
481481

482-
/// Checked negation. Computes `-self`, returning `None` if `self ==
482+
/// Checked negation. Computes `!self`, returning `None` if `self ==
483483
/// MIN`.
484484
///
485485
/// # Examples

branches/stable/src/libcore/ptr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ pub unsafe fn read<T>(src: *const T) -> T {
127127
tmp
128128
}
129129

130-
#[allow(missing_docs)]
130+
/// Variant of read_and_zero that writes the specific drop-flag byte
131+
/// (which may be more appropriate than zero).
131132
#[inline(always)]
132133
#[unstable(feature = "filling_drop",
133134
reason = "may play a larger role in std::ptr future extensions",

branches/stable/src/libcore/str/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl Utf8Error {
157157
/// // std::str::from_utf8 returns a Utf8Error
158158
/// let error = str::from_utf8(&sparkle_heart).unwrap_err();
159159
///
160-
/// // the second byte is invalid here
160+
/// // the first byte is invalid here
161161
/// assert_eq!(1, error.valid_up_to());
162162
/// ```
163163
#[stable(feature = "utf8_error", since = "1.5.0")]
@@ -174,10 +174,10 @@ impl Utf8Error {
174174
///
175175
/// If you are sure that the byte slice is valid UTF-8, and you don't want to
176176
/// incur the overhead of the validity check, there is an unsafe version of
177-
/// this function, [`from_utf8_unchecked()`][fromutf8u], which has the same
177+
/// this function, [`from_utf8_unchecked()`][fromutf8], which has the same
178178
/// behavior but skips the check.
179179
///
180-
/// [fromutf8u]: fn.from_utf8_unchecked.html
180+
/// [fromutf8]: fn.from_utf8.html
181181
///
182182
/// If you need a `String` instead of a `&str`, consider
183183
/// [`String::from_utf8()`][string].
@@ -275,7 +275,7 @@ unsafe fn from_raw_parts_mut<'a>(p: *mut u8, len: usize) -> &'a mut str {
275275
/// Converts a slice of bytes to a string slice without checking
276276
/// that the string contains valid UTF-8.
277277
///
278-
/// See the safe version, [`from_utf8()`][fromutf8], for more information.
278+
/// See the safe version, [`from_utf8()`][fromutf8], for more.
279279
///
280280
/// [fromutf8]: fn.from_utf8.html
281281
///

branches/stable/src/libstd/fs.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,26 +2151,6 @@ mod tests {
21512151
"foo");
21522152
}
21532153

2154-
#[test]
2155-
fn read_link() {
2156-
if cfg!(windows) {
2157-
// directory symlink
2158-
assert_eq!(check!(fs::read_link(r"C:\Users\All Users")).to_str().unwrap(),
2159-
r"C:\ProgramData");
2160-
// junction
2161-
assert_eq!(check!(fs::read_link(r"C:\Users\Default User")).to_str().unwrap(),
2162-
r"C:\Users\Default");
2163-
// junction with special permissions
2164-
assert_eq!(check!(fs::read_link(r"C:\Documents and Settings\")).to_str().unwrap(),
2165-
r"C:\Users");
2166-
}
2167-
let tmpdir = tmpdir();
2168-
let link = tmpdir.join("link");
2169-
if !got_symlink_permission(&tmpdir) { return };
2170-
check!(symlink_file(&"foo", &link));
2171-
assert_eq!(check!(fs::read_link(&link)).to_str().unwrap(), "foo");
2172-
}
2173-
21742154
#[test]
21752155
fn readlink_not_symlink() {
21762156
let tmpdir = tmpdir();

branches/stable/src/libstd/sys/windows/c.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ pub const MAXIMUM_REPARSE_DATA_BUFFER_SIZE: usize = 16 * 1024;
240240
pub const FSCTL_GET_REPARSE_POINT: DWORD = 0x900a8;
241241
pub const IO_REPARSE_TAG_SYMLINK: DWORD = 0xa000000c;
242242
pub const IO_REPARSE_TAG_MOUNT_POINT: DWORD = 0xa0000003;
243-
pub const SYMLINK_FLAG_RELATIVE: DWORD = 0x00000001;
244243
pub const FSCTL_SET_REPARSE_POINT: DWORD = 0x900a4;
245244
pub const FSCTL_DELETE_REPARSE_POINT: DWORD = 0x900ac;
246245

@@ -534,15 +533,6 @@ pub struct SYMBOLIC_LINK_REPARSE_BUFFER {
534533
pub PathBuffer: WCHAR,
535534
}
536535

537-
#[repr(C)]
538-
pub struct MOUNT_POINT_REPARSE_BUFFER {
539-
pub SubstituteNameOffset: c_ushort,
540-
pub SubstituteNameLength: c_ushort,
541-
pub PrintNameOffset: c_ushort,
542-
pub PrintNameLength: c_ushort,
543-
pub PathBuffer: WCHAR,
544-
}
545-
546536
pub type LPPROGRESS_ROUTINE = ::option::Option<unsafe extern "system" fn(
547537
TotalFileSize: LARGE_INTEGER,
548538
TotalBytesTransferred: LARGE_INTEGER,

0 commit comments

Comments
 (0)