]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agorustdoc: Add stability dashboard
Aaron Turon [Fri, 4 Jul 2014 07:51:46 +0000 (00:51 -0700)]
rustdoc: Add stability dashboard

This commit adds a crate-level dashboard summarizing the stability
levels of all items for all submodules of the crate.

The information is also written as a json file, intended for consumption
by pages like http://huonw.github.io/isrustfastyet/

Closes #13541

10 years agoauto merge of #15564 : alexcrichton/rust/moar-hash, r=huonw
bors [Fri, 11 Jul 2014 01:11:36 +0000 (01:11 +0000)]
auto merge of #15564 : alexcrichton/rust/moar-hash, r=huonw

- semver::Version is now Eq, Ord, and Hash
- Path is now PartialOrd and Ord

10 years agoauto merge of #15336 : jakub-/rust/diagnostics, r=brson
bors [Thu, 10 Jul 2014 23:26:39 +0000 (23:26 +0000)]
auto merge of #15336 : jakub-/rust/diagnostics, r=brson

This is a continuation of @brson's work from https://github.com/rust-lang/rust/pull/12144.

This implements the minimal scaffolding that allows mapping diagnostic messages to alpha-numeric codes, which could improve the searchability of errors. In addition, there's a new compiler option, `--explain {code}` which takes an error code and prints out a somewhat detailed explanation of the error. Example:

```rust
fn f(x: Option<bool>) {
match x {
Some(true) | Some(false) => (),
None => (),
Some(true) => ()
}
}
```

```shell
[~/rust]$ ./build/x86_64-apple-darwin/stage2/bin/rustc ./diagnostics.rs --crate-type dylib
diagnostics.rs:5:3: 5:13 error: unreachable pattern [E0001] (pass `--explain E0001` to see a detailed explanation)
diagnostics.rs:5  Some(true) => ()
                  ^~~~~~~~~~
error: aborting due to previous error
[~/rust]$ ./build/x86_64-apple-darwin/stage2/bin/rustc --explain E0001

    This error suggests that the expression arm corresponding to the noted pattern
    will never be reached as for all possible values of the expression being matched,
    one of the preceeding patterns will match.

    This means that perhaps some of the preceeding patterns are too general, this
    one is too specific or the ordering is incorrect.

```

I've refrained from migrating many errors to actually use the new macros as it can be done in an incremental fashion but if we're happy with the approach, it'd be good to do all of them sooner rather than later.

Originally, I was going to make libdiagnostics a separate crate but that's posing some interesting challenges with semi-circular dependencies. In particular, librustc would have a plugin-phase dependency on libdiagnostics, which itself depends on librustc. Per my conversation with @alexcrichton, it seems like the snapshotting process would also have to change. So for now the relevant modules from libdiagnostics are included using `#[path = ...] mod`.

10 years agoAdd scaffolding for assigning alpha-numeric codes to rustc diagnostics
Jakub Wieczorek [Tue, 1 Jul 2014 16:39:41 +0000 (18:39 +0200)]
Add scaffolding for assigning alpha-numeric codes to rustc diagnostics

10 years agoauto merge of #15353 : aturon/rust/env-hashmap, r=alexcrichton
bors [Thu, 10 Jul 2014 21:41:36 +0000 (21:41 +0000)]
auto merge of #15353 : aturon/rust/env-hashmap, r=alexcrichton

This commit adds `env_insert` and `env_remove` methods to the `Command`
builder, easing updates to the environment variables for the child
process. The existing method, `env`, is still available for overriding
the entire environment in one shot (after which the `env_insert` and
`env_remove` methods can be used to make further adjustments).

To support these new methods, the internal `env` representation for
`Command` has been changed to an optional `HashMap` holding owned
`CString`s (to support non-utf8 data). The `HashMap` is only
materialized if the environment is updated. The implementation does not
try hard to avoid allocation, since the cost of launching a process will
dwarf any allocation cost.

This patch also adds `PartialOrd`, `Eq`, and `Hash` implementations for
`CString`.

10 years agoio::process::Command: add fine-grained env builder
Aaron Turon [Wed, 2 Jul 2014 20:50:45 +0000 (13:50 -0700)]
io::process::Command: add fine-grained env builder

This commit changes the `io::process::Command` API to provide
fine-grained control over the environment:

* The `env` method now inserts/updates a key/value pair.
* The `env_remove` method removes a key from the environment.
* The old `env` method, which sets the entire environment in one shot,
  is renamed to `env_set_all`. It can be used in conjunction with the
  finer-grained methods. This renaming is a breaking change.

To support these new methods, the internal `env` representation for
`Command` has been changed to an optional `HashMap` holding owned
`CString`s (to support non-utf8 data). The `HashMap` is only
materialized if the environment is updated. The implementation does not
try hard to avoid allocation, since the cost of launching a process will
dwarf any allocation cost.

This patch also adds `PartialOrd`, `Eq`, and `Hash` implementations for
`CString`.

[breaking-change]

10 years agoauto merge of #15559 : fhahn/rust/issue-15445-mut-cast, r=alexcrichton
bors [Thu, 10 Jul 2014 19:06:59 +0000 (19:06 +0000)]
auto merge of #15559 : fhahn/rust/issue-15445-mut-cast, r=alexcrichton

I've added an error message for casts from raw pointers to floats #15445.

10 years agoauto merge of #14519 : hirschenberger/rust/issue-10934, r=alexcrichton
bors [Thu, 10 Jul 2014 17:16:30 +0000 (17:16 +0000)]
auto merge of #14519 : hirschenberger/rust/issue-10934, r=alexcrichton

