]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoFix up Split docs
Steve Klabnik [Mon, 15 Jun 2015 16:25:10 +0000 (12:25 -0400)]
Fix up Split docs

Because these structures are created by a macro, the doc comments
don't quite work: the leading /// isn't stripped. Instead, just
use #[doc] so that they render correctly.

9 years agoAuto merge of #25262 - Manishearth:rollup, r=Manishearth
bors [Sun, 10 May 2015 05:32:20 +0000 (05:32 +0000)]
Auto merge of #25262 - Manishearth:rollup, r=Manishearth

- Successful merges: #25200, #25242, #25248, #25249, #25251, #25252, #25261
- Failed merges: #25255

9 years agoRollup merge of #25261 - nham:obsolete_assoc_space_comment, r=alexcrichton
Manish Goregaokar [Sun, 10 May 2015 05:31:46 +0000 (11:01 +0530)]
Rollup merge of #25261 - nham:obsolete_assoc_space_comment, r=alexcrichton

This was added in d2f8074 along with the AssocSpace stuff. The AssocSpace
stuff was then removed in de8e0ae, except it seems the comment here was missed.

9 years agoRollup merge of #25252 - inrustwetrust:crate-type-attribute, r=alexcrichton
Manish Goregaokar [Sun, 10 May 2015 05:31:46 +0000 (11:01 +0530)]
Rollup merge of #25252 - inrustwetrust:crate-type-attribute, r=alexcrichton

Fixes the problem in #16974 with unhelpful error messages when accidentally using the wrong syntax for the `crate_type="lib"` attribute. The attribute syntax error now shows up instead of "main function not found".

9 years agoRollup merge of #25251 - nham:whitespace_lang_items, r=Manishearth
Manish Goregaokar [Sun, 10 May 2015 05:31:46 +0000 (11:01 +0530)]
Rollup merge of #25251 - nham:whitespace_lang_items, r=Manishearth

In my opinion this looks nicer, but also it matches the whitespace generally
used for stability markers.

9 years agoRollup merge of #25249 - robyoung:minor-doc-fix, r=Manishearth
Manish Goregaokar [Sun, 10 May 2015 05:31:46 +0000 (11:01 +0530)]
Rollup merge of #25249 - robyoung:minor-doc-fix, r=Manishearth

Remove an rogue 'is' and fix some line wrapping.

9 years agoRollup merge of #25248 - carols10cents:unused-auxiliaries, r=Manishearth
Manish Goregaokar [Sun, 10 May 2015 05:31:45 +0000 (11:01 +0530)]
Rollup merge of #25248 - carols10cents:unused-auxiliaries, r=Manishearth

Hiiiii Rust, it's me again, Carol ;)

Based on the unused files that I found hanging out and that I removed in #25231, I looked at the rest of the auxiliary files to see if there were any more not being used. Guess what!! There were!!!!! ;)

Have I mentioned how much I enjoy deleting code? ;) ;) ;) <3

9 years agoRollup merge of #25242 - acgtyrant:patch-3, r=Manishearth
Manish Goregaokar [Sun, 10 May 2015 05:31:45 +0000 (11:01 +0530)]
Rollup merge of #25242 - acgtyrant:patch-3, r=Manishearth

Fix a typo while `io::stdin().read_line()` returns `Result` actually

9 years agoRollup merge of #25200 - nham:E0062_E0063, r=alexcrichton
Manish Goregaokar [Sun, 10 May 2015 05:31:45 +0000 (11:01 +0530)]
Rollup merge of #25200 - nham:E0062_E0063, r=alexcrichton

cc #24407

9 years agoRemove obsolete comment in rustc::middle::subst.
Nick Hamann [Sun, 10 May 2015 04:43:48 +0000 (23:43 -0500)]
Remove obsolete comment in rustc::middle::subst.

This was added in d2f8074 along with the AssocSpace stuff. The AssocSpace
stuff was then removed in de8e0ae, except the comment was missed it seems.

9 years agoUpdate error-handling.md
Isaac Ge [Sat, 9 May 2015 12:36:12 +0000 (20:36 +0800)]
Update error-handling.md

Fix two typos while `io::stdin().read_line()` returns `Result` actually

Signed-off-by: acgtyrant <acgtyrant@gmail.com>
9 years agoUpgraded warning for invalid crate_type attribute syntax to an error
inrustwetrust [Sat, 9 May 2015 22:07:26 +0000 (00:07 +0200)]
Upgraded warning for invalid crate_type attribute syntax to an error

If the user intended to set the crate_type to "lib" but accidentally used
incorrect syntax such as `#![crate_type(lib)]`, the compilation would fail with
"main function not found". This made it hard to locate the source of the
problem, since the failure would cause the warning about the incorrect
attribute not to be shown.

9 years agoConvert #[lang=".."] to #[lang = ".."] for docs too.
Nick Hamann [Sat, 9 May 2015 21:08:02 +0000 (16:08 -0500)]
Convert #[lang=".."] to #[lang = ".."] for docs too.

9 years agoConvert #[lang="..."] to #[lang = "..."]
Nick Hamann [Sat, 9 May 2015 19:50:28 +0000 (14:50 -0500)]
Convert #[lang="..."] to #[lang = "..."]

