Commit Graph

41317 Commits

Author SHA1 Message Date
Corey Farwell 5b041fedb4 Fix punctuation placement in doc-comment 2015-05-10 15:20:25 -04:00
inrustwetrust b84f018bb4 Clarify Once::call_once memory ordering guarantees in docs 2015-05-10 15:20:07 -04:00
Steve Klabnik 7a0af01bd4 remove stability note from std::net
This is served by stability markers.
2015-05-10 15:19:56 -04:00
Chris Morgan 720f5865c0 Fix #24872, XSS in docs not found page. 2015-05-10 15:19:47 -04:00
Tshepang Lekhonkhobe 40fe325037 doc: it is 'index', not 'i' 2015-05-10 15:19:32 -04:00
Richo Healey be613a1b03 thread: right now you can't actually set those printers 2015-05-10 15:19:13 -04:00
Brian Anderson 83b70c2a66 Merge pull request #25192 from alexcrichton/beta-backport
Backport of PRs to Beta
2015-05-07 16:51:22 -07:00
Alex Crichton 5136e90536 std: Remove addition on vectors for now
Ideally this trait implementation would be unstable, requiring crates to opt-in
if they would like the functionality, but that's not currently how stability
works so the implementation needs to be removed entirely.

This may come back at a future date, but for now the conservative option is to
remove it.

[breaking-change]

Conflicts:
	src/libcollections/vec.rs
2015-05-07 16:48:45 -07:00
John Gallagher b94f1589f4 Make RwLock::try_write try to obtain a write lock
Conflicts:
	src/libstd/sync/rwlock.rs
2015-05-07 14:39:17 -07:00
Alex Crichton e57059d4a0 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-05-07 14:39:17 -07:00
Alex Crichton a0f0b1034a 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

Conflicts:
	src/libcoretest/slice.rs
	src/librustc_driver/lib.rs
2015-05-07 14:39:17 -07:00
Sean McArthur 1fcfba1b42 test: update run-pass tests to not use mutable transmuting 2015-05-07 14:22:55 -07:00
Sean McArthur 8ed0997278 std: update select internals to not use mutable transmuting 2015-05-07 14:22:52 -07:00
Sean McArthur 103d02ff2f lint: deny transmuting from immutable to mutable, since it's undefined behavior
[breaking-change] Technically breaking, since code that had been using
these transmutes before will no longer compile. However, it was
undefined behavior, so really, it's a good thing. Fixing your code would
require some re-working to use an UnsafeCell instead.

Closes #13146
2015-05-07 14:22:50 -07:00
Brian Anderson f873dc5e22 Merge pull request #25121 from alexcrichton/cherry-pick-error
Cherry-pick std::error downcasting to beta
2015-05-05 11:03:08 -07:00
Aaron Turon 279eaabfda 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]

Conflicts:
	src/libcore/marker.rs
2015-05-05 10:57:01 -07:00
Alex Crichton 850151a757 Test fixes and rebase conflicts 2015-04-30 16:52:54 -07:00
Brian Anderson 903cdfe63e Bump prerelease version to .4 2015-04-30 15:20:08 -07:00
Brian Anderson 09e8ad55f0 Merge pull request #25004 from alexcrichton/beta-backport
Backport of PRs to Beta
2015-04-30 15:16:50 -07:00
Felix S. Klock II 76a9a6f6dd tests for lint that warns about mixing #[repr(C)] with Drop.
THis includes tests for struct and enum. (I suspect the closure case
is actually unreachable, but i see no harm in including it.)
2015-04-30 15:12:08 -07:00
Felix S. Klock II 344b79c155 lint for mixing #[repr(C)] with an impl of Drop. 2015-04-30 15:12:05 -07:00
Felix S. Klock II a4043756a5 Regression test for issue 24687.
use visible characters for the multibyte character filler.
2015-04-30 15:12:01 -07:00
Felix S. Klock II e45a9190d7 Fix zero-normalization of the pos of a MultiByteChar.
Fix #24687
2015-04-30 15:11:58 -07:00
Felix S. Klock II 403bb254b5 regression test for Issue 24895. 2015-04-30 15:11:54 -07:00
Felix S. Klock II dc81472679 Fix #24895.
[breaking-change]

What does this break?  Basically, code that implements `Drop` and is
using `T:Copy` for one of its type parameters and is relying on the
Drop Check rule not applying to it.

Here is an example:

```rust
#![allow(dead_code,unused_variables,unused_assignments)]
struct D<T:Copy>(T);
impl<T:Copy> Drop for D<T> { fn drop(&mut self) { } }

trait UserT { fn c(&self) { } }
impl<T:Copy> UserT for T { }
struct E<T:UserT>(T);
impl<T:UserT> Drop for E<T> { fn drop(&mut self) { } }

// This one will start breaking.
fn foo() { let (d2, d1); d1 = D(34); d2 = D(&d1); }

#[cfg(this_one_does_and_should_always_break)]
fn bar() { let (e2, e1); e1 = E(34); e2 = E(&e1); }

fn main() {
    foo();
}
```
2015-04-30 15:11:51 -07:00
Alex Crichton 37277a8d33 std: Fix inheriting standard handles on windows
Currently if a standard I/O handle is set to inherited on Windows, no action is
taken and the slot in the process information description is set to
`INVALID_HANDLE_VALUE`. Due to our passing of `STARTF_USESTDHANDLES`, however,
this means that the handle is actually set to nothing and if a child tries to
print it will generate an error.

