]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoRegression test for #19982
Tamir Duberstein [Sun, 15 Mar 2015 19:44:37 +0000 (12:44 -0700)]
Regression test for #19982

Closes #17165, #19982.

9 years agoRegression test for #18919
Tamir Duberstein [Sun, 15 Mar 2015 20:14:15 +0000 (13:14 -0700)]
Regression test for #18919

Closes #18919.

9 years agoRegression test for #13407
Tamir Duberstein [Sun, 15 Mar 2015 19:05:10 +0000 (12:05 -0700)]
Regression test for #13407

Closes #13407.

9 years agoRegression test for #11820
Tamir Duberstein [Sun, 15 Mar 2015 18:57:33 +0000 (11:57 -0700)]
Regression test for #11820

Closes #11820.

9 years agoRegression test for #9951
Tamir Duberstein [Sun, 15 Mar 2015 18:46:51 +0000 (11:46 -0700)]
Regression test for #9951

Closes #9951.

9 years agoAuto merge of #23411 - cmr:test-7950, r=huonw
bors [Mon, 16 Mar 2015 07:37:27 +0000 (07:37 +0000)]
Auto merge of #23411 - cmr:test-7950, r=huonw

Closes #7950

9 years agoAdd test for #7950
Corey Richardson [Mon, 16 Mar 2015 07:33:12 +0000 (03:33 -0400)]
Add test for #7950

Closes #7950

9 years agoAuto merge of #23394 - tanadeau:remove-old_io-notes, r=alexcrichton
bors [Mon, 16 Mar 2015 03:55:13 +0000 (03:55 +0000)]
Auto merge of #23394 - tanadeau:remove-old_io-notes, r=alexcrichton

r? @alexcrichton

9 years agoAuto merge of #23396 - semarie:remove-sized-bounds, r=sfackler
bors [Mon, 16 Mar 2015 01:23:30 +0000 (01:23 +0000)]
Auto merge of #23396 - semarie:remove-sized-bounds, r=sfackler

cc @alexcrichton

9 years agoAuto merge of #23206 - nagisa:print-io, r=alexcrichton
bors [Sun, 15 Mar 2015 21:16:04 +0000 (21:16 +0000)]
Auto merge of #23206 - nagisa:print-io, r=alexcrichton

r? @alexcrichton or @aturon

This still needs to somehow figure out how to avoid unstable warnings arising from the use of unstable functions. I tried to use `#[allow_internal_unstable]` but it still spits out warnings as far as I can see. @huonw (I think you implemented it) does `#[allow_internal_unstable]` not work for some reason or am I using it incorrectly?

9 years agoAuto merge of #23353 - alexcrichton:stabilize-os, r=aturon
bors [Sun, 15 Mar 2015 18:42:54 +0000 (18:42 +0000)]
Auto merge of #23353 - alexcrichton:stabilize-os, r=aturon

This commit starts to organize the `std::os::$platform` modules and in the
process stabilizes some of the functionality contained within. The organization
of these modules will reflect the organization of the standard library itself
with extension traits for primitives in the same corresponding module.

The OS-specific modules will grow more functionality over time including
concrete types that are not extending functionality of other structures, and
these will either go into the closest module in `std::os::$platform` or they
will grow a new module in the hierarchy.

The following items are now stable:

* `os::{unix, windows}`
* `unix::ffi`
* `unix::ffi::OsStrExt`
* `unix::ffi::OsStrExt::{from_bytes, as_bytes, to_cstring}`
* `unix::ffi::OsString`
* `unix::ffi::OsStringExt::{from_vec, into_vec}`
* `unix::process`
* `unix::process::CommandExt`
* `unix::process::CommandExt::{uid, gid}`
* `unix::process::ExitStatusExt`
* `unix::process::ExitStatusExt::signal`
* `unix::prelude`
* `windows::ffi`
* `windows::ffi::OsStringExt`
* `windows::ffi::OsStringExt::from_wide`
* `windows::ffi::OsStrExt`
* `windows::ffi::OsStrExt::encode_wide`
* `windows::prelude`

The following items remain unstable:

* `unix::io`
* `unix::io::{Fd, AsRawFd}`
* `unix::fs::{PermissionsExt, OpenOptionsExt}`
* `windows::io`
* `windows::io::{Handle, AsRawHandle}`
* `windows::io::{Socket, AsRawSocket}`
* `windows::fs`
* `windows::fs::OpenOptionsExt`

Due to the reorgnization of the platform extension modules, this commit is a
breaking change. Most imports can be fixed by adding the relevant libstd module
in the `use` path (such as `ffi` or `fs`).

[breaking-change]

9 years agounbreak freebsd/openbsd/bitrig build after #23316
Sébastien Marie [Sun, 15 Mar 2015 17:30:43 +0000 (18:30 +0100)]
unbreak freebsd/openbsd/bitrig build after #23316

9 years agostd: Stabilize portions of `std::os::$platform`
Alex Crichton [Sat, 14 Mar 2015 00:12:38 +0000 (17:12 -0700)]
std: Stabilize portions of `std::os::$platform`

This commit starts to organize the `std::os::$platform` modules and in the
process stabilizes some of the functionality contained within. The organization
of these modules will reflect the organization of the standard library itself
with extension traits for primitives in the same corresponding module.

The OS-specific modules will grow more functionality over time including
concrete types that are not extending functionality of other structures, and
these will either go into the closest module in `std::os::$platform` or they
will grow a new module in the hierarchy.

The following items are now stable:

* `os::{unix, windows}`
* `unix::ffi`
* `unix::ffi::OsStrExt`
* `unix::ffi::OsStrExt::{from_bytes, as_bytes, to_cstring}`
* `unix::ffi::OsString`
* `unix::ffi::OsStringExt::{from_vec, into_vec}`
* `unix::process`
* `unix::process::CommandExt`
* `unix::process::CommandExt::{uid, gid}`
* `unix::process::ExitStatusExt`
* `unix::process::ExitStatusExt::signal`
* `unix::prelude`
* `windows::ffi`
* `windows::ffi::OsStringExt`
* `windows::ffi::OsStringExt::from_wide`
* `windows::ffi::OsStrExt`
* `windows::ffi::OsStrExt::encode_wide`
* `windows::prelude`

The following items remain unstable:

