Commit Graph

40254 Commits

Author SHA1 Message Date
Steve Klabnik
d52c36246a Clarify that slices don't just point to arrays
Fixes #23632
2015-03-23 13:59:04 -04:00
Steve Klabnik
a5e1cbe191 Beef up BufRead::consume documentation.
Fixes #23196
2015-03-23 13:42:39 -04:00
Brian Anderson
9ec9bc68fb Clarify behavior of Path::relative_from 2015-03-23 10:22:17 -07:00
Brian Anderson
2625bf9ae4 Fix regression in -C rpath that causes failures with symlinks
The new `relative_from` method no longer supports the case on unix
where both paths are absolute, which `-C rpath` depended on. This
version fixes the problem by copying the old path_relative_from
function into the rpath module.

Fixes #23140
2015-03-23 10:21:54 -07:00
Julian Orth
d6fb7e9da8 derive missing trait implementations for cursor 2015-03-23 17:48:13 +01:00
Steve Klabnik
2750e3c83e Add note about pointer state after the call.
Fixes #23422
2015-03-23 12:21:53 -04:00
Felix S. Klock II
bb9d210c99 Fix shift-overflow in very old run-pass test. 2015-03-23 07:04:15 -07:00
Andrew Paseltiner
88edf9774c document iteration order for vec_deque::IntoIter 2015-03-23 08:51:29 -04:00
Andrew Paseltiner
7934d524b5 implement ExactSizeIterator for linked_list::IntoIter 2015-03-23 08:51:13 -04:00
Andrew Paseltiner
64532f7f00 implement Clone for various iterators 2015-03-23 08:50:47 -04:00
Wangshan Lu
d944689cf6 Fix dead link for std::sync::mpsc. 2015-03-23 19:11:03 +08:00
Niko Matsakis
45fae88256 When matching against a pattern (either via match or let) that
contains ref-bindings, do not permit any upcasting from the type of
the value being matched. Similarly, do not permit coercion in a `let`.

This is a [breaking-change] in that it closes a type hole that
previously existed, and in that coercion is not performed. You should
be able to work around the latter by converting:

```rust
let ref mut x: T = expr;
```

into

```rust
let x: T = expr;
let ref mut x = x;
```

Restricting coercion not to apply in the case of `let ref` or `let ref mut` is sort
of unexciting to me, but seems the best solution:

1. Mixing coercion and `let ref` or `let ref mut` is a bit odd, because you are taking
   the address of a (coerced) temporary, but only sometimes. It's not syntactically evident,
   in other words, what's going on. When you're doing a coercion, you're kind of

2. Put another way, I would like to preserve the relationship that
   `equality <= subtyping <= coercion <= as-coercion`, where this is
   an indication of the number of `(T1,T2)` pairs that are accepted by
   the various relations. Trying to mix `let ref mut` and coercion
   would create another kind of relation that is like coercion, but
   acts differently in the case where a precise match is needed.

3. In any case, this is strictly more conservative than what we had
   before and we can undo it in the future if we find a way to make
   coercion mix with type equality.

The change to match I feel ok about but similarly unthrilled. There is
some subtle text already concerning whether to use eqtype or subtype
for identifier bindings. The best fix I think would be to always have
match use strict equality but use subtyping on identifier bindings,
but the comment `(*)` explains why that's not working at the moment.
As above, I think we can change this as we clean up the code there.
2015-03-23 05:30:43 -04:00
Niko Matsakis
50ea6f6886 Remove incorrect subtyping for &mut Trait and introduce coercion
for `&mut (Trait+'a)` to `&mut (Trait+'b)` if `'a:'b`.

Fixes #14985.
2015-03-23 04:52:33 -04:00
Anders Kaseorg
737bb30f0a min_stack_size: clarify both reasons to use dlsym
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-03-23 04:02:02 -04:00
Anders Kaseorg
b6641c1595 min_stack_size: update non-Linux implementation comment
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-03-23 03:48:06 -04:00
Anders Kaseorg
0090e01f08 Get __pthread_get_minstack at runtime with dlsym
Linking __pthread_get_minstack, even weakly, was causing Debian’s
dpkg-shlibdeps to detect an unnecessarily strict versioned dependency
on libc6.

