]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agostd: Rename slice::Vector to Slice
Brian Anderson [Thu, 7 Aug 2014 03:03:55 +0000 (20:03 -0700)]
std: Rename slice::Vector to Slice

This required some contortions because importing both raw::Slice
and slice::Slice makes rustc crash.

Since `Slice` is in the prelude, this renaming is unlikely to
casue breakage.

[breaking-change]

9 years agostd: Rename various slice traits for consistency
Brian Anderson [Thu, 7 Aug 2014 01:58:43 +0000 (18:58 -0700)]
std: Rename various slice traits for consistency

ImmutableVector -> ImmutableSlice
ImmutableEqVector -> ImmutableEqSlice
ImmutableOrdVector -> ImmutableOrdSlice
MutableVector -> MutableSlice
MutableVectorAllocating -> MutableSliceAllocating
MutableCloneableVector -> MutableCloneableSlice
MutableOrdVector -> MutableOrdSlice

These are all in the prelude so most code will not break.

[breaking-change]

9 years agoauto merge of #16381 : pnkfelix/rust/fsk-rust.md-fixes, r=alexcrichton
bors [Wed, 13 Aug 2014 14:16:27 +0000 (14:16 +0000)]
auto merge of #16381 : pnkfelix/rust/fsk-rust.md-fixes, r=alexcrichton

rust.md: Explicitly point out how special `'static` is.

Drive-by: fix description of `&content` to point out that `&'f type` is (as of today) only for type expressions.
9 years agoauto merge of #16421 : ipetkov/rust/cmd-fd-fix-retry, r=alexcrichton
bors [Wed, 13 Aug 2014 05:56:20 +0000 (05:56 +0000)]
auto merge of #16421 : ipetkov/rust/cmd-fd-fix-retry, r=alexcrichton

Retry pull requesting of https://github.com/rust-lang/rust/pull/16407 after accidentally messing up rebasing of branches and making bors think the PR was merged

9 years agoauto merge of #16460 : pcwalton/rust/borrowck-closure-issue, r=nikomatsakis
bors [Wed, 13 Aug 2014 04:11:22 +0000 (04:11 +0000)]
auto merge of #16460 : pcwalton/rust/borrowck-closure-issue, r=nikomatsakis

This fixes borrow checking for closures. Code like this will break:

    struct Foo {
        x: int,
    }

    pub fn main() {
        let mut this = &mut Foo {
            x: 1,
        };
        let r = || {
            let p = &this.x;
            &mut this.x;
        };
        r()
    }

Change this code to not take multiple mutable references to the same value. For
example:

    struct Foo {
        x: int,
    }

    pub fn main() {
        let mut this = &mut Foo {
            x: 1,
        };
        let r = || {
            &mut this.x;
        };
        r()
    }

Closes #16361.

[breaking-change]

r? @nikomatsakis

9 years agoauto merge of #16458 : pcwalton/rust/borrowck-for-moves, r=nikomatsakis
bors [Wed, 13 Aug 2014 02:26:23 +0000 (02:26 +0000)]
auto merge of #16458 : pcwalton/rust/borrowck-for-moves, r=nikomatsakis

`for` loop heads.

This breaks code like:

    let x = Some(box 1i);
    for &a in x.iter() {
    }

Change this code to obey the borrow checking rules. For example:

    let x = Some(box 1i);
    for &ref a in x.iter() {
    }

Closes #16205.

[breaking-change]

r? @nikomatsakis

9 years agolibnative: process spawning should not close inherited file descriptors
Ivan Petkov [Sun, 10 Aug 2014 21:10:34 +0000 (14:10 -0700)]
libnative: process spawning should not close inherited file descriptors

* The caller should be responsible for cleaning up file descriptors
* If a caller safely creates a file descriptor (via
  native::io::file::open) the returned structure (FileDesc) will try to
  clean up the file, failing in the process and writing error messages
  to the screen.
* This should not happen as the caller has no public interface for
  telling the FileDesc structure to NOT free the underlying fd.
* Alternatively, if another file is opened under the same fd held by
  the FileDesc structure returned by native::io::file::open, it will
  close the wrong file upon destruction.

9 years agoauto merge of #16452 : epdtry/rust/unreachable-item-ice, r=pcwalton
bors [Wed, 13 Aug 2014 00:41:22 +0000 (00:41 +0000)]
auto merge of #16452 : epdtry/rust/unreachable-item-ice, r=pcwalton

This code produces an ICE:

```rust
#![crate_type = "rlib"]
fn main() {
    if true { return }
    // remaining code is unreachable
    match () {
        () => { static MAGIC: uint = 0; }
    }
}
```
([playpen](http://is.gd/iwOISB))

The error is "encode_symbol: id not found 18", where 18 is the `NodeId` of the declaration of `MAGIC`.  The problem is that `rustc` tries to emit metadata for `MAGIC`, but some of the information is missing because `MAGIC` never gets translated by `trans_item` - the entire body of the `match` gets skipped because the `match` itself is unreachable.

This branch simplifies the handling of inner items by always processing them using the `trans_item` visitor, instead of sometimes using the visitor and sometimes waiting until `trans_stmt` encounters the item.  This fixes the ICE by making the translation of the item no longer depend on the declaration being reachable code.  This branch also reverts #16059 and #16359, since the new change to item translation fixes the same problems as those but is simpler.

9 years agomore consistent handling of inner items
Stuart Pernsteiner [Tue, 12 Aug 2014 16:19:47 +0000 (09:19 -0700)]
more consistent handling of inner items

9 years agoRevert "avoid redundant translation of items during monomorphization"
Stuart Pernsteiner [Mon, 11 Aug 2014 23:55:13 +0000 (16:55 -0700)]
Revert "avoid redundant translation of items during monomorphization"

This reverts commit f97f65f7b70e455c1c3e72e620120c9f1a96d89a.

Conflicts:
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/foreign.rs
src/librustc/middle/trans/monomorphize.rs

9 years agoRevert "don't translate items when monomorphizing foreign-ABI functions"
Stuart Pernsteiner [Mon, 11 Aug 2014 23:54:16 +0000 (16:54 -0700)]
Revert "don't translate items when monomorphizing foreign-ABI functions"

This reverts commit 0c158b4fbfcec7d6f18859661047dff2109fdfe4.

9 years agolibrustc: Use the correct categorized mutable type for the pattern in
Patrick Walton [Tue, 12 Aug 2014 19:51:23 +0000 (12:51 -0700)]
librustc: Use the correct categorized mutable type for the pattern in
`for` loop heads.

This breaks code like:

    let x = Some(box 1i);
        for &a in x.iter() {
    }

Change this code to obey the borrow checking rules. For example:

    let x = Some(box 1i);
        for &ref a in x.iter() {
    }

Closes #16205.

[breaking-change]

9 years agoauto merge of #16433 : aturon/rust/deprecated-in-crate, r=alexcrichton
bors [Tue, 12 Aug 2014 22:01:25 +0000 (22:01 +0000)]
auto merge of #16433 : aturon/rust/deprecated-in-crate, r=alexcrichton

Previously the stability lint considered cross-crate items only. That's appropriate for unstable and experimental levels, but not for deprecation.

In addition to changing the lint, this PR takes care of the fallout: a number of deprecated items that were being used throughout libstd.

Closes #16409

Due to deny(deprecated), this is a:

[breaking-change]

9 years agolibrustc: Record unique immutable borrows in the restrictions table.
Patrick Walton [Tue, 12 Aug 2014 21:25:41 +0000 (14:25 -0700)]
librustc: Record unique immutable borrows in the restrictions table.

This fixes borrow checking for closures. Code like this will break:

    struct Foo {
        x: int,
    }

    pub fn main() {
        let mut this = &mut Foo {
            x: 1,
        };
        let r = || {
            let p = &this.x;
            &mut this.x;
        };
        r()
    }

Change this code to not take multiple mutable references to the same value. For
example:

    struct Foo {
        x: int,
    }

    pub fn main() {
        let mut this = &mut Foo {
            x: 1,
        };
        let r = || {
            &mut this.x;
        };
        r()
    }

Closes #16361.

[breaking-change]

9 years agoAllow deprecation in deprecated libraries
Aaron Turon [Tue, 12 Aug 2014 00:33:43 +0000 (17:33 -0700)]
Allow deprecation in deprecated libraries

9 years agoDeprecation fallout in libsync
Aaron Turon [Tue, 12 Aug 2014 00:18:19 +0000 (17:18 -0700)]
Deprecation fallout in libsync

9 years agoDeprecation fallout in libcollections
Aaron Turon [Mon, 11 Aug 2014 23:47:46 +0000 (16:47 -0700)]
Deprecation fallout in libcollections

9 years agoEnable deprecation lint on crate-local items
Aaron Turon [Mon, 11 Aug 2014 23:39:34 +0000 (16:39 -0700)]
Enable deprecation lint on crate-local items

Previously the lint considered cross-crate items only. That's
appropriate for unstable and experimental levels, but not for
deprecation.

Closes #16409

Due to deny(deprecation), this is a:

[breaking-change]

9 years agoauto merge of #16454 : pcwalton/rust/types-in-path-patterns, r=brson
bors [Tue, 12 Aug 2014 20:06:30 +0000 (20:06 +0000)]
auto merge of #16454 : pcwalton/rust/types-in-path-patterns, r=brson

patterns.

This breaks code like:

    fn main() {
        match Some("foo") {
            None::<int> => {}
            Some(_) => {}
        }
    }

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

    fn main() {
        match Some("foo") {
            None::<&str> => {}
            Some(_) => {}
        }
    }

Closes #16353.

[breaking-change]

r? @huonw

9 years agoauto merge of #16081 : luqmana/rust/nr, r=pcwalton
bors [Tue, 12 Aug 2014 18:16:33 +0000 (18:16 +0000)]
auto merge of #16081 : luqmana/rust/nr, r=pcwalton

Fixes #15763

9 years agolibsyntax: Don't strip types and lifetimes from single-segment paths in
Patrick Walton [Tue, 12 Aug 2014 17:33:16 +0000 (10:33 -0700)]
libsyntax: Don't strip types and lifetimes from single-segment paths in
patterns.

This breaks code like:

    fn main() {
        match Some("foo") {
            None::<int> => {}
            Some(_) => {}
        }
    }

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

    fn main() {
        match Some("foo") {
            None::<&str> => {}
            Some(_) => {}
        }
    }

Closes #16353.

[breaking-change]

9 years agoauto merge of #16434 : vadimcn/rust/many-crates-but-no-match, r=alexcrichton
bors [Tue, 12 Aug 2014 09:31:17 +0000 (09:31 +0000)]
auto merge of #16434 : vadimcn/rust/many-crates-but-no-match, r=alexcrichton

9 years agoauto merge of #16425 : nham/rust/fix_nan_format, r=alexcrichton
bors [Tue, 12 Aug 2014 07:31:17 +0000 (07:31 +0000)]
auto merge of #16425 : nham/rust/fix_nan_format, r=alexcrichton

Currently, this:

    println!("{}", std::f64::NAN);

prints "-NaN". This commit is an attempt to change that to "NaN" instead.

9 years agoauto merge of #16195 : P1start/rust/more-index, r=aturon
bors [Tue, 12 Aug 2014 05:11:18 +0000 (05:11 +0000)]
auto merge of #16195 : P1start/rust/more-index, r=aturon

Implement `Index` for `RingBuf`, `HashMap`, `TreeMap`, `SmallIntMap`, and `TrieMap`.

If there’s anything that I missed or should be removed, let me know.

9 years agolibrustc: Don't use an alloca per return if the function doesn't have nested returns.
Luqman Aden [Tue, 12 Aug 2014 02:16:00 +0000 (19:16 -0700)]
librustc: Don't use an alloca per return if the function doesn't have nested returns.

9 years agoImplement Index for TrieMap
P1start [Sat, 2 Aug 2014 07:08:08 +0000 (19:08 +1200)]
Implement Index for TrieMap

9 years agoImplement Index for SmallIntMap
P1start [Sat, 2 Aug 2014 07:01:33 +0000 (19:01 +1200)]
Implement Index for SmallIntMap

This also deprecates SmallIntMap::get. Use indexing instead.

9 years agoImplement Index for TreeMap
P1start [Sat, 2 Aug 2014 06:54:38 +0000 (18:54 +1200)]
Implement Index for TreeMap

9 years agoImplement Index for HashMap
P1start [Sat, 2 Aug 2014 06:48:44 +0000 (18:48 +1200)]
Implement Index for HashMap

This also deprecates HashMap::get. Use indexing instead.

9 years agoImplement Index for RingBuf
P1start [Sat, 2 Aug 2014 06:39:39 +0000 (18:39 +1200)]
Implement Index for RingBuf

This also deprecates RingBuf::get. Use indexing instead.

9 years agoauto merge of #16284 : alexcrichton/rust/issue-16272, r=aturon
bors [Tue, 12 Aug 2014 03:31:20 +0000 (03:31 +0000)]
auto merge of #16284 : alexcrichton/rust/issue-16272, r=aturon

There was a bug in both libnative and libuv which prevented child processes from
being spawned correctly on windows when one of the arguments was an empty
string. The libuv bug has since been fixed upstream, and the libnative bug was
fixed as part of this commit.

When updating libuv, this also includes a fix for #15149.

Closes #15149
Closes #16272

9 years agoChange std::fmt::{Float,LowerExp,UpperExp} to not print '-NaN' for f32::NAN and f64...
nham [Mon, 11 Aug 2014 19:00:07 +0000 (15:00 -0400)]
Change std::fmt::{Float,LowerExp,UpperExp} to not print '-NaN' for f32::NAN and f64::NAN

9 years agolibrustc: Don't use Load/Store for structural values.
Luqman Aden [Mon, 11 Aug 2014 22:58:46 +0000 (15:58 -0700)]
librustc: Don't use Load/Store for structural values.

9 years agolibrustc: Don't allow return_address intrinsic in functions that don't use an out...
Luqman Aden [Tue, 5 Aug 2014 21:38:14 +0000 (14:38 -0700)]
librustc: Don't allow return_address intrinsic in functions that don't use an out pointer.

9 years agolibrustc: Add an intrinsic to retrieve the return pointer of a function.
Patrick Walton [Mon, 4 Aug 2014 18:48:26 +0000 (11:48 -0700)]
librustc: Add an intrinsic to retrieve the return pointer of a function.

This is needed for some GC stuff in Servo.

9 years agoReenable ignored test and add run-pass test.
Luqman Aden [Tue, 29 Jul 2014 19:35:38 +0000 (12:35 -0700)]
Reenable ignored test and add run-pass test.

9 years agolibrustc: Use separate stack slot for each return.
Luqman Aden [Tue, 29 Jul 2014 19:25:06 +0000 (12:25 -0700)]
librustc: Use separate stack slot for each return.

9 years agoFix many-crates-but-no-match test. (Issue #16348)
Vadim Chugunov [Fri, 8 Aug 2014 18:03:48 +0000 (11:03 -0700)]
Fix many-crates-but-no-match test. (Issue #16348)

9 years agoauto merge of #16417 : jasonthompson/rust/docs/slice3, r=alexcrichton
bors [Tue, 12 Aug 2014 00:26:13 +0000 (00:26 +0000)]
auto merge of #16417 : jasonthompson/rust/docs/slice3, r=alexcrichton

- Moved examples for permutations and next into trait definition as
   comments on pull request #16244.
- Fixed (hopefully) issue with erronious commit of changes to src/llvm.

9 years agoauto merge of #16427 : brson/rust/https, r=thestinger
bors [Mon, 11 Aug 2014 22:46:16 +0000 (22:46 +0000)]
auto merge of #16427 : brson/rust/https, r=thestinger

9 years agoauto merge of #16429 : steveklabnik/rust/guide_vectors, r=cmr
bors [Mon, 11 Aug 2014 20:31:20 +0000 (20:31 +0000)]
auto merge of #16429 : steveklabnik/rust/guide_vectors, r=cmr

Since https://github.com/rust-lang/rust/pull/16380 didn't get pulled in yet, I added it in here too.

This covers the very, very, very basics of vectors. I wanted to have a section that mentioned them, but I'm
unsure what else I should cover. So I just did the absolute simplest things. Feedback very welcome.

9 years agoGuide: vectors
Steve Klabnik [Mon, 11 Aug 2014 20:21:41 +0000 (16:21 -0400)]
Guide: vectors

9 years agoDownload snapshots using HTTPS
Brian Anderson [Mon, 11 Aug 2014 19:31:02 +0000 (12:31 -0700)]
Download snapshots using HTTPS

cc #16123

9 years agoUpdate docs to use HTTPS for static.rust-lang.org addresses
Brian Anderson [Mon, 11 Aug 2014 19:30:37 +0000 (12:30 -0700)]
Update docs to use HTTPS for static.rust-lang.org addresses

cc #16123

9 years agoauto merge of #16416 : nick29581/rust/log, r=pnkfelix
bors [Mon, 11 Aug 2014 11:06:08 +0000 (11:06 +0000)]
auto merge of #16416 : nick29581/rust/log, r=pnkfelix

Previously we would accept an empty log level without an equals sign, but not with one. This addresses that minor nit. E.g., `RUST_LOG=rustc::middle::trans=` will work the same as `RUST_LOG=rustc::middle::trans`.

9 years agoAPI docs/examples for std::slice
Jason Thompson [Thu, 31 Jul 2014 10:13:44 +0000 (06:13 -0400)]
API docs/examples for std::slice

 - API doc/example for next() in Permutations
 - API doc/example for permutations() in ImmutableCloneableVector
 - Moved examples for permutations and next into trait definition as
   comments on pull request #16244.
 - Fix erroneus inclusion of src/llvm in older commit.

9 years agoAccept empty log level
Nick Cameron [Mon, 11 Aug 2014 09:53:04 +0000 (10:53 +0100)]
Accept empty log level

9 years agoauto merge of #16196 : huonw/rust/fail-dead-code, r=alexcrichton
bors [Mon, 11 Aug 2014 09:01:06 +0000 (09:01 +0000)]
auto merge of #16196 : huonw/rust/fail-dead-code, r=alexcrichton

The fail macro defines some function/static items internally, which got
a dead_code warning when `fail!()` is used inside a dead function. This
is ugly and unnecessarily reveals implementation details, so the
warnings can be squashed.

Fixes #16192.

9 years agocore/std: squash dead_code warnings from fail! invocations.
Huon Wilson [Sat, 2 Aug 2014 12:41:40 +0000 (22:41 +1000)]
core/std: squash dead_code warnings from fail! invocations.

The fail macro defines some function/static items internally, which got
a dead_code warning when `fail!()` is used inside a dead function. This
is ugly and unnecessarily reveals implementation details, so the
warnings can be squashed.

Fixes #16192.

9 years agoauto merge of #16379 : parir/rust/guide-typos, r=kballard
bors [Mon, 11 Aug 2014 07:11:07 +0000 (07:11 +0000)]
auto merge of #16379 : parir/rust/guide-typos, r=kballard

This PR fixes some minor grammar and spelling issues in the guide.

9 years agoauto merge of #16399 : superlogical/rust/patch-2, r=steveklabnik
bors [Mon, 11 Aug 2014 05:21:10 +0000 (05:21 +0000)]
auto merge of #16399 : superlogical/rust/patch-2, r=steveklabnik

9 years agoFix some minor issues in the guide.
Peer Aramillo Irizar [Sat, 9 Aug 2014 07:29:07 +0000 (09:29 +0200)]
Fix some minor issues in the guide.

9 years agoauto merge of #15410 : LemmingAvalanche/rust/patch-1, r=alexcrichton
bors [Mon, 11 Aug 2014 03:36:11 +0000 (03:36 +0000)]
auto merge of #15410 : LemmingAvalanche/rust/patch-1, r=alexcrichton

People reading the tutorial may not be familiar with the convention of naming lists, vectors and the like as xs, ys, etc. Without some explanation of the reasoning behind it, it might come off as just throwaway non-descriptive names. Languages like Haskell gets flak from using short, non-descriptive names, while in reality, there are clear conventions and reasons for using certain terse variable names.

This is just a proposed explanation of this convention, as I've interpreted it - I assumed that the convention came from a language like Haskell, so I tailored it according to that. So beware that I might have misjudged how it is used in the Rust language, or at least how it is used in the Rust tutorial.

9 years agoauto merge of #16182 : jbcrail/rust/fix-test-comments, r=sfackler
bors [Sun, 10 Aug 2014 21:56:11 +0000 (21:56 +0000)]
auto merge of #16182 : jbcrail/rust/fix-test-comments, r=sfackler

9 years agoNote naming convention of lists (xs, ys, ...)
LemmingAvalanche [Fri, 4 Jul 2014 11:19:42 +0000 (13:19 +0200)]
Note naming convention of lists (xs, ys, ...)

People reading the tutorial may not be familiar with the convention of naming lists, vectors and the like as xs, ys, etc. Without some explanation of the reasoning behind it, it might come off as just throwaway non-descriptive names. Languages like Haskell gets flak from using short, non-descriptive names, while in reality, there are clear conventions and reasons for using certain terse variable names.

I assumed that the convention came from a language like Haskell, so I
tailored the explanation according to that.

9 years agoauto merge of #16400 : chuckries/rust/patch-1, r=huonw
bors [Sun, 10 Aug 2014 15:46:13 +0000 (15:46 +0000)]
auto merge of #16400 : chuckries/rust/patch-1, r=huonw

These are already coded as traits.

9 years agoauto merge of #16185 : luqmana/rust/match-drop, r=pcwalton
bors [Sun, 10 Aug 2014 13:56:16 +0000 (13:56 +0000)]
auto merge of #16185 : luqmana/rust/match-drop, r=pcwalton

Fixes #15571.
Fixes #16151.

r? @pcwalton

9 years agolint: dead_code ignores items with leading underscores.
Huon Wilson [Sun, 3 Aug 2014 06:40:06 +0000 (16:40 +1000)]
lint: dead_code ignores items with leading underscores.

This generalises the behaviour with struct fields (which recieve no
dead_code warning if they have a leading _), and other similar lints, to
all items, e.g. `fn _foo() {} fn main() {}` has no warnings.

9 years agoremove outdated comment
Chuck Ries [Sun, 10 Aug 2014 11:11:33 +0000 (04:11 -0700)]
remove outdated comment

These are already coded as traits.

9 years agoauto merge of #16395 : superlogical/rust/patch-1, r=alexcrichton
bors [Sun, 10 Aug 2014 08:56:15 +0000 (08:56 +0000)]
auto merge of #16395 : superlogical/rust/patch-1, r=alexcrichton

9 years agoFix typo `convering` to `converting`
Jake Scott [Sun, 10 Aug 2014 08:26:57 +0000 (20:26 +1200)]
Fix typo `convering` to `converting`

9 years agoauto merge of #16387 : Gankro/rust/doc-search, r=cmr
bors [Sun, 10 Aug 2014 06:31:15 +0000 (06:31 +0000)]
auto merge of #16387 : Gankro/rust/doc-search, r=cmr

Fixes str/struct ambiguity (by removing the synonym) and pushes raw searches to the history instead of processed ones.

# [Live Version Here](http://cg.scs.carleton.ca/~abeinges/doc/std/)

9 years agoauto merge of #16373 : brson/rust/nopads, r=pcwalton
bors [Sun, 10 Aug 2014 02:56:16 +0000 (02:56 +0000)]
auto merge of #16373 : brson/rust/nopads, r=pcwalton

Reduces time to build stage0 from 11:30 to 9:40 on my machine.

There's a tradeoff here since doing this will make the stage1 compile-fail tests fail.

r? @pcwalton

9 years agoFix typo
Jake Scott [Sun, 10 Aug 2014 02:12:15 +0000 (14:12 +1200)]
Fix typo

9 years agoFix misspelled comments for tests.
Joseph Crail [Fri, 1 Aug 2014 23:42:13 +0000 (19:42 -0400)]
Fix misspelled comments for tests.

9 years agoauto merge of #16371 : Gankro/rust/friendly-contrib, r=brson
bors [Sun, 10 Aug 2014 01:11:16 +0000 (01:11 +0000)]
auto merge of #16371 : Gankro/rust/friendly-contrib, r=brson

Had someone experience deep existential dread over building all of Rust on Windows just to do some minor fixes to the docs. This seems entirely unnecessary between reviewers + Bors for most purely english changes.

9 years agoauto merge of #16359 : epdtry/rust/mono-item-dedup-foreign, r=alexcrichton
bors [Sat, 9 Aug 2014 23:26:18 +0000 (23:26 +0000)]
auto merge of #16359 : epdtry/rust/mono-item-dedup-foreign, r=alexcrichton

Extend the changes from #16059 to the new generic foreign functions introduced by #15831.

9 years agoauto merge of #16356 : ruud-v-a/rust/fix-f32-doc, r=steveklabnik
bors [Sat, 9 Aug 2014 21:41:19 +0000 (21:41 +0000)]
auto merge of #16356 : ruud-v-a/rust/fix-f32-doc, r=steveklabnik

On a side note (but maybe this is not the right place to ask), the name `Float::two_pi` is inconsistent with `f32::consts::PI_2`.

9 years agorustdoc: use raw search in URL
Alexis Beingessner [Sat, 9 Aug 2014 13:38:10 +0000 (09:38 -0400)]
rustdoc: use raw search in URL

fixes #16385
fixes #16271

9 years agoremoving 'str'='struct' search synonym
Alexis Beingessner [Sat, 9 Aug 2014 13:20:44 +0000 (09:20 -0400)]
removing 'str'='struct' search synonym

fixes #16384

9 years agoauto merge of #16350 : hirschenberger/rust/issue-15917, r=alexcrichton
bors [Sat, 9 Aug 2014 19:56:21 +0000 (19:56 +0000)]
auto merge of #16350 : hirschenberger/rust/issue-15917, r=alexcrichton

Adding test for issue #15917 which was previously fixed with #15709

9 years agoauto merge of #16346 : vadimcn/rust/win64-cabi, r=brson
bors [Sat, 9 Aug 2014 18:11:22 +0000 (18:11 +0000)]
auto merge of #16346 : vadimcn/rust/win64-cabi, r=brson

This fixes
run-pass/extern-pass-TwoU64s.rs
run-pass/extern-pass-empty.rs
run-pass/extern-return-TwoU64s.rs

9 years agoauto merge of #16342 : alexcrichton/rust/issue-16341, r=huonw
bors [Sat, 9 Aug 2014 16:16:23 +0000 (16:16 +0000)]
auto merge of #16342 : alexcrichton/rust/issue-16341, r=huonw

Now that rustdoc is spawning a child task, the program won't exit with a default
error code if the main task fails (because it never fails). This commit forces
the main task to wait for a child task in order to correctly propagate failure.

Closes #16341

9 years agolibrustc: Encode upvar_borrow_map in metadata.
Luqman Aden [Tue, 5 Aug 2014 01:58:48 +0000 (18:58 -0700)]
librustc: Encode upvar_borrow_map in metadata.

9 years agolibrustc: Also use new alloca if matching on an arg or upvar which we reassign in...
Luqman Aden [Tue, 5 Aug 2014 01:58:06 +0000 (18:58 -0700)]
librustc: Also use new alloca if matching on an arg or upvar which we reassign in the arm body.

9 years agolibrustc: Don't use the same alloca for match binding which we reassign to in arm...
Luqman Aden [Sat, 2 Aug 2014 02:38:10 +0000 (19:38 -0700)]
librustc: Don't use the same alloca for match binding which we reassign to in arm body.

9 years agoauto merge of #16340 : thestinger/rust/pie, r=brson
bors [Sat, 9 Aug 2014 13:21:20 +0000 (13:21 +0000)]
auto merge of #16340 : thestinger/rust/pie, r=brson

Rust already builds all code as position independent by default, so the
linker can be told to build a position independent executable if it's
not disabled with `-C relocation-model=dynamic-no-pic`. Position
independent code does have a significant cost on i686 (not on x86_64 or
ARM) but there's no significant cost to linking code that's already
position independent as a position independent executable.

Address space layout randomization makes exploiting vulnerabilities much
more difficult by providing a statistical defence against an attempt to
find or modify existing code / data. Without ASLR, it's trivial to use a
vulnerability to take over control of the process via return-oriented
programming.

Rust code can be used for return-oriented programming whether it is safe
or unsafe, so even a fully safe application needs to be built as a
position independent executable to defend against vulnerabilities in
unsafe blocks or C libraries.

Sample program:

    extern crate libc;

    use std::mem;

    static mut global: u32 = 5;
    static constant: u32 = 5;
    fn foo() {}

    fn main() {
        let local = 5;
        println!("stack: {}, global: {}, constant: {}, fn: {}, lib fn: {}",
                 &local as *const u32,
                 unsafe { &global as *const u32 },
                 &constant as *const u32,
                 unsafe { mem::transmute::<_, *const ()>(foo) },
                 unsafe { mem::transmute::<_, *const ()>(libc::mprotect) });
    }

Before:

    stack: 0x3ff15eb9f94, global: 0x6ab488, constant: 0x47db40, fn: 0x4030e0, lib fn: 0x32749547530
    stack: 0x3b5d47d80e4, global: 0x6ab488, constant: 0x47db40, fn: 0x4030e0, lib fn: 0x394469a7530
    stack: 0x3fe2c4e5564, global: 0x6ab488, constant: 0x47db40, fn: 0x4030e0, lib fn: 0x399734a2530
    stack: 0x3e525e0fb24, global: 0x6ab488, constant: 0x47db40, fn: 0x4030e0, lib fn: 0x2f62a810530
    stack: 0x3b50fb3eae4, global: 0x6ab488, constant: 0x47db40, fn: 0x4030e0, lib fn: 0x2e590e86530

After:

    stack: 0x38cf12c90a4, global: 0x3e2d46b488, constant: 0x3e2d23cf80, fn: 0x3e2d1c2510, lib fn: 0x2617d3b4530
    stack: 0x3d733faf474, global: 0x7eb1839488, constant: 0x7eb160af80, fn: 0x7eb1590510, lib fn: 0x32d30c1f530
    stack: 0x3bb42212ec4, global: 0x5bbb365488, constant: 0x5bbb136f80, fn: 0x5bbb0bc510, lib fn: 0x3595e6c1530
    stack: 0x39f678c1ab4, global: 0x22c4e3c488, constant: 0x22c4c0df80, fn: 0x22c4b93510, lib fn: 0x3835b727530
    stack: 0x3afb25bd394, global: 0x493eab2488, constant: 0x493e883f80, fn: 0x493e809510, lib fn: 0x3478d6a7530

This may also be necessary on other platforms, but I can only test on
Linux right now. Note that GDB gained support for debugging position
independent executables in version 7.1 (March 2010).

9 years agoauto merge of #16253 : luqmana/rust/muv, r=nikomatsakis
bors [Sat, 9 Aug 2014 11:36:22 +0000 (11:36 +0000)]
auto merge of #16253 : luqmana/rust/muv, r=nikomatsakis

Fixes #11958.

9 years agoAdd tests.
Luqman Aden [Mon, 4 Aug 2014 20:30:38 +0000 (13:30 -0700)]
Add tests.

9 years agoauto merge of #16326 : pnkfelix/rust/fsk-add-path-suffix-lookup, r=huonw
bors [Sat, 9 Aug 2014 09:51:23 +0000 (09:51 +0000)]
auto merge of #16326 : pnkfelix/rust/fsk-add-path-suffix-lookup, r=huonw

Extended `ast_map::Map` with an iterator over all node id's that match a path suffix.

Extended pretty printer to let users choose particular items to pretty print, either by indicating an integer node-id, or by providing a path suffix.

 * Example 1: the suffix `typeck::check::check_struct` matches the item with the path `rustc::middle::typeck::check::check_struct` when compiling the `rustc` crate.

 * Example 2: the suffix `and` matches `core::option::Option::and` and `core::result::Result::and` when compiling the `core` crate.

Refactored `pprust` slightly to support the pretty printer changes.

(See individual commits for more description.)

9 years agorust.md: Explicitly point out how special `'static` is.
Felix S. Klock II [Sat, 9 Aug 2014 09:15:04 +0000 (11:15 +0200)]
rust.md: Explicitly point out how special `'static` is.

Drive-by: fix description of `&content` to point out that `&'f type`
is (as of today) only for type expressions.

9 years agopretty printer: Added some `run-make` tests of path-suffix lookup functionality.
Felix S. Klock II [Sat, 9 Aug 2014 07:59:47 +0000 (09:59 +0200)]
pretty printer: Added some `run-make` tests of path-suffix lookup functionality.

9 years agopretty-printer: let users choose particular items to pretty print.
Felix S. Klock II [Thu, 7 Aug 2014 16:22:24 +0000 (18:22 +0200)]
pretty-printer: let users choose particular items to pretty print.

With this change:

  * `--pretty variant=<node-id>` will print the item associated with
    `<node-id>` (where `<node-id>` is an integer for some node-id in
    the AST, and `variant` means one of {`normal`,`expanded`,...}).

  * `--pretty variant=<path-suffix>` will print all of the items that
    match the `<path-suffix>` (where `<path-suffix>` is a suffix of a
    path, and `variant` again means one of {`normal`,`expanded`,...}).

    Example 1: the suffix `typeck::check::check_struct` matches the
    item with the path `rustc::middle::typeck::check::check_struct`
    when compiling the `rustc` crate.

    Example 2: the suffix `and` matches `core::option::Option::and`
    and `core::result::Result::and` when compiling the `core` crate.

Both of the `--pretty variant=...` modes will include the full path to
the item in a comment that follows the item.

Note that when multiple paths match, then either:

  1. all matching items are printed, in series; this is what happens in
     the usual pretty-print variants, or

  2. the compiler signals an error; this is what happens in flowgraph
     printing.

----

Some drive-by improvements:

Heavily refactored the pretty-printing glue in driver.rs, introducing
a couple local traits to avoid cut-and-pasting very code segments that
differed only in how they accessed the `Session` or the
`ast_map::Map`. (Note the previous code had three similar calls to
`print_crate` which have all been unified in this revision; the
addition of printing individual node-ids exacerbated the situation
beyond tolerance.) We may want to consider promoting some of these
traits, e.g. `SessionCarrier`, for use more generally elsewhere in the
compiler; right now I have to double check how to access the `Session`
depending on what context I am hacking in.

Refactored `PpMode` to make the data directly reflect the fundamental
difference in the categories (in terms of printing source-code with
various annotations, versus printing a control-flow graph).

(also, addressed review feedback.)

9 years agoHelper method for `pprust::State` for printing instances of `ast_map::Node`.
Felix S. Klock II [Thu, 7 Aug 2014 12:21:15 +0000 (14:21 +0200)]
Helper method for `pprust::State` for printing instances of `ast_map::Node`.

9 years agorefactored pprust::State constructor methods out from `pprust::print_crate`.
Felix S. Klock II [Thu, 7 Aug 2014 09:25:31 +0000 (11:25 +0200)]
refactored pprust::State constructor methods out from `pprust::print_crate`.

(Groundwork for pretty-printing only selected items in an input crate.)

9 years agoast_map: Added iterator over all node id's that match a path suffix.
Felix S. Klock II [Thu, 7 Aug 2014 09:22:42 +0000 (11:22 +0200)]
ast_map: Added iterator over all node id's that match a path suffix.

This is useful e.g. for tools need a node-id, such as the flowgraph
pretty printer, since it can avoids the need to first pretty-print the
whole expanded,identified input in order to find out what the node-id
actually is.

It currently only supports path suffixes thst are made up of module
names (e.g. you cannot use the type instantiation form `a::<int>::b`
or `option::Option::unwrap_or` as a path suffix for this tool, though
the tool will produce paths that have non-modulues in the portion of
the path that is not included in the suffix).

(addressed review feedback too)

9 years agolibrustc: Update unused mut lint to properly track moved upvars.
Luqman Aden [Mon, 4 Aug 2014 20:26:25 +0000 (13:26 -0700)]
librustc: Update unused mut lint to properly track moved upvars.

9 years agolibrustc: Allow mutation of moved upvars.
Luqman Aden [Mon, 4 Aug 2014 20:10:08 +0000 (13:10 -0700)]
librustc: Allow mutation of moved upvars.

9 years agoauto merge of #16323 : c-nixon/rust/master, r=alexcrichton
bors [Sat, 9 Aug 2014 05:51:19 +0000 (05:51 +0000)]
auto merge of #16323 : c-nixon/rust/master, r=alexcrichton

This allows rustc to be built with msys2's mingw64

Fixes #16347.

9 years agoauto merge of #15964 : huonw/rust/gensym-test, r=alexcrichton
bors [Sat, 9 Aug 2014 03:06:21 +0000 (03:06 +0000)]
auto merge of #15964 : huonw/rust/gensym-test, r=alexcrichton

This requires avoiding `quote_...!` for constructing the parts of the
__test module, since that stringifies and reinterns the idents, losing
the special gensym'd nature of them. (#15962.)

9 years agotestsuite: implement #[reexport_test_harness_name] to get access to the
Huon Wilson [Fri, 8 Aug 2014 14:01:05 +0000 (00:01 +1000)]
testsuite: implement #[reexport_test_harness_name] to get access to the
default entrypoint of the --test binary.

This allows one to, e.g., run tests under libgreen by starting it
manually, passing in the test entrypoint.

9 years agomove a test into a run make, to check external affect rather than
Huon Wilson [Thu, 7 Aug 2014 12:06:29 +0000 (22:06 +1000)]
move a test into a run make, to check external affect rather than
implementation details.

(Mainly to avoid accessing the secret internal test module symbol name.)

9 years agoauto merge of #16314 : Ryman/rust/ringbuf_non_pow2, r=huonw
bors [Sat, 9 Aug 2014 01:21:23 +0000 (01:21 +0000)]
auto merge of #16314 : Ryman/rust/ringbuf_non_pow2, r=huonw

See test for details.

9 years agomk: Don't emit landing pads in stage 0.
Brian Anderson [Fri, 8 Aug 2014 23:54:26 +0000 (16:54 -0700)]
mk: Don't emit landing pads in stage 0.

Reduces time to build stage0 from 11:30 to 9:40 on my machine.

9 years agoMake small doc contributions less onerous/intimidating
Alexis Beingessner [Fri, 8 Aug 2014 23:36:32 +0000 (19:36 -0400)]
Make small doc contributions less onerous/intimidating

10 years agoauto merge of #16277 : Gankro/rust/responsive-docs, r=cmr
bors [Fri, 8 Aug 2014 21:36:11 +0000 (21:36 +0000)]
auto merge of #16277 : Gankro/rust/responsive-docs, r=cmr

* move some sidebar contents to a title bar when small
* inline description toggle when small
* make out-of-band and in-band content share space, rather than float and clash
* compress wording of out-of-band content to avoid line-wrap as much as possible

## [Live Version Here](http://cg.scs.carleton.ca/~abeinges/doc/index.html)

Pages Of Interest:
* [Vec](http://cg.scs.carleton.ca/~abeinges/doc/std/vec/struct.Vec.html) (small path)
* [TreeSet](http://cg.scs.carleton.ca/~abeinges/doc/collections/treemap/struct.TreeSet.html) (long path)
* [std](http://cg.scs.carleton.ca/~abeinges/doc/std/index.html) (for stability dash)

TBD in a future PR is to convert links in the sidebar into a series of nest ul/li's, so that they can easily be moved to a drop-down in the new title bar. I think this is out of scope for this PR, but am willing to implement it now if desired.

10 years agoauto merge of #16336 : retep998/rust/master, r=brson
bors [Fri, 8 Aug 2014 19:51:11 +0000 (19:51 +0000)]
auto merge of #16336 : retep998/rust/master, r=brson

Several of the tests in `make check-fast` were failing so this fixes those tests.

10 years agodon't translate items when monomorphizing foreign-ABI functions
Stuart Pernsteiner [Fri, 8 Aug 2014 18:24:44 +0000 (11:24 -0700)]
don't translate items when monomorphizing foreign-ABI functions

10 years agoauto merge of #16333 : steveklabnik/rust/guide_strings, r=brson
bors [Fri, 8 Aug 2014 18:06:11 +0000 (18:06 +0000)]
auto merge of #16333 : steveklabnik/rust/guide_strings, r=brson

I _think_ this is the right place to introduce strings. It's a bit hard to talk about without understanding pointers and ownership, but you need to have some idea of what's going on...

10 years agolibcore: Fix documentation comment for f32.
Ruud van Asseldonk [Fri, 8 Aug 2014 16:30:23 +0000 (18:30 +0200)]
libcore: Fix documentation comment for f32.