Commit Graph

73644 Commits

Author SHA1 Message Date
Guillaume Gomez
0e270fc842 Rollup merge of #47193 - cramertj:result-opts, r=TimNN
Add transpose conversions for nested Option and Result

These impls are useful when working with combinator
methods that expect an option or a result, but you
have a `Result<Option<T>, E>` instead of an `Option<Result<T, E>>`
or vice versa.
2018-01-20 22:32:42 +01:00
Guillaume Gomez
fe811eb328 Rollup merge of #46938 - hellow554:rustdoc-kbd-style, r=GuillaumeGomez
add kbd style tag to main.css in rustdoc

Added css style for kbd tags so they actually look like keys.
Result preview and discussion was going on in #46900 .
2018-01-20 22:32:41 +01:00
Esteban Küber
067405044c Fix tests by keepeing needed suggestions 2018-01-20 12:02:40 -08:00
bjorn3
a30232f9fd Remove the 'extern "C"' in the right place 2018-01-20 17:27:15 +01:00
bors
15a1e2844d Auto merge of #46980 - zackmdavis:and_the_case_of_the_needlessly_parenthesized_arguments, r=petrochenkov
in which the unused-parens lint comes to cover function and method args

Resolves #46137.
2018-01-20 15:06:41 +00:00
bors
bdda8d6115 Auto merge of #46952 - SimonSapin:nonnull, r=alexcrichton
Rename std::ptr::Shared to NonNull and stabilize it

This implements the changes proposed at https://github.com/rust-lang/rust/issues/27730#issuecomment-352800629:

> * Rename `Shared<T>` to `NonNull<T>` and stabilize it. (Being in the `ptr` module is enough to say that it’s a pointer. I’m not very attached to this specific name though.)
> * Rename `Box<T>` methods ~~`from_unique`~~/`into_unique` to ~~`from_nonnull`~~/`into_nonnull` (or whatever names are deemed appropriate), replace `Unique<T>` with `NonNull<T>` in their signatures, and stabilize them.
> *  Replace `Unique<T>` with `NonNull<T>` in the signatures of methods of the `Alloc` trait.
> * Mark `Unique` “permanently-unstable” by replacing remaining occurrences of `#[unstable(feature = "unique", issue = "27730")]` with:
>
>   ```rust
>   #[unstable(feature = "ptr_internals", issue = "0", reason = "\
>       use NonNull instead and consider PhantomData<T> (if you also use #[may_dangle]), \
>       Send, and/or Sync")]
>   ```
>
>   (Maybe the `reason` string is only useful on the struct definition.) Ideally it would be made private to some crate instead, but it needs to be used in both liballoc and libstd.
> * (Leave `NonZero` and `Zeroable` unstable for now, and subject to future bikeshedding.)
2018-01-20 12:28:13 +00:00
bjorn3
a4854e84f2 Fix ICE 2018-01-20 11:55:55 +01:00
Simon Sapin
602a445b92 Assign its own tracking issue to Box::into_raw_non_null
https://github.com/rust-lang/rust/issues/47336
2018-01-20 11:09:23 +01:00
Simon Sapin
76b686f78d Rename NonNull::empty to dangling. 2018-01-20 11:09:23 +01:00
Simon Sapin
5aeeafff49 Revert Box::into_raw_non_null to unstable 2018-01-20 11:09:23 +01:00
Simon Sapin
a1db237cd4 Preserve formatting options in Debug for NonNull/Unique 2018-01-20 11:09:23 +01:00
Simon Sapin
943a9e707c Fix some doc-comment examples for earlier API refactor
https://github.com/rust-lang/rust/pull/41064
2018-01-20 11:09:23 +01:00
Simon Sapin
12b3630f62 Rename Box::into_non_null_raw to Box::into_raw_non_null 2018-01-20 11:09:23 +01:00
Simon Sapin
8ef5e549c3 Remove Box::from_non_null_raw
Per https://github.com/rust-lang/rust/pull/46952#issuecomment-353956225
2018-01-20 11:09:23 +01:00
Simon Sapin
1772fa2aa1 Rename Box::*_nonnull_raw to *_non_null_raw 2018-01-20 11:09:23 +01:00
Simon Sapin
55c50cd8ac Stabilize std::ptr::NonNull 2018-01-20 11:09:23 +01:00
Simon Sapin
2d51e74580 Remove a deprecated (renamed) and unstable method of NonNull 2018-01-20 11:09:23 +01:00
Simon Sapin
c97c1f7dc3 Mark Unique as perma-unstable, with the feature renamed to ptr_internals. 2018-01-20 11:09:23 +01:00
Simon Sapin
a2f878a084 Replace Box::{from,into}_unique with {from,into}_nonnull_raw
Thew `_raw` prefix is included because the fact that `Box`’s ownership
semantics are "dissolved" or recreated seem more important than the exact
parameter type or return type.
2018-01-20 11:09:22 +01:00
Simon Sapin
fb03a49c25 Replace Unique<T> with NonZero<T> in Alloc trait 2018-01-20 10:55:16 +01:00
Simon Sapin
f19baf0977 Rename std::ptr::Shared to NonNull
`Shared` is now a deprecated `type` alias.

