Commit Graph

36711 Commits

Author SHA1 Message Date
bors
b27ba527c5 Auto merge of #23831 - Manishearth:rollup, r=Manishearth
- Successful merges: #23811, #23814, #23817, #23821, #23829
- Failed merges:
2015-03-29 14:02:28 +00:00
Manish Goregaokar
9147463678 Rollup merge of #23829 - huachaohuang:master, r=Manishearth 2015-03-29 18:22:16 +05:30
Manish Goregaokar
963bf1db61 Rollup merge of #23821 - nicholasbishop:bishop-slice-iter-typo-fix, r=alexcrichton 2015-03-29 18:22:16 +05:30
Manish Goregaokar
5daab4a25b Rollup merge of #23814 - steveklabnik:gh23320, r=alexcrichton
Fixes #23320
2015-03-29 18:22:15 +05:30
Manish Goregaokar
ef94b8a9d3 Rollup merge of #23811 - alexcrichton:libc-stable, r=Manishearth
Right now the `std::isize::BYTES` typedef is `#[unstable]`, but liblibc is using
this, preventing it from compiling on stable Rust.
2015-03-29 18:22:15 +05:30
bors
ea03ad9616 Auto merge of #23809 - cmr:issue-21310, r=Manishearth
This isn't really possible to test in an automatic way, since the only traits
you can negative impl are `Send` and `Sync`, and the implementors page for
those only exists in libstd.

Closes #21310
2015-03-29 11:12:26 +00:00
Huachao Huang
58c7d6f3e1 Fix typo 2015-03-29 18:22:01 +08:00
bors
fa3d778626 Auto merge of #23787 - steveklabnik:gh23760, r=alexcrichton
This was originally used to set up the guessing game, but that no longer
exists. This version uses `old_io`, and updating it involves talking
about `&mut` and such, which we haven't covered yet. So, for now, let's
just remove it.

Fixes #23760
2015-03-29 08:14:30 +00:00
Steven Fackler
ccb4e8423e Fix massive performance issue in read_to_end
with_end_to_cap is enormously expensive now that it's initializing
memory since it involves 64k allocation + memset on every call. This is
most noticable when calling read_to_end on very small readers, where the
new version if **4 orders of magnitude** faster.

BufReader also depended on with_end_to_cap so I've rewritten it in its
original form.

As a bonus, converted the buffered IO struct Debug impls to use the
debug builders.

Fixes #23815
2015-03-28 22:32:08 -07:00
bors
227b46bded Auto merge of #23810 - sfackler:debug-collections, r=alexcrichton
The collections debug helpers no longer prefix output with the
collection name, in line with the current conventions for Debug
implementations. Implementations that want to preserve the current
behavior can simply add a `try!(write!(fmt, "TypeName "));` at the
beginning of the `fmt` method.

[breaking-change]
2015-03-29 05:21:29 +00:00
Steven Fackler
3c0c8fc43a Oops fix output examples 2015-03-28 21:59:23 -07:00
bors
27af78c6dd Auto merge of #23819 - pnkfelix:kill-unsafe-dtor, r=pnkfelix
Port of pcwalton removal of `#[unsafe_destructor]` check.

Earlier commits impose rules on lifetimes that make generic destructors safe; thus we no longer need the `#[unsafe_destructor]` attribute nor its associated check.

----

So remove the check for the unsafe_destructor attribute.

And remove outdated compile-fail tests from when lifetime-parameteric dtors were disallowed/unsafe.

In addition, when one uses the attribute without the associated feature, report that the attribute is deprecated.

However, I do not think this is a breaking-change, because the attribute and feature are still currently accepted by the compiler. (After the next snapshot that has this commit, we can remove the feature itself and the attribute as well.)

----

I consider this to:

Fix #22196

