Commit Graph

31108 Commits

Author SHA1 Message Date
bors
d30776ec24 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%)
```
2014-07-25 15:41:08 +00:00
Alex Crichton
724bcec089 rustdoc: Hide impls for #[doc(hidden)] traits
Closes #14585
2014-07-25 08:26:17 -07:00
Randati
c7700077a1 Fix assert message 2014-07-25 18:12:21 +03:00
Alex Crichton
51355478f4 rustdoc: Add a --target flag
Closes #13893
2014-07-25 07:55:25 -07:00
bors
7ff5bbd494 auto merge of #15971 : alexcrichton/rust/hurray-for-windows, r=pcwalton
The right hand side of the comparison in these checks are values of type
Option<&Path> which are normalized versions of the left-hand side, so they're
not guaranteed to be byte-for-byte equivalent even though they're the same path.

For this reasons, the command line arguments are promoted to paths for
comparison of equality.

This fixes a bug on windows where if a library was specified with --extern it
would then be picked up twice because it was not considered to have been
previously registered.
2014-07-25 13:56:08 +00:00
Björn Steinbrink
b13cad3a9c Emit lifetime end markers in unwinding codepaths
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.
2014-07-25 14:31:05 +02:00
bors
44019c79e0 auto merge of #15970 : Zoxc/rust/noalias-ref, r=cmr
This add the LLVM noalias attribute to parameters of a
shared reference type (&) which have a safe interior.
2014-07-25 12:11:08 +00:00
bors
470dbef29a auto merge of #15957 : pcwalton/rust/builtin-bound-impl-checking, r=huonw,pnkfelix
method calls are involved.

This breaks code like:

    impl<T:Copy> Foo for T { ... }

    fn take_param<T:Foo>(foo: &T) { ... }

    fn main() {
        let x = box 3i; // note no `Copy` bound
        take_param(&x);
    }

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

    impl<T:Copy> Foo for T { ... }

    fn take_param<T:Foo>(foo: &T) { ... }

    fn main() {
        let x = 3i; // satisfies `Copy` bound
        take_param(&x);
    }

Closes #15860.

[breaking-change]

r? @alexcrichton
2014-07-25 09:31:10 +00:00
Patrick Walton
f1520ea0cf librustc: Check built-in trait bounds on implementations when direct
method calls are involved.

This breaks code like:

    impl<T:Copy> Foo for T { ... }

    fn take_param<T:Foo>(foo: &T) { ... }

    fn main() {
        let x = box 3i; // note no `Copy` bound
        take_param(&x);
    }

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

    impl<T:Copy> Foo for T { ... }

    fn take_param<T:Foo>(foo: &T) { ... }

    fn main() {
        let x = 3i; // satisfies `Copy` bound
        take_param(&x);
    }

Closes #15860.

[breaking-change]
2014-07-25 00:50:35 -07:00
bors
e5984640e6 auto merge of #15961 : pcwalton/rust/fn-pointer-in-iterator, r=huonw
This breaks code like:

    struct A<'a> {
        func: &'a fn() -> Option<int>
    }

    fn foo() -> Option<int> { ... }

    fn create() -> A<'static> {
        A {
            func: &foo
        }
    }

Change this code to not take functions by reference. For example:

    struct A {
        func: extern "Rust" fn() -> Option<int>
    }

    fn foo() -> Option<int> { ... }

    fn create() -> A {
        A {
            func: foo
        }
    }

Closes #13595.

[breaking-change]

r? @huonw
2014-07-25 07:46:12 +00:00
Brian Anderson
f7ab07c780 Put the struct passed to unwinding functions into a static
Produces very clean asm, but makes bigger binaries.
2014-07-25 00:40:58 -07:00
Brian Anderson
4636b32a42 Make most of the failure functions take &(&'static str, uint)
Passing one pointer takes less code than one pointer and an integer.
2014-07-25 00:02:29 -07:00
bors
4e388859a2 auto merge of #15959 : omasanori/rust/cleanup-ja, r=alexcrichton
The translation is based on an early version of tutorial.md, thus most
of entries have been marked as fuzzy and actually they are incorrect.
Now tutorial.md is planed to be replaced with guide.md, so I'd suggest
removing translation files for a while.

/cc @gifnksm
2014-07-25 06:01:13 +00:00
Alex Crichton
bd838a3b7e rustc: Compare paths with --extern, not bytes
The right hand side of the comparison in these checks are values of type
Option<&Path> which are normalized versions of the left-hand side, so they're
not guaranteed to be byte-for-byte equivalent even though they're the same path.

For this reasons, the command line arguments are promoted to paths for
comparison of equality.

This fixes a bug on windows where if a library was specified with --extern it
would then be picked up twice because it was not considered to have been
previously registered.
2014-07-24 22:41:52 -07:00
John Kåre Alsaker
4c2d4cd3de Add noalias to safe shared reference parameters
This add the LLVM noalias attribute to parameters of a
shared reference type (&) which have a safe interior.
2014-07-25 07:29:12 +02:00
nham
74b1aed0ec Add methods for obtaining iterators over the keys and values of a TrieMap 2014-07-25 01:14:49 -04:00
nham
0b339e09ab Add methods for obtaining iterators over the keys and values of a SmallIntMap 2014-07-25 00:48:05 -04:00
Brian Anderson
53543d2aa3 mk: Some fixes to grammar.mk
Invoke rustc in a way that sets LD_LIBRARY_PATH,
and disable the deps on RustLexer.class when antlr isn't available.
2014-07-24 21:34:51 -07:00
Brian Anderson
71f8db5b62 mk: Add comments to primary check targets 2014-07-24 21:34:51 -07:00
Brian Anderson
80b93a3b85 mk: Add check-secondary target for tests with no x-platform risk.
We'll use this to run a subset of the test suite onto a dedicated
bot.

This puts the grammar tests and the pretty-printer tests under
check-secondary. It leanves the pretty tests under plain `check`
for now, until the new bot is added to take over.

Because check-secondary is not run as part of `make check` there
will be a set of tests that most users never run and are only
checked by bors. I think this will be ok because grammar tests
should rarely regress, and the people regressing such tests
should have the fortitude to deal with it.
2014-07-24 21:34:51 -07:00
nham
18f7b8f201 Add methods for obtaining iterators over the keys and values of a TreeMap 2014-07-25 00:32:42 -04:00
bors
b9035c26e2 auto merge of #15809 : pcwalton/rust/dedesugar-for, r=pnkfelix
librustc: Stop desugaring `for` expressions and translate them directly.

This makes edge cases in which the `Iterator` trait was not in scope
and/or `Option` or its variants were not in scope work properly.

This breaks code that looks like:

    struct MyStruct { ... }

    impl MyStruct {
        fn next(&mut self) -> Option<int> { ... }
    }

    for x in MyStruct { ... } { ... }

Change ad-hoc `next` methods like the above to implementations of the
`Iterator` trait. For example:

    impl Iterator<int> for MyStruct {
        fn next(&mut self) -> Option<int> { ... }
    }

Closes #15392.

[breaking-change]
2014-07-25 02:21:14 +00:00
Patrick Walton
caa564bea3 librustc: Stop desugaring for expressions and translate them directly.
This makes edge cases in which the `Iterator` trait was not in scope
and/or `Option` or its variants were not in scope work properly.

This breaks code that looks like:

    struct MyStruct { ... }

    impl MyStruct {
        fn next(&mut self) -> Option<int> { ... }
    }

    for x in MyStruct { ... } { ... }

Change ad-hoc `next` methods like the above to implementations of the
`Iterator` trait. For example:

    impl Iterator<int> for MyStruct {
        fn next(&mut self) -> Option<int> { ... }
    }

Closes #15392.

[breaking-change]
2014-07-24 18:58:12 -07:00
bors
a4553453a0 auto merge of #15951 : edwardw/rust/issue-15896, r=alexcrichton
Fix ICE when there's an incorrect enum variant constructor in match arm.

Closes #15896.
2014-07-25 00:36:11 +00:00
bors
7f2e63ec3f auto merge of #15945 : treeman/rust/doc-smallint-update, r=alexcrichton
Forgot two methods, but @alexcrichton was a bit too quick to accept  #15943, so I made a new PR.
2014-07-24 22:51:10 +00:00
Patrick Walton
d1dcd19d26 librustc: Make references to functions not have static lifetime.
This breaks code like:

    struct A<'a> {
        func: &'a fn() -> Option<int>
    }

    fn foo() -> Option<int> { ... }

    fn create() -> A<'static> {
        A {
            func: &foo
        }
    }

Change this code to not take functions by reference. For example:

    struct A {
        func: extern "Rust" fn() -> Option<int>
    }

    fn foo() -> Option<int> { ... }

    fn create() -> A {
        A {
            func: foo
        }
    }

Closes #13595.

[breaking-change]
2014-07-24 15:29:26 -07:00
OGINO Masanori
1e2456b988 Remove obsolete Japanese translation for a while.
The translation is based on an early version of tutorial.md, thus most
of entries have been marked as fuzzy and actually they are incorrect.
Now tutorial.md is planed to be replaced with guide.md, so I'd suggest
removing translation files for a while.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-07-25 06:51:32 +09:00
Falco Hirschenberger
4ca127789d Fix display of -NaN% in borrock stats caused by div by zero 2014-07-24 23:49:30 +02:00
bors
d3f66bd5b4 auto merge of #15779 : alexcrichton/rust/no-nul-terminator, r=pcwalton
Apparently the default getFile implementation for a memory buffer in LLVM ends
up requiring a null terminator at the end of the file. This isn't true a good
bit of the time apparently on OSX. There have been a number of failed
nightly/snapshot builds recently with this strange assertion.

This modifies the calls to MemoryBuffer::getFile to explicitly not ask for a
null terminator.
2014-07-24 19:56:06 +00:00
Alex Crichton
b29d106b7c rustllvm: Don't require null terminators in files
Apparently the default getFile implementation for a memory buffer in LLVM ends
up requiring a null terminator at the end of the file. This isn't true a good
bit of the time apparently on OSX. There have been a number of failed
nightly/snapshot builds recently with this strange assertion.

This modifies the calls to MemoryBuffer::getFile to explicitly not ask for a
null terminator.
2014-07-24 11:31:28 -07:00
bors
c05bb4ec7d auto merge of #15424 : TeXitoi/rust/relicense-shootout-threadring, r=brson
Everyone agreed.

Related to #14248, close #15328

@brson OK?
2014-07-24 18:11:03 +00:00
Edward Wang
c3f4c6d492 Fix #15896
Fix ICE when there's an incorrect enum variant constructor in match arm.

Closes #15896.
2014-07-25 00:44:35 +08:00
bors
4461f03a36 auto merge of #15949 : alexcrichton/rust/rollup, r=alexcrichton 2014-07-24 16:11:23 +00:00
Alex Crichton
1031ad8f70 Test fixes from the rollup
Closes #15807 (Deprecate some unsafe functions in `str::raw` and remove `OwnedStr` trait)
Closes #15859 (Implement `Show` for `CString` and fix warning compiling tests for libcollections)
Closes #15911 (Updated LLVM for iOS)
Closes #15925 (libsyntax: Remove `~self` and `mut ~self` from the language.)
Closes #15930 (Add examples for Checked[Add|Sub|Mul|Div])
Closes #15933 (rustdoc: make table of contents optional)
Closes #15937 (librustc: Make bare functions implement the `FnMut` trait.)
Closes #15938 (librustc: Check structure constructors against their types.)
Closes #15939 (rustdoc: Add a --crate-name option)
Closes #15942 (Document trie collections)
Closes #15943 (Document SmallIntMap)
2014-07-24 08:48:50 -07:00
Jonas Hietala
222b780e7a Document update and update_with_key in SmallIntMap.
Move update above for better docs progression.
2014-07-24 16:30:29 +02:00
Jonas Hietala
dff14069c9 Document SmallIntMap with examples. 2014-07-24 07:26:33 -07:00
Jonas Hietala
d93e53e70e Format documentation for SmallIntMap. 2014-07-24 07:26:32 -07:00
Jonas Hietala
3685945ec1 Main examples for TrieSet and TrieMap. 2014-07-24 07:26:31 -07:00
Jonas Hietala
a524928951 Document TrieSet and TrieMap methods. 2014-07-24 07:26:31 -07:00
Alex Crichton
237738fa3e rustdoc: Add a --crate-name option
Like rustc, this is required by cargo to build documentation.
2014-07-24 07:26:26 -07:00
Patrick Walton
103d888f65 librustc: Check structure constructors against their types.
This breaks code like:

    struct Point<T> {
        x: T,
        y: T,
    }

    let pt = Point::<bool> {
        x: 1,
        y: 2,
    };

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

    let pt = Point::<int> {
        x: 1,
        y: 2,
    };

Closes #9620.
Closes #15875.

[breaking-change]
2014-07-24 07:26:24 -07:00
Patrick Walton
3550068b53 librustc: Make bare functions implement the FnMut trait.
This is done entirely in the libraries for functions up to 16 arguments.
A macro is used so that more arguments can be easily added if we need.
Note that I had to adjust the overloaded call algorithm to not try
calling the overloaded call operator if the callee is a built-in
function type, to prevent loops.

Closes #15448.
2014-07-24 07:26:22 -07:00
Aaron Turon
31ac8a90f1 rustdoc: make table of contents optional
rustdoc currently determines whether to produce a table of
contents (along with numbered sections) from the input type: yes for
markdown input, no for Rust input. This commit adds a flag to disable
the table of contents for markdown input, which is useful for embedding
the output in a larger context.
2014-07-24 07:26:17 -07:00
nham
62bddfa0a5 Add examples for Checked[Add|Sub|Mul|Div] 2014-07-24 07:26:08 -07:00
Patrick Walton
bb165eb5c2 libsyntax: Remove ~self and mut ~self from the language.
This eliminates the last vestige of the `~` syntax.

Instead of `~self`, write `self: Box<TypeOfSelf>`; instead of `mut
~self`, write `mut self: Box<TypeOfSelf>`, replacing `TypeOfSelf` with
the self-type parameter as specified in the implementation.

Closes #13885.

[breaking-change]
2014-07-24 07:26:03 -07:00
Valerii Hiora
57cade5744 Updated LLVM for iOS
There should be no more problems during SjLj pass
2014-07-24 07:25:55 -07:00
Adolfo Ochagavía
4ea1dd5494 Add a null pointer check to CString::new
This also removes checks in other methods of `CString`

Breaking changes:
* `CString::new` now fails if `buf` is null. To avoid this add a check
before creatng a new `CString` .
* The `is_null` and `is_not_null` methods are deprecated, because a
`CString` cannot be null.
* Other methods which used to fail if the `CString` was null do not fail anymore

[breaking-change]
2014-07-24 07:25:48 -07:00
Adolfo Ochagavía
6988bcd74c Implement Show for CString
We use use `from_utf8_lossy` to convert it to a MaybeOwned string, to
avoid failing in case the CString contains invalid UTF-8
2014-07-24 07:25:48 -07:00
Adolfo Ochagavía
8836048c76 Fix deprecation warning in deque.rs 2014-07-24 07:25:48 -07:00
Adolfo Ochagavía
75a0062d88 Add string::raw::from_buf 2014-07-24 07:25:43 -07:00