Commit Graph

102256 Commits

Author SHA1 Message Date
bors
ac162c6abe Auto merge of #63871 - BatmanAoD:FloatFnMustUse, r=withoutboats
Add #[must_use] to all functions 'fn(float) -> float'

These are pure functions.

```rust
impl f32/f64 {
    fn floor(self) -> Self;
    fn ceil(self) -> Self;
    fn round(self) -> Self;
    fn trunc(self) -> Self;
    fn fract(self) -> Self;
    fn abs(self) -> Self;
    fn signum(self) -> Self;
    fn mul_add(self, a: Self, b: Self) -> Self;
    fn div_euclid(self, rhs: Self) -> Self;
    fn rem_euclid(self, rhs: Self) -> Self;
    fn powi(self, n: i32) -> Self;
    fn powf(self, n: Self) -> Self;
    fn sqrt(self) -> Self;
    fn exp(self) -> Self;
    fn exp2(self) -> Self;
    fn ln(self) -> Self;
    fn log(self, base: Self) -> Self;
    fn log2(self) -> Self;
    fn log10(self) -> Self;
    fn abs_sub(self, other: Self) -> Self;
    fn cbrt(self) -> Self;
    fn hypot(self, other: Self) -> Self;
    fn sin(self) -> Self;
    fn cos(self) -> Self;
    fn tan(self) -> Self;
    fn asin(self) -> Self;
    fn acos(self) -> Self;
    fn atan(self) -> Self;
    fn atan2(self, other: Self) -> Self;
    fn exp_m1(self) -> Self;
    fn ln_1p(self) -> Self;
    fn sinh(self) -> Self;
    fn cosh(self) -> Self;
    fn tanh(self) -> Self;
    fn asinh(self) -> Self;
    fn acosh(self) -> Self;
    fn atanh(self) -> Self;
    fn clamp(self, min: Self, max: Self) -> Self;
}
```

Part of #48926
2019-11-09 17:02:49 +00:00
Mark Rousskov
43a74051c7 Inline reserve_node_ids
This function was only ever called with 1 so there's little point in it;
this isn't an expensive operation (essentially a checked add) so we're
not really "reserving" anything either.
2019-11-09 11:10:13 -05:00
Mark Rousskov
dd6df0d20e Move pretty parsing into Session options
This allows us to query whether PpmEveryBodyLoops is set during
expansion and run the everybody loops pass.
2019-11-09 11:10:13 -05:00
Mark Rousskov
516a817dbd Move next_node_id to Resolver
This doesn't migrate the pretty-printing everybody loops, which will be
done in the next few commits.
2019-11-09 11:10:13 -05:00
Vadim Petrochenkov
83f553c95c Address review comments 2019-11-09 18:19:34 +03:00
Vadim Petrochenkov
09fff50637 resolve: Factor out some common binding creation functionality 2019-11-09 17:50:51 +03:00
Vadim Petrochenkov
41a7c8be8b resolve: Remove some bits relevant only to legacy plugins
They are unstable and going to be removed anyway and the removed code would complicate the next commit
2019-11-09 17:50:51 +03:00
Vadim Petrochenkov
441e5aed25 Remove #[feature(custom_attribute)] 2019-11-09 17:50:51 +03:00
Vadim Petrochenkov
3a223a9173 Support registering attributes and attribute tools using crate-level attributes 2019-11-09 17:50:51 +03:00
bors
eb981a1da4 Auto merge of #66243 - RalfJung:miri, r=RalfJung
update miri

Fixes https://github.com/rust-lang/rust/issues/66179

r? @ghost
2019-11-09 13:48:56 +00:00
mjptree
15863a60e6
Update src/libstd/net/ip.rs
I assumed some sort of Oxford-comma case here, bit have to admit English is not my first language.

