]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agomanual: update list of feature gates, add phase attribute
Corey Richardson [Mon, 28 Jul 2014 21:31:46 +0000 (14:31 -0700)]
manual: update list of feature gates, add phase attribute

10 years agoRename Integer trait `divides` to `is_multiple_of`.
Jonas Hietala [Mon, 28 Jul 2014 14:03:01 +0000 (16:03 +0200)]
Rename Integer trait `divides` to `is_multiple_of`.

It is being changed because the previous wording was ambiguous.
`a.divides(b)` implied `a % b == 0` but it sounds like the other way
around. `9.divides(&3) == true` but we might read that as
"does 9 divide 3?".  It has been renamed to sidestep the ambiguity.

Work around the change by using `is_multiple_of` instead.

[breaking-change]

10 years agolint: Improve ffi-unsafe enum lint warning
Anton Lofgren [Tue, 22 Jul 2014 06:33:03 +0000 (08:33 +0200)]
lint: Improve ffi-unsafe enum lint warning

I think this is an improvement of the previous warning message, which
- like the comment that I removed implies - is in need of some
improvement.
I've opted to point the user in the right direction w.r.t how to fix the
problem, which I think is good form.

Not being familiar with the repr(...) attribute, I personally had to
check the lint rules myself to figure out what was wrong. Hopefully,
this will save he next person some time and headache.

Signed-off-by: Anton Lofgren <alofgren@op5.com>
10 years agoAdd pretty=typed test support to compiletest and add a test for fixed size arrays.
Luqman Aden [Tue, 22 Jul 2014 23:39:10 +0000 (16:39 -0700)]
Add pretty=typed test support to compiletest and add a test for fixed size arrays.

10 years agolibsyntax: Don't ICE on macro invocation in count expr of fixed array type.
Luqman Aden [Sat, 19 Jul 2014 07:06:43 +0000 (00:06 -0700)]
libsyntax: Don't ICE on macro invocation in count expr of fixed array type.

10 years agolibrustc: Typeck & record the count expr in TyFixedLengthVec.
Luqman Aden [Sat, 19 Jul 2014 06:54:57 +0000 (23:54 -0700)]
librustc: Typeck & record the count expr in TyFixedLengthVec.

10 years agoUpdate disclaimer to improve clarity and intent
Hugo Jobling [Tue, 1 Jul 2014 08:50:55 +0000 (09:50 +0100)]
Update disclaimer to improve clarity and intent

10 years agoauto merge of #16046 : dotdash/rust/call_ignore_alloca, r=pcwalton
bors [Tue, 29 Jul 2014 19:31:44 +0000 (19:31 +0000)]
auto merge of #16046 : dotdash/rust/call_ignore_alloca, r=pcwalton

10 years agoauto merge of #15989 : pcwalton/rust/borrowck-pattern-guards, r=pnkfelix
bors [Tue, 29 Jul 2014 17:41:41 +0000 (17:41 +0000)]
auto merge of #15989 : pcwalton/rust/borrowck-pattern-guards, r=pnkfelix

the CFG for match statements.

There were two bugs in issue #14684. One was simply that the borrow
check didn't know about the correct CFG for match statements: the
pattern must be a predecessor of the guard. This disallows the bad
behavior if there are bindings in the pattern. But it isn't enough to
prevent the memory safety problem, because of wildcards; thus, this
patch introduces a more restrictive rule, which disallows assignments
and mutable borrows inside guards outright.

I discussed this with Niko and we decided this was the best plan of
action.

This breaks code that performs mutable borrows in pattern guards. Most
commonly, the code looks like this:

    impl Foo {
        fn f(&mut self, ...) {}
        fn g(&mut self, ...) {
            match bar {
                Baz if self.f(...) => { ... }
                _ => { ... }
            }
        }
    }

Change this code to not use a guard. For example:

    impl Foo {
        fn f(&mut self, ...) {}
        fn g(&mut self, ...) {
            match bar {
                Baz => {
                    if self.f(...) {
                        ...
                    } else {
                        ...
                    }
                }
                _ => { ... }
            }
        }
    }

Sometimes this can result in code duplication, but often it illustrates
a hidden memory safety problem.

Closes #14684.

[breaking-change]

r? @pnkfelix

10 years agoauto merge of #16054 : tshepang/rust/patch-1, r=brson
bors [Tue, 29 Jul 2014 15:57:01 +0000 (15:57 +0000)]
auto merge of #16054 : tshepang/rust/patch-1, r=brson

10 years agoauto merge of #16052 : nham/rust/fs_docs, r=brson
bors [Tue, 29 Jul 2014 14:11:37 +0000 (14:11 +0000)]
auto merge of #16052 : nham/rust/fs_docs, r=brson

