Commit graph

31698 commits

Author SHA1 Message Date
bors 0d8738f9b5 auto merge of #16565 : kaseyc/rust/documentation_fixes, r=pcwalton
Corrected the sample rustdoc command to use --output instead of --output-dir and fixed markdown formatting in debuginfo.rs.
2014-08-17 23:01:10 +00:00
Alexis Beingessner 8c9bdda89b Correct internal BitvSet 0-padding, fixes #16542 2014-08-17 18:49:10 -04:00
Jakub Wieczorek d283574558 Forbid extern statics from appearing in patterns
Fixes #16149.
2014-08-18 00:08:57 +02:00
Daniel Micay 54cb0f6368 mark Windows binaries as compatible with ASLR
This is enough for dynamic libraries, but not executables because MinGW
does not output a .reloc section even with `--dynamicbase`. It could
either be worked around by exporting a DLL symbol from the executable or
fixed in MinGW itself.
2014-08-17 17:17:20 -04:00
bors 776c17f476 auto merge of #16554 : jakub-/rust/struct-pat-fields-ty-err, r=pcwalton
Fixes #16338.
Fixed #16401.
2014-08-17 21:16:10 +00:00
Kasey Carrothers 61b9036bb8 Changed the sample command in the Rustdoc readme to use --output instead of the outdated --output-dir and
fixed markdown formatting in debuginfo.rs
2014-08-17 14:01:26 -07:00
Jakub Wieczorek 9b0f89d342 Fix type checking of struct fields in patterns of type ty_err
Fixes #16338.
Fixed #16401.
2014-08-17 21:34:01 +02:00
bors 3f57c8988d auto merge of #16558 : Gankro/rust/hashbig, r=pcwalton
Pretty self-explanatory. Only annoying thing is that it *seems* that I had to add `#![feature(default_type_params)]` to libnum because of Hasher. Don't know if there's a way around that.

Fix #16551
2014-08-17 19:31:10 +00:00
Piotr Czarnecki 958250c0e5 rustdoc: Fix and improve line break hints with the <wbr> tag
Prevents zero-width spaces from appearing in copy-pasted paths.

Puts line breaks after `::`.

Fixes #16555
2014-08-17 19:28:20 +01:00
bors fb018a3d4b auto merge of #16550 : kaseyc/rust/fix_documentation_error, r=alexcrichton 2014-08-17 16:41:11 +00:00
Alexis Beingessner af82adce75 Make BigUint and BigInt Hash, fixes #16551 2014-08-17 12:26:33 -04:00
bors dc65307e3b auto merge of #16547 : huonw/rust/new-kw, r=pcwalton 2014-08-17 14:56:08 +00:00
bors eff87bc9d2 auto merge of #16543 : huonw/rust/deprecated-btree, r=alexcrichton
This is very half-baked at the moment and very inefficient, e.g.
inappropriate use of by-value `self` (and thus being forced into an
overuse of `clone`). People get the wrong impression about Rust when
using it, e.g. that Rust cannot express what other languages can because
the implementation is inefficient: https://news.ycombinator.com/item?id=8187831 .
2014-08-17 13:11:06 +00:00
bors a12a4ddcfa auto merge of #16537 : jakub-/rust/use-mod-manual, r=alexcrichton 2014-08-17 10:46:08 +00:00
bors 921240e00a auto merge of #16432 : pcwalton/rust/kindck-traits, r=nikomatsakis
them during kind checking.

This implements RFC #11.

Closes #15759.

r? @nikomatsakis
2014-08-17 08:46:09 +00:00
Patrick Walton 086a5ca7d2 librustc: Allow trait bounds on structures and enumerations, and check
them during kind checking.

This implements RFC #11.

Closes #15759.
2014-08-17 01:39:10 -07:00
bors 6dca1426bc auto merge of #16535 : michaelsproul/rust/vim-traits, r=pcwalton
The vim syntax highlighting file had become out of sync with the real prelude.

Lots of Vector -> Slice renames have happened recently.
2014-08-17 06:26:09 +00:00
bors cb9c1e0e70 auto merge of #16498 : Kimundi/rust/inline-utf-encoding, r=alexcrichton
The first commit improves code generation through a few changes:
- The `#[inline]` attributes allow llvm to constant fold the encoding step away in certain situations. For example, code like this changes from a call to `encode_utf8` in a inner loop to the pushing of a byte constant:

 ```rust
let mut s = String::new();
for _ in range(0u, 21) {
        s.push_char('a');
}
```
- Both methods changed their semantic from causing run time failure if the target buffer is not large enough to returning `None` instead. This makes llvm no longer emit code for causing failure for these methods.
- A few debug `assert!()` calls got removed because they affected code generation due to unwinding, and where basically unnecessary with today's sound handling of `char` as a Unicode scalar value.