(technically there is still the post snapshot work of removing the last remnants of the feature and the attribute, but the ticket can still be closed in my opinion).
2015-03-29 02:33:27 +00:00
Nicholas Bishop
256e78a39c Fix typo in docstring for slice 2015-03-28 22:06:42 -04:00
Felix S. Klock II
64c48f390c Port of pcwalton removal of #[unsafe_destructor] check.
Earlier commits impose rules on lifetimes that make generic
destructors safe; thus we no longer need the `#[unsafe_destructor]`
attribute nor its associated check.

----

So remove the check for the unsafe_destructor attribute.

And remove outdated compile-fail tests from when lifetime-parameteric
dtors were disallowed/unsafe.

In addition, when one uses the attribute without the associated
feature, report that the attribute is deprecated.

However, I do not think this is a breaking-change, because the
attribute and feature are still currently accepted by the compiler.
(After the next snapshot that has this commit, we can remove the
feature itself and the attribute as well.)

----

I consider this to:

Fix #22196

(techincally there is still the post snapshot work of removing the
last remants of the feature and the attribute, but the ticket can
still be closed in my opinion).
2015-03-29 00:19:19 +01:00
Steven Fackler
842e6cf63e Fold in debug builder doc examples 2015-03-28 15:51:57 -07:00
bors
c89de2c56b Auto merge of #23300 - sfackler:rm-iterator-ext, r=alexcrichton
All methods are inlined into Iterator with `Self: Sized` bounds to make
sure Iterator is still object safe.

[breaking-change]

This is blocked on ICEs: https://gist.github.com/sfackler/5aff7c57cf8d896e2c6f
Seem to be similar to #23281.
2015-03-28 22:11:49 +00:00
Steven Fackler
d502f4221f Remove IteratorExt
All methods are inlined into Iterator with `Self: Sized` bounds to make
sure Iterator is still object safe.

[breaking-change]
2015-03-28 13:53:45 -07:00
Steve Klabnik
f6c234fb45 Document properties for Eq + Hash
Fixes #23320
2015-03-28 16:06:37 -04:00
Steve Klabnik
9fb54f87cc Remove standard io chapter from the book
This was originally used to set up the guessing game, but that no longer
exists. This version uses `old_io`, and updating it involves talking
about `&mut` and such, which we haven't covered yet. So, for now, let's
just remove it.

Fixes #23760
2015-03-28 14:29:29 -04:00
Steven Fackler
b82bcec7ce Fold collections debug impls
Also convert [T]'s Debug impl. The behavior of the alternate flag here's
changing.
2015-03-28 11:24:26 -07:00
Alex Crichton
bd66f57e46 libc: Don't use unstable apis
Right now the `std::isize::BYTES` typedef is `#[unstable]`, but liblibc is using
this, preventing it from compiling on stable Rust.
2015-03-28 10:49:45 -07:00
Steven Fackler
4037f2a368 Update debug helpers and add list builder
The collections debug helpers no longer prefix output with the
collection name, in line with the current conventions for Debug
implementations. Implementations that want to preserve the current
behavior can simply add a `try!(write!(fmt, "TypeName "));` at the
beginning of the `fmt` method.

[breaking-change]
2015-03-28 10:33:51 -07:00
Valerii Hiora
6b7c5b9f08 iOS: int/uint fallout 2015-03-28 17:18:03 +02:00
Vadim Petrochenkov
1accaa9f86 Fix some typos 2015-03-28 18:09:51 +03:00
Manish Goregaokar
95f4061c49 Rollup merge of #23804 - dnwade:patch-1, r=Manishearth
r? @steveklabnik
2015-03-28 18:12:06 +05:30
Manish Goregaokar
5eb4be4c56 Rollup merge of #23803 - richo:unused-braces, r=Manishearth
Pretty much what it says on the tin.
2015-03-28 18:12:06 +05:30
Manish Goregaokar
4aa17c80e6 Rollup merge of #23788 - steveklabnik:gh23748, r=alexcrichton
Fixes #23748
2015-03-28 18:12:04 +05:30
Manish Goregaokar
5299d36c52 Rollup merge of #23751 - tshepang:do-not-hardcode-the-growth, r=Manishearth
I found the arbitrary `10` surprising. A better method name, in such a case, would be `grow_by_10` :)
2015-03-28 18:12:04 +05:30
Manish Goregaokar
474062da5d Rollup merge of #23332 - jakub-:rustup-curl-silent-flag, r=brson
curl's progress meter would otherwise interfere with sudo's password prompt.

