Commit Graph

42064 Commits

Author SHA1 Message Date
Ulrik Sverdrup
ee48e6d192 collections: Implement String::drain(range) according to RFC 574
`.drain(range)` is unstable and under feature(collections_drain).

This adds a safe way to remove any range of a String as efficiently as
possible.

As noted in the code, this drain iterator has none of the memory safety
issues of the vector version.

RFC tracking issue is #23055
2015-05-01 19:51:31 +02:00
Alex Crichton
b1976f1f6e std: Remove index notation on slice iterators
These implementations were intended to be unstable, but currently the stability
attributes cannot handle a stable trait with an unstable `impl` block. This
commit also audits the rest of the standard library for explicitly-`#[unstable]`
impl blocks. No others were removed but some annotations were changed to
`#[stable]` as they're defacto stable anyway.

One particularly interesting `impl` marked `#[stable]` as part of this commit
is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly
clones all elements of the vector provided.

Closes #24791
2015-05-01 10:40:46 -07:00
bors
613109db1b Auto merge of #24720 - critiqjo:stepby-sizehint, r=alexcrichton
`Iterator::size_hint` can be easily implemented for `StepBy`.
#23708
2015-05-01 16:42:19 +00:00
bors
1320c293c1 Auto merge of #25025 - Manishearth:rollup, r=Manishearth
- Successful merges: #24979, #24980, #24981, #24982, #24983, #24987, #24988, #24991, #24992, #24994, #24998, #25002, #25010, #25014, #25020, #25021
- Failed merges:
2015-05-01 14:50:51 +00:00
Manish Goregaokar
616b94b66c Rollup merge of #25021 - frewsxcv:an-utf, r=steveklabnik
Even spelled out, one would say 'a Universal Character Set'
2015-05-01 20:20:21 +05:30
Manish Goregaokar
ac7a75ec97 Rollup merge of #25020 - brson:current_dir, r=luqmana 2015-05-01 20:20:21 +05:30
Manish Goregaokar
c834fe474c Rollup merge of #25014 - frewsxcv:patch-20, r=alexcrichton
The variable doesn't need to be mutable.
2015-05-01 20:20:21 +05:30
Manish Goregaokar
0e9eb6022e Rollup merge of #25010 - huonw:inline-int-extremes, r=alexcrichton
These compile down to `mov $CONSTANT, register; ret`, but the lack of
`#[inline]` meant they have a full `call ...` when used from external
crates.
2015-05-01 20:20:20 +05:30
Manish Goregaokar
216fdafd71 Rollup merge of #25002 - steveklabnik:gh24767, r=alexcrichton
Fixes #24767
2015-05-01 20:20:20 +05:30
Manish Goregaokar
4aab003b60 Rollup merge of #24998 - steveklabnik:fix_links, r=alexcrichton
r? @alexcrichton
2015-05-01 20:20:20 +05:30
Manish Goregaokar
0855b7c8b5 Rollup merge of #24994 - steveklabnik:gh24977, r=alexcrichton
Fixes #24977
2015-05-01 20:20:20 +05:30
Manish Goregaokar
d3b7c5258f Rollup merge of #24992 - steveklabnik:gh24730, r=alexcrichton
Fixes #24730

r? @alexcrichton
2015-05-01 20:20:20 +05:30
Manish Goregaokar
4fda7e8b38 Rollup merge of #24991 - steveklabnik:gh24852, r=alexcrichton
First, a link was broken.

Second, the wording was a bit unclear, so I fixed it up.

Fixes #24852
2015-05-01 20:20:19 +05:30
Manish Goregaokar
84a23be537 Rollup merge of #24988 - semarie:unused-pid_t, r=alexcrichton
- unbreak the build under openbsd
- while here, apply same modification to dragonfly, freebsd, ios (pid_t
  imported, but not used in raw.rs)

r? @alexcrichton
cc @wg @mneumann @vhbit
2015-05-01 20:20:19 +05:30
Manish Goregaokar
0210381714 Rollup merge of #24983 - vhbit:ios-raw, r=sanxiyn 2015-05-01 20:20:19 +05:30
Manish Goregaokar
42fbcf3525 Rollup merge of #24982 - poga:fix-incorrect-doc-formatting, r=steveklabnik
Fix incorrect link tag formatting in `doc/trpl/nightly-rust.md`. Notice the last word of the paragraph.