Closes #23628.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-03-23 01:05:05 -04:00
Liam Monahan
558c427cd3 Fix a typo in the Rust Book ownership page. 2015-03-23 00:00:00 -04:00
bors
809a554fca Auto merge of #23593 - Manishearth:rollup, r=Manishearth
(yay, no Saturday)
2015-03-23 00:37:35 +00:00
Manish Goregaokar
b4e9106a8a Rollup merge of #23590 - FuGangqiang:attr, r=alexcrichton 2015-03-23 04:54:27 +05:30
Manish Goregaokar
5b9e87b571 Rollup merge of #23576 - barosl:mutex-doc, r=alexcrichton 2015-03-23 04:54:27 +05:30
FuGangqiang
7ec80fa31c add lifetime for while and for expression 2015-03-23 04:54:27 +05:30
Manish Goregaokar
f5782faa06 Rollup merge of #23562 - steveklabnik:fix_book_numbers, r=alexcrichton
Rustbook already does this.
2015-03-23 04:54:27 +05:30
FuGangqiang
5836efdfe7 fix the attributes sytax 2015-03-23 04:54:27 +05:30
Manish Goregaokar
78b61be77d Rollup merge of #23555 - steveklabnik:environment, r=sanxiyn
As @sanxiyn says,
https://github.com/rust-lang/rust/pull/23527#issuecomment-83835448
2015-03-23 04:54:27 +05:30
Manish Goregaokar
420bf9dd44 Rollup merge of #23554 - Ms2ger:readme-rustc, r=steveklabnik 2015-03-23 04:54:26 +05:30
Manish Goregaokar
718fe3d9c5 Rollup merge of #23578 - fhahn:issue-22820-feature-gate-tests1, r=alexcrichton
...ures.

Namely:

 * `box_syntax`
 * `box_patterns`
 * `simd_ffi`
 * `macro_reexport`

cc #22820
2015-03-23 04:54:26 +05:30
Manish Goregaokar
d8baa010ab Rollup merge of #23570 - dotdash:issue23550, r=eddyb
Boolean values and small aggregates have a different type in args/allocas than
in SSA values but the intrinsics for volatile and atomic ops were
missing the necessary casts to handle that.

Fixes #23550
2015-03-23 04:54:26 +05:30
Manish Goregaokar
a91eece96b Rollup merge of #23559 - aturon:future-proof-map-index, r=Gankro
This commit removes the `IndexMut` impls on `HashMap` and `BTreeMap`, in
order to future-proof the API against the eventual inclusion of an
`IndexSet` trait.

Ideally, we would eventually be able to support:

```rust
map[owned_key] = val;
map[borrowed_key].mutating_method(arguments);
&mut map[borrowed_key];
```

but to keep the design space as unconstrained as possible, we do not
currently want to support `IndexMut`, in case some other strategy will
eventually be needed.

Code currently using mutating index notation can use `get_mut` instead.

[breaking-change]

Closes #23448

r? @Gankro
2015-03-23 04:54:26 +05:30
Felix S. Klock II
4dfec6cab5 placate check-pretty and pretty-printer bug; see also issue 23623. 2015-03-22 23:53:06 +01:00
Tshepang Lekhonkhobe
8a500dea0e book: some Crates and Modules nits 2015-03-22 23:38:36 +02:00
Steve Klabnik
81801f2171 Re-word explanation on closures in intro
Fixes #23571
2015-03-22 15:40:46 -04:00
Ms2ger
29aca83eb4 Remove an unsafe function definition in __thread_local_inner.
This fixes a build error when using thread_local!() in a deny(unsafe_code)
scope in Servo for Android.
2015-03-22 20:27:00 +01:00
Steve Klabnik
fbc823d1e3 Document how to document macros
Fixes #23571
2015-03-22 15:26:23 -04:00
Steve Klabnik
3d04cb3688 Note order of BinaryHeap::drain
Fixes #23564
2015-03-22 15:21:32 -04:00
Steve Klabnik
5321d22afa Remove bad reference to std::io
Closes #23540
2015-03-22 15:04:58 -04:00
Björn Steinbrink
cfe7a8db06 Reduce code bloat in closure
For the rust-call ABI, the last function argument is a tuple that gets
untupled for the actual call. For bare functions using this ABI, the
code has access to the tuple, so we need to tuple the arguments again.
But closures can't actually access the tuple. Their arguments map to the
elements in the tuple. So what we currently do is to tuple the arguments
and then immediately untuple them again, which is pretty useless and we
can just omit it.
2015-03-22 19:18:07 +01:00
Simonas Kazlauskas
90c8592889 Refine Cursor docstring 2015-03-22 19:36:17 +02:00
bors
b0aad7dd4f Auto merge of #23361 - petrochenkov:refdst, r=jakub-
After this patch code like `let ref a = *"abcdef"` doesn't cause ICE anymore.
Required for #23121