~~The second commit is optional. It changes the methods from regular indexing with the `dst[i]` syntax to unsafe indexing with `dst.unsafe_mut_ref(i)`. This does not change code generation directly - in both cases llvm is smart enough to see that there can never be an out-of-bounds access. But it makes it emit a `nounwind` attribute for the function. 
However, I'm not sure whether that is a real improvement, so if there is any objection to this I'll remove the commit.~~

This changes how the methods behave on a too small buffer, so this is a 

[breaking-change]
2014-08-17 04:42:32 +00:00
Kasey Carrothers 9e514af07e Fix an error in a code sample in bitv.rs 2014-08-16 20:28:20 -07:00
bors 4a5654f960 auto merge of #16482 : pcwalton/rust/resolve-shadowing, r=brson
declared with the same name in the same scope.

This breaks several common patterns. First are unused imports:

    use foo::bar;
    use baz::bar;

Change this code to the following:

    use baz::bar;

Second, this patch breaks globs that import names that are shadowed by
subsequent imports. For example:

    use foo::*; // including `bar`
    use baz::bar;

Change this code to remove the glob:

    use foo::{boo, quux};
    use baz::bar;

Or qualify all uses of `bar`:

    use foo::{boo, quux};
    use baz;

    ... baz::bar ...

Finally, this patch breaks code that, at top level, explicitly imports
`std` and doesn't disable the prelude.

    extern crate std;

Because the prelude imports `std` implicitly, there is no need to
explicitly import it; just remove such directives.

The old behavior can be opted into via the `import_shadowing` feature
gate. Use of this feature gate is discouraged.

This implements RFC #116.

Closes #16464.

[breaking-change]

r? @brson
2014-08-17 02:36:10 +00:00
Patrick Walton 7f928d150e librustc: Forbid external crates, imports, and/or items from being
declared with the same name in the same scope.

This breaks several common patterns. First are unused imports:

    use foo::bar;
    use baz::bar;

Change this code to the following:

    use baz::bar;

Second, this patch breaks globs that import names that are shadowed by
subsequent imports. For example:

    use foo::*; // including `bar`
    use baz::bar;

Change this code to remove the glob:

    use foo::{boo, quux};
    use baz::bar;

Or qualify all uses of `bar`:

    use foo::{boo, quux};
    use baz;

    ... baz::bar ...

Finally, this patch breaks code that, at top level, explicitly imports
`std` and doesn't disable the prelude.

    extern crate std;

Because the prelude imports `std` implicitly, there is no need to
explicitly import it; just remove such directives.

The old behavior can be opted into via the `import_shadowing` feature
gate. Use of this feature gate is discouraged.

This implements RFC #116.

Closes #16464.

[breaking-change]
2014-08-16 19:32:25 -07:00
Huon Wilson d1c5db326f Add new keywords (particularly where & virtual) to editor modes. 2014-08-17 11:57:22 +10:00
Huon Wilson 7b141ad99b collections: deprecate BTree.
This is very half-baked at the moment and very inefficient, e.g.
inappropriate use of by-value `self` (and thus being forced into an
overuse of `clone`). People get the wrong impression about Rust when
using it, e.g. that Rust cannot express what other languages can because
the implementation is inefficient.
2014-08-17 10:16:48 +10:00
bors 85fd37f876 auto merge of #16531 : alexcrichton/rust/snapshots, r=luqmana
Hopefully this will fix #16489!
2014-08-16 21:11:08 +00:00
Jakub Wieczorek 7606f580a1 Add use a:🅱️:{c, mod}; to the manual 2014-08-16 22:42:38 +02:00
Marvin Löbel 13079c1a85 Optimized IR generation for UTF-8 and UTF-16 encoding
- Both can now be inlined and constant folded away
- Both can no longer cause failure
- Both now return an `Option` instead

Removed debug `assert!()`s over the valid ranges of a `char`
- It affected optimizations due to unwinding
- Char handling is now sound enought that they became uneccessary
2014-08-16 21:13:39 +02:00
bors 17bcc1b08c auto merge of #16505 : dotdash/rust/extern_realpath, r=alexcrichton
Crates that are resolved normally have their path canonicalized and all
symlinks resolved. This does currently not happen for paths specified
using the --extern option to rustc, which can lead to rustc thinking
that it encountered two different versions of a crate, when it's
actually the same version found through different paths.

Fixes #16496
2014-08-16 17:36:07 +00:00
bors 22b7e4dd56 auto merge of #16534 : thestinger/rust/dep, r=huonw
This is already enabled by default for x86_64 executables on Windows,
but it needs to be manually enabled on x86.

Closes #16533
2014-08-16 14:51:07 +00:00
bors 78ec3904b4 auto merge of #16527 : kballard/rust/vim_fold, r=chris
We shouldn't be setting any settings in the syntax file. Better to put
them in the ftplugin, where they won't be pulled in by :syn-include and
can be cleaned up when changing the filetype.
2014-08-16 13:01:09 +00:00
bors cf71f1c7b0 auto merge of #16525 : thestinger/rust/readonly, r=pcwalton
These are already marked as `noalias` due to the immutability guarantee
(see 4c2d4cd3de), but more information can
be bubbled up to the caller via `readonly`.
2014-08-16 11:21:11 +00:00
Michael Sproul 1a5816a9aa vim: Update syntax file for Prelude changes.
Lots of Vector -> Slice renames.
2014-08-16 21:07:27 +10:00
Daniel Micay d3c71a5890 enable DEP (NX bit) for 32-bit Windows executables
This is already enabled by default for x86_64 executables on Windows,
but it needs to be manually enabled on x86.