Before:
![before](https://cloud.githubusercontent.com/assets/8631/7413645/10754b7e-ef80-11e4-9bb1-15e87ce9308f.png)

After:
![after](https://cloud.githubusercontent.com/assets/8631/7413647/13b96202-ef80-11e4-990b-6ecf72925e7d.png)
2015-05-01 20:20:19 +05:30
Manish Goregaokar
70020aa066 Rollup merge of #24981 - carols10cents:remove-more-priv, r=alexcrichton
Hi! While researching stuff for the reference and the grammar, I came across a few mentions of using the `priv` keyword that was removed in 0.11.0 (#13547, #8122, rust-lang/rfcs#26, [RFC 0026](https://github.com/rust-lang/rfcs/blob/master/text/0026-remove-priv.md)).

One occurrence is a mention in the reference, a few are in comments, and a few are marking test functions. I left the test that makes sure you can't name an ident `priv` since it's still a reserved keyword. I did a little grepping around for `priv `, priv in backticks, `Private` etc and I think the remaining instances are fine, but if anyone knows anywhere in particular I should check for any other lingering mentions of `priv`, please let me know and I would be happy to! 🍂 🌊
2015-05-01 20:20:18 +05:30
Manish Goregaokar
4957ecce3e Add test for custom deriving plugins which rely on field attributes 2015-05-01 15:49:05 +05:30
critiqjo
2a8fc9b02c iterator: Add StepBy::size_hint method
Fixes `Step::steps_between` implementations by integer types
to correctly handle `by != 1`.
2015-05-01 14:10:08 +05:30
bors
aecf3d8b65 Auto merge of #24965 - arielb1:instant-reject, r=nikomatsakis
This uses a (per-trait) hash-table to separate impls from different TraitDefs, and makes coherence go so much quicker. I will post performance numbers tomorrow.

This is still WIP, as when there's an overlap error, impls can get printed in the wrong order, which causes a few issues. Should I pick the local impl with the smallest NodeId to print?

Could you take a look at this @nikomatsakis?
2015-05-01 08:33:08 +00:00
Simonas Kazlauskas
a23d7e10c7 Remove Managed
Leftovers from @-pointer times.
2015-05-01 10:58:42 +03:00
bors
5c710b593b Auto merge of #24793 - aturon:io-error-any, r=alexcrichton
This commit brings the `Error` trait in line with the [Error interoperation
RFC](https://github.com/rust-lang/rfcs/pull/201) by adding downcasting,
which has long been intended. This change means that for any `Error`
trait objects that are `'static`, you can downcast to concrete error
types.

To make this work, it is necessary for `Error` to inherit from
`Reflect` (which is currently used to mark concrete types as "permitted
for reflection, aka downcasting"). This is a breaking change: it means
that impls like

```rust
impl<T> Error for MyErrorType<T> { ... }
```

must change to

```rust
impl<T: Reflect> Error for MyErrorType<T> { ... }
```

This commit furthermore marks `Reflect` as stable, since we are already
essentially committed to it via `Any`. Note that in the future, if we
determine that the parametricity aspects of `Reflect` are not needed, we
can deprecate the trait and provide a blanket implementation for it
for *all* types (rather than by using OIBIT), which would allow all
mentions of `Reflect` to be dropped over time. So there is not a strong
commitment here.

[breaking-change]

r? @alexcrichton
2015-05-01 04:22:53 +00:00
Corey Farwell
554da45762 Replaces instanced of 'an UTF' with 'a UTF'
Even spelled out, one would say 'a Universal Character Set'
2015-04-30 21:38:01 -04:00
Manish Goregaokar
ede7a6dc8f Give access to field attributes in ext::deriving 2015-05-01 07:02:13 +05:30
Aaron Turon
a5762625a1 Add downcasting to std::error::Error
This commit brings the `Error` trait in line with the [Error interoperation
RFC](https://github.com/rust-lang/rfcs/pull/201) by adding downcasting,
which has long been intended. This change means that for any `Error`
trait objects that are `'static`, you can downcast to concrete error
types.

To make this work, it is necessary for `Error` to inherit from
`Reflect` (which is currently used to mark concrete types as "permitted
for reflection, aka downcasting"). This is a breaking change: it means
that impls like

```rust
impl<T> Error for MyErrorType<T> { ... }
```

must change to something like

```rust
impl<T: Reflect> Error for MyErrorType<T> { ... }
```

except that `Reflect` is currently unstable (and should remain so for
the time being). For now, code can instead bound by `Any`:

```rust
impl<T: Any> Error for MyErrorType<T> { ... }
```

which *is* stable and has `Reflect` as a super trait. The downside is
that this imposes a `'static` constraint, but that only
constrains *when* `Error` is implemented -- it does not actually
constrain the types that can implement `Error`.

[breaking-change]
2015-04-30 18:20:22 -07:00
Brian Anderson
d69cf2940e doc: current_dir returns a PathBuf, not a Path 2015-04-30 18:14:41 -07:00
bors
c634ec2e88 Auto merge of #24989 - alexcrichton:rustdoc-associated-constant, r=brson
Associated constants were now showing up for traits and would panic if they were
found on an inherent impl. This commit unblocks the nighly builders.
2015-04-30 23:40:27 +00:00
Alex Crichton
5c8ca26ad7 std: Always check for EDEADLK in rwlocks on unix
Apparently implementations are allowed to return EDEADLK instead of blocking
forever, in which case this can lead to unsafety in the `RwLock` primitive
exposed by the standard library. A debug-build of the standard library would
have caught this error (due to the debug assert), but we don't ship debug
builds right now.

This commit adds explicit checks for the EDEADLK error code and triggers a panic
to ensure the call does not succeed.

Closes #25012
2015-04-30 16:37:41 -07:00
Alex Crichton
4288a08e9a std: Favor cfg! over #[cfg] in unix rwlocks 2015-04-30 16:37:26 -07:00
Corey Farwell
ded5781cb9 Remove unnecessary 'mut' qualifier on doc-comment var
The variable doesn't need to be mutable.
2015-04-30 19:20:59 -04:00
Huon Wilson
7ba5f166b4 Mark the {min,max}_value functions on integers #[inline].
These compile down to `mov $CONSTANT, register; ret`, but the lack of
`#[inline]` meant they have a full `call ...` when used from external
crates.
2015-05-01 09:15:10 +10:00
Alex Crichton
db477eef72 std: Destabilize io::BufStream
As pointed out in #17136 the semantics of a `BufStream` aren't always what one
expects, and it looks like other [languages like C#][c-sharp] implement a
buffered stream with only one underlying buffer. For now this commit
destabilizes the primitive in the `std::io` module to give us some more time in
figuring out what to do with it.

[c-sharp]: https://msdn.microsoft.com/en-us/library/system.io.bufferedstream%28v=vs.110%29.aspx

[breaking-change]
2015-04-30 16:02:58 -07:00
Steve Klabnik
1e40360af9 Clarify intention wrt integers
Fixes #24767
2015-04-30 17:43:46 -04:00
bors
8a60e5667f Auto merge of #24978 - jooert:test-24446, r=alexcrichton
Closes #24446.
2015-04-30 20:51:03 +00:00
Steve Klabnik
585c7e2a0a Fix broken links in the book. 2015-04-30 16:00:44 -04:00
Steve Klabnik
8c38dfd537 Describe (a,) vs (a) in docs
Fixes #24730
2015-04-30 15:10:58 -04:00
bors
e962870420 Auto merge of #24975 - michaelsproul:enum-diagnostics, r=pnkfelix
Explanations for E0079, E0080, E0081, E0082, E0083 and E0084 as part of #24407.

All the errors concern the use of `#[repr(X)]` with enum types.

I also updated the short description for E0079 so that it takes sign into account.
2015-04-30 18:59:11 +00:00
Steve Klabnik
0b06fd70c8 Fix code sample, remove unstable code
Fixes #24977
2015-04-30 14:17:56 -04:00
Steve Klabnik
91e5481218 Fix two issues with TRPL: unsized types
First, a link was broken.

Second, the wording was a bit unclear, so I fixed it up.

Fixes #24852
2015-04-30 13:41:26 -04:00
Ariel Ben-Yehuda
30a5448d25 address review comments 2015-04-30 20:35:10 +03:00
bors
2568a4d8c5 Auto merge of #24924 - carols10cents:grammar-improvements, r=pnkfelix
I'm interested in helping out with #16676 but more in the grammar than the reference-- here's my first chunk, more to come!! 🎉 

I did pull a bit *out* of the reference, though, that was more relevant to the grammar but wasn't moved over as part of #24729.

I'm looking at, e.g. https://github.com/rust-lang/rust/blob/master/src/libsyntax/ast.rs, as the source of truth, please let me know if I should be checking against something else instead/in addition.

r? @steveklabnik
2015-04-30 17:07:14 +00:00
Alex Crichton
543b910f9b rustdoc: Fix rendering associated constants
Associated constants were now showing up for traits and would panic if they were
found on an inherent impl. This commit unblocks the nighly builders.
2015-04-30 09:37:13 -07:00
Sébastien Marie
27bcd2ebc7 remove denied unused import: pid_t in raw
- unbreak the build under openbsd
- while here, apply same modification to dragonfly, freebsd, ios (pid_t
  imported, but not used in raw.rs)
2015-04-30 17:26:53 +02:00
bors
2f613bfaeb Auto merge of #24902 - bombless:configure, r=pnkfelix
Closes #24840
2015-04-30 15:16:24 +00:00
Valerii Hiora
e50df770cc Fixed iOS build 2015-04-30 16:44:48 +03:00
York Xiang
98b7aaf3ef Mention --enable-optimize for --enable-debug 2015-04-30 21:39:52 +08:00
Poga Po
8a20b994ea remove newline within link tag 2015-04-30 21:28:49 +08:00
Felix S. Klock II
f40d9d9ea0 Regression tests for #24805.
The new functionality being tested here is that a drop impl bounded by
`UserDefined` does not cause dropck to inject its conservative
constraints on region inference.
2015-04-30 14:27:53 +02:00
Felix S. Klock II
db88e5a498 dropck: Rejectways trait bounds can indirectly access borrowed data.
Namely, we need to catch cases like `trait Child : Parent { }` where
`Parent` itself defines methods.
2015-04-30 14:27:53 +02:00
Felix S. Klock II
c76d66e923 Generalize dropck to ignore item-less traits.
Fix #24805

(see follow-on commit for test.)
2015-04-30 14:27:53 +02:00