Co-Authored-By: kennytm <kennytm@gmail.com>
2019-11-09 12:27:09 +00:00
Paul Dicker
b05e200867 Run rustfmt on libstd/sync/once.rs 2019-11-09 12:46:17 +01:00
Ralf Jung
1b8b2ee6f9 add raw ptr variant of UnsafeCell::get 2019-11-09 12:34:29 +01:00
Ralf Jung
769d52774b partially port invalid_value lint to diagnostic items 2019-11-09 10:34:16 +01:00
bors
5a5027519a Auto merge of #66242 - Centril:rollup-h73ztr1, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #65949 (Move promotion into its own pass)
 - #65994 (Point at where clauses where the associated item was restricted)
 - #66050 (Fix C aggregate-passing ABI on powerpc)
 - #66134 (Point at formatting descriptor string when it is invalid)
 - #66172 (Stabilize @file command line arguments)
 - #66226 (add link to unstable book for asm! macro)

Failed merges:

r? @ghost
2019-11-09 09:33:13 +00:00
Ralf Jung
145e19318c update miri 2019-11-09 09:20:13 +01:00
Mazdak Farrokhzad
3ef975d4be
Rollup merge of #66226 - lzutao:asm-usage-link, r=Centril
add link to unstable book for asm! macro

r? @Centril
2019-11-09 07:18:35 +01:00
Mazdak Farrokhzad
648e8bfe34
Rollup merge of #66172 - jsgf:stabilize-atfile, r=nikomatsakis
Stabilize @file command line arguments

Issue https://github.com/rust-lang/rust/issues/63576
2019-11-09 07:18:34 +01:00
Mazdak Farrokhzad
12c1e9a193
Rollup merge of #66134 - estebank:unknown-formatting-trait, r=nikomatsakis
Point at formatting descriptor string when it is invalid

When a formatting string contains an invalid descriptor, point at it
instead of the argument:

```
error: unknown format trait `foo`
  --> $DIR/ifmt-bad-arg.rs:86:17
   |
LL |     println!("{:foo}", 1);
   |                 ^^^
   |
   = note: the only appropriate formatting traits are:
           - ``, which uses the `Display` trait
           - `?`, which uses the `Debug` trait
           - `e`, which uses the `LowerExp` trait
           - `E`, which uses the `UpperExp` trait
           - `o`, which uses the `Octal` trait
           - `p`, which uses the `Pointer` trait
           - `b`, which uses the `Binary` trait
           - `x`, which uses the `LowerHex` trait
           - `X`, which uses the `UpperHex` trait
```
2019-11-09 07:18:32 +01:00
Mazdak Farrokhzad
a1fc485e64
Rollup merge of #66050 - smaeul:patch/powerpc-abi-2, r=eddyb
Fix C aggregate-passing ABI on powerpc

The existing code (which looks like it was copied from MIPS) passes
aggregates by value in registers. This is wrong. According to the SVR4
powerpc psABI, all aggregates are passed indirectly.

See #64259 for more discussion, which addresses the ABI for the special
case of ZSTs (empty structs).
2019-11-09 07:18:31 +01:00
Mazdak Farrokhzad
666f9f9aa0
Rollup merge of #65994 - estebank:where-bound, r=nikomatsakis
Point at where clauses where the associated item was restricted

CC #57663.
r? @nikomatsakis
2019-11-09 07:18:29 +01:00
Mazdak Farrokhzad
aaceeded9e
Rollup merge of #65949 - ecstatic-morse:promote-only-pass, r=eddyb
Move promotion into its own pass

**edited**

This adds a `PromoteTemps` pass, which runs after the old `QualifyAndPromoteConsts` pass, that *only* does promotion (no const-checking). Everything related to promotion has been removed from `QualifyAndPromoteConstants`: it no longer even visits the body of a non-const `fn`.

As a result we no longer need to keep the `BitSet` of promotable locals that was returned by `mir_const_qualif`. Rvalue-static promotion in a `const` is now done in `promote_consts`, and it operates on a set of `Candidate`s instead. This will allow me–in a later PR–to create promoted MIR fragments for `const`s when necessary, which could resolve some shortcomings of the current approach (removing `StorageDead`).