Issue #10934

10 years agoauto merge of #15578 : alexcrichton/rust/fix-dist-again, r=pnkfelix
bors [Thu, 10 Jul 2014 15:34:02 +0000 (15:34 +0000)]
auto merge of #15578 : alexcrichton/rust/fix-dist-again, r=pnkfelix

This is already checked by the install script, no need to check it twice.

10 years agomk: Don't run rustc manually during distcheck
Alex Crichton [Thu, 10 Jul 2014 15:09:43 +0000 (08:09 -0700)]
mk: Don't run rustc manually during distcheck

This is already checked by the install script, no need to check it twice.

10 years agostd: Add some implementation of common traits
Alex Crichton [Thu, 10 Jul 2014 01:16:16 +0000 (18:16 -0700)]
std: Add some implementation of common traits

- semver::Version is now Eq, Ord, and Hash
- Path is now PartialOrd and Ord

10 years agoauto merge of #15569 : pcwalton/rust/reexport-intrinsics, r=cmr
bors [Thu, 10 Jul 2014 12:46:30 +0000 (12:46 +0000)]
auto merge of #15569 : pcwalton/rust/reexport-intrinsics, r=cmr

code bloat.

This didn't make a difference in any compile times that I saw, but it
fits what we're doing with `transmute` and seems prudent.

r? @alexcrichton

10 years agoauto merge of #15563 : luqmana/rust/nif, r=pcwalton
bors [Thu, 10 Jul 2014 11:01:32 +0000 (11:01 +0000)]
auto merge of #15563 : luqmana/rust/nif, r=pcwalton

10 years agotypeck: check casts from pointers to floats, closes #15445
Florian Hahn [Wed, 9 Jul 2014 20:01:31 +0000 (22:01 +0200)]
typeck: check casts from pointers to floats, closes #15445

10 years agoauto merge of #15566 : japaric/rust/command-clone, r=alexcrichton
bors [Thu, 10 Jul 2014 09:16:29 +0000 (09:16 +0000)]
auto merge of #15566 : japaric/rust/command-clone, r=alexcrichton

Allows use cases like this one:

``` rust
use std::io::Command;

fn main() {
    let mut cmd = Command::new("ls");
    cmd.arg("-l");

    for &dir in ["a", "b", "c"].iter() {
        println!("{}", cmd.clone().arg(dir));
    }
}
```

Output:
```
ls '-l' 'a'
ls '-l' 'b'
ls '-l' 'c'
```
Without the `clone()`, you'll end up with:
```
ls '-l' 'a'
ls '-l' 'a' 'b'
ls '-l' 'a' 'b' 'c'
```

cc #15294

10 years agoAdd range lint for float literals, fixing #10934
Falco Hirschenberger [Wed, 9 Jul 2014 07:45:32 +0000 (09:45 +0200)]
Add range lint for float literals, fixing #10934

10 years agolibcore: Reexport a couple of widely-used low-level intrinsics to reduce
Patrick Walton [Thu, 10 Jul 2014 05:24:23 +0000 (22:24 -0700)]
libcore: Reexport a couple of widely-used low-level intrinsics to reduce
code bloat.

This didn't make a difference in any compile times that I saw, but it
fits what we're doing with `transmute` and seems prudent.

10 years agoauto merge of #15561 : huonw/rust/must-use-iterators, r=alexcrichton
bors [Thu, 10 Jul 2014 05:16:28 +0000 (05:16 +0000)]
auto merge of #15561 : huonw/rust/must-use-iterators, r=alexcrichton

Similar to the stability attributes, a type annotated with `#[must_use =
"informative snippet"]` will print the normal warning message along with
"informative snippet". This allows the type author to provide some
guidance about why the type should be used.

---

It can be a little unintuitive that something like `v.iter().map(|x|
println!("{}", x));` does nothing: the majority of the iterator adaptors
are lazy and do not execute anything until something calls `next`, e.g.
a `for` loop, `collect`, `fold`, etc.

The majority of such errors can be seen by someone writing something
like the above, i.e. just calling an iterator adaptor and doing nothing
with it (and doing this is certainly useless), so we can co-opt the
`must_use` lint, using the message functionality to give a hint to the
reason why.

Fixes #14666.

10 years agoauto merge of #15556 : alexcrichton/rust/snapshots, r=brson
bors [Thu, 10 Jul 2014 03:21:30 +0000 (03:21 +0000)]
auto merge of #15556 : alexcrichton/rust/snapshots, r=brson

Closes #15544

10 years agolibrustc: Translate input for transmute directly into dest.
Luqman Aden [Thu, 10 Jul 2014 03:09:57 +0000 (20:09 -0700)]
librustc: Translate input for transmute directly into dest.

10 years agoauto merge of #15554 : steveklabnik/rust/gh_15539, r=brson
bors [Thu, 10 Jul 2014 01:36:28 +0000 (01:36 +0000)]
auto merge of #15554 : steveklabnik/rust/gh_15539, r=brson

This was super silly anyway.

Fixes #15539.

10 years agoDerive Clone for Command and StdioContainer
Jorge Aparicio [Thu, 10 Jul 2014 01:00:44 +0000 (20:00 -0500)]
Derive Clone for Command and StdioContainer