In addition, add the -f flag to make sure 4xx status codes are treated as errors.

r? @brson
2015-03-28 18:12:04 +05:30
Dan W.
aaf74d1c1b book: Fix typo
r? @steveklabnik
2015-03-28 03:31:51 -07:00
Richo Healey
cbce6bfbdb cleanup: Remove unused braces in use statements 2015-03-28 02:23:20 -07:00
bors
f8b6e28e75 Auto merge of #23799 - reem:error-no-send, r=aturon
The Send bound is an unnecessary restriction, and though provided as a convenience, can't be removed by downstream code.

The removal of this bound is a [breaking-change] since it removes an implicit Send bound on all `E: Error` and all `Error` trait objects.

To migrate, consider if your code actually requires the Send bound and, if so, add it explicitly.

Fixes #23774

r? @aturon
2015-03-28 09:09:50 +00:00
bors
9f9e2516b4 Auto merge of #23798 - alexcrichton:issue-23781, r=aturon
Previously a panic was generated for recursive prints due to a double-borrow of
a `RefCell`. This was solved by the second borrow's output being directed
towards the global stdout instead of the per-thread stdout (still experimental
functionality).

After this functionality was altered, however, recursive prints still deadlocked
due to the overridden `write_fmt` method which locked itself first and then
wrote all the data. This was fixed by removing the override of the `write_fmt`
method. This means that unlocked usage of `write!` on a `Stdout`/`Stderr` may be
slower due to acquiring more locks, but it's easy to make more performant with a
call to `.lock()`.

Closes #23781
2015-03-28 05:43:12 +00:00
Alex Crichton
e2fd2dffde std: Don't deadlock/panic on recursive prints
Previously a panic was generated for recursive prints due to a double-borrow of
a `RefCell`. This was solved by the second borrow's output being directed
towards the global stdout instead of the per-thread stdout (still experimental
functionality).

After this functionality was altered, however, recursive prints still deadlocked
due to the overridden `write_fmt` method which locked itself first and then
wrote all the data. This was fixed by removing the override of the `write_fmt`
method. This means that unlocked usage of `write!` on a `Stdout`/`Stderr` may be
slower due to acquiring more locks, but it's easy to make more performant with a
call to `.lock()`.

Closes #23781
2015-03-27 19:03:18 -07:00
bors
e58f05717d Auto merge of #23789 - steveklabnik:gh22716, r=alexcrichton
Fixes #22716
2015-03-28 01:55:50 +00:00
Jonathan Reem
3feeea59db Make std::error::Error not inherit from Send
The Send bound is an unnecessary restriction, and though provided as a
convenience, can't be removed by downstream code.

The removal of this bound is a [breaking-change] since it
removes an implicit Send bound on all `E: Error` and all
`Error` trait objects.

To migrate, consider if your code actually requires the Send
bound and, if so, add it explicitly.

Fixes #23774
2015-03-27 16:35:16 -07:00
Alex Crichton
d3a4f362cb rollup merge of #23786: alexcrichton/less-quotes
Conflicts:
	src/test/auxiliary/static-function-pointer-aux.rs
	src/test/auxiliary/trait_default_method_xc_aux.rs
	src/test/run-pass/issue-4545.rs