r? @eddyb
2019-11-09 07:18:27 +01:00
bors
98c173afe4 Auto merge of #65879 - ohadravid:stabilize-re-rebalance-coherence, r=nikomatsakis
Stabilize the `re_rebalance_coherence` feature

This PR stabilizes [RFC 2451](https://rust-lang.github.io/rfcs/2451-re-rebalancing-coherence.html), re-rebalance coherence.

Changes include removing the attribute from tests which tested both the old and new behavior, moving the feature to `accepted` and removing the old logic.

I'll also open a [PR](https://github.com/rust-lang-nursery/reference/pull/703) against the reference, updating it with the content of the RFC.

Closes #63599

r? @nikomatsakis
2019-11-09 05:57:14 +00:00
Lzu Tao
e6d72c3cef bump openssl version
to support newer versions of libressl in rust builds

Co-authored-by: dylanaraps <dylan.araps@gmail.com>
2019-11-09 03:49:03 +00:00
Wesley Wiser
4505ff4bad [mir-opt] Handle aggregates in SimplifyLocals pass 2019-11-08 22:28:53 -05:00
Wesley Wiser
8316701d37 [mir-opt] Handle const-prop for the return place 2019-11-08 22:27:27 -05:00
Mazdak Farrokhzad
5011ec7fed move attr meta grammar to parse::validate_atr + ast_validation 2019-11-09 02:04:24 +01:00
Eduard-Mihai Burtescu
0da85d6228 rustc_metadata: don't let LLVM confuse rmeta blobs for COFF object files. 2019-11-09 02:06:22 +02:00
bors
475c713b2f Auto merge of #66194 - alexcrichton:update-clang, r=Mark-Simulacrum
Update Clang & build MSVC LLVM with it

This is a general update of our builders to Clang 9, and then it also attempts to tackle a bit of #66192 by building LLVM for rustc with Clang, not with the system `cl.exe` on MSVC.
2019-11-08 23:28:06 +00:00
Dylan MacKenzie
a3b03690c0 Clean up dead code in qualify_consts
We don't do promotion here anymore, so `Checker` will never even visit
the body of a non-const `fn`.
2019-11-08 15:00:20 -08:00
Dylan MacKenzie
b13c2c330d Bless tests now that we do promotion if min_const_fn fails
We bailed out of `QualifyAndPromoteConsts` immediately if the
`min_const_fn` checks failed, which sometimes resulted in additional,
spurious errors since promotion was skipped.

We now do promotion in a completely separate pass, so this is no longer
an issue.
2019-11-08 15:00:20 -08:00
Dylan MacKenzie
b316384e14 Use new PromoteTemps for promotion 2019-11-08 15:00:20 -08:00
Dylan MacKenzie
170272b74f Add a PromoteTemps pass
`remove_storage_dead_and_drop` has been copied to `promote_temps` and
now operates on an array of `Candidate`s instead of a bitset.
2019-11-08 14:58:27 -08:00
Dylan MacKenzie
3783ef6dbe Stop returning promotables from mir_const_qualif 2019-11-08 14:52:22 -08:00
Alexander Nye
619f057dae remove vestigial comments referring to defunct numeric trait hierarchy
see also https://github.com/rust-lang/rust/pull/23104/files
2019-11-08 13:51:07 -08:00
Mark Mansi
8635482e23 update rustc-guide 2019-11-08 11:48:12 -06:00
Bryan Burgers
413ab57c02 docs: Fix link to BufWriter::flush
One of the links in the docs was being rendered as a literal
open-bracket followed by a single quote, instead of being transformed
into a link. Fix it to match the link earlier in the same paragraph.
2019-11-08 10:18:58 -06:00
Lzu Tao
3db1005c9d add link to unstable book for asm! macro 2019-11-08 15:58:25 +00:00
bors
9e346646e9 Auto merge of #66225 - Centril:rollup-it0t5tk, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #65785 (Transition future compat lints to {ERROR, DENY} - Take 2)
 - #66007 (Remove "here" from "expected one of X here")
 - #66043 (rename Memory::get methods to get_raw to indicate their unchecked nature)
 - #66154 (miri: Rename to_{u,i}size to to_machine_{u,i}size)
 - #66188 (`MethodSig` -> `FnSig` & Use it in `ItemKind::Fn`)

Failed merges:

r? @ghost
2019-11-08 15:52:14 +00:00
Mazdak Farrokhzad
65c77bc09a
Rollup merge of #66188 - Centril:fnsig, r=davidtwco
`MethodSig` -> `FnSig` & Use it in `ItemKind::Fn`

In both AST & HIR, rename `MethodSig` to `FnSig` and then proceed to use it in `ItemKind::Fn` so that the overall structure is more regular.

r? @davidtwco
2019-11-08 16:50:41 +01:00
Mazdak Farrokhzad
76db11c165
Rollup merge of #66154 - RalfJung:to_usize, r=oli-obk
miri: Rename to_{u,i}size to to_machine_{u,i}size

Having a function `to_usize` that does not return a (host) usize is somewhat confusing, so let's rename it.

r? @oli-obk
2019-11-08 16:50:40 +01:00
Mazdak Farrokhzad
3b0438aa7b
Rollup merge of #66043 - RalfJung:memory-get-raw, r=cramertj
rename Memory::get methods to get_raw to indicate their unchecked nature

Some recent Miri PRs started using these methods when they should not; this should discourage their use.

In fact we could make these methods private to the `interp` module as far as Miri is concerned -- with the exception of the `uninit` intrinsic which will hopefully go away soon. @bjorn3 @oli-obk does priroda need these methods? It would be great to be able to seal them away.
2019-11-08 16:50:38 +01:00
Mazdak Farrokhzad
5a6fd110b8
Rollup merge of #66007 - estebank:remove-here, r=Centril
Remove "here" from "expected one of X here"
2019-11-08 16:50:35 +01:00
Mazdak Farrokhzad
7ab50e4006
Rollup merge of #65785 - Centril:compat-to-error-2, r=oli-obk
Transition future compat lints to {ERROR, DENY} - Take 2

Follow up to https://github.com/rust-lang/rust/pull/63247 implementing https://github.com/rust-lang/rust/pull/63247#issuecomment-536295992.

- `legacy_ctor_visibility` (ERROR) -- closes #39207
- `legacy_directory_ownership` (ERROR) -- closes #37872
- `safe_extern_static` (ERROR) -- closes #36247
- `parenthesized_params_in_types_and_modules` (ERROR) -- closes #42238
- `duplicate_macro_exports` (ERROR)
- `nested_impl_trait` (ERROR) -- closes #59014
- `ill_formed_attribute_input` (DENY) -- transitions #57571
- `patterns_in_fns_without_body` (DENY) -- transitions #35203

r? @varkor
cc @petrochenkov
2019-11-08 16:50:33 +01:00
Mazdak Farrokhzad
b4c6abcf9e ast::ItemKind::Fn: use ast::FnSig 2019-11-08 09:32:20 +01:00
Mazdak Farrokhzad
2cd48e8a3b ast::MethodSig -> ast::FnSig 2019-11-08 09:32:20 +01:00
Mazdak Farrokhzad
27511b22df hir::MethodSig -> hir::FnSig 2019-11-08 09:32:20 +01:00
Mazdak Farrokhzad
30d7279628 hir::ItemKind::Fn: use hir::MethodSig 2019-11-08 09:32:20 +01:00
Ralf Jung
900fc9a2f0 miri: Rename to_{u,i}size to to_machine_{u,i}size
Having a function `to_usize` that does not return a usize is somewhat confusing
2019-11-08 09:21:49 +01:00
Ralf Jung
15ec8f7c52 rename Memory::get methods to get_raw to indicate their unchecked nature 2019-11-08 09:20:30 +01:00