Skip to content

Rollup of PRs in the queue; Wednesday #23031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 47 commits into from
Mar 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
f1eebb8
Order list of linted files by frequency
iKevinY Feb 6, 2015
9569691
Refactor code in tidy.py
iKevinY Feb 7, 2015
e93b2ab
Bison grammar: support parsing default trait impls
bleibig Mar 1, 2015
f1fe1b5
Bison grammar: allow ExprQualifiedPath to have optional "as TRAIT_REF"
bleibig Mar 1, 2015
481b21c
Bison grammar: parse higher ranked constraints in where clauses
bleibig Mar 1, 2015
7d31197
Fixed references to set & take ; minor wording & syntax fixes
djmally Mar 2, 2015
0a17764
Added note that method names in tables may differ from actual collect…
djmally Mar 2, 2015
7496539
Change span_help calls to fileline_help where appropriate
ivanradanov Feb 24, 2015
c9e2de4
unicode: Properly parse ranges in UnicodeData.txt
Florob Mar 3, 2015
da03392
std: Mark `Index::Output` as a stable associated type
alexcrichton Mar 3, 2015
9893b44
libc: Move features behind a cfg_attr gate
alexcrichton Mar 3, 2015
8c28284
When generating WF criteria, do not visit the same type more than
nikomatsakis Mar 4, 2015
dde4e58
Made failing/working examples look alike.
Mar 2, 2015
8e50853
Remove integer suffixes where the types in compiled code are identical.
eddyb Mar 3, 2015
1c2dc1a
updating llvm submodule to include bitrig support
Mar 3, 2015
6d36a14
bumping the jemalloc revision to include the bitrig changes
Mar 4, 2015
2361ec3
bumping again to get the updated configure
Mar 4, 2015
bcd6076
adding bitrig snapshot to snapshots file
Mar 4, 2015
4486d78
Fix Duration::weeks docs
fenhl Mar 4, 2015
48fba76
Fix compile-fail error messages after integer suffix removal.
eddyb Mar 4, 2015
6de0dc4
iOS: fallout of env stab
vhbit Mar 4, 2015
e0a0b46
updating llvm-auto-clean-trigger too
Mar 4, 2015
433392a
Reword str docs and include links to StrExt
mdcox-sdm Mar 4, 2015
299b594
Fix grammar nits in compound-data-types.md
pelmers Mar 4, 2015
d693ec1
Rollup merge of #22029 - iKevinY:tidy-changes, r=brson
Manishearth Mar 4, 2015
478c396
Rollup merge of #22939 - bleibig:grammar-updates, r=sanxiyn
Manishearth Mar 4, 2015
bb459bf
Rollup merge of #23000 - Florob:unicode-FL, r=brson
Manishearth Mar 4, 2015
24f00eb
Rollup merge of #23001 - alexcrichton:index-output-stable, r=nikomats…
Manishearth Mar 4, 2015
bedfca0
Rollup merge of #23004 - alexcrichton:libc-stable, r=brson
Manishearth Mar 4, 2015
71ef073
Rollup merge of #23013 - nikomatsakis:syncbox, r=pnkfelix
Manishearth Mar 4, 2015
951118b
Fix quoting of ?Sized
sanxiyn Mar 4, 2015
4de4234
Rollup merge of #23018 - sanxiyn:quote-question, r=huonw
Manishearth Mar 4, 2015
c8c4d85
Rollup merge of #22764 - ivanradanov:fileline_help, r=huonw
Manishearth Mar 4, 2015
e646708
Remove integer suffixes where the types in compiled code are identical.
eddyb Mar 3, 2015
34410ec
Fix compile-fail error messages after integer suffix removal.
eddyb Mar 4, 2015
145b83e
Rollup merge of #22994 - eddyb:unsuffix-ints-good, r=alexcrichton
Manishearth Mar 4, 2015
ca13fd2
Rollup merge of #22973 - djmally:coll_docs, r=Gankro
Manishearth Mar 4, 2015
3d3ccff
Rollup merge of #23006 - dhuseby:master, r=alexcrichton
Manishearth Mar 4, 2015
931c55a
Move span in error (fixup #22764)
Manishearth Mar 4, 2015
faca553
Rollup merge of #22994 - eddyb:unsuffix-ints-good, r=alexcrichton
Manishearth Mar 4, 2015
eab5d0d
Rollup merge of #22937 - MDCox:str-docs, r=steveklabnik
Manishearth Mar 4, 2015
44f8ac0
Rollup merge of #22947 - ic:master, r=steveklabnik
Manishearth Mar 4, 2015
4c2bd63
Rollup merge of #23006 - dhuseby:master, r=alexcrichton
Manishearth Mar 4, 2015
acd9554
Rollup merge of #23027 - fenhl:patch-1, r=sfackler
Manishearth Mar 4, 2015
8a55fce
Rollup merge of #23029 - vhbit:ios-env-stab, r=alexcrichton
Manishearth Mar 4, 2015
455aa62
Rollup merge of #23033 - pelmers:patch-3, r=steveklabnik
Manishearth Mar 4, 2015
340d1cc
Fix tag align tests for 32bit linux (fixes #7340)
Manishearth Mar 5, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 8 additions & 5 deletions src/doc/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ fn main() {

let guards: Vec<_> = (0..3).map(|i| {
Thread::scoped(move || {
for j in 0..3 { numbers[j] += 1 }
numbers[i] += 1;
println!("numbers[{}] is {}", i, numbers[i]);
});
}).collect();
}
Expand All @@ -437,10 +438,12 @@ fn main() {
It gives us this error:

```text
7:29: 9:10 error: cannot move out of captured outer variable in an `FnMut` closure
7 Thread::scoped(move || {
8 for j in 0..3 { numbers[j] += 1 }
9 });
7:25: 10:6 error: cannot move out of captured outer variable in an `FnMut` closure
7 Thread::scoped(move || {
8 numbers[i] += 1;
9 println!("numbers[{}] is {}", i, numbers[i]);
10 });
error: aborting due to previous error
```

It mentions that "captured outer variable in an `FnMut` closure".
Expand Down
6 changes: 3 additions & 3 deletions src/doc/trpl/compound-data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ strings, but next, let's talk about some more complicated ways of storing data.

## Tuples

The first compound data type we're going to talk about are called *tuples*.
Tuples are an ordered list of a fixed size. Like this:
The first compound data type we're going to talk about is called the *tuple*.
A tuple is an ordered list of fixed size. Like this:

```rust
let x = (1, "hello");
Expand Down Expand Up @@ -229,7 +229,7 @@ enum Character {
```

An `enum` variant can be defined as most normal types. Below are some example
types have been listed which also would be allowed in an `enum`.
types which also would be allowed in an `enum`.

```rust
struct Empty;
Expand Down
80 changes: 42 additions & 38 deletions src/etc/tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import subprocess
import re
import os
from licenseck import *
from licenseck import check_license
import snapshot

err = 0
Expand All @@ -22,13 +22,8 @@
tab_flag = "ignore-tidy-tab"
linelength_flag = "ignore-tidy-linelength"

# Be careful to support Python 2.4, 2.6, and 3.x here!
config_proc = subprocess.Popen(["git", "config", "core.autocrlf"],
stdout=subprocess.PIPE)
result = config_proc.communicate()[0]

true = "true".encode('utf8')
autocrlf = result.strip() == true if result is not None else False
interesting_files = ['.rs', '.py', '.js', '.sh', '.c', '.h']
uninteresting_files = ['miniz.c', 'jquery', 'rust_android_dummy']


def report_error_name_no(name, no, s):
Expand All @@ -51,6 +46,34 @@ def do_license_check(name, contents):
if not check_license(name, contents):
report_error_name_no(name, 1, "incorrect license")


def update_counts(current_name):
global file_counts
global count_other_linted_files

_, ext = os.path.splitext(current_name)

if ext in interesting_files:
file_counts[ext] += 1
else:
count_other_linted_files += 1


def interesting_file(f):
if any(x in f for x in uninteresting_files):
return False

return any(os.path.splitext(f)[1] == ext for ext in interesting_files)


# Be careful to support Python 2.4, 2.6, and 3.x here!
config_proc = subprocess.Popen(["git", "config", "core.autocrlf"],
stdout=subprocess.PIPE)
result = config_proc.communicate()[0]

true = "true".encode('utf8')
autocrlf = result.strip() == true if result is not None else False

current_name = ""
current_contents = ""
check_tab = True
Expand All @@ -63,28 +86,16 @@ def do_license_check(name, contents):

src_dir = sys.argv[1]

try:
count_lines = 0
count_non_blank_lines = 0
count_lines = 0
count_non_blank_lines = 0
count_other_linted_files = 0

interesting_files = ['.rs', '.py', '.js', '.sh', '.c', '.h']
file_counts = {ext: 0 for ext in interesting_files}

file_counts = {ext: 0 for ext in interesting_files}
file_counts['other'] = 0

def update_counts(current_name):
global file_counts
_, ext = os.path.splitext(current_name)

if ext in file_counts:
file_counts[ext] += 1
else:
file_counts['other'] += 1

all_paths = set()
all_paths = set()

try:
for (dirpath, dirnames, filenames) in os.walk(src_dir):

# Skip some third-party directories
skippable_dirs = {
'src/jemalloc',
Expand All @@ -103,14 +114,6 @@ def update_counts(current_name):
if any(d in dirpath for d in skippable_dirs):
continue

def interesting_file(f):
if "miniz.c" in f \
or "jquery" in f \
or "rust_android_dummy" in f:
return False

return any(os.path.splitext(f)[1] == ext for ext in interesting_files)

file_names = [os.path.join(dirpath, f) for f in filenames
if interesting_file(f)
and not f.endswith("_gen.rs")
Expand Down Expand Up @@ -196,10 +199,11 @@ def interesting_file(f):
report_err("UTF-8 decoding error " + str(e))

print
for ext in file_counts:
print "* linted " + str(file_counts[ext]) + " " + ext + " files"
print "* total lines of code: " + str(count_lines)
print "* total non-blank lines of code: " + str(count_non_blank_lines)
for ext in sorted(file_counts, key=file_counts.get, reverse=True):
print "* linted {} {} files".format(file_counts[ext], ext)
print "* linted {} other files".format(count_other_linted_files)
print "* total lines of code: {}".format(count_lines)
print "* total non-blank lines of code: {}".format(count_non_blank_lines)
print

sys.exit(err)
33 changes: 21 additions & 12 deletions src/etc/unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def fetch(f):
sys.stderr.write("cannot load %s" % f)
exit(1)

def is_valid_unicode(n):
return 0 <= n <= 0xD7FF or 0xE000 <= n <= 0x10FFFF
def is_surrogate(n):
return 0xD800 <= n <= 0xDFFF

def load_unicode_data(f):
fetch(f)
Expand All @@ -96,19 +96,28 @@ def load_unicode_data(f):
canon_decomp = {}
compat_decomp = {}

udict = {};
range_start = -1;
for line in fileinput.input(f):
fields = line.split(";")
if len(fields) != 15:
data = line.split(';');
if len(data) != 15:
continue
[code, name, gencat, combine, bidi,
decomp, deci, digit, num, mirror,
old, iso, upcase, lowcase, titlecase ] = fields

code_org = code
code = int(code, 16)

if not is_valid_unicode(code):
cp = int(data[0], 16);
if is_surrogate(cp):
continue
if range_start >= 0:
for i in xrange(range_start, cp):
udict[i] = data;
range_start = -1;
if data[1].endswith(", First>"):
range_start = cp;
continue;
udict[cp] = data;

for code in udict:
[code_org, name, gencat, combine, bidi,
decomp, deci, digit, num, mirror,
old, iso, upcase, lowcase, titlecase ] = udict[code];

# generate char to char direct common and simple conversions
# uppercase to lowercase
Expand Down
53 changes: 38 additions & 15 deletions src/grammar/parser-lalr.y
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ extern char *yytext;
%precedence MOD_SEP
%precedence RARROW ':'

// In where clauses, "for" should have greater precedence when used as
// a higher ranked constraint than when used as the beginning of a
// for_in_type (which is a ty)
%precedence FORTYPE
%precedence FOR

// Binops & unops, and their precedences
%precedence BOX
%precedence BOXPLACE
Expand Down Expand Up @@ -582,6 +588,14 @@ item_impl
{
$$ = mk_node("ItemImplNeg", 7, $1, $3, $5, $7, $8, $10, $11);
}
| maybe_unsafe IMPL generic_params trait_ref FOR DOTDOT '{' '}'
{
$$ = mk_node("ItemImplDefault", 3, $1, $3, $4);
}
| maybe_unsafe IMPL generic_params '!' trait_ref FOR DOTDOT '{' '}'
{
$$ = mk_node("ItemImplDefaultNeg", 3, $1, $3, $4);
}
;

maybe_impl_items
Expand Down Expand Up @@ -769,10 +783,14 @@ where_predicates
;

where_predicate
: lifetime ':' bounds { $$ = mk_node("WherePredicate", 2, $1, $3); }
| ty ':' ty_param_bounds { $$ = mk_node("WherePredicate", 2, $1, $3); }
: maybe_for_lifetimes lifetime ':' bounds { $$ = mk_node("WherePredicate", 3, $1, $2, $4); }
| maybe_for_lifetimes ty ':' ty_param_bounds { $$ = mk_node("WherePredicate", 3, $1, $2, $4); }
;

maybe_for_lifetimes
: FOR '<' lifetimes '>' { $$ = mk_none(); }
| %prec FORTYPE %empty { $$ = mk_none(); }

ty_params
: ty_param { $$ = mk_node("TyParams", 1, $1); }
| ty_params ',' ty_param { $$ = ext_node($1, 1, $3); }
Expand Down Expand Up @@ -1024,7 +1042,8 @@ ty_qualified_path_and_generic_values
}
| ty_qualified_path ',' ty_sums maybe_bindings
{
$$ = mk_node("GenericValues", 3, mk_none(), ext_node(mk_node("TySums", 1, $1), 1, $3), $4); }
$$ = mk_node("GenericValues", 3, mk_none(), mk_node("TySums", 2, $1, $3), $4);
}
;

ty_qualified_path
Expand Down Expand Up @@ -1513,31 +1532,35 @@ nonblock_prefix_expr
;

expr_qualified_path
: '<' ty_sum AS trait_ref '>' MOD_SEP ident
: '<' ty_sum maybe_as_trait_ref '>' MOD_SEP ident
{
$$ = mk_node("ExprQualifiedPath", 3, $2, $4, $7);
$$ = mk_node("ExprQualifiedPath", 3, $2, $3, $6);
}
| '<' ty_sum AS trait_ref '>' MOD_SEP ident generic_args
| '<' ty_sum maybe_as_trait_ref '>' MOD_SEP ident generic_args
{
$$ = mk_node("ExprQualifiedPath", 4, $2, $4, $7, $8);
$$ = mk_node("ExprQualifiedPath", 4, $2, $3, $6, $7);
}
| SHL ty_sum AS trait_ref '>' MOD_SEP ident AS trait_ref '>' MOD_SEP ident
| SHL ty_sum maybe_as_trait_ref '>' MOD_SEP ident maybe_as_trait_ref '>' MOD_SEP ident
{
$$ = mk_node("ExprQualifiedPath", 3, mk_node("ExprQualifiedPath", 3, $2, $4, $7), $9, $12);
$$ = mk_node("ExprQualifiedPath", 3, mk_node("ExprQualifiedPath", 3, $2, $3, $6), $7, $10);
}
| SHL ty_sum AS trait_ref '>' MOD_SEP ident generic_args AS trait_ref '>' MOD_SEP ident
| SHL ty_sum maybe_as_trait_ref '>' MOD_SEP ident generic_args maybe_as_trait_ref '>' MOD_SEP ident
{
$$ = mk_node("ExprQualifiedPath", 3, mk_node("ExprQualifiedPath", 4, $2, $4, $7, $8), $10, $13);
$$ = mk_node("ExprQualifiedPath", 3, mk_node("ExprQualifiedPath", 4, $2, $3, $6, $7), $8, $11);
}
| SHL ty_sum AS trait_ref '>' MOD_SEP ident AS trait_ref '>' MOD_SEP ident generic_args
| SHL ty_sum maybe_as_trait_ref '>' MOD_SEP ident maybe_as_trait_ref '>' MOD_SEP ident generic_args
{
$$ = mk_node("ExprQualifiedPath", 4, mk_node("ExprQualifiedPath", 3, $2, $4, $7), $9, $12, $13);
$$ = mk_node("ExprQualifiedPath", 4, mk_node("ExprQualifiedPath", 3, $2, $3, $6), $7, $10, $11);
}
| SHL ty_sum AS trait_ref '>' MOD_SEP ident generic_args AS trait_ref '>' MOD_SEP ident generic_args
| SHL ty_sum maybe_as_trait_ref '>' MOD_SEP ident generic_args maybe_as_trait_ref '>' MOD_SEP ident generic_args
{
$$ = mk_node("ExprQualifiedPath", 4, mk_node("ExprQualifiedPath", 4, $2, $4, $7, $8), $10, $13, $14);
$$ = mk_node("ExprQualifiedPath", 4, mk_node("ExprQualifiedPath", 4, $2, $3, $6, $7), $8, $11, $12);
}

maybe_as_trait_ref
: AS trait_ref { $$ = $2; }
| %empty { $$ = mk_none(); }
;

lambda_expr
: %prec LAMBDA
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
//! }
//! ```
//!
//! This will print `Cons(1i32, Box(Cons(2i32, Box(Nil))))`.
//! This will print `Cons(1, Box(Cons(2, Box(Nil))))`.

#![stable(feature = "rust1", since = "1.0.0")]

Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/boxed_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ fn test_show() {
#[test]
fn deref() {
fn homura<T: Deref<Target=i32>>(_: T) { }
homura(Box::new(765i32));
homura(Box::new(765));
}

#[test]
fn raw_sized() {
unsafe {
let x = Box::new(17i32);
let x = Box::new(17);
let p = boxed::into_raw(x);
assert_eq!(17, *p);
*p = 19;
Expand Down
Loading