Commit Graph

41978 Commits

Author SHA1 Message Date
Nick Hamann
dd85c42ee1 Unwrap address values in Debug implementations for TcpStream/TcpListener/UdpSocket.
This now omits address fields in Debug implementations when a proper address value
cannot be unwrapped.
2015-05-03 17:13:42 -05:00
Nick Hamann
3a4a1e5f38 Implement Debug for std::net::{UdpSocket,TcpStream,TcpListener,Shutdown}
Fixes #23134.
2015-05-03 14:02:59 -05:00
bors
84f8c257b4 Auto merge of #25054 - bguiz:patch-1, r=steveklabnik
- `0..2` iterates over `0,1`
- `0..3` iterates over `0,1,2`, which is what we want instead
2015-05-02 14:42:57 +00:00
bors
38cedaf430 Auto merge of #25045 - XuefengWu:1398_remove_ndebug, r=huonw
According to #1398 and pull https://github.com/rust-lang/cargo/pull/1444 , fix doc overridable using -C debug-assertions
2015-05-02 12:56:05 +00:00
Brendan Graetz
07ff8279be =BG= minor: ensure correct range bounds in concurreny examples in the rust book
- `0..2` iterates over `0,1`
- `0..3` iterates over `0,1,2`, which is what we want instead
2015-05-02 22:29:53 +10:00
bors
354d16bd72 Auto merge of #25027 - Manishearth:deriving_attr, r=huonw
Adds an `attrs` field to `FieldInfo` which lets one check the attributes on
a field whilst expanding.

This lets deriving plugins be more robust, for example providing the ability to
"ignore" a field for the purpose of deriving, or perhaps handle the field a
different way.


r? @huonw
2015-05-02 09:55:13 +00:00
Manish Goregaokar
5892b40859 Rename AstBuilder::expr_int -> AstBuilder::expr_isize 2015-05-02 13:57:58 +05:30
bors
82158c9d1c Auto merge of #25040 - mrsweaters:patch-1, r=alexcrichton
Correct 'danging' to 'dangling'.
2015-05-02 08:09:47 +00:00
bors
f0af2ec99c Auto merge of #24980 - jooert:test-22468, r=pnkfelix
Closes #22468.
2015-05-02 06:22:41 +00:00
bors
700b4c160b Auto merge of #25028 - bluss:drain-string, r=alexcrichton
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-02 04:35:33 +00:00
bors
b858b7f4ce Auto merge of #25015 - alexcrichton:rwlock-check-ret, r=aturon
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-05-02 02:48:53 +00:00
Xuefeng Wu
5d963d23c6 fix doc:#1398 stop passing --cfg ndebug and uses -C debug-assertions 2015-05-02 10:24:10 +08:00
bors
c42c1e7a67 Auto merge of #24792 - alexcrichton:issue-24748, r=alexcrichton
Ensures that the same error type is propagated throughout. Unnecessary leakage
of the internals is prevented through the usage of stability attributes.

Closes #24748
2015-05-02 01:03:43 +00:00
Jordan Humphreys
f2a19b39fb Correct typo in introduction
Correct 'danging' to 'dangling'.
2015-05-01 16:54:57 -07:00
Alex Crichton
12910418fb std: Don't use a wrapper for the float error type
Ensures that the same error type is propagated throughout. Unnecessary leakage
of the internals is prevented through the usage of stability attributes.

Closes #24748
2015-05-01 16:44:36 -07:00
bors
f6574c5b04 Auto merge of #25006 - alexcrichton:unstable-indexing, r=aturon
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

[breaking-change]
2015-05-01 22:54:09 +00:00
bors
f3345cb0a7 Auto merge of #24778 - nagisa:managed-removal, r=huonw
Leftovers from @-pointer times, I guess.
2015-05-01 19:17:45 +00:00
Ulrik Sverdrup
da03c9df33 syntax: Avoid reallocating or copying in CodeMap::new_filemap
Avoid creating a new String when there is no BOM to strip, and
otherwises use .drain(..3) to strip the BOM using the same allocation.
2015-05-01 19:51:31 +02:00
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
Steve Klabnik
1e40360af9 Clarify intention wrt integers
Fixes #24767
2015-04-30 17:43:46 -04:00