CC https://github.com/rust-lang/rust/issues/27730#issuecomment-352800629
2018-01-20 10:55:16 +01:00
Corey Farwell
ba5d7a66e8 Implement Debug for ptr::Shared and ptr::Unique.
Fixes https://github.com/rust-lang/rust/issues/46755.
2018-01-20 10:55:16 +01:00
Esteban Küber
7ed00caacc Closure argument mismatch tweaks
- use consistent phrasing for expected and found arguments
 - suggest changing arugments to tuple if possible
 - suggest changing single tuple argument to arguments if possible
2018-01-20 01:36:01 -08:00
bors
816d765716 Auto merge of #46919 - michaelwoerister:new-leb128, r=sfackler
Speed up leb128 encoding and decoding for unsigned values.

Make the implementation for some leb128 functions potentially faster.

@Mark-Simulacrum, could you please trigger a perf.rlo run?
2018-01-20 02:00:13 +00:00
Esteban Küber
6f9ecaa7cf Tweak wording and spans of closure lifetime errors 2018-01-19 13:28:43 -08:00
bjorn3
82ac9f7532 Hopefully fix the 32bit SEGV 2018-01-19 20:27:52 +01:00
bjorn3
cc4deb2767 Just forget the DynamicLibrary after getting a hot plugged backend 2018-01-19 20:27:52 +01:00
bjorn3
a09aebee21 Remove accidential libloading dependency 2018-01-19 20:27:51 +01:00
bjorn3
c0444242ef Fix ICE 2018-01-19 20:27:36 +01:00
bjorn3
77dec3b03a Remove use of RUSTC_COMPILETEST env var 2018-01-19 20:27:36 +01:00
bjorn3
d2c53f8b4d Add missing licenses 2018-01-19 20:27:36 +01:00
bjorn3
4ef16d7466 Fix hotplug backend and add test 2018-01-19 20:27:36 +01:00
bjorn3
ace502a107 Fix review comments 2018-01-19 20:27:35 +01:00
bjorn3
2d241f66fe Cleanup hot plug codegen backend code 2018-01-19 20:27:35 +01:00
bjorn3
9315ed45c5 Hot plug rustc_trans 2018-01-19 20:27:33 +01:00
bjorn3
6dffaa9175 Hide even more of rustc_trans 2018-01-19 20:27:12 +01:00
bjorn3
bd2e808180 Fix rustc_driver test.rs 2018-01-19 20:27:12 +01:00
bjorn3
2af0f0dddf Hide more stuff from rustc_trans 2018-01-19 20:27:12 +01:00
bjorn3
af0f17386f Fix rustc_driver test.rs 2018-01-19 20:27:12 +01:00
bjorn3
74c92c5562 Allow runtime switching between trans backends 2018-01-19 20:27:10 +01:00
Alex Crichton
06913a5b1d Automaticaly calculate beta prerelease numbers
This is a forward-port of:

* 9426dda83d7a928d6ced377345e14b84b0f11c21
* cbfb9858951da7aee22d82178405306fca9decb1

from the beta branch which is used to automatically calculate the beta number
based on the number of merges to the beta branch so far.
2018-01-19 08:57:01 -08:00
Pieter Penninckx
81e6840ff4 Small improvements to the documentation of VecDeque. 2018-01-19 16:51:46 +01:00
Arthur Silva
fdf444da76 Update BTreeMap recommendation
Focus on the ordering/range benefit.
2018-01-19 15:40:58 +01:00
bors
5965b79014 Auto merge of #47503 - arielb1:check-size, r=eddyb
avoid double-unsizing arrays in bytestring match lowering

The match lowering code, when lowering matches against bytestrings,
works by coercing both the scrutinee and the pattern to `&[u8]` and
then comparing them using `<[u8] as Eq>::eq`.

If the scrutinee is already of type `&[u8]`, then unsizing it is both
unneccessary and a trait error caught by the new and updated MIR typeck,
so this PR changes lowering to avoid doing that (match lowering tried to
avoid that before, but that attempt was quite broken).

Fixes #46920.

r? @eddyb
2018-01-19 10:18:52 +00:00
Ed Schouten
8d7f554a7f Give TargetOptions::linker a sane default value.
Though some parts of rust use cc-rs to invoke a compiler/linker, Cargo
seems to make use of the TargetOptions::linker property. Make the out of
the box experience for CloudABI a bit better by using the same compiler
name as cc-rs.
2018-01-19 09:29:58 +01:00
bors
b71cbd8443 Auto merge of #47454 - topecongiro:update-rustfmt, r=nrc
Update rustfmt to 0.3.6

r? @nrc
2018-01-19 07:35:18 +00:00
bors
10333dde82 Auto merge of #47494 - michaelwoerister:proc-macro-incremental, r=nikomatsakis
Don't include DefIndex in proc-macro registrar function symbol.

There can only ever be one registrar function per plugin or proc-macro crate, so adding the `DefIndex` to the function's symbol name does not serve a real purpose. Remove the `DefIndex` from the symbol name makes it stable across incremental compilation sessions.

This should fix issue #47292.
2018-01-19 04:45:22 +00:00
bors
9af8d42ec7 Auto merge of #47401 - rkruppe:issue-47278, r=eddyb
Compute LLVM argument indices correctly in face of padding

Closes #47278

r? @eddyb
2018-01-19 01:58:30 +00:00
Matthew Walinga
9a4287d263
Update CONTRIBUTING.md 2018-01-18 18:05:33 -05:00
Zack M. Davis
14982db2d6 in which the unused-parens lint comes to cover function and method args
Resolves #46137.
2018-01-18 08:33:58 -08:00