In my opinion this looks nicer, but also it matches the whitespace generally
used for stability markers more closely.

9 years agoChange E0062 and E0063 to say each field should be specified once.
Nick Hamann [Fri, 8 May 2015 18:13:43 +0000 (13:13 -0500)]
Change E0062 and E0063 to say each field should be specified once.

9 years agoAdd long diagnostic for E0137
Nick Hamann [Fri, 8 May 2015 00:00:56 +0000 (19:00 -0500)]
Add long diagnostic for E0137

9 years agoAdd long diagnostics for E0062 and E0063
Nick Hamann [Thu, 7 May 2015 23:41:33 +0000 (18:41 -0500)]
Add long diagnostics for E0062 and E0063

9 years agoMinor docs fix
Rob Young [Sat, 9 May 2015 17:31:00 +0000 (18:31 +0100)]
Minor docs fix

Remove an rogue 'is' and fix some line wrapping.

9 years agoRemove auxiliary files not used since eb4d39e
Carol Nichols [Sat, 9 May 2015 17:09:47 +0000 (13:09 -0400)]
Remove auxiliary files not used since eb4d39e

9 years agoRemove auxiliary file not used since 17da4c7
Carol Nichols [Sat, 9 May 2015 17:05:16 +0000 (13:05 -0400)]
Remove auxiliary file not used since 17da4c7

9 years agoRemove auxiliary files not used since 812637e
Carol Nichols [Sat, 9 May 2015 17:03:16 +0000 (13:03 -0400)]
Remove auxiliary files not used since 812637e

9 years agoAuto merge of #24728 - GuillaumeGomez:type-mismatch, r=pnkfelix
bors [Sat, 9 May 2015 16:48:11 +0000 (16:48 +0000)]
Auto merge of #24728 - GuillaumeGomez:type-mismatch, r=pnkfelix

Part of #24407.

9 years agoUse of @pnkfelix code and fix typos
Guillaume Gomez [Sat, 9 May 2015 15:53:18 +0000 (17:53 +0200)]
Use of @pnkfelix code and fix typos

9 years agoAuto merge of #24612 - lifthrasiir:flt2dec, r=pnkfelix
bors [Sat, 9 May 2015 14:56:56 +0000 (14:56 +0000)]
Auto merge of #24612 - lifthrasiir:flt2dec, r=pnkfelix

