Commit Graph

40500 Commits

Author SHA1 Message Date
Alex Crichton
7d79a4facd rollup merge of #23753: aturon/revise-convert
This commit revises `path` and `os_str` to use blanket impls for `From`
on reference types. This both cuts down on the number of required impls,
and means that you can pass through e.g. `T: AsRef<OsStr>` to
`PathBuf::from` without an intermediate call to `as_ref`.

It also makes a FIXME note for later generalizing the blanket impls for
`AsRef` and `AsMut` to use `Deref`/`DerefMut`, once it is possible to do
so.
2015-03-27 10:07:49 -07:00
Alex Crichton
55c398d651 rollup merge of #23752: alexcrichton/remove-should-fail
This attribute has been deprecated in favor of #[should_panic]. This also
updates rustdoc to no longer accept the `should_fail` directive and instead
renames it to `should_panic`.
2015-03-27 10:07:48 -07:00
Alex Crichton
88c3a0f423 rollup merge of #23750: murarth/ipaddr-fromstr 2015-03-27 10:07:48 -07:00
Alex Crichton
5d8a5297da rollup merge of #23747: tshepang/misleading-info
The first sentence was not compatible with the second.
2015-03-27 10:07:47 -07:00
Alex Crichton
5f9fd2ea27 rollup merge of #23745: oneeman/trpl-looping
Was reading the 'Looping' section of the book and was puzzled why the last example uses `0u32..10` when the others don't.  Tried it out without and it seems to work, so I figured it should just be `0..10`.  If there is a reason it needs to be `0u32..10` it should be explained in the text (I'd offer to do it but I have no idea).

r? @steveklabnik
2015-03-27 10:07:47 -07:00
Alex Crichton
df49ea6a83 rollup merge of #23743: Adenilson/addInfoArcClone01
Adding more information about the behavior of Arc/Rc when you perform a clone() call.
2015-03-27 10:07:47 -07:00
Alex Crichton
d2fac629e4 rollup merge of #23740: alexcrichton/remove-deprecated-slicing-syntax
This syntax has been deprecated for quite some time, and there were only a few
remaining uses of it in the codebase anyway.
2015-03-27 10:07:45 -07:00
Alex Crichton
31fbfc3baf rollup merge of #23736: gmjosack/master
Found a few 404s that seemed like simple fixes:

In footer.inc, certain 404 pages were 404ing on the request to jquery.js and playpen.js. This is easily demonstrated by visiting http://doc.rust-lang.org/foo then http://doc.rust-lang.org/foo/bar. The latter 404s, looking for foo/jquery.js.

The Result docs use old_io Writer as an example. Fix the link to old_io Writer. There's probably an effort to update the example away from a deprecated api but this was a simple fix.

rustc/plugin was pointing at the old guide and it was a broken link anyways (plugin vs plugins). Point at the book instead.

The main page of the API docs referenced c_{str,vec}. Looks like these were deleted in 25d5a3a194. Point at ffi docs instead.
2015-03-27 10:07:45 -07:00
Alex Crichton
39fecde4dd rollup merge of #23725: tamird/test-with-ios
r? @alexcrichton this should allow `make check` to run when `./configure`d for iOS cross-compilation
2015-03-27 10:07:44 -07:00
Alex Crichton
4bd1552296 rollup merge of #23721: erickt/deprecate
This is technically a breaking change as it deprecates and unstables some previously stable apis that were missed in the last round of deprecations.

[breaking change]
2015-03-27 10:07:44 -07:00
Alex Crichton
8eb918e970 rollup merge of #23719: steveklabnik/unstable_book
Now that feature flags are only on nightly, it's good to split this stuff out.
2015-03-27 10:07:44 -07:00
Alex Crichton
e6166b7498 rollup merge of #23712: nikomatsakis/reflect-trait
This PR introduces a `Reflect` marker trait which is a supertrait of `Any`. The idea is that `Reflect` is defined for all concrete types, but is not defined for type parameters unless there is a `T:Reflect` bound. This is intended to preserve the parametricity property. This allows the `Any` interface to be stabilized without committing us to unbounded reflection that is not easily detectable by the caller.