Closes #16533
2014-08-16 05:20:31 -04:00
bors ec9476cd63 auto merge of #16520 : dotdash/rust/fix_llvm_before_36, r=thestinger 2014-08-16 08:56:11 +00:00
bors bc181f8075 auto merge of #16475 : treeman/rust/complex-divide-by-zero-test, r=alexcrichton
Did not find a test for it.
2014-08-16 07:16:13 +00:00
bors ec1d34eb27 auto merge of #16513 : sfackler/rust/io-util-cleanup, r=alexcrichton
* Fix `LimitReader`'s `Buffer::consume` impl to avoid limit underflow
* Make `MultiWriter` fail fast instead of always running through each
    `Writer`. This may or may not be what we want, but it at least
    doesn't throw any errors encountered in later `Writer`s into oblivion.
* Prevent `IterReader`'s `Reader::read` impl from returning EOF if given
    an empty buffer.

[breaking-change]
2014-08-16 05:36:14 +00:00
Alex Crichton 8f16aa748c Register new snapshots
Hopefully this will fix #16489!
2014-08-15 22:16:10 -07:00
bors d30001d04d auto merge of #16519 : apoelstra/rust/patch-1, r=alexcrichton
This is needed to derive Clone on structures containing durations.
2014-08-16 00:46:15 +00:00
Kevin Ballard ab65869c9d vim: Don't set foldmethod in the syntax file either
We shouldn't be setting any settings in the syntax file. Better to put
them in the ftplugin, where they won't be pulled in by :syn-include and
can be cleaned up when changing the filetype.
2014-08-15 16:41:07 -07:00
bors 38cb37de72 auto merge of #16493 : kballard/rust/fix_drop_field_order, r=pnkfelix
When a struct implements Drop, its fields should still drop in
declaration order (just as they do when the struct does not implement
Drop).

Fixes #16492.
2014-08-15 22:36:15 +00:00
Kevin Ballard b517b42891 Fix the order in which struct fields drop
When a struct implements Drop, its fields should still drop in
declaration order (just as they do when the struct does not implement
Drop).

Fixes #16492.
2014-08-15 13:36:25 -07:00
bors 2da5018838 auto merge of #16517 : dotdash/rust/for_trunc, r=pcwalton
The discriminant for Option values is either 0 or 1, so we can just
truncate the value to an i1, which ends up as a no-op for Options
containing pointers.
2014-08-15 20:31:16 +00:00
Daniel Micay 48edb32a3f mark &T params without UnsafeCell<U> as readonly
These are already marked as `noalias` due to the immutability guarantee
(see 4c2d4cd3de), but more information can
be bubbled up to the caller via `readonly`.
2014-08-15 14:23:00 -04:00
bors 02f9fd87ec auto merge of #16511 : luqmana/rust/sbnt, r=pcwalton
Fixes #15397.
Fixes #7261.
Fixes #6573.
2014-08-15 15:46:17 +00:00
Andrew Poelstra b586582481 Derive Clone for std::time::Duration
This is needed to derive Clone for types containing Durations.
2014-08-15 07:50:02 -07:00
Björn Steinbrink f1f67b2848 Fix builds with LLVM < 3.6 2014-08-15 16:36:05 +02:00
bors cafa47506d auto merge of #16497 : michaelwoerister/rust/no_debug_attribute, r=pcwalton
Fixes #15332.
2014-08-15 14:06:17 +00:00
Michael Woerister 910dd2635c debuginfo: Add a "no_debug" attribute that allows to exclude functions from debuginfo generation. 2014-08-15 15:35:43 +02:00
Björn Steinbrink a5590b3c75 Properly canonicalize crate paths specified via --extern
Crates that are resolved normally have their path canonicalized and all
symlinks resolved. This does currently not happen for paths specified
using the --extern option to rustc, which can lead to rustc thinking
that it encountered two different versions of a crate, when it's
actually the same version found through different paths.

To fix this, we must store the canonical path for crates found via
--extern and also use the canonical path when comparing paths.

Fixes #16496
2014-08-15 14:40:09 +02:00
bors 406de8d5dd auto merge of #16500 : jackheizer/rust/export-name, r=alexcrichton 2014-08-15 12:11:16 +00:00
Björn Steinbrink 6c5d97a5da Generate slightly better unoptimized code for for-loops
The discriminant for Option values is either 0 or 1, so we can just
truncate the value to an i1, which ends up as a no-op for Options
containing pointers.
2014-08-15 13:12:48 +02:00