This is a direct port of my prior work on the float formatting. The detailed description is available [here](https://github.com/lifthrasiir/rust-strconv#flt2dec). In brief,

* This adds a new hidden module `core::num::flt2dec` for testing from `libcoretest`. Why is it in `core::num` instead of `core::fmt`? Because I envision that the table used by `flt2dec` is directly applicable to `dec2flt` (cf. #24557) as well, which exceeds the realm of "formatting".
* This contains both Dragon4 algorithm (exact, complete but slow) and Grisu3 algorithm (exact, fast but incomplete).
* The code is accompanied with a large amount of self-tests and some exhaustive tests. In particular, `libcoretest` gets a new dependency on `librand`. For the external interface it relies on the existing test suite.
* It is known that, in the best case, the entire formatting code has about 30 KBs of binary overhead (judged from strconv experiments). Not too bad but there might be a potential room for improvements.

This is rather large code. I did my best to comment and annotate the code, but you have been warned.

For the maximal availability the original code was licensed in CC0, but I've also dual-licensed it in MIT/Apache as well so there should be no licensing concern.

This is [breaking-change] as it changes the float output slightly (and it also affects the casing of `inf` and `nan`). I hope this is not a big deal though :)

Fixes #7030, #18038 and #24556. Also related to #6220 and #20870.

## Known Issues

- [x] I've yet to finish `make check-stage1`. It does pass main test suites including `run-pass` but there might be some unknown edges on the doctests.
- [ ] Figure out how this PR affects rustc.
- [ ] Determine which internal routine is mapped to the formatting specifier. Depending on the decision, some internal routine can be safely removed (for instance, currently `to_shortest_str` is unused).

9 years agotest: fixed some tests affected by banker's rounding.
Kang Seonghoon [Sat, 9 May 2015 13:52:47 +0000 (22:52 +0900)]
test: fixed some tests affected by banker's rounding.

9 years agoAuto merge of #25243 - Manishearth:rollup, r=Manishearth
bors [Sat, 9 May 2015 13:10:43 +0000 (13:10 +0000)]
Auto merge of #25243 - Manishearth:rollup, r=Manishearth

- Successful merges: #25216, #25227
- Failed merges:

9 years agoRollup merge of #25227 - jooert:bitvec-doc-fix, r=alexcrichton
Manish Goregaokar [Sat, 9 May 2015 13:10:19 +0000 (18:40 +0530)]
Rollup merge of #25227 - jooert:bitvec-doc-fix, r=alexcrichton

I forgot this in #24890.

9 years agoRollup merge of #25216 - barosl:no-more-task, r=Manishearth
Manish Goregaokar [Sat, 9 May 2015 13:10:19 +0000 (18:40 +0530)]
Rollup merge of #25216 - barosl:no-more-task, r=Manishearth

I've found that there are still huge amounts of occurrences of `task`s in the documentation. This PR tries to eliminate all of them in favor of `thread`.

9 years agoAuto merge of #25212 - pnkfelix:dropck-box-trait, r=nikomatsakis
bors [Sat, 9 May 2015 09:20:43 +0000 (09:20 +0000)]
Auto merge of #25212 - pnkfelix:dropck-box-trait, r=nikomatsakis

dropck: must assume `Box<Trait + 'a>` has a destructor of interest.

Fix #25199.

This detail was documented in [RFC 769]; the implementation was just missing.

[breaking-change]

The breakage here falls into both obvious and non-obvious cases.

The obvious case: if you were relying on the unsoundness this exposes (namely being able to reference dead storage from a destructor, by doing it via a boxed trait object bounded by the lifetime of the dead storage), then this change disallows that.

The non-obvious cases: The way dropck works, it causes lifetimes to be extended to longer extents than they covered before. I.e.  lifetimes that are attached as trait-bounds may become longer than they were previously.

* This includes lifetimes that are only *implicitly* attached as trait-bounds (due to [RFC 599]). So you may have code that was e.g. taking a parameter of type `&'a Box<Trait>` (which expands to `&'a Box<Trait+'a>`), that now may need to be assigned type `&'a Box<Trait+'static>` to ensure that `'a` is not inadvertantly inferred to a region that is actually too long.  (See commit ee06263 for an example of this.)

[RFC 769]: https://github.com/rust-lang/rfcs/blob/master/text/0769-sound-generic-drop.md#the-drop-check-rule

[RFC 599]: https://github.com/rust-lang/rfcs/blob/master/text/0599-default-object-bound.md

9 years agoAuto merge of #25214 - acgtyrant:patch-1, r=brson
bors [Sat, 9 May 2015 07:31:44 +0000 (07:31 +0000)]
Auto merge of #25214 - acgtyrant:patch-1, r=brson

make the definition of static methods explicit

9 years agoaddress fallout in libsyntaxtest.
Felix S. Klock II [Sat, 9 May 2015 06:46:58 +0000 (08:46 +0200)]
address fallout in libsyntaxtest.

9 years agoAuto merge of #25231 - carols10cents:lingering-quoted-crate-names, r=alexcrichton
bors [Sat, 9 May 2015 05:43:23 +0000 (05:43 +0000)]
Auto merge of #25231 - carols10cents:lingering-quoted-crate-names, r=alexcrichton

This syntax was removed in b24a3b8 but references remained in the
grammar, the reference, rustdoc generation, and some auxiliary test
files that don't seem to have been used since 812637e.

Thanks!! :heart_decoration:

9 years agoAuto merge of #25159 - inrustwetrust:wrapping_inline, r=alexcrichton
bors [Sat, 9 May 2015 03:55:27 +0000 (03:55 +0000)]
Auto merge of #25159 - inrustwetrust:wrapping_inline, r=alexcrichton

This was causing function calls to be emitted for bitwise complements, even with optimizations on.
Steps to reproduce:
```
$ cat wrapping.rs
fn main() {
    let a = std::num::Wrapping(std::env::args().len() as u32);
    let b = !a;
    println!("{}", b.0);
}
$ rustc -O wrapping.rs --emit=asm,link
$ grep Not wrapping.s
        callq   _ZN3num8wrapping23Wrapping$LT$u32$GT$.Not3not20hba4b266232e02b1dHkbE
```

9 years agoAuto merge of #24859 - richo:valgrind-tests, r=brson
bors [Sat, 9 May 2015 02:07:18 +0000 (02:07 +0000)]
Auto merge of #24859 - richo:valgrind-tests, r=brson

This stung me more than once in dev.

Bonus DRY'ing up of configure that I did on my way past.

9 years agoRemove references to deprecated `extern crate "foo" as bar` syntax
Carol Nichols [Sat, 9 May 2015 00:48:54 +0000 (20:48 -0400)]
Remove references to deprecated `extern crate "foo" as bar` syntax

This syntax was removed in b24a3b8 but references remained in the
grammar, the reference, rustdoc generation, and some auxiliary test
files that don't seem to have been used since 812637e.

9 years agoAuto merge of #25162 - seanmonstar:asref-bytes, r=alexcrichton
bors [Sat, 9 May 2015 00:18:49 +0000 (00:18 +0000)]
Auto merge of #25162 - seanmonstar:asref-bytes, r=alexcrichton

r? @aturon

9 years agocollections: change bounds of SliceConcatExt implementations to use Borrow instead...
Sean McArthur [Sat, 9 May 2015 00:13:35 +0000 (17:13 -0700)]
collections: change bounds of SliceConcatExt implementations to use Borrow instead of AsRef

9 years agocollections: impl AsRef<[u8]> for String
Sean McArthur [Wed, 6 May 2015 22:53:53 +0000 (15:53 -0700)]
collections: impl AsRef<[u8]> for String

9 years agocore: impl AsRef<[u8]> for str
Sean McArthur [Wed, 6 May 2015 22:53:34 +0000 (15:53 -0700)]
core: impl AsRef<[u8]> for str

9 years agoDocument panic behaviour of BitVec::split_off
Johannes Oertel [Fri, 8 May 2015 22:41:38 +0000 (00:41 +0200)]
Document panic behaviour of BitVec::split_off

9 years agoAuto merge of #25217 - alexcrichton:fix-distcheck, r=brson
bors [Fri, 8 May 2015 22:29:05 +0000 (22:29 +0000)]
Auto merge of #25217 - alexcrichton:fix-distcheck, r=brson

This fixes the `distcheck` target and nightly builds.

9 years agoAuto merge of #25218 - Manishearth:rollup, r=Manishearth
bors [Fri, 8 May 2015 20:39:08 +0000 (20:39 +0000)]
Auto merge of #25218 - Manishearth:rollup, r=Manishearth

- Successful merges: #24864, #25140, #25179, #25181, #25190, #25194, #25195, #25198, #25203, #25210, #25211, #25215
- Failed merges: #25200

9 years agoRollup merge of #25215 - acgtyrant:patch-2, r=alexcrichton
Manish Goregaokar [Fri, 8 May 2015 19:07:45 +0000 (00:37 +0530)]
Rollup merge of #25215 - acgtyrant:patch-2, r=alexcrichton

Fix wrong radius valve from 0.0 to 1.0 as above

9 years agoRollup merge of #25211 - huonw:libc, r=cmr
Manish Goregaokar [Fri, 8 May 2015 19:07:45 +0000 (00:37 +0530)]
Rollup merge of #25211 - huonw:libc, r=cmr

Many many many people ask in #rust about this libraries, having an
explanatory reason will probably help a lot.

9 years agoRollup merge of #25210 - rick68:patch-1, r=alexcrichton
Manish Goregaokar [Fri, 8 May 2015 19:07:44 +0000 (00:37 +0530)]
Rollup merge of #25210 - rick68:patch-1, r=alexcrichton

fixed a doc mistake in libcore/marker.mk

9 years agoRollup merge of #25203 - sharnik:fix-sort-authors, r=alexcrichton
Manish Goregaokar [Fri, 8 May 2015 19:07:44 +0000 (00:37 +0530)]
Rollup merge of #25203 - sharnik:fix-sort-authors, r=alexcrichton

Properly sorted, Ł goes between L and M.

9 years agoRollup merge of #25198 - carols10cents:update-configure-osx, r=alexcrichton
Manish Goregaokar [Fri, 8 May 2015 19:07:43 +0000 (00:37 +0530)]
Rollup merge of #25198 - carols10cents:update-configure-osx, r=alexcrichton

Tiny tiny nitpick that I just noticed after getting a new laptop ( :beer: + :computer: = :angel: ) and thus needing to ./configure anew on Yosemite.

It's weird to see a message that says you're on 10.9 if you're on 10.10, in a oh-i-wonder-what-else-is-wrong sort of sense-- easy fix with a `>=` since `gcc --version` on 10.10 with the newest xcode still says it's clang.

:heart:

9 years agoRollup merge of #25195 - simonkern:master, r=steveklabnik
Manish Goregaokar [Fri, 8 May 2015 19:07:43 +0000 (00:37 +0530)]
Rollup merge of #25195 - simonkern:master, r=steveklabnik

I deleted one unneccessary 'the' and added the href for [bindings]

9 years agoRollup merge of #25194 - tshepang:assert-convention, r=steveklabnik
Manish Goregaokar [Fri, 8 May 2015 19:07:43 +0000 (00:37 +0530)]
Rollup merge of #25194 - tshepang:assert-convention, r=steveklabnik

… compared

9 years agoRollup merge of #25190 - nham:E0046_E0054, r=alexcrichton
Manish Goregaokar [Fri, 8 May 2015 19:07:43 +0000 (00:37 +0530)]
Rollup merge of #25190 - nham:E0046_E0054, r=alexcrichton

cc #24407

9 years agoRollup merge of #25181 - steveklabnik:fix_curlies, r=alexcrichton
Manish Goregaokar [Fri, 8 May 2015 19:07:43 +0000 (00:37 +0530)]
Rollup merge of #25181 - steveklabnik:fix_curlies, r=alexcrichton

9 years agoRollup merge of #25179 - bengesoff:patch-1, r=steveklabnik
Manish Goregaokar [Fri, 8 May 2015 19:07:42 +0000 (00:37 +0530)]
Rollup merge of #25179 - bengesoff:patch-1, r=steveklabnik

Following paragraph says "we've used `*` which..." but code says "rand=\"0.3.0\""

9 years agoRollup merge of #25140 - kevinmehall:mips, r=steveklabnik
Manish Goregaokar [Fri, 8 May 2015 19:07:42 +0000 (00:37 +0530)]
Rollup merge of #25140 - kevinmehall:mips, r=steveklabnik

Building with `--target=mipsel-unknown-linux-gnu` currently results in the following errors, fixed by this PR:

```
rustc: x86_64-unknown-linux-gnu/stage2/lib/rustlib/mipsel-unknown-linux-gnu/lib/libstd
/vol/rust/src/libstd/os/linux/raw.rs:76:21: 76:28 error: use of undeclared type name `c_ulong`
/vol/rust/src/libstd/os/linux/raw.rs:76         pub st_dev: c_ulong,
                                                            ^~~~~~~
/vol/rust/src/libstd/os/linux/raw.rs:83:22: 83:29 error: use of undeclared type name `c_ulong`
/vol/rust/src/libstd/os/linux/raw.rs:83         pub st_rdev: c_ulong,
                                                             ^~~~~~~
/vol/rust/src/libstd/sys/common/net2.rs:210:52: 210:70 error: unresolved name `libc::TCP_KEEPIDLE`
/vol/rust/src/libstd/sys/common/net2.rs:210         setsockopt(&self.inner, libc::IPPROTO_TCP, libc::TCP_KEEPIDLE,
```

9 years agoRollup merge of #24864 - astraw:patch-1, r=steveklabnik
Manish Goregaokar [Fri, 8 May 2015 19:07:42 +0000 (00:37 +0530)]
Rollup merge of #24864 - astraw:patch-1, r=steveklabnik

If you have 0 references (`&T`) to a resource, presumably, you could have a mutable reference (`&mut T`). So this only start to make sense at having 1 reference to a resource.

9 years agoFix the tests broken by replacing `task` with `thread`
Barosl Lee [Fri, 8 May 2015 17:14:51 +0000 (02:14 +0900)]
Fix the tests broken by replacing `task` with `thread`

9 years agoAuto merge of #25187 - alexcrichton:mem-forget-safe, r=brson
bors [Fri, 8 May 2015 18:21:51 +0000 (18:21 +0000)]
Auto merge of #25187 - alexcrichton:mem-forget-safe, r=brson

This commit is an implementation of [RFC 1066][rfc] where the conclusion was
that leaking a value is a safe operation in Rust code, so updating the signature
of this function follows suit.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1066-safe-mem-forget.md

Closes #25186

9 years agomk: Log that valgrind tests are disabled
Richo Healey [Fri, 8 May 2015 17:47:28 +0000 (10:47 -0700)]
mk: Log that valgrind tests are disabled

9 years agoPlease the `make tidy`
Barosl Lee [Fri, 8 May 2015 15:56:50 +0000 (00:56 +0900)]
Please the `make tidy`

9 years agoFix invalid references due to the automated string substitution
Barosl Lee [Fri, 8 May 2015 15:39:58 +0000 (00:39 +0900)]
Fix invalid references due to the automated string substitution

9 years agoSqueeze the last bits of `task`s in documentation in favor of `thread`
Barosl Lee [Fri, 8 May 2015 15:12:29 +0000 (00:12 +0900)]
Squeeze the last bits of `task`s in documentation in favor of `thread`

An automated script was run against the `.rs` and `.md` files,
subsituting every occurrence of `task` with `thread`. In the `.rs`
files, only the texts in the comment blocks were affected.

9 years agomk: Add a missing folder to the dist directory
Alex Crichton [Fri, 8 May 2015 16:45:16 +0000 (09:45 -0700)]
mk: Add a missing folder to the dist directory

This fixes the `distcheck` target and nightly builds.

9 years agoUpdate method-syntax.md
Isaac Ge [Fri, 8 May 2015 14:39:25 +0000 (22:39 +0800)]
Update method-syntax.md

Fix wrong radius valve from 0.0 to 1.0 as above

9 years agoUpdate method-syntax.md
Isaac Ge [Fri, 8 May 2015 14:30:00 +0000 (22:30 +0800)]
Update method-syntax.md

make the definition of static methods explicit

9 years agoFallout to compile-fail tests.
Felix S. Klock II [Fri, 8 May 2015 14:08:59 +0000 (16:08 +0200)]
Fallout to compile-fail tests.

This change is worrisome to me, both because:

1. I thought the rules in RFC 599 imply that the `Box<Trait>` without `'static`
   in the first case would expand to the second case, but their behaviors
   here differ.  And,

2. The explicit handling of `'static` should mean `dropck` has no application
   here and thus we should have seen no change to the expected error messages.
   Nonetheless, the error messages changed.

9 years agofallout to run-pass tests.
Felix S. Klock II [Fri, 8 May 2015 13:39:25 +0000 (15:39 +0200)]
fallout to run-pass tests.

9 years agoRegression tests for Issue 25199 (dropck and `Box<Trait + 'a>`).
Felix S. Klock II [Fri, 8 May 2015 13:22:25 +0000 (15:22 +0200)]
Regression tests for Issue 25199 (dropck and `Box<Trait + 'a>`).

9 years agoAdd a reason to the libc & rand instability.
Huon Wilson [Fri, 8 May 2015 13:19:06 +0000 (23:19 +1000)]
Add a reason to the libc & rand instability.

Many many many people ask in #rust about this libraries, having an
explanatory reason will probably help a lot.

9 years agodropck: must assume `Box<Trait + 'a>` has a destructor of interest.
Felix S. Klock II [Fri, 8 May 2015 13:06:16 +0000 (15:06 +0200)]
dropck: must assume `Box<Trait + 'a>` has a destructor of interest.

Implements this (previously overlooked) note from [RFC 769]:

> (Note: When encountering a D of the form `Box<Trait+'b>`, we
> conservatively assume that such a type has a Drop implementation
> parametric in 'b.)

Fix #25199.

[breaking-change]

The breakage here falls into both obvious and non-obvious cases.

The obvious case: if you were relying on the unsoundness this exposes
(namely being able to reference dead storage from a destructor, by
doing it via a boxed trait object bounded by the lifetime of the dead
storage), then this change disallows that.

The non-obvious cases: The way dropck works, it causes lifetimes to be
extended to longer extents than they covered before. I.e.  lifetimes
that are attached as trait-bounds may become longer than they were
previously.

* This includes lifetimes that are only *implicitly* attached as
  trait-bounds (due to [RFC 599]). So you may have code that was
  e.g. taking a parameter of type `&'a Box<Trait>` (which expands to
  `&'a Box<Trait+'a>`), that now may need to be assigned type `&'a
  Box<Trait+'static>` to ensure that `'a` is not inadvertantly
  inferred to a region that is actually too long.  (See earlier commit
  in this PR for an example of this.)

[RFC 769]: https://github.com/rust-lang/rfcs/blob/master/text/0769-sound-generic-drop.md#the-drop-check-rule

[RFC 599]: https://github.com/rust-lang/rfcs/blob/master/text/0599-default-object-bound.md

9 years agoFallout from fixing Issue 25199.
Felix S. Klock II [Fri, 8 May 2015 12:48:26 +0000 (14:48 +0200)]
Fallout from fixing Issue 25199.

There are two interesting kinds of breakage illustrated here:

1. `Box<Trait>` in many contexts is treated as `Box<Trait + 'static>`,
   due to [RFC 599]. However, in a type like `&'a Box<Trait>`, the
   `Box<Trait>` type will be expanded to `Box<Trait + 'a>`, again due
   to [RFC 599]. This, combined with the fix to Issue 25199, leads to
   a borrowck problem due the combination of this function signature
   (in src/libstd/net/parser.rs):

   ```rust
   fn read_or<T>(&mut self, parsers: &mut [Box<FnMut(&mut Parser) -> Option<T>>]) -> Option<T>;
   ```

   with this call site (again in src/libstd/net/parser.rs):

   ```rust
   fn read_ip_addr(&mut self) -> Option<IpAddr> {
       let ipv4_addr = |p: &mut Parser| p.read_ipv4_addr().map(|v4| IpAddr::V4(v4));
       let ipv6_addr = |p: &mut Parser| p.read_ipv6_addr().map(|v6| IpAddr::V6(v6));
       self.read_or(&mut [Box::new(ipv4_addr), Box::new(ipv6_addr)])
   }
   ```

   yielding borrowck errors like:

   ```
   parser.rs:265:27: 265:69 error: borrowed value does not live long enough
   parser.rs:265         self.read_or(&mut [Box::new(ipv4_addr), Box::new(ipv6_addr)])
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ```

   (full log at: https://gist.github.com/pnkfelix/e2e80f1a71580f5d3103 )

   The issue here is perhaps subtle: the `parsers` argument is
   inferred to be taking a slice of boxed objects with the implicit
   lifetime bound attached to the `self` parameter to `read_or`.

   Meanwhile, the fix to Issue 25199 (added in a forth-coming commit)
   is forcing us to assume that each boxed object may have a
   destructor that could refer to state of that lifetime, and
   *therefore* that inferred lifetime is required to outlive the boxed
   object itself.

   In this case, the relevant boxed object here is not going to make
   any such references; I believe it is just an artifact of how the
   expression was built that it is not assigned type:

     `Box<FnMut(&mut Parser) -> Option<T> + 'static>`.

   (i.e., mucking with the expression is probably one way to fix this
   problem).

   But the other way to fix it, adopted here, is to change the
   `read_or` method type to force make the (presumably-intended)
   `'static` bound explicit on the boxed `FnMut` object.

   (Note: this is still just the *first* example of breakage.)

2. In `macro_rules.rs`, the `TTMacroExpander` trait defines a method
   with signature:

   ```rust
   fn expand<'cx>(&self, cx: &'cx mut ExtCtxt, ...) -> Box<MacResult+'cx>;
   ```

   taking a `&'cx mut ExtCtxt` as an argument and returning a
   `Box<MacResult'cx>`.

   The fix to Issue 25199 (added in aforementioned forth-coming
   commit) assumes that a value of type `Box<MacResult+'cx>` may, in
   its destructor, refer to a reference of lifetime `'cx`; thus the
   `'cx` lifetime is forced to outlive the returned value.

   Meanwhile, within `expand.rs`, the old code was doing:

   ```rust
   match expander.expand(fld.cx, ...).make_pat() { ... => immutable borrow of fld.cx ... }
   ```

   The problem is that the `'cx` lifetime, inferred for the
   `expander.expand` call, has now been extended so that it has to
   outlive the temporary R-value returned by `expanded.expand`.  But
   call is also reborrowing `fld.cx` *mutably*, which means that this
   reborrow must end before any immutable borrow of `fld.cx`; but
   there is one of those within the match body. (Note that the
   temporary R-values for the input expression to `match` all live as
   long as the whole `match` expression itself (see Issue #3511 and PR
   #11585).

   To address this, I moved the construction of the pat value into its
   own `let`-statement, so that the `Box<MacResult>` will only live
   for as long as the initializing expression for the `let`-statement,
   and thus allow the subsequent immutable borrow within the `match`.

[RFC 599]: https://github.com/rust-lang/rfcs/blob/master/text/0599-default-object-bound.md

9 years agofixed a mistake
Wei-Ming Yang [Fri, 8 May 2015 12:44:11 +0000 (20:44 +0800)]
fixed a mistake

9 years agoFix sort in AUTHORS.txt
Wojciech Ogrodowczyk [Fri, 8 May 2015 05:38:18 +0000 (07:38 +0200)]
Fix sort in AUTHORS.txt

Properly sorted, Ł goes between L and M.

9 years agofix logic when describing kinds of borrows
Andrew Straw [Mon, 27 Apr 2015 11:18:26 +0000 (07:18 -0400)]
fix logic when describing kinds of borrows

If you have 0 references (`&T`) to a resource, presumably, you could
have a mutable reference (`&mut T`). So this only start to make sense
at having 1 reference to a resource.

9 years agoAuto merge of #25136 - alexcrichton:drop-the-two, r=aturon
bors [Fri, 8 May 2015 01:32:59 +0000 (01:32 +0000)]
Auto merge of #25136 - alexcrichton:drop-the-two, r=aturon

* Remove the 2-suffix from some modules
* Remove some unused files
* Remove double-boxing for `ReentrantMutex`

9 years agostd: Mark `mem::forget` as a safe function
Alex Crichton [Thu, 7 May 2015 17:49:39 +0000 (10:49 -0700)]
std: Mark `mem::forget` as a safe function

This commit is an implementation of [RFC 1066][rfc] where the conclusion was
that leaking a value is a safe operation in Rust code, so updating the signature
of this function follows suit.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1066-safe-mem-forget.md

Closes #25186

9 years agofixed href for structs
Simon Kern [Thu, 7 May 2015 23:46:26 +0000 (01:46 +0200)]
fixed href for structs

9 years agov2 gets a copy of the pointer, not a copy of the data
Simon Kern [Thu, 7 May 2015 23:43:18 +0000 (01:43 +0200)]
v2 gets a copy of the pointer, not a copy of the data

9 years agoAuto merge of #25123 - arielb1:self-inhibiting-error, r=nikomatsakis
bors [Thu, 7 May 2015 23:40:55 +0000 (23:40 +0000)]
Auto merge of #25123 - arielb1:self-inhibiting-error, r=nikomatsakis

Fix #25076.

r? @nikomatsakis

9 years agoExpand OS X versions referenced in configure message
Carol Nichols [Thu, 7 May 2015 23:11:18 +0000 (19:11 -0400)]
Expand OS X versions referenced in configure message

10.10 is out, so it's weird to see a message that says you're on 10.9.
Change the message to be >=10.9.

9 years agodeleted unnecessary `the`
Simon Kern [Thu, 7 May 2015 22:59:45 +0000 (00:59 +0200)]
deleted unnecessary `the`

9 years agotwo minor fixes
Simon Kern [Thu, 7 May 2015 22:42:10 +0000 (00:42 +0200)]
two minor fixes

9 years agodoc: the prevailing convention is to use assert_eq! when 2 values are compared
Tshepang Lekhonkhobe [Thu, 7 May 2015 22:14:00 +0000 (00:14 +0200)]
doc: the prevailing convention is to use assert_eq! when 2 values are compared

9 years agoAuto merge of #25157 - alexcrichton:remove-vec-add, r=aturon
bors [Thu, 7 May 2015 21:45:11 +0000 (21:45 +0000)]
Auto merge of #25157 - alexcrichton:remove-vec-add, r=aturon

Ideally this trait implementation would be unstable, requiring crates to opt-in
if they would like the functionality, but that's not currently how stability
works so the implementation needs to be removed entirely.

This may come back at a future date, but for now the conservative option is to
remove it.

[breaking-change]

9 years agoAdd long diagnostic for E0054
Nick Hamann [Thu, 7 May 2015 19:34:54 +0000 (14:34 -0500)]
Add long diagnostic for E0054

9 years agoAdd long diagnostic for E0046
Nick Hamann [Thu, 7 May 2015 18:08:59 +0000 (13:08 -0500)]
Add long diagnostic for E0046

9 years agoAuto merge of #24973 - roryokane:fix-minus-doc-buttons, r=alexcrichton
bors [Thu, 7 May 2015 17:19:33 +0000 (17:19 +0000)]
Auto merge of #24973 - roryokane:fix-minus-doc-buttons, r=alexcrichton

My change in #24797 had a bug, described in that issue’s comments, and first discovered in issue #24918. This fixes it.

I tested this new `main.js` by changing the `main.js` content of [a rendered docs page](https://doc.rust-lang.org/std/option/) to this new content. The ‘[−]’ button worked again.

I am also including another related fix, because it would require manual merging if I made a separate pull request for it. The page-global ‘[−]’ button currently adds `#` to the end of the URL whenever it is clicked. I am changing its `href` from `#` to `javascript:void(0)` (the same as the `href` for section-specific ‘[−]’ links) to fix that.

9 years agostd: Remove a double-box in ReentrantMutex
Alex Crichton [Tue, 5 May 2015 23:44:28 +0000 (16:44 -0700)]
std: Remove a double-box in ReentrantMutex

Perform unsafe initialization up front and then only afterward the mutex is in
place do we initialize it.

9 years agostd: Remove unused helper_thread.rs file
Alex Crichton [Tue, 5 May 2015 23:39:46 +0000 (16:39 -0700)]
std: Remove unused helper_thread.rs file

This module has been removed for quite some time!

9 years agostd: Rename sys::foo2 modules to sys::foo
Alex Crichton [Tue, 5 May 2015 23:35:15 +0000 (16:35 -0700)]
std: Rename sys::foo2 modules to sys::foo

Now that `std::old_io` has been removed for quite some time the naming real
estate here has opened up to allow these modules to move back to their proper
names.

9 years agoAuto merge of #25013 - pnkfelix:span_to_lines-oflo, r=huonw
bors [Thu, 7 May 2015 15:25:09 +0000 (15:25 +0000)]
Auto merge of #25013 - pnkfelix:span_to_lines-oflo, r=huonw

Guard against overflow in `codemap::span_to_lines`.

(Revised/expanded version of PR #24976)

Make `span_to_lines` to return a `Result`.

In `diagnostic`, catch `Err` from `span_to_lines` and print `"(unprintable span)"` instead.

----

There a number of recent issues that report the bug here.  See e.g. #24761 and #24954.

This change *might* fix them. However, that is *not* its main goal. The main goals are:

 1. Make it possible for callers to recover from an error here, and

 2. Insert a more conservative check, in that we are also checking that the files match up.

----

As a drive-by, fix #24997 , which was causing my attempts to `make check-stage1` on an `--enable-debug` build to fail.

9 years agoUndid changes involving misunderstanding of 0.3.x
Ben Gesoff [Thu, 7 May 2015 14:36:47 +0000 (15:36 +0100)]
Undid changes involving misunderstanding of 0.3.x

Didn't realise 0.3.0 referred to all 0.3.x versions! Fixed my mistakes. Should have just updated the Cargo.toml now.

9 years agoFix incorrect curly quotes
Steve Klabnik [Thu, 7 May 2015 14:26:00 +0000 (10:26 -0400)]
Fix incorrect curly quotes

9 years agoRefactor to keep rand version 0.3.0
Ben Gesoff [Thu, 7 May 2015 13:48:44 +0000 (14:48 +0100)]
Refactor to keep rand version 0.3.0

changed paragraphs with discussion of Cargo.lock file to agree with rand version 0.3.0 in the Cargo.tom file.

9 years agoAuto merge of #25161 - jooert:moretests, r=alexcrichton
bors [Thu, 7 May 2015 13:33:33 +0000 (13:33 +0000)]
Auto merge of #25161 - jooert:moretests, r=alexcrichton

The last one (at least for the moment :smiley:).

r? @alexcrichton

9 years agoChange rand version to '*'
Ben Gesoff [Thu, 7 May 2015 13:23:05 +0000 (14:23 +0100)]
Change rand version to '*'

Following paragraph says "we've used `*` which..." but code says "rand=\"0.3.0\""

9 years agofix test
Ariel Ben-Yehuda [Thu, 7 May 2015 13:19:43 +0000 (16:19 +0300)]
fix test

9 years agoAuto merge of #25175 - steveklabnik:rollup, r=steveklabnik
bors [Thu, 7 May 2015 10:21:19 +0000 (10:21 +0000)]
Auto merge of #25175 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #24576, #24966, #25052, #25131, #25137, #25138, #25139, #25141, #25142, #25144, #25146, #25148, #25154, #25156, #25160, #25173
- Failed merges:

9 years agoRollup merge of #25173 - andreastt:guessing_game_syntax_fix, r=steveklabnik
Steve Klabnik [Thu, 7 May 2015 10:21:05 +0000 (12:21 +0200)]
Rollup merge of #25173 - andreastt:guessing_game_syntax_fix, r=steveklabnik

9 years agoRollup merge of #25160 - michaelwu:remove-schedule_free_slice, r=cmr
Steve Klabnik [Thu, 7 May 2015 10:21:05 +0000 (12:21 +0200)]
Rollup merge of #25160 - michaelwu:remove-schedule_free_slice, r=cmr

Nothing uses it anymore.

9 years agoRollup merge of #25156 - rydotyosh:patch-4, r=alexcrichton
Steve Klabnik [Thu, 7 May 2015 10:21:04 +0000 (12:21 +0200)]
Rollup merge of #25156 - rydotyosh:patch-4, r=alexcrichton

Remove printing of secret number at final source.

9 years agoRollup merge of #25154 - rydotyosh:patch-3, r=steveklabnik
Steve Klabnik [Thu, 7 May 2015 10:21:04 +0000 (12:21 +0200)]
Rollup merge of #25154 - rydotyosh:patch-3, r=steveklabnik

Edit version of #25150.
This commit depends on #25148.