This commit fixes this behavior by explicitly creating stdio handles to be
placed in these slots by duplicating the current process's I/O handles. This is
presumably what previously happened silently by using a file-descriptor-based
implementation instead of a `HANDLE`-centric implementation.

Along the way this cleans up a lot of code in `Process::spawn` for Windows by
ensuring destructors are always run, using more RAII, and limiting the scope of
`unsafe` wherever possible.
2015-04-30 15:11:47 -07:00
York Xiang da78718d20 Fix #20616
Conflicts:
	src/libsyntax/parse/parser.rs
2015-04-30 15:11:41 -07:00
Alex Crichton 4d4a5c896c Merge pull request #24943 from pnkfelix/beta-cherrypick
cherry-pick of PR #24553 to [beta]
2015-04-29 08:14:55 -07:00
Niko Matsakis fb847bf319 fix rustc_driver tests
This is cherry-pick of commit 55ffd2e from PR #24553
2015-04-29 16:28:04 +02:00
Niko Matsakis 571ed6951c Rather than storing the relations between free-regions in a global
table, introduce a `FreeRegionMap` data structure. regionck computes the
`FreeRegionMap` for each fn and stores the result into the tcx so that
borrowck can use it (this could perhaps be refactored to have borrowck
recompute the map, but it's a bid tedious to recompute due to the
interaction of closures and free fns). The main reason to do this is
because of #22779 -- using a global table was incorrect because when
validating impl method signatures, we want to use the free region
relationships from the *trait*, not the impl.

Fixes #22779.

----

This is cherry-pick of commit 6dfeda7 from PR #24553

Manually resolved conflicts in:
  src/librustc/lib.rs
  src/librustc/middle/infer/region_inference/mod.rs
(both conflicts were related to changes to file structure.)
2015-04-29 15:40:56 +02:00
Alex Crichton 5241bf9c34 Merge pull request #24817 from alexcrichton/beta-fix
Remove an unused import on windows
2015-04-25 11:04:49 -07:00
Alex Crichton 92d9289d90 Remove an unused import on windows 2015-04-25 11:02:56 -07:00
Steve Klabnik 7ab793eb97 Merge pull request #24814 from steveklabnik/doc_backport
Doc backport
2015-04-25 13:56:43 -04:00
Aram Visser b43138bc88 Fixed typo in hash_map::Entry documentation 2015-04-25 12:10:45 -04:00
Corey Farwell 01db977099 Indicate None is code-like in doc comments 2015-04-25 12:10:35 -04:00
Florian Hartwig f19a12d6a2 Fix broken links in the docs 2015-04-25 12:10:21 -04:00
Tshepang Lekhonkhobe 007060ba07 doc: improve/fix 'let' FAQ 2015-04-25 12:09:59 -04:00
Corey Farwell 9e2598348f Indicate keywords are code-like in Fuse::reset_fuse doc comment 2015-04-25 12:09:47 -04:00
Corey Farwell f796438373 Utilize if..let for get_mut doc-comment examples 2015-04-25 12:09:37 -04:00
Tamir Duberstein 88f1b2dc3a Update Windows caveats
- https://github.com/rust-lang/rust/issues/1237 is closed
- `libgcc` is now statically linked:
  https://github.com/rust-lang/rust/pull/17471
2015-04-25 12:09:25 -04:00
Steve Klabnik 6a31baa701 Remove the 30 minute intro
Fixes #24569.
2015-04-25 12:09:14 -04:00
York Xiang 44c5aa534c Improve doc for Result::unwrap() 2015-04-25 12:08:49 -04:00
Corey Farwell 5b986198e3 Fix typos in code comments 2015-04-25 12:08:36 -04:00
Corey Farwell 6ab15dc099 Simplify alloc::arc::Arc example in doc-comment
As far as I can tell, this conversion to integer to floating point does not need to happen and is beside the point
2015-04-25 12:08:27 -04:00
Steve Klabnik abbd9dcf7d Make iterator struct docs more consistent.
Fixes #24008.
2015-04-25 12:08:15 -04:00
Steve Klabnik 75051c6d2d remove bad example from PartialEq docs
Fixes #24173
2015-04-25 12:08:02 -04:00
Steve Klabnik 051fb376bf Clean up Box documentation.
Without the `box` keyword, one of these two reasons is not correct, so
let's just eliminate this section and elaborate on the reason for the
legit use case inline.

Fixes #24511
2015-04-25 12:07:51 -04:00
Matt Brubeck b40356098a Update reference to old_io in fmt docs 2015-04-25 12:07:38 -04:00
Steve Klabnik 4ceda40d46 Whoops, please tidy 2015-04-25 12:07:25 -04:00
Steve Klabnik 31859708cb Add examples by @pnkfelix to fmt precision
Fixes #24656
2015-04-25 12:07:25 -04:00