10 years agolibrustc: Update to reflect changes to how intrinsics are codegened.
Luqman Aden [Thu, 10 Jul 2014 00:51:05 +0000 (17:51 -0700)]
librustc: Update to reflect changes to how intrinsics are codegened.

10 years agolibrustc: Remove old codepaths for creating intrinsic functions.
Luqman Aden [Thu, 10 Jul 2014 00:25:52 +0000 (17:25 -0700)]
librustc: Remove old codepaths for creating intrinsic functions.

10 years agoauto merge of #15514 : luqmana/rust/die-advance-die, r=cmr
bors [Wed, 9 Jul 2014 23:51:27 +0000 (23:51 +0000)]
auto merge of #15514 : luqmana/rust/die-advance-die, r=cmr

Closes #15492.

10 years agotests: Remove uses of advance.
Luqman Aden [Mon, 7 Jul 2014 22:22:23 +0000 (15:22 -0700)]
tests: Remove uses of advance.

10 years agolibrustc: Remove uses of advance.
Luqman Aden [Thu, 12 Jun 2014 10:14:15 +0000 (06:14 -0400)]
librustc: Remove uses of advance.

10 years agolibsyntax: Remove uses of advance.
Luqman Aden [Thu, 12 Jun 2014 10:13:25 +0000 (06:13 -0400)]
libsyntax: Remove uses of advance.

10 years agolibgetopts: Use iterators instead of old-style loops.
Luqman Aden [Thu, 12 Jun 2014 09:35:02 +0000 (05:35 -0400)]
libgetopts: Use iterators instead of old-style loops.

10 years agolibcollections: Use iterators instead of old-style loops.
Luqman Aden [Thu, 12 Jun 2014 09:19:55 +0000 (05:19 -0400)]
libcollections: Use iterators instead of old-style loops.

10 years agolibcore: Deprecate advance method on Iterators.
Luqman Aden [Thu, 12 Jun 2014 06:56:40 +0000 (02:56 -0400)]
libcore: Deprecate advance method on Iterators.

10 years agolibrustc: Don't emit call for intrinsics instead just trans at callsite.
Luqman Aden [Wed, 9 Jul 2014 22:31:45 +0000 (15:31 -0700)]
librustc: Don't emit call for intrinsics instead just trans at callsite.

10 years agoauto merge of #15550 : alexcrichton/rust/install-script, r=brson
bors [Wed, 9 Jul 2014 22:06:27 +0000 (22:06 +0000)]
auto merge of #15550 : alexcrichton/rust/install-script, r=brson

This adds detection of the relevant LD_LIBRARY_PATH-like environment variable
and appropriately sets it when testing whether binaries can run or not.
Additionally, the installation prints a recommended value if one is necessary.

Closes #15545

10 years agocore: add `#[must_use]` attributes to iterator adaptor structs.
Huon Wilson [Wed, 9 Jul 2014 12:13:14 +0000 (22:13 +1000)]
core: add `#[must_use]` attributes to iterator adaptor structs.

It can be a little unintuitive that something like `v.iter().map(|x|
println!("{}", x));` does nothing: the majority of the iterator adaptors
are lazy and do not execute anything until something calls `next`, e.g.
a `for` loop, `collect`, `fold`, etc.

The majority of such errors can be seen by someone writing something
like the above, i.e. just calling an iterator adaptor and doing nothing
with it (and doing this is certainly useless), so we can co-opt the
`must_use` lint, using the message functionality to give a hint to the
reason why.

Fixes #14666.

10 years agolint: extend `#[must_use]` to handle a message.
Huon Wilson [Wed, 9 Jul 2014 12:02:19 +0000 (22:02 +1000)]
lint: extend `#[must_use]` to handle a message.

Similar to the stability attributes, a type annotated with `#[must_use =
"informative snippet"]` will print the normal warning message along with
"informative snippet". This allows the type author to provide some
guidance about why the type should be used.

10 years agosyntax: De-doc comment to fix nightlies
Alex Crichton [Wed, 9 Jul 2014 21:44:40 +0000 (14:44 -0700)]
syntax: De-doc comment to fix nightlies

This reverts the promotion from line-comment to doc-comment in 4989a56 to fix
the compiler-docs target.

Closes #15553

10 years agoauto merge of #15471 : erickt/rust/push_all, r=acrichto
bors [Wed, 9 Jul 2014 20:21:29 +0000 (20:21 +0000)]
auto merge of #15471 : erickt/rust/push_all, r=acrichto

llvm is currently not able to conver `Vec::extend` into a memcpy for `Copy` types, which results in methods like `Vec::push_all` to run twice as slow as it should be running. This patch takes the unsafe `Vec::clone` optimization to speed up all the operations that are cloning a slice into a `Vec`.

before:

```
test vec::tests::bench_clone_from_0000_0000                ... bench:        12 ns/iter (+/- 2)
test vec::tests::bench_clone_from_0000_0010                ... bench:       125 ns/iter (+/- 4) = 80 MB/s
test vec::tests::bench_clone_from_0000_0100                ... bench:       360 ns/iter (+/- 33) = 277 MB/s
test vec::tests::bench_clone_from_0000_1000                ... bench:      2601 ns/iter (+/- 175) = 384 MB/s
test vec::tests::bench_clone_from_0010_0000                ... bench:        12 ns/iter (+/- 2)
test vec::tests::bench_clone_from_0010_0010                ... bench:       125 ns/iter (+/- 10) = 80 MB/s
test vec::tests::bench_clone_from_0010_0100                ... bench:       361 ns/iter (+/- 28) = 277 MB/s
test vec::tests::bench_clone_from_0100_0010                ... bench:       131 ns/iter (+/- 13) = 76 MB/s
test vec::tests::bench_clone_from_0100_0100                ... bench:       360 ns/iter (+/- 9) = 277 MB/s
test vec::tests::bench_clone_from_0100_1000                ... bench:      2575 ns/iter (+/- 168) = 388 MB/s
test vec::tests::bench_clone_from_1000_0100                ... bench:       356 ns/iter (+/- 20) = 280 MB/s
test vec::tests::bench_clone_from_1000_1000                ... bench:      2605 ns/iter (+/- 167) = 383 MB/s
test vec::tests::bench_from_slice_0000                     ... bench:        11 ns/iter (+/- 0)
test vec::tests::bench_from_slice_0010                     ... bench:       115 ns/iter (+/- 5) = 86 MB/s
test vec::tests::bench_from_slice_0100                     ... bench:       309 ns/iter (+/- 170) = 323 MB/s
test vec::tests::bench_from_slice_1000                     ... bench:      2065 ns/iter (+/- 198) = 484 MB/s
test vec::tests::bench_push_all_0000_0000                  ... bench:         7 ns/iter (+/- 0)
test vec::tests::bench_push_all_0000_0010                  ... bench:        79 ns/iter (+/- 7) = 126 MB/s
test vec::tests::bench_push_all_0000_0100                  ... bench:       342 ns/iter (+/- 18) = 292 MB/s
test vec::tests::bench_push_all_0000_1000                  ... bench:      2873 ns/iter (+/- 75) = 348 MB/s
test vec::tests::bench_push_all_0010_0010                  ... bench:       154 ns/iter (+/- 8) = 64 MB/s
test vec::tests::bench_push_all_0100_0100                  ... bench:       518 ns/iter (+/- 18) = 193 MB/s
test vec::tests::bench_push_all_1000_1000                  ... bench:      4490 ns/iter (+/- 223) = 222 MB/s
```

after:

```
test vec::tests::bench_clone_from_0000_0000                ... bench:        12 ns/iter (+/- 1)
test vec::tests::bench_clone_from_0000_0010                ... bench:       123 ns/iter (+/- 5) = 81 MB/s
test vec::tests::bench_clone_from_0000_0100                ... bench:       367 ns/iter (+/- 23) = 272 MB/s
test vec::tests::bench_clone_from_0000_1000                ... bench:      2618 ns/iter (+/- 252) = 381 MB/s
test vec::tests::bench_clone_from_0010_0000                ... bench:        12 ns/iter (+/- 1)
test vec::tests::bench_clone_from_0010_0010                ... bench:       124 ns/iter (+/- 7) = 80 MB/s
test vec::tests::bench_clone_from_0010_0100                ... bench:       369 ns/iter (+/- 34) = 271 MB/s
test vec::tests::bench_clone_from_0100_0010                ... bench:       123 ns/iter (+/- 6) = 81 MB/s
test vec::tests::bench_clone_from_0100_0100                ... bench:       371 ns/iter (+/- 25) = 269 MB/s
test vec::tests::bench_clone_from_0100_1000                ... bench:      2713 ns/iter (+/- 532) = 368 MB/s
test vec::tests::bench_clone_from_1000_0100                ... bench:       369 ns/iter (+/- 14) = 271 MB/s
test vec::tests::bench_clone_from_1000_1000                ... bench:      2611 ns/iter (+/- 194) = 382 MB/s
test vec::tests::bench_from_slice_0000                     ... bench:         7 ns/iter (+/- 0)
test vec::tests::bench_from_slice_0010                     ... bench:       108 ns/iter (+/- 4) = 92 MB/s
test vec::tests::bench_from_slice_0100                     ... bench:       235 ns/iter (+/- 24) = 425 MB/s
test vec::tests::bench_from_slice_1000                     ... bench:      1318 ns/iter (+/- 96) = 758 MB/s
test vec::tests::bench_push_all_0000_0000                  ... bench:         7 ns/iter (+/- 0)
test vec::tests::bench_push_all_0000_0010                  ... bench:        70 ns/iter (+/- 4) = 142 MB/s
test vec::tests::bench_push_all_0000_0100                  ... bench:       176 ns/iter (+/- 16) = 568 MB/s
test vec::tests::bench_push_all_0000_1000                  ... bench:      1125 ns/iter (+/- 94) = 888 MB/s
test vec::tests::bench_push_all_0010_0010                  ... bench:       159 ns/iter (+/- 15) = 62 MB/s
test vec::tests::bench_push_all_0100_0100                  ... bench:       363 ns/iter (+/- 12) = 275 MB/s
test vec::tests::bench_push_all_1000_1000                  ... bench:      2860 ns/iter (+/- 415) = 349 MB/s
```

This also includes extra benchmarks for `Vec` and `MemWriter`.

10 years agoauto merge of #15283 : kwantam/rust/master, r=alexcrichton
bors [Wed, 9 Jul 2014 18:36:30 +0000 (18:36 +0000)]
auto merge of #15283 : kwantam/rust/master, r=alexcrichton

Add libunicode; move unicode functions from core