* `unix::io`
* `unix::io::{Fd, AsRawFd}`
* `unix::fs::{PermissionsExt, OpenOptionsExt}`
* `windows::io`
* `windows::io::{Handle, AsRawHandle}`
* `windows::io::{Socket, AsRawSocket}`
* `windows::fs`
* `windows::fs::OpenOptionsExt`

Due to the reorgnization of the platform extension modules, this commit is a
breaking change. Most imports can be fixed by adding the relevant libstd module
in the `use` path (such as `ffi` or `fs`).

[breaking-change]

9 years agoAuto merge of #23387 - Manishearth:rollup, r=Manishearth
bors [Sun, 15 Mar 2015 16:06:04 +0000 (16:06 +0000)]
Auto merge of #23387 - Manishearth:rollup, r=Manishearth

- Successful merges: #23375, #23379, #23382, #23384
- Failed merges:

9 years agoRemoved old_io note from std::net
Trent Nadeau [Sun, 15 Mar 2015 15:31:38 +0000 (11:31 -0400)]
Removed old_io note from std::net

9 years agoAuto merge of #23372 - tamird:fix-ios-compilation, r=alexcrichton
bors [Sun, 15 Mar 2015 13:32:21 +0000 (13:32 +0000)]
Auto merge of #23372 - tamird:fix-ios-compilation, r=alexcrichton

r? @alexcrichton cc @vhbit

9 years agoRollup merge of #23384 - daboross:patch-2, r=alexcrichton
Manish Goregaokar [Sun, 15 Mar 2015 10:10:18 +0000 (15:40 +0530)]
Rollup merge of #23384 - daboross:patch-2, r=alexcrichton

This changed `an String` to `a String`. Very minor change!

The usage of `an String` was introduced in https://github.com/rust-lang/rust/commit/a828e7948069f310dc5b33be8edb65e5e8e0cf9a#diff-b596503c7c33ce457b6d047e351ac12bR423, which changed `an OsString` to `an String`.

9 years agoRollup merge of #23382 - FuGangqiang:typos, r=alexcrichton
Manish Goregaokar [Sun, 15 Mar 2015 10:10:18 +0000 (15:40 +0530)]
Rollup merge of #23382 - FuGangqiang:typos, r=alexcrichton

9 years agoRollup merge of #23379 - kballard:tweak-stdio-docs-no-raw-constructors, r=alexcrichton
Manish Goregaokar [Sun, 15 Mar 2015 10:10:18 +0000 (15:40 +0530)]
Rollup merge of #23379 - kballard:tweak-stdio-docs-no-raw-constructors, r=alexcrichton