There are still places in rustc_trans where pointers are always assumed to be thin. In particular, #19064 is not resolved by this patch.
2015-03-22 15:52:30 +00:00
Andrew Paseltiner
1381249265 implement Clone for btree iterators 2015-03-21 22:55:52 -04:00
Alex Crichton
1ec9adcfc0 std: Tweak rt::at_exit behavior
There have been some recent panics on the bots and this commit is an attempt to
appease them. Previously it was considered invalid to run `rt::at_exit` after
the handlers had already started running. Due to the multithreaded nature of
applications, however, it is not always possible to guarantee this. For example
[this program][ex] will show off the abort.

[ex]: https://gist.github.com/alexcrichton/56300b87af6fa554e52d

The semantics of the `rt::at_exit` function have been modified as such:

* It is now legal to call `rt::at_exit` at any time. The return value now
  indicates whether the closure was successfully registered or not. Callers must
  now decide what to do with this information.
* The `rt::at_exit` handlers will now be run for a fixed number of iterations.
  Common cases (such as the example shown) may end up registering a new handler
  while others are running perhaps once or twice, so this common condition is
  covered by re-running the handlers a fixed number of times, after which new
  registrations are forbidden.

Some usage of `rt::at_exit` was updated to handle these new semantics, but
deprecated or unstable libraries calling `rt::at_exit` were not updated.
2015-03-21 11:14:58 -07:00
Alex Crichton
e24fe5b8cf std: Remove deprecated ptr functions
The method with which backwards compatibility was retained ended up leading to
documentation that rustdoc didn't handle well and largely ended up confusing.
2015-03-21 10:16:01 -07:00
Felix S. Klock II
5e47c6655b workaround bugs in pretty-printer so that we can pass check-stage2-pretty-rpass. 2015-03-21 17:57:22 +01:00
FuGangqiang
bc9d9f20db add lifetime for while and for expression 2015-03-21 23:59:30 +08:00
FuGangqiang
c175b35495 fix the attributes sytax 2015-03-21 22:56:05 +08:00
Björn Steinbrink
d4ca1cffce Fix volatile / atomic ops on bools and small aggregates
Boolean values and small aggregates have a different type in
args/allocas than in SSA values but the intrinsics for volatile and
atomic ops were missing the necessary casts to handle that.

Fixes #23550
2015-03-21 10:46:52 +01:00
Florian Hahn
c48bb85702 Add tests checking that a number of feature gates are gating their features.
Namely:

 * `box_syntax`
 * `box_patterns`
 * `simd_ffi`
 * `macro_reexport`

 cc #22820
2015-03-21 10:18:28 +01:00
Barosl Lee
84b14c5dc9 Fix documentation for std::sync::mutex: into_guard -> into_inner 2015-03-21 14:38:23 +09:00
bors
ecf8c64e1b Auto merge of #23470 - alexcrichton:less-prelude, r=aturon
This commit removes the reexports of `old_io` traits as well as `old_path` types
and traits from the prelude. This functionality is now all deprecated and needs
to be removed to make way for other functionality like `Seek` in the `std::io`
module (currently reexported as `NewSeek` in the io prelude).

Closes #23377
Closes #23378
2015-03-21 05:25:21 +00:00
Alex Crichton
212e03181e std: Remove old_io/old_path from the prelude
This commit removes the reexports of `old_io` traits as well as `old_path` types
and traits from the prelude. This functionality is now all deprecated and needs
to be removed to make way for other functionality like `Seek` in the `std::io`
module (currently reexported as `NewSeek` in the io prelude).

Closes #23377
Closes #23378
2015-03-20 20:07:19 -07:00
bors
e2fa53e593 Auto merge of #23512 - oli-obk:result_ok_unwrap, r=alexcrichton
because then the call to `unwrap()` will not print the error object.
2015-03-20 23:16:47 +00:00