- created new crate, libunicode, below libstd
- split `Char` trait into `Char` (libcore) and `UnicodeChar` (libunicode)
  - Unicode-aware functions now live in libunicode
    - `is_alphabetic`, `is_XID_start`, `is_XID_continue`, `is_lowercase`,
      `is_uppercase`, `is_whitespace`, `is_alphanumeric`, `is_control`, `is_digit`,
      `to_uppercase`, `to_lowercase`
  - added `width` method in UnicodeChar trait
    - determines printed width of character in columns, or None if it is a non-NULL control character
    - takes a boolean argument indicating whether the present context is CJK or not (characters with 'A'mbiguous widths are double-wide in CJK contexts, single-wide otherwise)
- split `StrSlice` into `StrSlice` (libcore) and `UnicodeStrSlice` (libunicode)
  - functionality formerly in `StrSlice` that relied upon Unicode functionality from `Char` is now in `UnicodeStrSlice`
    - `words`, `is_whitespace`, `is_alphanumeric`, `trim`, `trim_left`, `trim_right`
  - also moved `Words` type alias into libunicode because `words` method is in `UnicodeStrSlice`
- unified Unicode tables from libcollections, libcore, and libregex into libunicode
- updated `unicode.py` in `src/etc` to generate aforementioned tables
- generated new tables based on latest Unicode data
- added `UnicodeChar` and `UnicodeStrSlice` traits to prelude
- libunicode is now the collection point for the `std::char` module, combining the libunicode functionality with the `Char` functionality from libcore
  - thus, moved doc comment for `char` from `core::char` to `unicode::char`
- libcollections remains the collection point for `std::str`

The Unicode-aware functions that previously lived in the `Char` and `StrSlice` traits are no longer available to programs that only use libcore. To regain use of these methods, include the libunicode crate and `use` the `UnicodeChar` and/or `UnicodeStrSlice` traits:

    extern crate unicode;
    use unicode::UnicodeChar;
    use unicode::UnicodeStrSlice;
    use unicode::Words; // if you want to use the words() method

NOTE: this does *not* impact programs that use libstd, since UnicodeChar and UnicodeStrSlice have been added to the prelude.

closes #15224
[breaking-change]

10 years agoRegister new snapshots
Alex Crichton [Wed, 9 Jul 2014 17:57:01 +0000 (10:57 -0700)]
Register new snapshots

Closes #15544

10 years agoRemove car analogy.
Steve Klabnik [Wed, 9 Jul 2014 17:04:52 +0000 (13:04 -0400)]
Remove car analogy.

This was super silly anyway.

Fixes #15539.

10 years agoauto merge of #15220 : vhbit/rust/treemap-str-equiv, r=alexcrichton
bors [Wed, 9 Jul 2014 16:51:28 +0000 (16:51 +0000)]
auto merge of #15220 : vhbit/rust/treemap-str-equiv, r=alexcrichton

- it allows to lookup using any str-equiv object, making TreeMaps finally usable (for example, it is much easier to work with JSON with lookup values being static strs)
- actually provides pretty flexible solution which could be extended to other equivalent types (although it might be not that performant)

10 years agoTreeMap: find enhancements
Valerii Hiora [Wed, 9 Jul 2014 14:48:17 +0000 (17:48 +0300)]
TreeMap: find enhancements

find_with/find_mut_with which use provided closure for navigating tree
and searching as flexible as possible

10 years agoetc: Fix install script for rpath removal
Alex Crichton [Wed, 9 Jul 2014 14:44:49 +0000 (07:44 -0700)]
etc: Fix install script for rpath removal

This adds detection of the relevant LD_LIBRARY_PATH-like environment variable
and appropriately sets it when testing whether binaries can run or not.
Additionally, the installation prints a recommended value if one is necessary.

10 years agofix test failures
kwantam [Tue, 8 Jul 2014 18:46:01 +0000 (14:46 -0400)]
fix test failures

- unicode tests live in coretest crate
- libcollections str tests need UnicodeChar trait.
- libregex perlw tests were checking a char in the Alphabetic category,
  \x2161. Confirmed perl 5.18 considers this a \w character. Changed to
  \x2961, which is not \w as the test expects.

10 years agoauto merge of #15483 : AlisdairO/rust/master, r=alexcrichton
bors [Wed, 9 Jul 2014 14:06:29 +0000 (14:06 +0000)]
auto merge of #15483 : AlisdairO/rust/master, r=alexcrichton

Noticed there wasn't an awful lot of info out there on using Any types, so added an example to the rustdocs.

10 years agoauto merge of #15540 : Gankro/rust/master, r=huonw
bors [Wed, 9 Jul 2014 12:21:29 +0000 (12:21 +0000)]
auto merge of #15540 : Gankro/rust/master, r=huonw

Removing recursion from TreeMap implementation, because we don't have TCO. No need to add ```O(logn)``` extra stack frames to search in a tree.

I find it curious that ```find_mut``` and ```find``` basically duplicated the same logic, but in different ways (iterative vs recursive), possibly to maneuvre around mutability rules, but that's a more fundamental issue to deal with elsewhere.

Thanks to acrichto for the magic trick to appease borrowck (another issue to deal with elsewhere).

10 years agoauto merge of #15530 : adrientetar/rust/proper-fonts, r=alexcrichton
bors [Wed, 9 Jul 2014 10:36:31 +0000 (10:36 +0000)]
auto merge of #15530 : adrientetar/rust/proper-fonts, r=alexcrichton