2015-03-27 16:10:25 -07:00
Alex Crichton
1c0e1a80e5 rollup merge of #23763: brson/installer 2015-03-27 16:09:54 -07:00
Alex Crichton
7e3fd148b3 Test fixes and rebase conflicts, round 3 2015-03-27 16:09:54 -07:00
Alex Crichton
990202cd0e rollup merge of #23794: brson/slicegate
Conflicts:
	src/test/run-pass/issue-13027.rs
2015-03-27 16:09:52 -07:00
Steve Klabnik
59d417a64a Note that zip and enumerate are similar
Fixes #22716
2015-03-27 18:32:46 -04:00
Steve Klabnik
e604382ad2 Explain why &self is common
Fixes #23748
2015-03-27 18:31:44 -04:00
Corey Richardson
8d6fb44c99 rustdoc: show negative impls properly in the implementors page
This isn't really possible to test in an automatic way, since the only traits
you can negative impl are `Send` and `Sync`, and the implementors page for
those only exists in libstd.

Closes #21310
2015-03-27 17:29:07 -04:00
Alex Crichton
d65fee28d3 Test fixes and rebase conflicts, round 2 2015-03-27 13:43:42 -07:00
Alex Crichton
1c78478c12 rollup merge of #23793: steveklabnik/gh21668
Fixes #21668
2015-03-27 13:04:38 -07:00
Alex Crichton
828c36932a rollup merge of #23197: aatxe/master
`std::dynamic_library` is currently using `std::old_io::Path` specifically. This change brings the API in alignment with `std::fs::File` by having it take `std::path::AsPath`. The Windows code should work, but I admittedly haven't tried it (I don't have a Windows machine readily available right now).

r? @alexcrichton
2015-03-27 13:04:27 -07:00
Brian Anderson
1639e51f6e Feature gate *all* slice patterns. #23121
Until some backwards-compatibility hazards are fixed in #23121,
these need to be unstable.

[breaking-change]
2015-03-27 12:50:49 -07:00
Alex Crichton
8ec3695a67 rollup merge of #23791: jviereck/fix-23713
Fixes #23713.
2015-03-27 12:44:10 -07:00
Alex Crichton
df50510937 rollup merge of #23665: steveklabnik/doc_std_ascii
Also tweaked a few things.
2015-03-27 12:44:02 -07:00
Alex Crichton
ac24a517bc rollup merge of #23486: nikomatsakis/issue-23485
When testing whether a default method predicates are satisfiable,
combine normalization with this check so that we also skip the
default method if normalization fails. Fixes #23485.

r? @nrc (I tried to address your nit from before as well)
2015-03-27 12:44:00 -07:00
Alex Crichton
3f1d57fcde rollup merge of #23285: steveklabnik/gh11794
Fixes #11794

I mostly removed superflous examples which use the standard library.

I have one more quesiton here though: threads. They're mostly a library thing, at this point, right?
2015-03-27 12:43:59 -07:00
Steve Klabnik
1a6188aa07 Update return value docs in atomics docs
Fixes #21668
2015-03-27 15:37:11 -04:00
bors
0c9de8140b Auto merge of #23419 - murarth:lookup-addr, r=alexcrichton
Closes #22608
2015-03-27 19:34:04 +00:00
Julian Viereck
63bbdc1590 Fix wording for Option<T>.unwrap. Fixes #23713 2015-03-27 20:20:21 +01:00
Alex Crichton
e77db16afb Fix fallout of removing quotes in crate names 2015-03-27 11:43:40 -07:00
Alex Crichton
01560112b8 Test fixes and rebase conflicts, round 1 2015-03-27 11:29:36 -07:00
Niko Matsakis
70042cff97 When testing whether a default method predicates are satisfiable,
combine normalization with this check so that we also skip the
default method if normalization fails. Fixes #23485.
2015-03-27 14:28:25 -04:00
Aaron Weiss
6acf385c96 Updated std::dynamic_lib to use std::path. 2015-03-27 14:15:48 -04:00
Alex Crichton
8bc3838e91 Merge 'richo/unquote-crates' into less-quotes
Conflicts:
	src/libsyntax/parse/parser.rs
