Commit Graph

40327 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
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
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
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
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
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
Murarth
1c43e53c8f impl FromStr for IpAddr 2015-03-26 13:31:37 -07:00
Tshepang Lekhonkhobe
3e100ff038 book: make it one sentence 2015-03-26 22:10:59 +02:00
Or Neeman
dac552f255 doc: change 0u32..10 to 0..10 2015-03-26 13:24:20 -06:00
Adenilson Cavalcanti
7d3bf47323 Adding more information about the behavior of Arc/Rc
when you perform a clone() call.
2015-03-26 12:05:21 -07:00
bors
53a183f027 Auto merge of #23359 - erickt:quote, r=pnkfelix
This PR allows the quote macros to unquote trait items, impl items, where clauses, and paths.
2015-03-26 18:43:56 +00:00
Felix S. Klock II
e2cc8b1436 add feature flags required post rebase. 2015-03-26 19:31:53 +01:00
Alex Crichton
77de3ee6e5 syntax: Remove parsing of old slice 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-26 10:24:44 -07:00
bors
199bdcfeff Auto merge of #23680 - erickt:inline, r=cmr
before:

test bench_read_slice  ... bench:        68 ns/iter (+/- 56)
test bench_read_vec    ... bench:        78 ns/iter (+/- 21)
test bench_write_slice ... bench:       133 ns/iter (+/- 46)
test bench_write_vec   ... bench:       308 ns/iter (+/- 69)

after:

test bench_read_slice  ... bench:        32 ns/iter (+/- 10)
test bench_read_vec    ... bench:        32 ns/iter (+/- 8)
test bench_write_slice ... bench:        53 ns/iter (+/- 12)
test bench_write_vec   ... bench:       247 ns/iter (+/- 172)
2015-03-26 16:10:23 +00:00
Steve Klabnik
c153fc1da1 New section of the book: nightly rust
Now that feature flags are only on nightly, it's good to split this stuff out.
2015-03-26 11:42:45 -04:00
Erick Tryzelaar
c5b8763753 Deprecate as_mut_slice methods
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-26 07:29:06 -07:00
bors
557d4346a2 Auto merge of #21237 - erickt:derive-assoc-types, r=erickt
This PR adds support for associated types to the `#[derive(...)]` syntax extension. In order to do this, it switches over to using where predicates to apply the type constraints. So now this:

```rust
type Trait {
    type Type;
}

#[derive(Clone)]
struct Foo<A> where A: Trait {
    a: A,
    b: <A as Trait>::Type,
}
```

Gets expended into this impl:

```rust
impl<A: Clone> Clone for Foo<A> where
    A: Trait,
    <A as Trait>::Type: Clone,
{
    fn clone(&self) -> Foo<T> {
        Foo {
            a: self.a.clone(),
            b: self.b.clone(),
        }
    }
}
```
2015-03-26 13:38:41 +00:00
Felix S. Klock II
aab4bef939 Add tests exercising the dropflag checking functionality. 2015-03-26 14:08:55 +01:00
Felix S. Klock II
4053b00112 Use -Z force-dropflag-checks=on/off for emitting sanity-check.
(That is, added config and debugflag a la check-overflow but for drop
flag sanity-check.)

Remove now-unused import of NoDebugInfo from trans::glue.
2015-03-26 14:08:55 +01:00
Felix S. Klock II
601eca3b53 Added instability markers to POST_DROP_* consts, and related opt-in's.
(Reviewed rest of code; did not see other `pub` items that needed such
treatment.)

Driveby: fix typo in comment in ptr.rs.
2015-03-26 14:08:55 +01:00
Felix S. Klock II
5733726508 A better core::mem::dropped implementation suggested by huonw on the PR. 2015-03-26 14:08:55 +01:00
Felix S. Klock II
5bc35b1852 filling-drop: switch DTOR_NEEDED and DTOR_DONE to non-trivial values. 2015-03-26 14:08:55 +01:00
Felix S. Klock II
7c671e5177 Regression tests for issues uncovered only post the run-pass and compile-fail tests.
(I.e. the idea being, lets catch errors in these basic constructs
sometime *before* we start doing the doc tests.)
2015-03-26 14:08:54 +01:00