`std::io` does not currently expose the `stdin_raw`, `stdout_raw`, or
`stderr_raw` functions. According to the current plans for stdio (see
rust-lang/rfcs#517), raw access will likely be provided using the
platform-specific `std::os::{unix,windows}` modules. At the moment we
don't expose any way to do this. As such, delete all mention of the
`*_raw` functions from the `stdin`/`stdout`/`stderr` function
documentation.

While we're at it, remove a few `pub`s from items that aren't exposed.
This is done just to lessen the confusion experienced by anyone who
looks at the source in an attempt to find the `*_raw` functions.

9 years agoRollup merge of #23375 - kballard:remove-old_io-recommendation-from-io, r=huonw
Manish Goregaokar [Sun, 15 Mar 2015 10:10:18 +0000 (15:40 +0530)]
Rollup merge of #23375 - kballard:remove-old_io-recommendation-from-io, r=huonw

Now that `old_io` is deprecated and `std::io` is stable, we should stop
recommending the use of `old_io` in the module documentation.

9 years agoAuto merge of #23316 - alexcrichton:less-question-sized, r=aturon
bors [Sun, 15 Mar 2015 09:18:42 +0000 (09:18 +0000)]
Auto merge of #23316 - alexcrichton:less-question-sized, r=aturon

It is a frequent pattern among I/O functions to take `P: AsPath + ?Sized` or
`AsOsStr` instead of `AsPath`. Most of these functions do not need to take
ownership of their argument, but for libraries in general it's much more
ergonomic to not deal with `?Sized` at all and simply require an argument `P`
instead of `&P`.

This change is aimed at removing unsightly `?Sized` bounds while retaining the
same level of usability as before. All affected functions now take ownership of
their arguments instead of taking them by reference, but due to the forwarding
implementations of `AsOsStr` and `AsPath` all code should continue to work as it
did before.

This is strictly speaking a breaking change due to the signatures of these
functions changing, but normal idiomatic usage of these APIs should not break in
practice.

[breaking-change]

9 years agoImplement `winsize()` for {ios,dragonfly}
Tamir Duberstein [Sat, 14 Mar 2015 22:39:46 +0000 (15:39 -0700)]
Implement `winsize()` for {ios,dragonfly}

`sys/ttycom.h` in both:
`#define TIOCGWINSZ  _IOR('t', 104, struct winsize)  /* get window size */`

9 years agoFallout of c933d44f7bb9
Tamir Duberstein [Sat, 14 Mar 2015 22:38:59 +0000 (15:38 -0700)]
Fallout of c933d44f7bb9

9 years agoFix an String -> a String in env.rs documentation
Dabo Ross [Sun, 15 Mar 2015 07:00:26 +0000 (00:00 -0700)]
Fix an String -> a String in env.rs documentation

Super minor change!

The `an String` was introduced in https://github.com/rust-lang/rust/commit/a828e7948069f310dc5b33be8edb65e5e8e0cf9a#diff-b596503c7c33ce457b6d047e351ac12bR423, which changed `an OsString` to `an String`.

9 years agostd: Remove ?Sized bounds from many I/O functions
Alex Crichton [Thu, 12 Mar 2015 19:59:53 +0000 (12:59 -0700)]
std: Remove ?Sized bounds from many I/O functions

It is a frequent pattern among I/O functions to take `P: AsPath + ?Sized` or
`AsOsStr` instead of `AsPath`. Most of these functions do not need to take
ownership of their argument, but for libraries in general it's much more
ergonomic to not deal with `?Sized` at all and simply require an argument `P`
instead of `&P`.

This change is aimed at removing unsightly `?Sized` bounds while retaining the
same level of usability as before. All affected functions now take ownership of
their arguments instead of taking them by reference, but due to the forwarding
implementations of `AsOsStr` and `AsPath` all code should continue to work as it
did before.

This is strictly speaking a breaking change due to the signatures of these
functions changing, but normal idiomatic usage of these APIs should not break in
practice.

[breaking-change]

9 years agofix typos
FuGangqiang [Sun, 15 Mar 2015 05:47:34 +0000 (13:47 +0800)]
fix typos

9 years agoAuto merge of #23381 - Manishearth:rollup, r=Manishearth
bors [Sun, 15 Mar 2015 05:42:41 +0000 (05:42 +0000)]
Auto merge of #23381 - Manishearth:rollup, r=Manishearth

r? @Manishearth

9 years agoRollup merge of #23368 - EduardoBautista:fix-closures-chapter, r=steveklabnik
Manish Goregaokar [Sat, 14 Mar 2015 23:44:55 +0000 (05:14 +0530)]
Rollup merge of #23368 - EduardoBautista:fix-closures-chapter, r=steveklabnik

   "body": null,

9 years agoRollup merge of #23367 - EduardoBautista:fix-indentation-in-book, r=steveklabnik
Manish Goregaokar [Sat, 14 Mar 2015 23:44:46 +0000 (05:14 +0530)]
Rollup merge of #23367 - EduardoBautista:fix-indentation-in-book, r=steveklabnik

 It was using tabs.

9 years agoRollup merge of #23365 - dotdash:array_loop_panic, r=eddyb
Manish Goregaokar [Sat, 14 Mar 2015 23:44:36 +0000 (05:14 +0530)]
Rollup merge of #23365 - dotdash:array_loop_panic, r=eddyb

 [expr; 0] currently exhibits inconsistent behaviour and [expr; n] with n > 1 triggers an LLVM assertion in case that \"expr\" diverges.

9 years agoRollup merge of #23363 - meqif:master, r=alexcrichton
Manish Goregaokar [Sat, 14 Mar 2015 23:44:22 +0000 (05:14 +0530)]
Rollup merge of #23363 - meqif:master, r=alexcrichton

 There was a minor typo in the book's concurrency section (\"recieve\" instead of \"receive\").

9 years agoRollup merge of #23362 - dotdash:llvm_req, r=alexcrichton
Manish Goregaokar [Sat, 14 Mar 2015 23:44:11 +0000 (05:14 +0530)]
Rollup merge of #23362 - dotdash:llvm_req, r=alexcrichton

 LLVM older that 3.6 has a bug that cause assertions when compiling certain
constructs. For 3.5 there's still a chance that the bug might get fixed
in 3.5.2, so let's keep allowing to compile with it for it for now.

9 years agoRollup merge of #23358 - rprichard:reject-empty-L, r=alexcrichton
Manish Goregaokar [Sat, 14 Mar 2015 23:44:02 +0000 (05:14 +0530)]
Rollup merge of #23358 - rprichard:reject-empty-L, r=alexcrichton

 This change closes #23303 by rejecting an empty search path.

9 years agoRollup merge of #23356 - bombless:camelcase, r=alexcrichton
Manish Goregaokar [Sat, 14 Mar 2015 23:43:52 +0000 (05:13 +0530)]
Rollup merge of #23356 - bombless:camelcase, r=alexcrichton

 non_camel_case_types lint suggests `ONETWOTHREE` for non-camel type `ONE_TWO_THREE`, which doesn't look good.
This patch fixes it.

9 years agoRollup merge of #23351 - nagisa:rustdoc-lines-2, r=alexcrichton
Manish Goregaokar [Sat, 14 Mar 2015 23:43:44 +0000 (05:13 +0530)]
Rollup merge of #23351 - nagisa:rustdoc-lines-2, r=alexcrichton

 Previously it would fail on a trivial case like

    /// Summary line
    /// <trailing space>
    /// Regular content

Compliant markdown preprocessor would render that as two separate paragraphs, but our summary line
extractor interprets both lines as the same paragraph and includes both into the short summary resulting in
![screenshot from 2015-03-13 22 47 08](https://cloud.githubusercontent.com/assets/679122/6648596/7ef792b2-c9e4-11e4-9c19-704c288ec4de.png)

9 years agoAuto merge of #23351 - nagisa:rustdoc-lines-2, r=alexcrichton
bors [Sun, 15 Mar 2015 03:11:14 +0000 (03:11 +0000)]
Auto merge of #23351 - nagisa:rustdoc-lines-2, r=alexcrichton

Previously it would fail on a trivial case like

    /// Summary line
    /// <trailing space>
    /// Regular content

Compliant markdown preprocessor would render that as two separate paragraphs, but our summary line
extractor interprets both lines as the same paragraph and includes both into the short summary resulting in
![screenshot from 2015-03-13 22 47 08](https://cloud.githubusercontent.com/assets/679122/6648596/7ef792b2-c9e4-11e4-9c19-704c288ec4de.png)

9 years agoRemove incorrect references to _raw stdio functions
Kevin Ballard [Sun, 15 Mar 2015 01:08:09 +0000 (18:08 -0700)]
Remove incorrect references to _raw stdio functions

std::io does not currently expose the stdin_raw, stdout_raw, or
stderr_raw functions. According to the current plans for stdio (see RFC
#517), raw access will likely be provided using the platform-specific
std::os::{unix,windows} modules. At the moment we don't expose any way
to do this. As such, delete all mention of the _raw functions from the
stdin/stdout/stderr function documentation.

While we're at it, remove a few `pub`s from items that aren't exposed.
This is done just to lessen the confusion experienced by anyone who
looks at the source in an attempt to find the _raw functions.

9 years agoAuto merge of #23313 - barosl:match-specialize-ice, r=jakub-
bors [Sun, 15 Mar 2015 00:39:54 +0000 (00:39 +0000)]
Auto merge of #23313 - barosl:match-specialize-ice, r=jakub-

The arity of `ref x` is always 1, so it needs to be dereferenced before being compared with some other type whose arity is not 1.

Fixes #23009.

9 years agoStop recommending old_io in the module doc for std::io
Kevin Ballard [Sun, 15 Mar 2015 00:36:36 +0000 (17:36 -0700)]
Stop recommending old_io in the module doc for std::io

Now that `old_io` is deprecated and `std::io` is stable, we should stop
recommending the use of `old_io` in the module documentation.

9 years agoUse new io in print and println macroses
Simonas Kazlauskas [Sun, 8 Mar 2015 22:30:15 +0000 (00:30 +0200)]
Use new io in print and println macroses

9 years agoAuto merge of #23289 - mihneadb:rustdoc-search-by-type, r=alexcrichton
bors [Sat, 14 Mar 2015 22:07:25 +0000 (22:07 +0000)]
Auto merge of #23289 - mihneadb:rustdoc-search-by-type, r=alexcrichton

This adds search by type (for functions/methods) support to Rustdoc. Target issue is at https://github.com/rust-lang/rfcs/issues/658.

I've described my approach here: https://github.com/rust-lang/rfcs/issues/658#issuecomment-76484200. I'll copy the text in here as well:

---

Hi, it took me longer than I wished, but I have implemented this in a not-too-complex way that I think can be extended to support more complex features (like the ones mentioned [here](https://github.com/rust-lang/rust/issues/12866#issuecomment-66945317)).

The idea is to generate a JSON representation of the types of methods/functions in the existing index, and then make the JS understand when it should look by type (and not by name).

I tried to come up with a JSON representation that can be extended to support generics, bounds, ref/mut annotations and so on. Here are a few samples:

Function:

```rust
fn to_uppercase(c: char) -> char
```

```json
{
    "inputs": [
        {"name": "char"}
    ],
    "output": {
        "name": "char",
    }
}
```

Method (implemented or defined in trait):

```rust
// in struct Vec
// self is considered an argument as well
fn capacity(&self) -> usize
```

```json
{
    "inputs": [
        {"name": "vec"}
    ],
    "output": {
        "name": "usize"
    }
}
```

This simple format can be extended by adding more fields, like `generic: bool`, a `bounds` mapping and so on.

I have a working implementation in https://github.com/rust-lang/rust/compare/master...mihneadb:rustdoc-search-by-type. You can check out a live demo [here](http://data.mihneadb.net/doc/std/index.html?search=charext%20-%3E%20char).

![screenshot from 2015-02-28 00 54 00](https://cloud.githubusercontent.com/assets/643127/6422722/7e5374ee-bee4-11e4-99a6-9aac3c9d5068.png)

The feature list is not that long:
- search by types (you *can* use generics as well, as long as you use the exact name - e.g. [`vec,t -> `](http://data.mihneadb.net/doc/std/index.html?search=vec%2C%20t%20-%3E))
- order of arguments does not matter
- `self` is took into account as well (e.g. search for `vec -> usize`)
- does not use "complex" annotations (e.g. you don't search for `&char -> char` but for `char -> char`)

My goal is to get a working, minimal "base" merged so that others can build upon it. How should I proceed? Do I open a PR (badly in need of code review since this is my first non "hello world"-ish rust code)?

---

9 years agoConcurrency is now in the "Concurrency" chapter
Eduardo Bautista [Sat, 14 Mar 2015 20:05:59 +0000 (14:05 -0600)]
Concurrency is now in the "Concurrency" chapter

9 years agoFix indentation in the "Method Syntax" chapter
Eduardo Bautista [Sat, 14 Mar 2015 19:27:44 +0000 (13:27 -0600)]
Fix indentation in the "Method Syntax" chapter

9 years agoAdd support to search functions by type to rustdoc.
Mihnea Dobrescu-Balaur [Wed, 25 Feb 2015 23:03:06 +0000 (01:03 +0200)]
Add support to search functions by type to rustdoc.

9 years agoAuto merge of #23357 - Manishearth:oops, r=Manishearth
bors [Sat, 14 Mar 2015 16:59:06 +0000 (16:59 +0000)]
Auto merge of #23357 - Manishearth:oops, r=Manishearth

Oops, merged #21468 by accident.

9 years agocheck_match: Dereference `ref x` before comparing it and some other type
Barosl Lee [Wed, 11 Mar 2015 16:36:52 +0000 (01:36 +0900)]
check_match: Dereference `ref x` before comparing it and some other type

The arity of `ref x` is always 1, so it needs to be dereferenced before
being compared with some other type whose arity is not 1.

Fixes #23009.

9 years agoFix broken codegen for [expr; n] where "expr" diverges
Björn Steinbrink [Sat, 14 Mar 2015 13:21:43 +0000 (14:21 +0100)]
Fix broken codegen for [expr; n] where "expr" diverges

9 years agoAlways evaluate the expression in [expr; n]
Björn Steinbrink [Sat, 14 Mar 2015 13:19:29 +0000 (14:19 +0100)]
Always evaluate the expression in [expr; n]

In case that there is a destination for the array, like in
"let x = [expr; n]", we currently don't evaluate the given expression if
n is zero. That's inconsistent with all other cases, including "[expr;
0]" without a destination.

Fixes #23354

9 years agoFix a typo in the documentation.
Ricardo Martins [Sat, 14 Mar 2015 12:42:12 +0000 (12:42 +0000)]
Fix a typo in the documentation.

9 years agoDrop support for LLVM < 3.5 and fix compile errors with 3.5
Björn Steinbrink [Sat, 14 Mar 2015 12:14:04 +0000 (13:14 +0100)]
Drop support for LLVM < 3.5 and fix compile errors with 3.5

LLVM older that 3.6 has a bug that cause assertions when compiling certain
constructs. For 3.5 there's still a chance that the bug might get fixed
in 3.5.2, so let's keep allowing to compile with it for it for now.

9 years agoSplit rustdoc summary lines in a smarter way
Simonas Kazlauskas [Fri, 13 Mar 2015 22:45:39 +0000 (00:45 +0200)]
Split rustdoc summary lines in a smarter way

Previously it would fail on a trivial case like

    /// Summary line
    /// <trailing space>
    /// Regular content

Compliant markdown preprocessor would render that as two separate paragraphs, but our summary line
extractor would interpret both lines as the same paragraph and include both into the short summary.

9 years agoAuto merge of #23333 - oli-obk:slice_from_raw_parts, r=alexcrichton
bors [Sat, 14 Mar 2015 08:55:31 +0000 (08:55 +0000)]
Auto merge of #23333 - oli-obk:slice_from_raw_parts, r=alexcrichton

at least that's what the docs say: http://doc.rust-lang.org/std/slice/fn.from_raw_parts.html

A few situations got prettier. In some situations the mutability of the resulting and source pointers differed (and was cast away by transmute), the mutability matches now.

9 years agoReject `-L ""`, `-L native=`, and other empty search paths.
Ryan Prichard [Sat, 14 Mar 2015 06:49:44 +0000 (23:49 -0700)]
Reject `-L ""`, `-L native=`, and other empty search paths.

It wasn't clear to me that early_error was correct here, but it seems to
work. This code is reachable from `rustdoc`, which is problematic, because
early_error panics. rustc handles the panics gracefully (without ICEing or
crashing), but rustdoc does not. It's not the first such rustdoc problem,
though:

    $ rustdoc hello.rs --extern std=bad-std
    error: extern location for std does not exist: bad-std
    hello.rs:1:1: 1:1 error: can't find crate for `std`
    hello.rs:1
           ^
    error: aborting due to 2 previous errors
    thread '<unnamed>' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:151
    thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "rustc failed"', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/result.rs:744
    thread '<main>' panicked at 'child thread None panicked', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/thread.rs:661

9 years agoRevert "Extend dead code lint to detect more unused enum variants"
Manish Goregaokar [Sat, 14 Mar 2015 06:44:32 +0000 (12:14 +0530)]
Revert "Extend dead code lint to detect more unused enum variants"

This reverts commit b042ffc4a768c2bd6d7588b1b2f47af22669c2cb.

Conflicts:
src/librustc/middle/pat_util.rs

9 years agoRevert "Remove dead code flagged by lint"
Manish Goregaokar [Sat, 14 Mar 2015 06:44:03 +0000 (12:14 +0530)]
Revert "Remove dead code flagged by lint"

This reverts commit bce7a6f4a9edd23c73bf4fc390db3037895c1850.

9 years agoImprove camelcase suggestion
York Xiang [Sat, 14 Mar 2015 05:40:33 +0000 (13:40 +0800)]
Improve camelcase suggestion

9 years agoAuto merge of #22948 - rprichard:simple-panic-opt, r=alexcrichton
bors [Sat, 14 Mar 2015 01:04:37 +0000 (01:04 +0000)]
Auto merge of #22948 - rprichard:simple-panic-opt, r=alexcrichton

Reduce code size overhead from core::panicking::panic

core::panicking::panic currently creates an Arguments structure using
format_args!("{}", expr), which formats the expr str using the Display::fmt.
Display::fmt pulls in Formatter::pad, which then also pulls in string-related
code for truncation and padding.

If core::panicking::panic instead creates an Arguments structure with a string
piece, it is possible that the Display::fmt function for str can be optimized
out of the program.

In my testing with a 32-bit x86 bare metal program, the change tended to save
between ~100 bytes and ~5500 bytes, depending on what other panic* functions
the program invokes and whether the panic_fmt lang item uses the Arguments
value.

9 years agoAvoid passing -L "" during cross-compilation.
Ryan Prichard [Fri, 13 Mar 2015 02:24:59 +0000 (19:24 -0700)]
Avoid passing -L "" during cross-compilation.

LLVM_LIBDIR_<triple> is only defined for host triples, not target triples.

FWIW, the same is true for LLVM_STDCPP_RUSTFLAGS_<triple>, where we
explicitly define it as empty when --enable-llvm-static-stdcpp is not
specified, but it's still undefined for cross-compiled triples.

9 years agoAuto merge of #23292 - alexcrichton:stabilize-io, r=aturon
bors [Fri, 13 Mar 2015 20:22:16 +0000 (20:22 +0000)]
Auto merge of #23292 - alexcrichton:stabilize-io, r=aturon

The new `std::io` module has had some time to bake now, and this commit
stabilizes its functionality. There are still portions of the module which
remain unstable, and below contains a summart of the actions taken.

This commit also deprecates the entire contents of the `old_io` module in a
blanket fashion. All APIs should now have a reasonable replacement in the
new I/O modules.

Stable APIs:

* `std::io` (the name)
* `std::io::prelude` (the name)
* `Read`
* `Read::read`
* `Read::{read_to_end, read_to_string}` after being modified to return a `usize`
  for the number of bytes read.
* `ReadExt`
* `Write`
* `Write::write`
* `Write::{write_all, write_fmt}`
* `WriteExt`
* `BufRead`
* `BufRead::{fill_buf, consume}`
* `BufRead::{read_line, read_until}` after being modified to return a `usize`
  for the number of bytes read.
* `BufReadExt`
* `BufReader`
* `BufReader::{new, with_capacity}`
* `BufReader::{get_ref, get_mut, into_inner}`
* `{Read,BufRead} for BufReader`
* `BufWriter`
* `BufWriter::{new, with_capacity}`
* `BufWriter::{get_ref, get_mut, into_inner}`
* `Write for BufWriter`
* `IntoInnerError`
* `IntoInnerError::{error, into_inner}`
* `{Error,Display} for IntoInnerError`
* `LineWriter`
* `LineWriter::{new, with_capacity}` - `with_capacity` was added
* `LineWriter::{get_ref, get_mut, into_inner}` - `get_mut` was added)
* `Write for LineWriter`
* `BufStream`
* `BufStream::{new, with_capacities}`
* `BufStream::{get_ref, get_mut, into_inner}`
* `{BufRead,Read,Write} for BufStream`
* `stdin`
* `Stdin`
* `Stdin::lock`
* `Stdin::read_line` - added method
* `StdinLock`
* `Read for Stdin`
* `{Read,BufRead} for StdinLock`
* `stdout`
* `Stdout`
* `Stdout::lock`
* `StdoutLock`
* `Write for Stdout`
* `Write for StdoutLock`
* `stderr`
* `Stderr`
* `Stderr::lock`
* `StderrLock`
* `Write for Stderr`
* `Write for StderrLock`
* `io::Result`
* `io::Error`
* `io::Error::last_os_error`
* `{Display, Error} for Error`

Unstable APIs:

(reasons can be found in the commit itself)

* `Write::flush`
* `Seek`
* `ErrorKind`
* `Error::new`
* `Error::from_os_error`
* `Error::kind`

Deprecated APIs

* `Error::description` - available via the `Error` trait
* `Error::detail` - available via the `Display` implementation
* `thread::Builder::{stdout, stderr}`

Changes in functionality:

* `old_io::stdio::set_stderr` is now a noop as the infrastructure for printing
  backtraces has migrated to `std::io`.

[breaking-change]

9 years agoAuto merge of #23337 - Manishearth:rollup, r=Manishearth
bors [Fri, 13 Mar 2015 17:49:15 +0000 (17:49 +0000)]
Auto merge of #23337 - Manishearth:rollup, r=Manishearth

r? @Manishearth

9 years agoFallout of std::old_io deprecation
Alex Crichton [Wed, 11 Mar 2015 22:24:14 +0000 (15:24 -0700)]
Fallout of std::old_io deprecation

9 years agorm unused import
Manish Goregaokar [Fri, 13 Mar 2015 14:22:18 +0000 (19:52 +0530)]
rm unused import

9 years agoFix def -> PathResolution
Manish Goregaokar [Fri, 13 Mar 2015 14:21:09 +0000 (19:51 +0530)]
Fix def -> PathResolution

9 years agoRollup merge of #21468 - sanxiyn:dead-variant, r=
Manish Goregaokar [Fri, 13 Mar 2015 12:42:05 +0000 (18:12 +0530)]
Rollup merge of #21468 - sanxiyn:dead-variant, r=

 This implements a wish suggested in #17410, detecting enum variants that are never constructed, even in the presence of `#[derive(Clone)]`. The implementation is general and not specific to `#[derive(Clone)]`.

r? @jakub-

9 years agoRollup merge of #23324 - rprichard:fix-freebsd, r=brson
Manish Goregaokar [Fri, 13 Mar 2015 12:41:57 +0000 (18:11 +0530)]
Rollup merge of #23324 - rprichard:fix-freebsd, r=brson

 Currently, target.mk passes -L \"\" when LLVM_STDCPP_LOCATION_$(2) is empty.

This fixes #23287.

9 years agoRollup merge of #23322 - dotdash:jemalloc_attrs, r=brson
Manish Goregaokar [Fri, 13 Mar 2015 12:41:51 +0000 (18:11 +0530)]
Rollup merge of #23322 - dotdash:jemalloc_attrs, r=brson

 When this attribute is applied to a function, its return value gets the
noalias attribute, which is how you tell LLVM that the function returns
a \"new\" pointer that doesn't alias anything accessible to the caller,
i.e. it acts like a memory allocator.

Plain malloc doesn't need this attribute because LLVM already knows
about malloc and adds the attribute itself.

9 years agoRollup merge of #23321 - apasel422:hash, r=alexcrichton
Manish Goregaokar [Fri, 13 Mar 2015 12:41:46 +0000 (18:11 +0530)]
Rollup merge of #23321 - apasel422:hash, r=alexcrichton

 It is no longer possible to specialize on the `Hasher` because it moved to a method-level type parameter.

9 years agoRollup merge of #23317 - tanadeau:fix-formatting-and-grammar, r=steveklabnik
Manish Goregaokar [Fri, 13 Mar 2015 12:41:40 +0000 (18:11 +0530)]
Rollup merge of #23317 - tanadeau:fix-formatting-and-grammar, r=steveklabnik

 Fixed grammar errors (incorrect uses of commas and \"you're\" instead of \"your\") and broke up a long line.

r? @steveklabnik

9 years agoRollup merge of #23312 - gkoz:ptr_from_box_docs, r=steveklabnik
Manish Goregaokar [Fri, 13 Mar 2015 12:41:34 +0000 (18:11 +0530)]
Rollup merge of #23312 - gkoz:ptr_from_box_docs, r=steveklabnik

 Show how to get a pointer without destroying the box.
Use `boxed::into_raw` instead of `mem::transmute`.

I removed the `let my_num: *const i32 = mem::transmute(my_num);` case altogether because we own the box, a `*mut` pointer is good anywhere a `*const` is needed, `from_raw` takes a mutable pointer and casting from a `*const` caused an ICE.

9 years agoRollup merge of #23328 - alexcrichton:rustdoc-default-impl, r=brson
Manish Goregaokar [Fri, 13 Mar 2015 12:41:27 +0000 (18:11 +0530)]
Rollup merge of #23328 - alexcrichton:rustdoc-default-impl, r=brson

 This adds a special code path for impls which are listed as default impls to
ensure that they're loaded correctly.

9 years agoRollup merge of #23325 - brson:beta, r=alexcrichton
Manish Goregaokar [Fri, 13 Mar 2015 12:41:21 +0000 (18:11 +0530)]
Rollup merge of #23325 - brson:beta, r=alexcrichton

 This is the second time I've made this typo.

9 years agoRollup merge of #23310 - michaelwoerister:gdb-std-pp, r=alexcrichton
Manish Goregaokar [Fri, 13 Mar 2015 12:41:13 +0000 (18:11 +0530)]
Rollup merge of #23310 - michaelwoerister:gdb-std-pp, r=alexcrichton

 ```rust
Rust:  let slice: &[i32] = &[0, 1, 2, 3];
GDB:   $1 = &[i32](len: 4) = {0, 1, 2, 3}

Rust:  let vec = vec![4, 5, 6, 7];
GDB:   $2 = Vec<u64>(len: 4, cap: 4) = {4, 5, 6, 7}

Rust:  let str_slice = \"IAMA string slice!\";
GDB:   $3 = \"IAMA string slice!\"

Rust:  let string = \"IAMA string!\".to_string();
GDB:   $4 = \"IAMA string!\"
```
Neat!

9 years agoRollup merge of #23307 - michaelwoerister:lldb-vec-pp-bug, r=alexcrichton
Manish Goregaokar [Fri, 13 Mar 2015 12:41:07 +0000 (18:11 +0530)]
Rollup merge of #23307 - michaelwoerister:lldb-vec-pp-bug, r=alexcrichton

 Fixes #22656. Also adds a nice pretty printer for `Vec`.

9 years agofix tests
Oliver Schneider [Fri, 13 Mar 2015 12:09:34 +0000 (13:09 +0100)]
fix tests

9 years agoAuto merge of #23307 - michaelwoerister:lldb-vec-pp-bug, r=alexcrichton
bors [Fri, 13 Mar 2015 11:44:47 +0000 (11:44 +0000)]
Auto merge of #23307 - michaelwoerister:lldb-vec-pp-bug, r=alexcrichton

Fixes #22656. Also adds a nice pretty printer for `Vec`.

9 years agoslice::from_raw_parts is preferred over transmuting a fresh raw::Slice
Oliver Schneider [Fri, 13 Mar 2015 08:56:18 +0000 (09:56 +0100)]
slice::from_raw_parts is preferred over transmuting a fresh raw::Slice

9 years agorustdoc: Fix ICE with cross-crate default impls
Alex Crichton [Fri, 13 Mar 2015 02:15:52 +0000 (19:15 -0700)]
rustdoc: Fix ICE with cross-crate default impls

This adds a special code path for impls which are listed as default impls to
ensure that they're loaded correctly.

9 years agostd: Stabilize the `io` module
Alex Crichton [Wed, 11 Mar 2015 21:16:46 +0000 (14:16 -0700)]
std: Stabilize the `io` module

The new `std::io` module has had some time to bake now, and this commit
stabilizes its functionality. There are still portions of the module which
remain unstable, and below contains a summart of the actions taken.

This commit also deprecates the entire contents of the `old_io` module in a
blanket fashion. All APIs should now have a reasonable replacement in the
new I/O modules.

Stable APIs:

* `std::io` (the name)
* `std::io::prelude` (the name)
* `Read`
* `Read::read`
* `Read::{read_to_end, read_to_string}` after being modified to return a `usize`
  for the number of bytes read.
* `Write`
* `Write::write`
* `Write::{write_all, write_fmt}`
* `BufRead`
* `BufRead::{fill_buf, consume}`
* `BufRead::{read_line, read_until}` after being modified to return a `usize`
  for the number of bytes read.
* `BufReader`
* `BufReader::{new, with_capacity}`
* `BufReader::{get_ref, get_mut, into_inner}`
* `{Read,BufRead} for BufReader`
* `BufWriter`
* `BufWriter::{new, with_capacity}`
* `BufWriter::{get_ref, get_mut, into_inner}`
* `Write for BufWriter`
* `IntoInnerError`
* `IntoInnerError::{error, into_inner}`
* `{Error,Display} for IntoInnerError`
* `LineWriter`
* `LineWriter::{new, with_capacity}` - `with_capacity` was added
* `LineWriter::{get_ref, get_mut, into_inner}` - `get_mut` was added)
* `Write for LineWriter`
* `BufStream`
* `BufStream::{new, with_capacities}`
* `BufStream::{get_ref, get_mut, into_inner}`
* `{BufRead,Read,Write} for BufStream`
* `stdin`
* `Stdin`
* `Stdin::lock`
* `Stdin::read_line` - added method
* `StdinLock`
* `Read for Stdin`
* `{Read,BufRead} for StdinLock`
* `stdout`
* `Stdout`
* `Stdout::lock`
* `StdoutLock`
* `Write for Stdout`
* `Write for StdoutLock`
* `stderr`
* `Stderr`
* `Stderr::lock`
* `StderrLock`
* `Write for Stderr`
* `Write for StderrLock`
* `io::Result`
* `io::Error`
* `io::Error::last_os_error`
* `{Display, Error} for Error`

Unstable APIs:

(reasons can be found in the commit itself)

* `Write::flush`
* `Seek`
* `ErrorKind`
* `Error::new`
* `Error::from_os_error`
* `Error::kind`

Deprecated APIs

* `Error::description` - available via the `Error` trait
* `Error::detail` - available via the `Display` implementation
* `thread::Builder::{stdout, stderr}`

Changes in functionality:

* `old_io::stdio::set_stderr` is now a noop as the infrastructure for printing
  backtraces has migrated to `std::io`.
* The `ReadExt`, `WriteExt`, and `BufReadExt` extension traits were all removed
  by folding functionality into the corresponding trait.

[breaking-change]

9 years agoAdd an "allocator" attribute to mark functions as allocators
Björn Steinbrink [Fri, 13 Mar 2015 02:19:30 +0000 (03:19 +0100)]
Add an "allocator" attribute to mark functions as allocators

When this attribute is applied to a function, its return value gets the
noalias attribute, which is how you tell LLVM that the function returns
a "new" pointer that doesn't alias anything accessible to the caller,
i.e. it acts like a memory allocator.

Plain malloc doesn't need this attribute because LLVM already knows
about malloc and adds the attribute itself.

9 years agoAuto merge of #23229 - aturon:stab-path, r=alexcrichton
bors [Fri, 13 Mar 2015 01:00:02 +0000 (01:00 +0000)]
Auto merge of #23229 - aturon:stab-path, r=alexcrichton

This commit stabilizes essentially all of the new `std::path` API. The
API itself is changed in a couple of ways (which brings it in closer
alignment with the RFC):

* `.` components are now normalized away, unless they appear at the
  start of a path. This in turn effects the semantics of e.g. asking for
  the file name of `foo/` or `foo/.`, both of which yield `Some("foo")`
  now. This semantics is what the original RFC specified, and is also
  desirable given early experience rolling out the new API.

* The `parent` method is now `without_file` and succeeds if, and only
  if, `file_name` is `Some(_)`. That means, in particular, that it fails
  for a path like `foo/../`. This change affects `pop` as well.

In addition, the `old_path` module is now deprecated.

[breaking-change]

r? @alexcrichton

9 years agoFix naming of beta artifacts again
Brian Anderson [Fri, 13 Mar 2015 00:37:51 +0000 (17:37 -0700)]
Fix naming of beta artifacts again

9 years agoStabilize std::path
Aaron Turon [Mon, 9 Mar 2015 15:49:10 +0000 (08:49 -0700)]
Stabilize std::path

This commit stabilizes essentially all of the new `std::path` API. The
API itself is changed in a couple of ways (which brings it in closer
alignment with the RFC):

* `.` components are now normalized away, unless they appear at the
  start of a path. This in turn effects the semantics of e.g. asking for
  the file name of `foo/` or `foo/.`, both of which yield `Some("foo")`
  now. This semantics is what the original RFC specified, and is also
  desirable given early experience rolling out the new API.

* The `parent` function now succeeds if, and only if, the path has at
  least one non-root/prefix component. This change affects `pop` as
  well.

* The `Prefix` component now involves a separate `PrefixComponent`
  struct, to better allow for keeping both parsed and unparsed prefix data.

In addition, the `old_path` module is now deprecated.

Closes #23264

[breaking-change]

9 years agoremove mention of specialization from `Hash` trait
Andrew Paseltiner [Thu, 12 Mar 2015 22:09:52 +0000 (18:09 -0400)]
remove mention of specialization from `Hash` trait

It is no longer possible to specialize on the `Hasher` because it moved
to a method-level type parameter.

9 years agoFixed several grammar errors and broke up very long line.
Trent Nadeau [Thu, 12 Mar 2015 21:00:35 +0000 (17:00 -0400)]
Fixed several grammar errors and broke up very long line.

9 years agoAuto merge of #23265 - eddyb:meth-ast-refactor, r=nikomatsakis
bors [Thu, 12 Mar 2015 20:13:23 +0000 (20:13 +0000)]
Auto merge of #23265 - eddyb:meth-ast-refactor, r=nikomatsakis

The end result is that common fields (id, name, attributes, etc.) are stored in now-structures `ImplItem` and `TraitItem`.
The signature of a method is no longer duplicated between methods with a body (default/impl) and those without, they now share `MethodSig`.

This is also a [breaking-change] because of minor bugfixes and changes to syntax extensions:
* `pub fn` methods in a trait no longer parse - remove the `pub`, it has no meaning anymore
* `MacResult::make_methods` is now `make_impl_items` and the return type has changed accordingly
* `quote_method` is gone, because `P<ast::Method>` doesn't exist and it couldn't represent a full method anyways - could be replaced by `quote_impl_item`/`quote_trait_item` in the future, but I do hope we realize how silly that combinatorial macro expansion is and settle on a single `quote` macro + some type hints - or just no types at all (only token-trees)

r? @nikomatsakis This is necessary (hopefully also sufficient) for associated constants.

9 years agoUpdate the ways to get a pointer from a box
Gleb Kozyrev [Thu, 12 Mar 2015 15:09:26 +0000 (17:09 +0200)]
Update the ways to get a pointer from a box

Show how to get a pointer without destroying the box.
Use `boxed::into_raw` instead of `mem::transmute`.

9 years agoAuto merge of #23245 - alexcrichton:allow-warnings-again, r=aturon
bors [Thu, 12 Mar 2015 17:39:30 +0000 (17:39 +0000)]
Auto merge of #23245 - alexcrichton:allow-warnings-again, r=aturon

These were suppressing lots of interesting warnings! Turns out there was also
quite a bit of dead code.

9 years agostd: Remove #[allow] directives in sys modules
Alex Crichton [Tue, 10 Mar 2015 03:04:35 +0000 (20:04 -0700)]
std: Remove #[allow] directives in sys modules

These were suppressing lots of interesting warnings! Turns out there was also
quite a bit of dead code.

9 years agodebuginfo: Add GDB pretty printers for slices, Vec<>, and String.
Michael Woerister [Thu, 12 Mar 2015 16:05:44 +0000 (17:05 +0100)]
debuginfo: Add GDB pretty printers for slices, Vec<>, and String.

9 years agoAuto merge of #23299 - mdinger:monospace_table, r=steveklabnik
bors [Thu, 12 Mar 2015 13:47:20 +0000 (13:47 +0000)]
Auto merge of #23299 - mdinger:monospace_table, r=steveklabnik

The [literals table](http://doc.rust-lang.org/reference.html#characters-and-strings) now looks ugly but compact. Add back the monospace text.

9 years agodebuginfo: Make LLDB pretty printer correctly handle zero-sized fields.
Michael Woerister [Thu, 12 Mar 2015 11:18:15 +0000 (12:18 +0100)]
debuginfo: Make LLDB pretty printer correctly handle zero-sized fields.

9 years agoAvoid passing -L "" to rustc.
Ryan Prichard [Thu, 12 Mar 2015 11:09:12 +0000 (04:09 -0700)]
Avoid passing -L "" to rustc.

Currently, target.mk passes -L "" when LLVM_STDCPP_LOCATION_$(2) is empty.

This fixes #23287.

9 years agoAuto merge of #23162 - sfackler:debug-builders, r=alexcrichton
bors [Thu, 12 Mar 2015 07:30:44 +0000 (07:30 +0000)]
Auto merge of #23162 - sfackler:debug-builders, r=alexcrichton

I've made some minor changes from the implementation attached to the RFC to try to minimize codegen. The methods now take `&Debug` trait objects rather than being parameterized and there are inlined stub methods that call to non-inlined methods to do the work.

r? @alexcrichton

cc @huonw for the `derive(Debug)` changes.

9 years agoAuto merge of #23298 - Manishearth:rollup, r=Manishearth
bors [Thu, 12 Mar 2015 04:53:31 +0000 (04:53 +0000)]
Auto merge of #23298 - Manishearth:rollup, r=Manishearth

None

9 years agoAdd monospace font back to literals table
mdinger [Thu, 12 Mar 2015 04:24:48 +0000 (00:24 -0400)]
Add monospace font back to literals table

9 years agoRm unused feature
Manish Goregaokar [Wed, 11 Mar 2015 09:13:37 +0000 (14:43 +0530)]
Rm unused feature

9 years agoRollup merge of #23296 - shepmaster:explain-why-joinguard-is-must-use, r=alexcrichton
Manish Goregaokar [Thu, 12 Mar 2015 03:45:06 +0000 (09:15 +0530)]
Rollup merge of #23296 - shepmaster:explain-why-joinguard-is-must-use, r=alexcrichton

9 years agoRollup merge of #23295 - johnz133:patch-1, r=steveklabnik
Manish Goregaokar [Thu, 12 Mar 2015 03:44:59 +0000 (09:14 +0530)]
Rollup merge of #23295 - johnz133:patch-1, r=steveklabnik

 Changed the docs to reflect that

9 years agoRollup merge of #23279 - steveklabnik:gh23244, r=alexcrichton
Manish Goregaokar [Thu, 12 Mar 2015 03:44:51 +0000 (09:14 +0530)]
Rollup merge of #23279 - steveklabnik:gh23244, r=alexcrichton

 Fixes #23244

9 years agoRollup merge of #23275 - aochagavia:constants, r=eddyb
Manish Goregaokar [Thu, 12 Mar 2015 03:44:44 +0000 (09:14 +0530)]
Rollup merge of #23275 - aochagavia:constants, r=eddyb

 Fixes #23260

r? @eddyb