2015-03-27 11:06:48 -07:00
Richo Healey
13e4270bf9 Unquote all crate names without underscores 2015-03-27 10:58:12 -07:00
Alex Crichton
b24a3b8201 rustc: Remove support for hyphens in crate names
This commit removes parser support for `extern crate "foo" as bar` as the
renamed crate is now required to be an identifier. Additionally this commit
enables hard errors on crate names that contain hyphens in them, they must now
solely contain alphanumeric characters or underscores.

If the crate name is inferred from the file name, however, the file name
`foo-bar.rs` will have the crate name inferred as `foo_bar`. If a binary is
being emitted it will have the name `foo-bar` and a library will have the name
`libfoo_bar.rlib`.

This commit is a breaking change for a number of reasons:

* Old syntax is being removed. This was previously only issuing warnings.
* The output for the compiler when input is received on stdin is now `rust_out`
  instead of `rust-out`.
* The crate name for a crate in the file `foo-bar.rs` is now `foo_bar` which can
  affect infrastructure such as logging.

[breaking-change]
2015-03-27 10:19:59 -07:00
Alex Crichton
e361b25c5e rollup merge of #23749: alexcrichton/remove-old-impl-check
Conflicts:
	src/libsyntax/feature_gate.rs
2015-03-27 10:10:38 -07:00
Alex Crichton
28a6b16130 rollup merge of #23741: alexcrichton/remove-int-uint
Conflicts:
	src/librustc/middle/ty.rs
	src/librustc_trans/trans/adt.rs
	src/librustc_typeck/check/mod.rs
	src/libserialize/json.rs
	src/test/run-pass/spawn-fn.rs
2015-03-27 10:10:05 -07:00
Alex Crichton
956c2eb257 rollup merge of #23738: alexcrichton/snapshots
Conflicts:
	src/libcollections/vec.rs
2015-03-27 10:08:40 -07:00
Alex Crichton
169231dc83 rollup merge of #23780: ruud-v-a/wrapping
This allows `Wrapping<T>` to be used in `assert_eq!`, for example.

One of the tests (compile-fail/xc-private-method.rs) fails, but I can hardly imagine it is related to this change. I would also like to add a tests to ensure that `assert_eq!` compiles and keeps working in the future for `Wrapped<T>` values, but there appear to be no tests in libcore. What would be a good place to add such a test?
2015-03-27 10:07:54 -07:00
Alex Crichton
dc6bb5e8ef rollup merge of #23776: nrc/allow_trivial_cast
r? @alexcrichton
2015-03-27 10:07:54 -07:00
Alex Crichton
aff160bb03 rollup merge of #23775: alexcrichton/fix-flaky-test
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 10:07:53 -07:00
Alex Crichton
45f1324037 rollup merge of #23771: aturon/stab-straggle-1
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]

r? @alexcrichton
2015-03-27 10:07:52 -07:00
Alex Crichton
a491d21353 rollup merge of #23769: alexcrichton/stabilize-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-27 10:07:51 -07:00
Alex Crichton
73936932e7 rollup merge of #23767: tshepang/typo 2015-03-27 10:07:51 -07:00
Alex Crichton
fbbf02db1c rollup merge of #23765: alexcrichton/remove-colon-syntax
This syntax has been renamed to `-l static=foo` some time ago.
2015-03-27 10:07:50 -07:00
Alex Crichton
19ed61eabd rollup merge of #23764: tshepang/no-guessing-anymore 2015-03-27 10:07:50 -07:00
Alex Crichton
625199950c rollup merge of #23761: alexcrichton/remove-phase
This commit removes the extra deprecation warnings and support for the old
`phase` and `plugin` attributes for loading plugins.
2015-03-27 10:07:49 -07:00
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
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