- Treat WOFF as binary files so that git does not perform newline normalization.
- Replace corrupt Heuristica files with Source Serif Pro &mdash; italics are [almost in production](https://github.com/adobe/source-serif-pro/issues/2) so I left Heuristica Italic which makes a good pair with SSP. Overall, Source Serif Pro is I think a better fit for rustdoc (cc @TheHydroImpulse). This ought to fix #15527.
- Store Source Code Pro locally in order to make offline docs freestanding. Fixes #14778.

Preview: http://adrientetar.legtux.org/cached/rust-docs/core.html

r? @alexcrichton

10 years agoauto merge of #15339 : cmr/rust/rewrite-lexer2, r=huonw
bors [Wed, 9 Jul 2014 08:46:35 +0000 (08:46 +0000)]
auto merge of #15339 : cmr/rust/rewrite-lexer2, r=huonw

Mostly minor things that rebasing is becoming painful.

10 years agoFix all the test fallout
Corey Richardson [Wed, 9 Jul 2014 05:28:52 +0000 (22:28 -0700)]
Fix all the test fallout

10 years agoast: make Name its own type
Corey Richardson [Sun, 6 Jul 2014 08:17:59 +0000 (01:17 -0700)]
ast: make Name its own type

10 years agolexer: lex WS/COMMENT/SHEBANG rather than skipping
Corey Richardson [Sat, 5 Jul 2014 05:30:39 +0000 (22:30 -0700)]
lexer: lex WS/COMMENT/SHEBANG rather than skipping

Now, the lexer will categorize every byte in its input according to the
grammar. The parser skips over these while parsing, thus avoiding their
presence in the input to syntax extensions.

10 years agosyntax: don't parse numeric literals in the lexer
Corey Richardson [Wed, 18 Jun 2014 17:44:20 +0000 (10:44 -0700)]
syntax: don't parse numeric literals in the lexer

This removes a bunch of token types. Tokens now store the original, unaltered
numeric literal (that is still checked for correctness), which is parsed into
an actual number later, as needed, when creating the AST.

This can change how syntax extensions work, but otherwise poses no visible
changes.

[breaking-change]

10 years agosyntax: don't process string/char/byte/binary lits
Corey Richardson [Thu, 3 Jul 2014 07:47:30 +0000 (00:47 -0700)]
syntax: don't process string/char/byte/binary lits

This shuffles things around a bit so that LIT_CHAR and co store an Ident
which is the original, unaltered literal in the source. When creating the AST,
unescape and postprocess them.

This changes how syntax extensions can work, slightly, but otherwise poses no
visible changes. To get a useful value out of one of these tokens, call
`parse::{char_lit, byte_lit, bin_lit, str_lit}`

[breaking-change]

10 years agoast: add an `as_str` method to Ident
Corey Richardson [Thu, 3 Jul 2014 07:45:59 +0000 (00:45 -0700)]
ast: add an `as_str` method to Ident

This is technically unsafe but interned strings are considered immortal.

10 years agolexer: add ident_from and ident_from_to methods
Corey Richardson [Wed, 25 Jun 2014 00:44:50 +0000 (17:44 -0700)]
lexer: add ident_from and ident_from_to methods

10 years agolexer: shuffle around some functions
Corey Richardson [Wed, 2 Jul 2014 16:39:48 +0000 (09:39 -0700)]
lexer: shuffle around some functions

10 years agocodemap: be less annoying in debug logging
Corey Richardson [Mon, 23 Jun 2014 20:37:30 +0000 (13:37 -0700)]
codemap: be less annoying in debug logging

10 years agosyntax: use a better Show impl for Ident
Corey Richardson [Tue, 17 Jun 2014 06:00:49 +0000 (23:00 -0700)]
syntax: use a better Show impl for Ident

Rather than just dumping the id in the interner, which is useless, actually
print the interned string. Adjust the lexer logging to use Show instead of
Poly.

10 years agotest: simplify numeric literal cfail tests
Corey Richardson [Wed, 18 Jun 2014 17:44:09 +0000 (10:44 -0700)]
test: simplify numeric literal cfail tests

10 years agostr: use more helpful assertion failure messages
Corey Richardson [Wed, 18 Jun 2014 17:40:38 +0000 (10:40 -0700)]
str: use more helpful assertion failure messages

10 years agotestsuite: merge some lexer testcases
Corey Richardson [Mon, 16 Jun 2014 21:12:44 +0000 (14:12 -0700)]
testsuite: merge some lexer testcases

Now that the lexer is more robust, these tests don't need to be in separate
files. Yay!

10 years agotoken: replace ast::Ident with just Ident
Corey Richardson [Mon, 9 Jun 2014 20:19:38 +0000 (13:19 -0700)]
token: replace ast::Ident with just Ident

10 years agosyntax: doc comments all the things
Corey Richardson [Mon, 9 Jun 2014 20:12:30 +0000 (13:12 -0700)]
syntax: doc comments all the things

10 years agoAdd example to Any documentation
Alisdair Owens [Sun, 6 Jul 2014 16:30:01 +0000 (17:30 +0100)]
Add example to Any documentation

10 years agoauto merge of #15537 : jbclements/rust/hygiene-for-methods, r=pcwalton
bors [Wed, 9 Jul 2014 05:11:38 +0000 (05:11 +0000)]
auto merge of #15537 : jbclements/rust/hygiene-for-methods, r=pcwalton

This patch adds hygiene for methods. This one was more difficult than the others, due principally to issues surrounding `self`. Specifically, there were a whole bunch of places in the code that assumed that a `self` identifier could be discarded and then made up again later, causing the discard of contexts and hygiene breakage.

10 years agoauto merge of #15422 : steveklabnik/rust/guide_compound_data_types, r=brson
bors [Wed, 9 Jul 2014 02:21:37 +0000 (02:21 +0000)]
auto merge of #15422 : steveklabnik/rust/guide_compound_data_types, r=brson

I'm not happy about the hand-waving around `cmp`, but I'm not sure how to get around it.

10 years agoRemoving recursion from find_mut in treemap
Alexis Beingessner [Wed, 9 Jul 2014 00:09:21 +0000 (20:09 -0400)]
Removing recursion from find_mut in treemap

10 years agoauto merge of #15374 : steveklabnik/rust/comments, r=brson
bors [Wed, 9 Jul 2014 00:36:40 +0000 (00:36 +0000)]
auto merge of #15374 : steveklabnik/rust/comments, r=brson

I'm leaving off `rustdoc` usage because it won't work unless this is a `pub fn`, and I want to talk about public/private in the context of modules. I'm also not mentioning `//!` because it is exclusively used to provide the overview of a module.

10 years agofix hygiene for test case
John Clements [Tue, 8 Jul 2014 22:02:33 +0000 (15:02 -0700)]
fix hygiene for test case

10 years agocarry self ident forward through re-parsing
John Clements [Sun, 6 Jul 2014 22:10:57 +0000 (15:10 -0700)]
carry self ident forward through re-parsing

formerly, the self identifier was being discarded during parsing, which
stymies hygiene. The best fix here seems to be to attach a self identifier
to ExplicitSelf_, a change that rippled through the rest of the compiler,
but without any obvious damage.

10 years agomacro literals should be compared by name only
John Clements [Tue, 8 Jul 2014 00:43:09 +0000 (17:43 -0700)]
macro literals should be compared by name only

10 years agomake macros non-capturing
John Clements [Mon, 7 Jul 2014 23:26:30 +0000 (16:26 -0700)]
make macros non-capturing

10 years agocomments
John Clements [Mon, 7 Jul 2014 22:10:18 +0000 (15:10 -0700)]
comments

10 years agoremove outdated comment
John Clements [Mon, 7 Jul 2014 21:27:07 +0000 (14:27 -0700)]
remove outdated comment

I believe this comment is now irrelevant, as a result of
commit 6757053cffb585249105fbd76f

10 years agoimplement hygiene for method args
John Clements [Fri, 4 Jul 2014 18:24:28 +0000 (11:24 -0700)]
implement hygiene for method args

10 years agotest case for expansion of method macro
John Clements [Mon, 7 Jul 2014 22:12:31 +0000 (15:12 -0700)]
test case for expansion of method macro

10 years agointroducing let-syntax
John Clements [Mon, 7 Jul 2014 16:54:08 +0000 (09:54 -0700)]
introducing let-syntax

The let-syntax expander is different in that it doesn't apply
a mark to its token trees before expansion. This is used
for macro_rules, and it's because macro_rules is essentially
MTWT's let-syntax. You don't want to mark before expand sees
let-syntax, because there's no "after" syntax to mark again.

In some sense, the cleaner approach might be to introduce a new
AST node that macro_rules expands into; this would make it clearer
that the expansion of a macro is distinct from the addition of a
new macro binding.

This should work for now, though...

10 years agoauto merge of #14832 : alexcrichton/rust/no-rpath, r=brson
bors [Tue, 8 Jul 2014 22:51:39 +0000 (22:51 +0000)]
auto merge of #14832 : alexcrichton/rust/no-rpath, r=brson

This commit disables rustc's emission of rpath attributes into dynamic libraries
and executables by default. The functionality is still preserved, but it must
now be manually enabled via a `-C rpath` flag.

This involved a few changes to the local build system:

* --disable-rpath is now the default configure option
* Makefiles now prefer our own LD_LIBRARY_PATH over the user's LD_LIBRARY_PATH
  in order to support building rust with rust already installed.
* The compiletest program was taught to correctly pass through the aux dir as a
  component of LD_LIBRARY_PATH in more situations.

The major impact of this change is that neither rustdoc nor rustc will work
out-of-the-box in all situations because they are dynamically linked. It must be
arranged to ensure that the libraries of a rust installation are part of the
LD_LIBRARY_PATH. The default installation paths for all platforms ensure this,
but if an installation is in a nonstandard location, then configuration may be
necessary.

Additionally, for all developers of rustc, it will no longer be possible to run
$target/stageN/bin/rustc out-of-the-box. The old behavior can be regained
through the `--enable-rpath` option to the configure script.

This change brings linux/mac installations in line with windows installations
where rpath is not possible.

Closes #11747
[breaking-change]

10 years agoself arg macro test case
John Clements [Mon, 7 Jul 2014 16:53:41 +0000 (09:53 -0700)]
self arg macro test case

10 years agoreplace idents with names
John Clements [Sun, 6 Jul 2014 23:02:48 +0000 (16:02 -0700)]
replace idents with names

10 years agoget rid of keyword idents, replace with names
John Clements [Sun, 6 Jul 2014 22:19:29 +0000 (15:19 -0700)]
get rid of keyword idents, replace with names

should prevent future bugs

10 years agopreserve context in parsing of `self` varref
John Clements [Sun, 6 Jul 2014 22:11:44 +0000 (15:11 -0700)]
preserve context in parsing of `self` varref

10 years agoremove unused fn, make SELF_KEYWORD_NAME public
John Clements [Sun, 6 Jul 2014 22:07:31 +0000 (15:07 -0700)]
remove unused fn, make SELF_KEYWORD_NAME public

10 years agotest harness cleanup
John Clements [Sun, 6 Jul 2014 22:06:32 +0000 (15:06 -0700)]
test harness cleanup

10 years agochange if/else to match
John Clements [Sun, 6 Jul 2014 21:29:29 +0000 (14:29 -0700)]
change if/else to match

10 years agoadded test for method arg hygiene
John Clements [Fri, 4 Jul 2014 17:57:17 +0000 (10:57 -0700)]
added test for method arg hygiene

10 years agoauto merge of #15493 : brson/rust/tostr, r=pcwalton
bors [Tue, 8 Jul 2014 20:06:40 +0000 (20:06 +0000)]
auto merge of #15493 : brson/rust/tostr, r=pcwalton

This updates https://github.com/rust-lang/rust/pull/15075.

Rename `ToStr::to_str` to `ToString::to_string`. The naive renaming ends up with two `to_string` functions defined on strings in the prelude (the other defined via `collections::str::StrAllocating`). To remedy this I removed `StrAllocating::to_string`, making all conversions from `&str` to `String` go through `Show`. This has a measurable impact on the speed of this conversion, but the sense I get from others is that it's best to go ahead and unify `to_string` and address performance for all `to_string` conversions in `core::fmt`. `String::from_str(...)` still works as a manual fast-path.

Note that the patch was done with a script, and ended up renaming a number of other `*_to_str` functions, particularly inside of rustc. All the ones I saw looked correct, and I didn't notice any additional API breakage.

Closes #15046.

10 years agostd: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.
Richo Healey [Sat, 21 Jun 2014 10:39:03 +0000 (03:39 -0700)]
std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.

[breaking-change]

10 years agowebfonts: check-in licenses
Adrien Tétar [Tue, 8 Jul 2014 19:55:37 +0000 (21:55 +0200)]
webfonts: check-in licenses

10 years agowebfonts: serve Source Code Pro locally
Adrien Tétar [Tue, 8 Jul 2014 18:26:23 +0000 (20:26 +0200)]
webfonts: serve Source Code Pro locally

So that we have freestanding docs.

10 years agowebfonts: proper fix
Adrien Tétar [Tue, 8 Jul 2014 17:51:06 +0000 (19:51 +0200)]
webfonts: proper fix

10 years agoGuide: comments
Steve Klabnik [Thu, 3 Jul 2014 17:11:15 +0000 (13:11 -0400)]
Guide: comments

10 years agoauto merge of #15521 : nick29581/rust/type, r=pcwalton
bors [Tue, 8 Jul 2014 16:01:41 +0000 (16:01 +0000)]
auto merge of #15521 : nick29581/rust/type, r=pcwalton

closes #13367

[breaking-change] Use `Sized?` to indicate a dynamically sized type parameter or trait (used to be `type`). E.g.,

```
trait Tr for Sized? {}

fn foo<Sized? X: Share>(x: X) {}
```

10 years agoGuide: complex data types
Steve Klabnik [Fri, 4 Jul 2014 19:07:27 +0000 (15:07 -0400)]
Guide: complex data types

10 years agoauto merge of #15518 : alexcrichton/rust/fix-some-crate-names, r=sfackler
bors [Tue, 8 Jul 2014 13:31:41 +0000 (13:31 +0000)]
auto merge of #15518 : alexcrichton/rust/fix-some-crate-names, r=sfackler

The output file was only being renamed based off #[crate_name], not #[crate_id]
or --crate-name. Both of these behaviors have been restored now.

10 years agorustc: Fix naming output files with --crate-name
Alex Crichton [Tue, 8 Jul 2014 02:04:34 +0000 (19:04 -0700)]
rustc: Fix naming output files with --crate-name

The output file was only being renamed based off #[crate_name], not #[crate_id]
or --crate-name. Both of these behaviors have been restored now.

10 years agoChange DST syntax: type -> Sized?
Nick Cameron [Tue, 8 Jul 2014 02:26:02 +0000 (14:26 +1200)]
Change DST syntax: type -> Sized?

closes #13367

[breaking-change] Use `Sized?` to indicate a dynamically sized type parameter or trait (used to be `type`). E.g.,

```
trait Tr for Sized? {}

fn foo<Sized? X: Share>(x: X) {}
```

10 years agoauto merge of #15516 : brson/rust/tidy, r=alexcrichton
bors [Tue, 8 Jul 2014 09:56:41 +0000 (09:56 +0000)]
auto merge of #15516 : brson/rust/tidy, r=alexcrichton

Tidy takes like forever to run. How many times have I wished I didn't have to sit through tidy before seeing my tests fail?

10 years agoauto merge of #15508 : jakub-/rust/struct-pattern-witness, r=alexcrichton
bors [Tue, 8 Jul 2014 04:21:40 +0000 (04:21 +0000)]
auto merge of #15508 : jakub-/rust/struct-pattern-witness, r=alexcrichton

10 years agoauto merge of #15443 : pcwalton/rust/module-and-type-with-same-name, r=nick29581
bors [Tue, 8 Jul 2014 02:36:43 +0000 (02:36 +0000)]
auto merge of #15443 : pcwalton/rust/module-and-type-with-same-name, r=nick29581

This will break code that looks like:

    struct Foo {
        ...
    }

    mod Foo {
        ...
    }

Change this code to:

    struct Foo {
        ...
    }

    impl Foo {
        ...
    }

Or rename the module.

Closes #15205.

[breaking-change]

r? @nick29581