The implementation of `Reflect` relies on an experimental variant of OIBIT. This variant behaves differently for objects, since it requires that all types exposed as part of the object's *interface* are `Reflect`, but isn't concerned about other types that may be closed over. In other words, you don't have to write `Foo+Reflect` in order for `Foo: Reflect` to hold (where `Foo` is a trait).

Given that `Any` is slated to stabilization and hence that we are committed to some form of reflection, the goal of this PR is to leave our options open with respect to parametricity. I see the options for full stabilization as follows (I think an RFC would be an appropriate way to confirm whichever of these three routes we take):

1. We make `Reflect` a lang-item.
2. We stabilize some version of the OIBIT variation I implemented as a general mechanism that may be appropriate for other use cases.
3. We give up on preserving parametricity here and just have `impl<T> Reflect for T` instead. In that case, `Reflect` is a harmless but not especially useful trait going forward.

cc @aturon
cc @alexcrichton
cc @glaebhoerl (this is more-or-less your proposal, as I understood it)
cc @reem (this is more-or-less what we discussed on IRC at some point)
cc @FlaPer87 (vaguely pertains to OIBIT)
2015-03-27 10:07:43 -07:00
Manish Goregaokar
db50084cd9 Rollup merge of #23740 - alexcrichton:remove-deprecated-slicing-syntax, r=aturon
This syntax has been deprecated for quite some time, and there were only a few
remaining uses of it in the codebase anyway.
2015-03-27 22:37:42 +05:30
Alex Crichton
adbb516067 rollup merge of #23690: wettowelreactor/patch-1 2015-03-27 10:07:42 -07:00
Alex Crichton
431296f434 rollup merge of #23676: gkoz/array_as_ref
r? @aturon
2015-03-27 10:07:42 -07:00
Alex Crichton
6968ccfd7a rollup merge of #23651: alexcrichton/unwind-try
This commit provides a safe, but unstable interface for the `try` functionality
of running a closure and determining whether it panicked or not.

There are two primary reasons that this function was previously marked `unsafe`:

1. A vanilla version of this function exposes the problem of exception safety by
   allowing a bare try/catch in the language. It is not clear whether this
   concern should be directly tied to `unsafe` in Rust at the API level. At this
   time, however, the bounds on `ffi::try` require the closure to be both
   `'static` and `Send` (mirroring those of `thread::spawn`). It may be possible
   to relax the bounds in the future, but for now it's the level of safety that
   we're willing to commit to.

2. Panicking while panicking will leak resources by not running destructors.
   Because panicking is still controlled by the standard library, safeguards
   remain in place to prevent this from happening.

The new API is now called `catch_panic` and is marked as `#[unstable]` for now.
2015-03-27 10:07:42 -07:00
Alex Crichton
b79fbe0dae rollup merge of #23625: fhahn/issue-23620-ice-unicode-bytestring
closes #23620

This PR patches the issue mentioned in #23620, but there is also an ICE for invalid escape sequences in byte literals. This is due to the fact that the `scan_byte` function returns ` token::intern("??") ` for invalid bytes, resulting in an ICE later on. Is there a reason for this behavior? Shouldn't `scan_byte` fail when it encounters an invalid byte?

And I noticed a small inconsistency in the documentation. According to the formal byte literal definition in http://doc.rust-lang.org/reference.html#byte-and-byte-string-literals , a byte string literal contains `string_body *`, but according to the text (and the behavior of the lexer) it should not accept unicode escape sequences. Hence it should be replaced by `byte_body *`. If this is valid, I can add this fix to this PR.
2015-03-27 10:07:41 -07:00
Alex Crichton
e42521aa58 rollup merge of #23535: pnkfelix/fsk-filling-drop
Replace zeroing-on-drop with filling-on-drop.

This is meant to set the stage for removing *all* zeroing and filling (on drop) in the future.

Note that the code is meant to be entirely abstract with respect to the particular values used for the drop flags: the final commit demonstrates how to go from zeroing-on-drop to filling-on-drop by changing the value of three constants (in two files).

See further discussion on the internals thread:
  http://internals.rust-lang.org/t/attention-hackers-filling-drop/1715/11