Some of the fixes include:

 - fixing mismatch between the documentation and the function parameters. (i.e. documentation references `path` parameter, but it's actually called `from`, or vice versa)
 - A few Error sections were missing an "if" on the middle clause. For example, they used to be: "This function will return an error if [Thing], [Another Thing], or if [Yet Another Thing]." I added an "if" so it becomes "This function will return an error if [Thing], if [Another Thing], or if [Yet Another Thing]"
 - The error sections previously started off with 3 different phrases:

     - "This function will return an error if ..."
     - "Will return an error if ..."
     - "This call will return an error if ..."

  I've standardized on the first phrase.

10 years agoauto merge of #16050 : jxs/rust/master, r=alexcrichton
bors [Tue, 29 Jul 2014 12:26:38 +0000 (12:26 +0000)]
auto merge of #16050 : jxs/rust/master, r=alexcrichton

getopts returns Matches not Opt

10 years agoauto merge of #16049 : aturon/rust/stability-dashboard-improvements, r=alexcrichton
bors [Tue, 29 Jul 2014 10:41:41 +0000 (10:41 +0000)]
auto merge of #16049 : aturon/rust/stability-dashboard-improvements, r=alexcrichton

* Makes dashboard width dynamic.
* Colors unmarked items.
* Gives overall crate percentages.

10 years agoauto merge of #16038 : nham/rust/collections_partialord, r=alexcrichton
bors [Tue, 29 Jul 2014 07:56:41 +0000 (07:56 +0000)]
auto merge of #16038 : nham/rust/collections_partialord, r=alexcrichton

cc #15294

10 years agoauto merge of #16034 : sfackler/rust/test-reexport-fix, r=alexcrichton
bors [Tue, 29 Jul 2014 06:11:41 +0000 (06:11 +0000)]
auto merge of #16034 : sfackler/rust/test-reexport-fix, r=alexcrichton

We previously reexported entire modules, which caused private things to
become reachable and trip the dead code and private items in public API
lints.

Closes #15912

10 years agoauto merge of #16033 : nham/rust/hash_tuple_impl, r=alexcrichton
bors [Tue, 29 Jul 2014 04:26:42 +0000 (04:26 +0000)]
auto merge of #16033 : nham/rust/hash_tuple_impl, r=alexcrichton

Previously the implementation of Hash was limited to tuples of up to arity 8. This increases it to tuples of up to arity 12.

Also, the implementation macro for `Hash` used to expand to something like this:

    impl Hash for (a7,)
    impl Hash for (a6, a7)
    impl Hash for (a5, a6, a7)
    ...

This style is inconsistent with the implementations in core::tuple, which look like this:

    impl Trait for (A,)
    impl Trait for (A, B)
    impl Trait for (A, B, C)
    ...

This is perhaps a minor point, but it does mean the documentation pages are inconsistent. Compare the tuple implementations in the documentation for [Hash](http://static.rust-lang.org/doc/master/std/hash/trait.Hash.html) and [PartialOrd](http://static.rust-lang.org/doc/master/core/cmp/trait.PartialOrd.html)

This changes the Hash implementation to be consistent with `core::tuple`.

10 years agoauto merge of #16032 : treeman/rust/doc-treecollection, r=alexcrichton
bors [Tue, 29 Jul 2014 02:41:41 +0000 (02:41 +0000)]
auto merge of #16032 : treeman/rust/doc-treecollection, r=alexcrichton

10 years agoauto merge of #16027 : treeman/rust/doc-string, r=alexcrichton
bors [Mon, 28 Jul 2014 22:36:39 +0000 (22:36 +0000)]
auto merge of #16027 : treeman/rust/doc-string, r=alexcrichton

10 years agodoc: reduce overlong sentence
Tshepang Lekhonkhobe [Mon, 28 Jul 2014 21:22:47 +0000 (23:22 +0200)]
doc: reduce overlong sentence

10 years agoauto merge of #15983 : brson/rust/fail, r=alexcrichton
bors [Mon, 28 Jul 2014 20:51:33 +0000 (20:51 +0000)]
auto merge of #15983 : brson/rust/fail, r=alexcrichton

A few refactorings to decrease text size and increase data size. I'm not sure about this tradeoff. Various stats below. cc @pcwalton

This reduces the code needed to pass arguments for `fail!()`, `fail!("{}", ...)`, and to a lesser extent `fail!("...")`. Still more work to be done on compiler-generated failures and the `fail!("...")` case.

do_fail_empty:

```
#[inline(never)]
fn do_fail_empty() {
    fail!()
}
```

do_fail_empty before:

```
leaq 8(%rsp), %rdi
movabsq $13, %rsi
leaq "str\"str\"(1494)"(%rip), %rax
movq %rax, 8(%rsp)
movq $19, 16(%rsp)
callq _ZN6unwind31begin_unwind_no_time_to_explain20h57030457935ab6111SdE@PLT
```

do_fail_empty after:

```
leaq _ZN13do_fail_empty9file_line20h339df6a0541e837eIaaE(%rip), %rdi
callq _ZN6unwind31begin_unwind_no_time_to_explain20h33184cfdcce4dfd8QTdE@PLT
```

do_fail_fmt:

```
#[inline(never)]
fn do_fail_fmt() {
    fail!("guh{}", "faw")
}
```

do_fail_fmt before:

```
        ... (snip lots of fmt stuff)
callq _ZN3fmt22Arguments$LT$$x27a$GT$3new20he09b3a3f473879c41paE
leaq 144(%rsp), %rsi
movabsq $23, %rdx
leaq "str\"str\"(1494)"(%rip), %rax
leaq 32(%rsp), %rcx
movq %rcx, 160(%rsp)
movq 160(%rsp), %rdi
movq %rax, 144(%rsp)
movq $19, 152(%rsp)
callq _ZN6unwind16begin_unwind_fmt20h3ebeb42f4d189b2buQdE@PLT
```

do_fail_fmt after:

```
        ... (snip lots of fmt stuff)
callq _ZN3fmt22Arguments$LT$$x27a$GT$3new20h42e5bb8d1711ee61OqaE
leaq _ZN11do_fail_fmt7run_fmt9file_line20h339df6a0541e837eFbaE(%rip), %rsi
leaq 32(%rsp), %rax
movq %rax, 144(%rsp)
movq 144(%rsp), %rdi
callq _ZN6unwind16begin_unwind_fmt20hfdcadc14d188656biRdE@PLT
```

File size increases.

file size before:

```
-rw-rw-r-- 1 brian brian 100501740 Jul 24 23:28 /home/brian/dev/rust2/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.rlib
-rwxrwxr-x 1 brian brian  21201780 Jul 24 23:27 /home/brian/dev/rust2/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.so
```

file size after:

```
-rw-rw-r-- 1 brian brian 101542484 Jul 25 00:34 x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.rlib
-rwxrwxr-x 1 brian brian  21348862 Jul 25 00:34 x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.so
```

Text size decreases by 52486 while data size increases by 143686.

section size before:

```
   text    data     bss     dec     hex filename
12712262        5924997     368 18637627        11c633b x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.so
```

section size after:

```
   text    data     bss     dec     hex filename
12659776        6068683     368 18728827        11dc77b /home/brian/dev/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.so
```

I don't know if anything can be learned from these benchmarks. Looks like a wash.

std bench before:

```
test collections::hashmap::bench::find_existing             ... bench:     43452 ns/iter (+/- 2423)
test collections::hashmap::bench::find_nonexisting          ... bench:     42416 ns/iter (+/- 3996)
test collections::hashmap::bench::find_pop_insert           ... bench:       214 ns/iter (+/- 11)
test collections::hashmap::bench::hashmap_as_queue          ... bench:       123 ns/iter (+/- 6)
test collections::hashmap::bench::insert                    ... bench:       153 ns/iter (+/- 14)
test collections::hashmap::bench::new_drop                  ... bench:       547 ns/iter (+/- 259)
test collections::hashmap::bench::new_insert_drop           ... bench:       682 ns/iter (+/- 366)
test io::buffered::test::bench_buffered_reader              ... bench:      1046 ns/iter (+/- 86)
test io::buffered::test::bench_buffered_stream              ... bench:      2156 ns/iter (+/- 801)
test io::buffered::test::bench_buffered_writer              ... bench:      1057 ns/iter (+/- 75)
test io::extensions::bench::u64_from_be_bytes_4_aligned     ... bench:        80 ns/iter (+/- 5)
test io::extensions::bench::u64_from_be_bytes_4_unaligned   ... bench:        81 ns/iter (+/- 6)
test io::extensions::bench::u64_from_be_bytes_7_aligned     ... bench:        80 ns/iter (+/- 4)
test io::extensions::bench::u64_from_be_bytes_7_unaligned   ... bench:        69 ns/iter (+/- 4)
test io::extensions::bench::u64_from_be_bytes_8_aligned     ... bench:        69 ns/iter (+/- 3)
test io::extensions::bench::u64_from_be_bytes_8_unaligned   ... bench:        81 ns/iter (+/- 4)
test io::mem::test::bench_buf_reader                        ... bench:       628 ns/iter (+/- 18)
test io::mem::test::bench_buf_writer                        ... bench:       478 ns/iter (+/- 19)
test io::mem::test::bench_mem_reader                        ... bench:       712 ns/iter (+/- 44)
test io::mem::test::bench_mem_writer_001_0000               ... bench:        31 ns/iter (+/- 1)
test io::mem::test::bench_mem_writer_001_0010               ... bench:        51 ns/iter (+/- 3)
test io::mem::test::bench_mem_writer_001_0100               ... bench:       121 ns/iter (+/- 8)
test io::mem::test::bench_mem_writer_001_1000               ... bench:       774 ns/iter (+/- 47)
test io::mem::test::bench_mem_writer_100_0000               ... bench:       756 ns/iter (+/- 50)
test io::mem::test::bench_mem_writer_100_0010               ... bench:      2726 ns/iter (+/- 198)
test io::mem::test::bench_mem_writer_100_0100               ... bench:      8961 ns/iter (+/- 712)
test io::mem::test::bench_mem_writer_100_1000               ... bench:    105673 ns/iter (+/- 24711)
test num::bench::bench_pow_function                         ... bench:      5849 ns/iter (+/- 371)
test num::strconv::bench::f64::float_to_string              ... bench:       662 ns/iter (+/- 202)
test num::strconv::bench::int::to_str_base_36               ... bench:       424 ns/iter (+/- 7)
test num::strconv::bench::int::to_str_bin                   ... bench:      1227 ns/iter (+/- 80)
test num::strconv::bench::int::to_str_dec                   ... bench:       466 ns/iter (+/- 13)
test num::strconv::bench::int::to_str_hex                   ... bench:       498 ns/iter (+/- 22)
test num::strconv::bench::int::to_str_oct                   ... bench:       502 ns/iter (+/- 229)
test num::strconv::bench::uint::to_str_base_36              ... bench:       375 ns/iter (+/- 7)
test num::strconv::bench::uint::to_str_bin                  ... bench:      1011 ns/iter (+/- 590)
test num::strconv::bench::uint::to_str_dec                  ... bench:       407 ns/iter (+/- 17)
test num::strconv::bench::uint::to_str_hex                  ... bench:       442 ns/iter (+/- 7)
test num::strconv::bench::uint::to_str_oct                  ... bench:       433 ns/iter (+/- 46)
test path::posix::bench::ends_with_path_home_dir            ... bench:       167 ns/iter (+/- 10)
test path::posix::bench::ends_with_path_missmatch_jome_home ... bench:       148 ns/iter (+/- 6)
test path::posix::bench::is_ancestor_of_path_with_10_dirs   ... bench:       221 ns/iter (+/- 31)
test path::posix::bench::join_abs_path_home_dir             ... bench:       144 ns/iter (+/- 23)
test path::posix::bench::join_home_dir                      ... bench:       196 ns/iter (+/- 9)
test path::posix::bench::join_many_abs_path_home_dir        ... bench:       143 ns/iter (+/- 6)
test path::posix::bench::join_many_home_dir                 ... bench:       195 ns/iter (+/- 8)
test path::posix::bench::path_relative_from_backward        ... bench:       248 ns/iter (+/- 10)
test path::posix::bench::path_relative_from_forward         ... bench:       241 ns/iter (+/- 13)
test path::posix::bench::path_relative_from_same_level      ... bench:       296 ns/iter (+/- 11)
test path::posix::bench::push_abs_path_home_dir             ... bench:       104 ns/iter (+/- 7)
test path::posix::bench::push_home_dir                      ... bench:     27311 ns/iter (+/- 2727)
test path::posix::bench::push_many_abs_path_home_dir        ... bench:       109 ns/iter (+/- 5)
test path::posix::bench::push_many_home_dir                 ... bench:     23263 ns/iter (+/- 1726)
test rand::bench::rand_isaac                                ... bench:       884 ns/iter (+/- 31) = 904 MB/s
test rand::bench::rand_isaac64                              ... bench:       440 ns/iter (+/- 126) = 1818 MB/s
test rand::bench::rand_shuffle_100                          ... bench:      2518 ns/iter (+/- 1371)
test rand::bench::rand_std                                  ... bench:       429 ns/iter (+/- 17) = 1864 MB/s
test rand::bench::rand_xorshift                             ... bench:         0 ns/iter (+/- 0) = 800000 MB/s
```

std bench after:

```
test collections::hashmap::bench::find_existing             ... bench:     43635 ns/iter (+/- 4508)
test collections::hashmap::bench::find_nonexisting          ... bench:     42323 ns/iter (+/- 1753)
test collections::hashmap::bench::find_pop_insert           ... bench:       216 ns/iter (+/- 11)
test collections::hashmap::bench::hashmap_as_queue          ... bench:       125 ns/iter (+/- 8)
test collections::hashmap::bench::insert                    ... bench:       153 ns/iter (+/- 63)
test collections::hashmap::bench::new_drop                  ... bench:       517 ns/iter (+/- 282)
test collections::hashmap::bench::new_insert_drop           ... bench:       734 ns/iter (+/- 264)
test io::buffered::test::bench_buffered_reader              ... bench:      1063 ns/iter (+/- 206)
test io::buffered::test::bench_buffered_stream              ... bench:      2321 ns/iter (+/- 2302)
test io::buffered::test::bench_buffered_writer              ... bench:      1060 ns/iter (+/- 24)
test io::extensions::bench::u64_from_be_bytes_4_aligned     ... bench:        69 ns/iter (+/- 2)
test io::extensions::bench::u64_from_be_bytes_4_unaligned   ... bench:        81 ns/iter (+/- 7)
test io::extensions::bench::u64_from_be_bytes_7_aligned     ... bench:        70 ns/iter (+/- 5)
test io::extensions::bench::u64_from_be_bytes_7_unaligned   ... bench:        69 ns/iter (+/- 5)
test io::extensions::bench::u64_from_be_bytes_8_aligned     ... bench:        80 ns/iter (+/- 6)
test io::extensions::bench::u64_from_be_bytes_8_unaligned   ... bench:        81 ns/iter (+/- 5)
test io::mem::test::bench_buf_reader                        ... bench:       663 ns/iter (+/- 44)
test io::mem::test::bench_buf_writer                        ... bench:       489 ns/iter (+/- 17)
test io::mem::test::bench_mem_reader                        ... bench:       700 ns/iter (+/- 23)
test io::mem::test::bench_mem_writer_001_0000               ... bench:        31 ns/iter (+/- 3)
test io::mem::test::bench_mem_writer_001_0010               ... bench:        49 ns/iter (+/- 5)
test io::mem::test::bench_mem_writer_001_0100               ... bench:       112 ns/iter (+/- 6)
test io::mem::test::bench_mem_writer_001_1000               ... bench:       765 ns/iter (+/- 59)
test io::mem::test::bench_mem_writer_100_0000               ... bench:       727 ns/iter (+/- 54)
test io::mem::test::bench_mem_writer_100_0010               ... bench:      2586 ns/iter (+/- 215)
test io::mem::test::bench_mem_writer_100_0100               ... bench:      8846 ns/iter (+/- 439)
test io::mem::test::bench_mem_writer_100_1000               ... bench:    105747 ns/iter (+/- 17443)
test num::bench::bench_pow_function                         ... bench:      5844 ns/iter (+/- 421)
test num::strconv::bench::f64::float_to_string              ... bench:       669 ns/iter (+/- 571)
test num::strconv::bench::int::to_str_base_36               ... bench:       417 ns/iter (+/- 24)
test num::strconv::bench::int::to_str_bin                   ... bench:      1216 ns/iter (+/- 36)
test num::strconv::bench::int::to_str_dec                   ... bench:       466 ns/iter (+/- 24)
test num::strconv::bench::int::to_str_hex                   ... bench:       492 ns/iter (+/- 8)
test num::strconv::bench::int::to_str_oct                   ... bench:       496 ns/iter (+/- 295)
test num::strconv::bench::uint::to_str_base_36              ... bench:       366 ns/iter (+/- 8)
test num::strconv::bench::uint::to_str_bin                  ... bench:      1005 ns/iter (+/- 69)
test num::strconv::bench::uint::to_str_dec                  ... bench:       396 ns/iter (+/- 20)
test num::strconv::bench::uint::to_str_hex                  ... bench:       435 ns/iter (+/- 4)
test num::strconv::bench::uint::to_str_oct                  ... bench:       436 ns/iter (+/- 451)
test path::posix::bench::ends_with_path_home_dir            ... bench:       171 ns/iter (+/- 6)
test path::posix::bench::ends_with_path_missmatch_jome_home ... bench:       152 ns/iter (+/- 6)
test path::posix::bench::is_ancestor_of_path_with_10_dirs   ... bench:       215 ns/iter (+/- 8)
test path::posix::bench::join_abs_path_home_dir             ... bench:       143 ns/iter (+/- 6)
test path::posix::bench::join_home_dir                      ... bench:       192 ns/iter (+/- 29)
test path::posix::bench::join_many_abs_path_home_dir        ... bench:       144 ns/iter (+/- 9)
test path::posix::bench::join_many_home_dir                 ... bench:       194 ns/iter (+/- 19)
test path::posix::bench::path_relative_from_backward        ... bench:       254 ns/iter (+/- 15)
test path::posix::bench::path_relative_from_forward         ... bench:       244 ns/iter (+/- 17)
test path::posix::bench::path_relative_from_same_level      ... bench:       293 ns/iter (+/- 27)
test path::posix::bench::push_abs_path_home_dir             ... bench:       108 ns/iter (+/- 5)
test path::posix::bench::push_home_dir                      ... bench:     32292 ns/iter (+/- 4361)
test path::posix::bench::push_many_abs_path_home_dir        ... bench:       108 ns/iter (+/- 6)
test path::posix::bench::push_many_home_dir                 ... bench:     20305 ns/iter (+/- 1331)
test rand::bench::rand_isaac                                ... bench:       888 ns/iter (+/- 35) = 900 MB/s
test rand::bench::rand_isaac64                              ... bench:       439 ns/iter (+/- 17) = 1822 MB/s
test rand::bench::rand_shuffle_100                          ... bench:      2582 ns/iter (+/- 1001)
test rand::bench::rand_std                                  ... bench:       431 ns/iter (+/- 93) = 1856 MB/s
test rand::bench::rand_xorshift                             ... bench:         0 ns/iter (+/- 0) = 800000 MB/s
```

10 years agoUse correct conventions for static
Brian Anderson [Mon, 28 Jul 2014 20:40:55 +0000 (13:40 -0700)]
Use correct conventions for static

10 years agoauto merge of #16025 : cmr/rust/plugin-fields, r=alexcrichton
bors [Mon, 28 Jul 2014 19:06:34 +0000 (19:06 +0000)]
auto merge of #16025 : cmr/rust/plugin-fields, r=alexcrichton

Some minor changes to the compiler to expose this information. Very
inconvenient since struct fields aren't an item.

10 years agoFix some of the documentation std::io::fs.
nham [Mon, 28 Jul 2014 18:14:56 +0000 (14:14 -0400)]
Fix some of the documentation std::io::fs.

10 years agoFix typo in getopts::getopts documentation, return Matches instead of Opt
joaoxsouls [Mon, 28 Jul 2014 16:35:31 +0000 (17:35 +0100)]
Fix typo in getopts::getopts documentation, return Matches instead of Opt

10 years agorustdoc: improvements to stability dashboard
Aaron Turon [Mon, 28 Jul 2014 06:03:46 +0000 (23:03 -0700)]
rustdoc: improvements to stability dashboard

* Makes dashboard width dynamic.
* Colors unmarked items.
* Gives overall crate percentages.

10 years agodoc: Method examples for String
Jonas Hietala [Sun, 27 Jul 2014 10:40:39 +0000 (12:40 +0200)]
doc: Method examples for String

Reword comments on unsafe methods regarding UTF-8.

10 years agoEmit lifetime end markers for allocas for ignored return values
Björn Steinbrink [Mon, 28 Jul 2014 06:41:44 +0000 (08:41 +0200)]
Emit lifetime end markers for allocas for ignored return values

10 years agoOmit unnecessary stack slots for ignored return values
Björn Steinbrink [Mon, 28 Jul 2014 06:23:16 +0000 (08:23 +0200)]
Omit unnecessary stack slots for ignored return values

If we have an immediate return value that doesn't need to be dropped, we
don't have to create a stack slot for it.

10 years agorustc: encode is_sugared_doc on ast::Attribute
Corey Richardson [Mon, 28 Jul 2014 08:02:31 +0000 (01:02 -0700)]
rustc: encode is_sugared_doc on ast::Attribute

10 years agorustdoc: remove extraneous .move_iter().collect()s
Corey Richardson [Mon, 28 Jul 2014 08:00:54 +0000 (01:00 -0700)]
rustdoc: remove extraneous .move_iter().collect()s

The impl of Clean for Vec obsoleted these long, long ago.

10 years agorustdoc: show struct field docs when inlined
Corey Richardson [Sat, 26 Jul 2014 20:21:36 +0000 (13:21 -0700)]
rustdoc: show struct field docs when inlined

Some minor changes to the compiler to expose this information. Very
inconvenient since struct fields aren't an item. Adds (yet another) table to
metadata.

Closes #15739

10 years agoImplement Ord for TrieMap/TrieSet/SmallIntMap/Bitv/BitvSet
nham [Mon, 28 Jul 2014 06:53:44 +0000 (02:53 -0400)]
Implement Ord for TrieMap/TrieSet/SmallIntMap/Bitv/BitvSet

10 years agoImplement PartialOrd for Bitv and BitvSet
nham [Mon, 28 Jul 2014 04:28:49 +0000 (00:28 -0400)]
Implement PartialOrd for Bitv and BitvSet

10 years agoImplement PartialOrd for SmallIntMap
nham [Mon, 28 Jul 2014 04:00:29 +0000 (00:00 -0400)]
Implement PartialOrd for SmallIntMap

10 years agoImplement PartialOrd for TrieMap and TrieSet
nham [Mon, 28 Jul 2014 03:51:28 +0000 (23:51 -0400)]
Implement PartialOrd for TrieMap and TrieSet

10 years agoauto merge of #16031 : arielb1/rust/remove_unneeded_fixme, r=kballard
bors [Sun, 27 Jul 2014 22:41:15 +0000 (22:41 +0000)]
auto merge of #16031 : arielb1/rust/remove_unneeded_fixme, r=kballard

The issue was fixed a month ago - remove the workaround.

10 years agoauto merge of #16026 : ruud-v-a/rust/patch-1, r=steveklabnik
bors [Sun, 27 Jul 2014 20:51:16 +0000 (20:51 +0000)]
auto merge of #16026 : ruud-v-a/rust/patch-1, r=steveklabnik

10 years agoauto merge of #16020 : nham/rust/ringbuf_hash_ord, r=alexcrichton
bors [Sun, 27 Jul 2014 19:06:16 +0000 (19:06 +0000)]
auto merge of #16020 : nham/rust/ringbuf_hash_ord, r=alexcrichton

cc #15294

10 years agoMake test expansion induce less reachability
Steven Fackler [Sun, 27 Jul 2014 19:02:19 +0000 (12:02 -0700)]
Make test expansion induce less reachability

We previously reexported entire modules, which caused private things to
become reachable and trip the dead code and private items in public API
lints.

Closes #15912

10 years agoImplement Hash for tuples of up to arity 12. Also change the style to be consistent...
nham [Sun, 27 Jul 2014 18:41:33 +0000 (14:41 -0400)]
Implement Hash for tuples of up to arity 12. Also change the style to be consistent with core::tuple

10 years agodoc: Small rewording.
Jonas Hietala [Sun, 27 Jul 2014 17:57:33 +0000 (19:57 +0200)]
doc: Small rewording.

10 years agoauto merge of #16030 : treeman/rust/doc-hashset-fix, r=sfackler
bors [Sun, 27 Jul 2014 17:06:17 +0000 (17:06 +0000)]
auto merge of #16030 : treeman/rust/doc-hashset-fix, r=sfackler

Not sure how this could slip by.

10 years agoHash the length of the RingBuf before hashing elements
nham [Sun, 27 Jul 2014 16:37:32 +0000 (12:37 -0400)]
Hash the length of the RingBuf before hashing elements

10 years agodoc: Main example for TreeMap.
Jonas Hietala [Sun, 27 Jul 2014 16:19:04 +0000 (18:19 +0200)]
doc: Main example for TreeMap.

10 years agodoc: TreeMap methods with examples.
Jonas Hietala [Sun, 27 Jul 2014 15:44:07 +0000 (17:44 +0200)]
doc: TreeMap methods with examples.

Small corrections for TreeSet examples.

10 years agodoc: TreeSet methods and main example.
Jonas Hietala [Sun, 27 Jul 2014 15:04:44 +0000 (17:04 +0200)]
doc: TreeSet methods and main example.

10 years agoRemove an unneeded FIXME in coherence.rs
Ariel Ben-Yehuda [Sun, 27 Jul 2014 15:01:19 +0000 (18:01 +0300)]
Remove an unneeded FIXME in coherence.rs

Also, let f; f = ...; is just wrong.

10 years agodoc: Correctly onclose code blocks in HashSet
Jonas Hietala [Sun, 27 Jul 2014 14:05:53 +0000 (16:05 +0200)]
doc: Correctly onclose code blocks in HashSet

10 years agoauto merge of #16016 : tomjakubowski/rust/rustdoc-fix-15490, r=alexcrichton
bors [Sun, 27 Jul 2014 09:46:15 +0000 (09:46 +0000)]
auto merge of #16016 : tomjakubowski/rust/rustdoc-fix-15490, r=alexcrichton

Previously, private and `#[doc(hidden)]` struct fields appeared in the
search index despite being hidden from the struct's documentation.

Fix #15490

10 years agodocs: Fix typo in container guide.
Ruud van Asseldonk [Sun, 27 Jul 2014 08:14:44 +0000 (10:14 +0200)]
docs: Fix typo in container guide.

10 years agoauto merge of #16001 : Gankro/rust/rawstrings-proof, r=pnkfelix
bors [Sun, 27 Jul 2014 08:01:14 +0000 (08:01 +0000)]
auto merge of #16001 : Gankro/rust/rawstrings-proof, r=pnkfelix

Stumbled across this and thought it would be cool to prove. I've never used Ogden's Lemma before, but I'm pretty sure I used it right. The pumping lemma definitely doesn't seem sufficient for the job. In particular, when using the pumping lemma, you can always just pump one of the quotes, and it's fine. Ogden's Lemma lets you effectively force the pumper to use certain characters in the string.

@cmr

10 years agoauto merge of #15963 : nham/rust/moar_15294, r=alexcrichton
bors [Sun, 27 Jul 2014 06:16:14 +0000 (06:16 +0000)]
auto merge of #15963 : nham/rust/moar_15294, r=alexcrichton

Implements PartialEq/Eq/Clone/Hash/FromIterator/Extendable for SmallIntMap and Clone/Show for TrieMap/TrieSet. cc #15294

10 years agoadding proof of context-sensitivy of raw string literals
Alexis Beingessner [Sat, 26 Jul 2014 04:28:56 +0000 (00:28 -0400)]
adding proof of context-sensitivy of raw string literals

10 years agoauto merge of #16021 : brson/rust/mb, r=pcwalton
bors [Sun, 27 Jul 2014 04:21:14 +0000 (04:21 +0000)]
auto merge of #16021 : brson/rust/mb, r=pcwalton

No longer does anything.

10 years agoRemove managed_box gate from tests
Brian Anderson [Sun, 27 Jul 2014 04:05:03 +0000 (21:05 -0700)]
Remove managed_box gate from tests

No longer does anything.

10 years agoImplement PartialOrd for RingBuf
nham [Sun, 27 Jul 2014 03:18:56 +0000 (23:18 -0400)]
Implement PartialOrd for RingBuf

10 years agoImplement Hash for RingBuf
nham [Sun, 27 Jul 2014 02:33:47 +0000 (22:33 -0400)]
Implement Hash for RingBuf

10 years agoauto merge of #16006 : TeXitoi/rust/relicense-shootout-k-nucleotide, r=brson
bors [Sun, 27 Jul 2014 00:31:13 +0000 (00:31 +0000)]
auto merge of #16006 : TeXitoi/rust/relicense-shootout-k-nucleotide, r=brson

Everyone agreed except @thestinger. As @thestinger contribution on this file is trivial,
we can relicense it.

Related to #14248, close #15330

@brson OK?

10 years agorustdoc: Keep hidden struct fields out of search
Tom Jakubowski [Sat, 26 Jul 2014 23:13:01 +0000 (16:13 -0700)]
rustdoc: Keep hidden struct fields out of search

Previously, private and `#[doc(hidden)]` struct fields appeared in the
search index despite being hidden from the struct's documentation.

Fix #15490

10 years agoManually implement Hash for SmallIntMap
nham [Sat, 26 Jul 2014 16:04:41 +0000 (12:04 -0400)]
Manually implement Hash for SmallIntMap

10 years agoauto merge of #15941 : treeman/rust/doc-lru, r=alexcrichton
bors [Sat, 26 Jul 2014 22:46:13 +0000 (22:46 +0000)]
auto merge of #15941 : treeman/rust/doc-lru, r=alexcrichton

10 years agoauto merge of #15936 : alexcrichton/rust/stability, r=brson
bors [Sat, 26 Jul 2014 21:01:15 +0000 (21:01 +0000)]
auto merge of #15936 : alexcrichton/rust/stability, r=brson

This commit applies stability attributes to the contents of these modules,
summarized here:

* The `unit` and `bool` modules have become #[unstable] as they are purely meant
  for documentation purposes and are candidates for removal.

* The `ty` module has been deprecated, and the inner `Unsafe` type has been
  renamed to `UnsafeCell` and moved to the `cell` module. The `marker1` field
  has been removed as the compiler now always infers `UnsafeCell` to be
  invariant. The `new` method i stable, but the `value` field, `get` and
  `unwrap` methods are all unstable.

* The `tuple` module has its name as stable, the naming of the `TupleN` traits
  as stable while the methods are all #[unstable]. The other impls in the module
  have appropriate stability for the corresponding trait.

* The `arc` module has received the exact same treatment as the `rc` module
  previously did.

* The `any` module has its name as stable. The `Any` trait is also stable, with
  a new private supertrait which now contains the `get_type_id` method. This is
  to make the method a private implementation detail rather than a public-facing
  detail.

  The two extension traits in the module are marked #[unstable] as they will not
  be necessary with DST. The `is` method is #[stable], the as_{mut,ref} methods
  have been renamed to downcast_{mut,ref} and are #[unstable].

  The extension trait `BoxAny` has been clarified as to why it is unstable as it
  will not be necessary with DST.

This is a breaking change because the `marker1` field was removed from the
`UnsafeCell` type. To deal with this change, you can simply delete the field and
only specify the value of the `data` field in static initializers.

[breaking-change]

10 years agostd: Stabilize unit, bool, ty, tuple, arc, any
Alex Crichton [Thu, 24 Jul 2014 02:10:12 +0000 (19:10 -0700)]
std: Stabilize unit, bool, ty, tuple, arc, any

This commit applies stability attributes to the contents of these modules,
summarized here:

* The `unit` and `bool` modules have become #[unstable] as they are purely meant
  for documentation purposes and are candidates for removal.

* The `ty` module has been deprecated, and the inner `Unsafe` type has been
  renamed to `UnsafeCell` and moved to the `cell` module. The `marker1` field
  has been removed as the compiler now always infers `UnsafeCell` to be
  invariant. The `new` method i stable, but the `value` field, `get` and
  `unwrap` methods are all unstable.

* The `tuple` module has its name as stable, the naming of the `TupleN` traits
  as stable while the methods are all #[unstable]. The other impls in the module
  have appropriate stability for the corresponding trait.

* The `arc` module has received the exact same treatment as the `rc` module
  previously did.

* The `any` module has its name as stable. The `Any` trait is also stable, with
  a new private supertrait which now contains the `get_type_id` method. This is
  to make the method a private implementation detail rather than a public-facing
  detail.

  The two extension traits in the module are marked #[unstable] as they will not
  be necessary with DST. The `is` method is #[stable], the as_{mut,ref} methods
  have been renamed to downcast_{mut,ref} and are #[unstable].

  The extension trait `BoxAny` has been clarified as to why it is unstable as it
  will not be necessary with DST.

This is a breaking change because the `marker1` field was removed from the
`UnsafeCell` type. To deal with this change, you can simply delete the field and
only specify the value of the `data` field in static initializers.

[breaking-change]

10 years agoauto merge of #15762 : nham/rust/ringbuf_docs, r=alexcrichton
bors [Sat, 26 Jul 2014 19:16:16 +0000 (19:16 +0000)]
auto merge of #15762 : nham/rust/ringbuf_docs, r=alexcrichton

This adds examples for get(), get_mut(), swap(), iter() and mut_iter()

10 years agoAdd examples for RingBuf methods get, get_mut, iter, mut_iter
nham [Thu, 17 Jul 2014 23:19:51 +0000 (19:19 -0400)]
Add examples for RingBuf methods get, get_mut, iter, mut_iter

10 years agoauto merge of #16000 : emkay/rust/lifetimes-guide-typo, r=alexcrichton
bors [Sat, 26 Jul 2014 17:31:16 +0000 (17:31 +0000)]
auto merge of #16000 : emkay/rust/lifetimes-guide-typo, r=alexcrichton

10 years agoSmall fixes for tests
nham [Sat, 26 Jul 2014 01:35:58 +0000 (21:35 -0400)]
Small fixes for tests

10 years agoauto merge of #15998 : luqmana/rust/nmnnbd, r=thestinger
bors [Sat, 26 Jul 2014 15:46:18 +0000 (15:46 +0000)]
auto merge of #15998 : luqmana/rust/nmnnbd, r=thestinger

LLVM recently added a new attribute, dereferenceable: http://reviews.llvm.org/D4449

>This patch adds a dereferencable attribute. In some sense, this is a companion to the nonnull attribute, but specifies that the pointer is known to be dereferencable in the same sense as a pointer generated by alloca is known to be dereferencable.

With rust, everywhere that we previously marked `nonnull` we can actually mark as `dereferenceable` (which implies nonnull) since we know the size. That is, except for one case: when generating calls for TyVisitor. It seems like we haven't substituted the self type (so we have `ty_param`) and just treat it as an opaque pointer so I just left that bit as nonnull.

With this, LLVM can for example hoist a load out of a loop where it previously couldn't:

```Rust
pub fn baz(c: &uint, n: uint) -> uint {
    let mut res = 0;
    for i in range(0, n) {
        if i > 0 {
            res += *c * i;
        }
    }
    res
}
```

Before:
```llvm
define i64 @baz(i64* noalias nocapture nonnull readonly, i64) unnamed_addr #0 {
entry-block:
  br label %for_loopback.outer

for_loopback.outer:                               ; preds = %then-block-33-, %entry-block
  %.ph = phi i64 [ %.lcssa, %then-block-33- ], [ 0, %entry-block ]
  %res.0.ph = phi i64 [ %8, %then-block-33- ], [ 0, %entry-block ]
  br label %for_loopback

for_exit:                                         ; preds = %for_loopback
  %res.0.ph.lcssa = phi i64 [ %res.0.ph, %for_loopback ]
  ret i64 %res.0.ph.lcssa

for_loopback:                                     ; preds = %for_loopback.outer, %for_body
  %2 = phi i64 [ %4, %for_body ], [ %.ph, %for_loopback.outer ]
  %3 = icmp ult i64 %2, %1
  br i1 %3, label %for_body, label %for_exit

for_body:                                         ; preds = %for_loopback
  %4 = add i64 %2, 1
  %5 = icmp eq i64 %2, 0
  br i1 %5, label %for_loopback, label %then-block-33-

then-block-33-:                                   ; preds = %for_body
  %.lcssa = phi i64 [ %4, %for_body ]
  %.lcssa15 = phi i64 [ %2, %for_body ]
  %6 = load i64* %0, align 8                     ; <------- this load
  %7 = mul i64 %6, %.lcssa15
  %8 = add i64 %7, %res.0.ph
  br label %for_loopback.outer
}
```

After:
```llvm
define i64 @baz(i64* noalias nocapture readonly dereferenceable(8), i64) unnamed_addr #0 {
entry-block:
  %2 = load i64* %0, align 8                    ; <------- load once instead
  br label %for_loopback.outer

for_loopback.outer:                               ; preds = %then-block-33-, %entry-block
  %.ph = phi i64 [ %.lcssa, %then-block-33- ], [ 0, %entry-block ]
  %res.0.ph = phi i64 [ %8, %then-block-33- ], [ 0, %entry-block ]
  br label %for_loopback

for_exit:                                         ; preds = %for_loopback
  %res.0.ph.lcssa = phi i64 [ %res.0.ph, %for_loopback ]
  ret i64 %res.0.ph.lcssa

for_loopback:                                     ; preds = %for_loopback.outer, %for_body
  %3 = phi i64 [ %5, %for_body ], [ %.ph, %for_loopback.outer ]
  %4 = icmp ult i64 %3, %1
  br i1 %4, label %for_body, label %for_exit

for_body:                                         ; preds = %for_loopback
  %5 = add i64 %3, 1
  %6 = icmp eq i64 %3, 0
  br i1 %6, label %for_loopback, label %then-block-33-

then-block-33-:                                   ; preds = %for_body
  %.lcssa = phi i64 [ %5, %for_body ]
  %.lcssa15 = phi i64 [ %3, %for_body ]
  %7 = mul i64 %2, %.lcssa15
  %8 = add i64 %7, %res.0.ph
  br label %for_loopback.outer
}
```

10 years agoauto merge of #15996 : nham/rust/smallintmap_not_hashmap, r=sanxiyn
bors [Sat, 26 Jul 2014 14:01:22 +0000 (14:01 +0000)]
auto merge of #15996 : nham/rust/smallintmap_not_hashmap, r=sanxiyn

SmallIntMap doesn't involve hashing?

10 years agoRelicense shootout-k-nucleotide.rs
Guillaume Pinot [Sat, 26 Jul 2014 13:06:40 +0000 (15:06 +0200)]
Relicense shootout-k-nucleotide.rs

Everyone agreed except @thestinger. As @thestinger contribution on this file is trivial,
we can relicense it.

Related to #14248, close #15330

10 years agoauto merge of #15991 : pcwalton/rust/resolve-regions-in-trait-matching, r=alexcrichton
bors [Sat, 26 Jul 2014 12:16:21 +0000 (12:16 +0000)]
auto merge of #15991 : pcwalton/rust/resolve-regions-in-trait-matching, r=alexcrichton

matching.

This breaks code like:

    struct Foo<'a,'b> {
        x: &'a int,
        y: &'b int,
    }

    trait Tr {
        fn foo(x: Self) {}
    }

    impl<'a,'b> Tr for Foo<'a,'b> {
        fn foo(x: Foo<'b,'a>) {} // <-- bad
    }

Change this code to not contain a lifetime mismatch error. For example:

    struct Foo<'a,'b> {
        x: &'a int,
        y: &'b int,
    }

    trait Tr {
        fn foo(x: Self) {}
    }

    impl<'a,'b> Tr for Foo<'a,'b> {
        fn foo(x: Foo<'a,'b>) {} // OK
    }

Closes #15517.

[breaking-change]

r? @alexcrichton

10 years agoauto merge of #15988 : brson/rust/antlrprep, r=cmr
bors [Sat, 26 Jul 2014 10:31:23 +0000 (10:31 +0000)]
auto merge of #15988 : brson/rust/antlrprep, r=cmr

Add `check-secondary`, which runs the pretty and lexer tests so we can run them on a dedicated bot. Leaves the pretty tests running under `check` until the bots are switched over. Also fixes some issues.

r? @cmr

10 years agoauto merge of #15987 : brson/rust/hidestdrt, r=alexcrichton
bors [Sat, 26 Jul 2014 08:46:21 +0000 (08:46 +0000)]
auto merge of #15987 : brson/rust/hidestdrt, r=alexcrichton

Rename and gensym the runtime on import, so that users
can't refer to the `native` crate.

This is unlikely to break code, but users should import the "native" crate directly.

[breaking-change]

cc @alexcrichton

10 years agoauto merge of #15982 : alexcrichton/rust/rustdoc-fixes, r=brson
bors [Sat, 26 Jul 2014 06:56:23 +0000 (06:56 +0000)]
auto merge of #15982 : alexcrichton/rust/rustdoc-fixes, r=brson

Sadly there's still a lot of open issues, but this tackles some of the more pressing ones. Each commit has its own description along with the issues it closes.

10 years agofix small typo in guide-lifetimes
Michael Matuzak [Sat, 26 Jul 2014 04:13:39 +0000 (21:13 -0700)]
fix small typo in guide-lifetimes

10 years agoauto merge of #15975 : dotdash/rust/unwind_lifetimes, r=pcwalton
bors [Sat, 26 Jul 2014 03:31:22 +0000 (03:31 +0000)]
auto merge of #15975 : dotdash/rust/unwind_lifetimes, r=pcwalton

Currently we don't emit lifetime end markers when translating the
unwinding code. I omitted that when I added the support for lifetime
intrinsics, because I initially made the mistake of just returning true
in clean_on_unwind(). That caused almost all calls to be translated as
invokes, leading to quite awful results.

To correctly emit the lifetime end markers, we must differentiate
between cleanup that requires unwinding and such cleanup that just wants
to emit code during unwinding.

10 years agorustllvm: Stub out some functions for llvm < 3.5
Luqman Aden [Sat, 26 Jul 2014 02:47:29 +0000 (19:47 -0700)]
rustllvm: Stub out some functions for llvm < 3.5

10 years agoFix a typo in SmallIntMap documentation
nham [Sat, 26 Jul 2014 01:40:47 +0000 (21:40 -0400)]
Fix a typo in SmallIntMap documentation

10 years agoImplement PartialEq/Eq/Clone/Hash/FromIterator/Extendable for SmallIntMap and Show...
nham [Thu, 24 Jul 2014 21:50:21 +0000 (17:50 -0400)]
Implement PartialEq/Eq/Clone/Hash/FromIterator/Extendable for SmallIntMap and Show/Clone for TrieMap and TrieSet

10 years agolibrustc: Use dereferenceable attribute instead of nonnull where we can.
Luqman Aden [Sat, 26 Jul 2014 01:33:10 +0000 (18:33 -0700)]
librustc: Use dereferenceable attribute instead of nonnull where we can.

10 years agoauto merge of #15789 : steveklabnik/rust/guide_pointers, r=cmr
bors [Sat, 26 Jul 2014 00:46:16 +0000 (00:46 +0000)]
auto merge of #15789 : steveklabnik/rust/guide_pointers, r=cmr

This is super, super WIP, but I'm going to go get lunch for a while, and figured I'd toss my work up here in case anyone wants to see my work as I do it.

This contains a new introductory section explaining the basics of pointers, and some pitfalls that Rust attempts to solve. I'd be interested in hearing how my explanation is, as well as if this belongs here. Pointers are such a crucial concept, I don't mind having a beginners' section on them in the main docs, even though our main audience is supposed to understand them already. Reasonable people may disagree, however.

10 years agoAdd tests that the injected runtime is inaccessible
Brian Anderson [Fri, 25 Jul 2014 22:26:51 +0000 (15:26 -0700)]
Add tests that the injected runtime is inaccessible

10 years agolibrustc: Use builder for llvm attributes.
Luqman Aden [Fri, 25 Jul 2014 23:06:44 +0000 (16:06 -0700)]
librustc: Use builder for llvm attributes.

10 years agoauto merge of #15787 : treeman/rust/hashmap-doc, r=alexcrichton
bors [Fri, 25 Jul 2014 23:01:16 +0000 (23:01 +0000)]
auto merge of #15787 : treeman/rust/hashmap-doc, r=alexcrichton

Add an example showing how to use the map with a custom type. Fill in
examples for methods  without ones.

Also move `pop_equiv` next to related public methods, to not create a
duplicate trait in the docs.

10 years agolibrustc: Resolve regions and report errors in trait/impl method
Patrick Walton [Fri, 25 Jul 2014 22:56:42 +0000 (15:56 -0700)]
librustc: Resolve regions and report errors in trait/impl method
matching.

This breaks code like:

    struct Foo<'a,'b> {
        x: &'a int,
        y: &'b int,
    }

    trait Tr {
        fn foo(x: Self) {}
    }

    impl<'a,'b> Tr for Foo<'a,'b> {
        fn foo(x: Foo<'b,'a>) {} // <-- bad
    }

Change this code to not contain a lifetime mismatch error. For example:

    struct Foo<'a,'b> {
        x: &'a int,
        y: &'b int,
    }

    trait Tr {
        fn foo(x: Self) {}
    }

    impl<'a,'b> Tr for Foo<'a,'b> {
        fn foo(x: Foo<'a,'b>) {} // OK
    }

Closes #15517.

[breaking-change]

10 years agoRevert "Use fewer instructions for `fail!`"
Brian Anderson [Fri, 25 Jul 2014 22:57:15 +0000 (15:57 -0700)]
Revert "Use fewer instructions for `fail!`"

This reverts commit c61f9763e2e03afbe62445877ceb3ed15e22e123.

Conflicts:
src/librustrt/unwind.rs
src/libstd/macros.rs

10 years agostd: Use correct conventions for statics in macros
Brian Anderson [Fri, 25 Jul 2014 22:54:56 +0000 (15:54 -0700)]
std: Use correct conventions for statics in macros

10 years agocore: Remove unneeded cfgs
Brian Anderson [Fri, 25 Jul 2014 22:54:10 +0000 (15:54 -0700)]
core: Remove unneeded cfgs

10 years agolibrustc: Disallow mutation and assignment in pattern guards, and modify
Patrick Walton [Fri, 25 Jul 2014 22:18:19 +0000 (15:18 -0700)]
librustc: Disallow mutation and assignment in pattern guards, and modify
the CFG for match statements.

There were two bugs in issue #14684. One was simply that the borrow
check didn't know about the correct CFG for match statements: the
pattern must be a predecessor of the guard. This disallows the bad
behavior if there are bindings in the pattern. But it isn't enough to
prevent the memory safety problem, because of wildcards; thus, this
patch introduces a more restrictive rule, which disallows assignments
and mutable borrows inside guards outright.

I discussed this with Niko and we decided this was the best plan of
action.

This breaks code that performs mutable borrows in pattern guards. Most
commonly, the code looks like this:

    impl Foo {
        fn f(&mut self, ...) {}
        fn g(&mut self, ...) {
            match bar {
                Baz if self.f(...) => { ... }
                _ => { ... }
            }
        }
    }

Change this code to not use a guard. For example:

    impl Foo {
        fn f(&mut self, ...) {}
        fn g(&mut self, ...) {
            match bar {
                Baz => {
                    if self.f(...) {
                        ...
                    } else {
                        ...
                    }
                }
                _ => { ... }
            }
        }
    }

Sometimes this can result in code duplication, but often it illustrates
a hidden memory safety problem.

Closes #14684.

[breaking-change]

10 years agomk: Print grammar info message like others
Brian Anderson [Fri, 25 Jul 2014 21:32:34 +0000 (14:32 -0700)]
mk: Print grammar info message like others

10 years agomk: Remove check-syntax target
Brian Anderson [Fri, 25 Jul 2014 21:28:55 +0000 (14:28 -0700)]
mk: Remove check-syntax target

This appears to be redundantly named with a shortcut target for
testing the syntax crate.

10 years agorustc: Future proof runtime injection
Brian Anderson [Fri, 25 Jul 2014 04:35:42 +0000 (21:35 -0700)]
rustc: Future proof runtime injection

Rename and gensym the runtime on import, so that users
can't refer to the `native` crate.

This is unlikely to break code, but users should import the "native" crate directly.

[breaking-change]

10 years agoauto merge of #15979 : Randati/rust/patch-2, r=kballard
bors [Fri, 25 Jul 2014 20:36:10 +0000 (20:36 +0000)]
auto merge of #15979 : Randati/rust/patch-2, r=kballard

10 years agoauto merge of #15968 : nham/rust/keys_values_other_maps, r=alexcrichton
bors [Fri, 25 Jul 2014 18:51:09 +0000 (18:51 +0000)]
auto merge of #15968 : nham/rust/keys_values_other_maps, r=alexcrichton

Adds methods for obtaining iterators over the keys or values of a SmallIntMap/TreeMap/TrieMap.

Closes #14376

10 years agorustdoc: Inline items from foreign mods
Alex Crichton [Fri, 25 Jul 2014 17:37:23 +0000 (10:37 -0700)]
rustdoc: Inline items from foreign mods

These were all just previously skipped.

Closes #15648

10 years agorustdoc: Correctly handle local renamings
Alex Crichton [Fri, 25 Jul 2014 17:16:41 +0000 (10:16 -0700)]
rustdoc: Correctly handle local renamings

Previously a `pub use` would not rename the destination in rustdoc, it would
always use the destination ident instead of the renamed ident.

10 years agorustdoc: Fix links to Box/Gc
Alex Crichton [Fri, 25 Jul 2014 16:31:20 +0000 (09:31 -0700)]
rustdoc: Fix links to Box/Gc

These are lang items now, so the internal representations need to be
re-translated back to the original structures manually.

Closes #15185
Closes #15800

10 years agorustdoc: Fix inlining type parameters
Alex Crichton [Fri, 25 Jul 2014 16:07:20 +0000 (09:07 -0700)]
rustdoc: Fix inlining type parameters

I'm not entirely sure if the correct space can be inferred when cleaning
Generics, so the impl has been switched to take the space explicitly.

Closes #15099

10 years agorustdoc: Bind keydown instead of keypress for nav
Alex Crichton [Fri, 25 Jul 2014 15:54:38 +0000 (08:54 -0700)]
rustdoc: Bind keydown instead of keypress for nav

Apparently keypress doesn't quite work in all browsers due to some not invoking
the handler and jquery not setting the right `which` field in all circumstances.
According to http://stackoverflow.com/questions/2166771 switching over to
`keydown` works and it appears to do the trick. Tested in Safari, Firefox, and
Chrome.

Closes #15011

10 years agoauto merge of #15958 : hirschenberger/rust/borrock-stats-div-by-zero, r=alexcrichton
bors [Fri, 25 Jul 2014 15:41:08 +0000 (15:41 +0000)]
auto merge of #15958 : hirschenberger/rust/borrock-stats-div-by-zero, r=alexcrichton

`rustc -Z borrowck-stats` displays ugly `-NaN%` in the stats

```
paths requiring guarantees: 0
paths requiring loans     : 0 (-NaN%)
paths requiring imm loans : 0 (-NaN%)
stable paths              : 0 (-NaN%)
```