[breaking-change] especially for structs / enums using `#[unsafe_no_drop_flag]`.
2015-03-27 10:07:41 -07:00
Alex Crichton
0e5052c396 rollup merge of #23419: murarth/lookup-addr
Closes #22608
2015-03-27 10:07:40 -07:00
Manish Goregaokar
5b45ede68f Rollup merge of #23712 - nikomatsakis:reflect-trait, r=FlaPer87
This PR introduces a `Reflect` marker trait which is a supertrait of `Any`. The idea is that `Reflect` is defined for all concrete types, but is not defined for type parameters unless there is a `T:Reflect` bound. This is intended to preserve the parametricity property. This allows the `Any` interface to be stabilized without committing us to unbounded reflection that is not easily detectable by the caller.

The implementation of `Reflect` relies on an experimental variant of OIBIT. This variant behaves differently for objects, since it requires that all types exposed as part of the object's *interface* are `Reflect`, but isn't concerned about other types that may be closed over. In other words, you don't have to write `Foo+Reflect` in order for `Foo: Reflect` to hold (where `Foo` is a trait).

Given that `Any` is slated to stabilization and hence that we are committed to some form of reflection, the goal of this PR is to leave our options open with respect to parametricity. I see the options for full stabilization as follows (I think an RFC would be an appropriate way to confirm whichever of these three routes we take):

1. We make `Reflect` a lang-item.
2. We stabilize some version of the OIBIT variation I implemented as a general mechanism that may be appropriate for other use cases.
3. We give up on preserving parametricity here and just have `impl<T> Reflect for T` instead. In that case, `Reflect` is a harmless but not especially useful trait going forward.

cc @aturon
cc @alexcrichton
cc @glaebhoerl (this is more-or-less your proposal, as I understood it)
cc @reem (this is more-or-less what we discussed on IRC at some point)
cc @FlaPer87 (vaguely pertains to OIBIT)
2015-03-27 22:37:36 +05:30
Manish Goregaokar
e65c6e572a Rollup merge of #23625 - fhahn:issue-23620-ice-unicode-bytestring, r=alexcrichton
closes #23620

This PR patches the issue mentioned in #23620, but there is also an ICE for invalid escape sequences in byte literals. This is due to the fact that the `scan_byte` function returns ` token::intern(\"??\") ` for invalid bytes, resulting in an ICE later on. Is there a reason for this behavior? Shouldn't `scan_byte` fail when it encounters an invalid byte?

And I noticed a small inconsistency in the documentation. According to the formal byte literal definition in http://doc.rust-lang.org/reference.html#byte-and-byte-string-literals , a byte string literal contains `string_body *`, but according to the text (and the behavior of the lexer) it should not accept unicode escape sequences. Hence it should be replaced by `byte_body *`. If this is valid, I can add this fix to this PR.
2015-03-27 22:37:28 +05:30
Manish Goregaokar
d77a9510f6 Rollup merge of #23419 - murarth:lookup-addr, r=alexcrichton
Closes #22608
2015-03-27 22:37:20 +05:30
Manish Goregaokar
82b375b44d Rollup merge of #23738 - alexcrichton:snapshots, r=cmr 2015-03-27 22:37:12 +05:30
Alex Crichton
fa3840305c alloc: Don't run some Arc doc tests
Windows gets quite unhappy when a thread fails while the main thread is exiting,
frequently leading to process deadlock. This has been causing quite a few
deadlocks on the windows bots recently. The child threads are presumably failing
because the `println!` is failing due to the main thread being shut down.
2015-03-27 09:59:46 -07:00
Florian Hahn
afaa3b6a20 Prevent ICEs when parsing invalid escapes, closes #23620 2015-03-27 17:47:16 +01:00
bors
242ed0b7c0 Auto merge of #22930 - Gankro:entry_3, r=aturon
RFC pending, but this is the patch that does it.

Totally untested. Likely needs some removed imports. std::collections docs should also be updated to provide better examples.

Closes #23508
2015-03-27 12:55:23 +00:00
Alexis Beingessner
1b98f6da7a default => or_insert per RFC 2015-03-27 07:42:03 -04:00
Ruud van Asseldonk
975ebc194c num: Derive Debug for Wrapping
This allows `Wrapping<T>` to be used in `assert_eq!`, for example.
2015-03-27 10:16:13 +01:00
Nick Cameron
a67faf1b25 Change the trivial cast lints to allow by default 2015-03-27 18:41:18 +13:00
Alexis
93cdf1f278 update everything to use Entry defaults 2015-03-26 21:36:06 -04:00
Alexis
1c35953cf8 entry API v3: replace Entry::get with Entry::default and Entry::default_with 2015-03-26 21:36:06 -04:00
Niko Matsakis
dd8cf92389 Fix doc tests. 2015-03-26 21:12:52 -04:00
Aaron Turon
c9f600bcee Stabilize some stragglers in std::option
Marks as `#[stable}`:

* `ok_or`
* `ok_or_else`
* `iter_mut`
* `cloned`

Similarly to `IteratorExt::cloned`, the `cloned` method is pared down to
work only on `Option<&T>`. Thus, this is a:

[breaking-change]
2015-03-26 17:47:13 -07:00
Murarth
c0dd239753 Add std::net::lookup_addr for reverse DNS lookup
Closes #22608
2015-03-26 17:13:14 -07:00
Felix S. Klock II
b68ca84ef1 workaround pretty-print bugs to placate make check-pretty. 2015-03-27 01:07:27 +01:00
Alex Crichton
e71221f327 std: Stabilize BufRead::split
Now that `<[_]>::split` is an inherent method, it will trump `BufRead::split`
when `BufRead` is in scope, so there is no longer a conflict. As a result,
calling `slice.split()` will probably always give you precisely what you want!
2015-03-26 16:54:15 -07:00
Tshepang Lekhonkhobe
ce668a873e book: fix typo 2015-03-27 01:44:03 +02:00
Alex Crichton
4f419d9668 rustc: Remove support for -l foo:static
This syntax has been renamed to `-l static=foo` some time ago.
2015-03-26 16:42:22 -07:00
Tshepang Lekhonkhobe
4357621ca9 book: there is no guessing game anymore, so remove references to it 2015-03-27 01:35:50 +02:00
Brian Anderson
cbef22e242 Update rust-installer. Fixes --help and interop with NixOS 2015-03-26 16:09:46 -07:00
Alex Crichton
671d896294 rustc: Remove old #[phase] and #[plugin]
This commit removes the extra deprecation warnings and support for the old
`phase` and `plugin` attributes for loading plugins.
2015-03-26 15:43:42 -07:00
Niko Matsakis
710af0498d Refactor object-safety test to use def-ids only 2015-03-26 17:52:39 -04:00
Niko Matsakis
703308db4a Refactor how binders are handled in trait selection 2015-03-26 17:52:38 -04:00
Niko Matsakis
c59fe8bde2 Drive-by fix for incorrect variance rule that I noticed. 2015-03-26 17:52:38 -04:00
Niko Matsakis
9c9bb9ce1d Implement Reflect trait with a variant on the standard OIBIT
semantics that tests the *interface* of trait objects, rather
than what they close over.
2015-03-26 17:52:38 -04:00
Gary M. Josack
5123bf40a1 Update docs to fix various 404s
Found a few 404s that seemed like simple fixes:

The Result docs use old_io Writer as an example. Fix the link to old_io Writer. There's probably an effort to update the example away from a deprecated api but this was a simple fix.

rustc/plugin was pointing at the old guide and it was a broken link anyways (plugin vs plugins). Point at the book instead.

The main page of the API docs referenced c_{str,vec}. Looks like these were deleted in 25d5a3a194. Point at ffi docs instead.
2015-03-26 14:46:06 -07:00
Aaron Turon
e7525cf620 Revise use of conversion traits
This commit revises `path` and `os_str` to use blanket impls for `From`
on reference types. This both cuts down on the number of required impls,
and means that you can pass through e.g. `T: AsRef<OsStr>` to
`PathBuf::from` without an intermediate call to `as_ref`.

It also makes a FIXME note for later generalizing the blanket impls for
`AsRef` and `AsMut` to use `Deref`/`DerefMut`, once it is possible to do
so.
2015-03-26 13:54:48 -07:00
Alex Crichton
3752958e40 syntax: Remove support for #[should_fail]
This attribute has been deprecated in favor of #[should_panic]. This also
updates rustdoc to no longer accept the `should_fail` directive and instead
renames it to `should_panic`.
2015-03-26 13:53:52 -07:00
Tshepang Lekhonkhobe
07afd04d34 book: let grow() accept the growth parameter 2015-03-26 22:38:19 +02:00
Murarth
1c43e53c8f impl FromStr for IpAddr 2015-03-26 13:31:37 -07:00