Commit Graph

98487 Commits

Author SHA1 Message Date
Andreas Molzer
7388cb4cf8 Fixup remaining direct relocation field references 2019-08-30 04:19:29 +02:00
Andreas Molzer
bee2d3748e Move relocation range copies into allocation 2019-08-30 04:17:18 +02:00
Oliver Scherer
6978b9482b Update tests 2019-08-30 02:46:25 +02:00
Oliver Scherer
26e9990198 Add a "diagnostic item" scheme
This allows lints and other diagnostics to refer to items
by a unique ID instead of relying on whacky path
resolution schemes that may break when items are
relocated.
2019-08-30 01:00:55 +02:00
Oliver Scherer
c6e7f039aa Merge oli-obk mail addresses 2019-08-30 00:30:50 +02:00
Andreas Jonson
b304cd02c0 Run doctests via out-of-process rustc 2019-08-29 23:15:31 +02:00
Dylan MacKenzie
86487329bb Add Place::is_indirect
This returns whether a `Place` references the same region of memory
as its base, or equivalently whether it contains a `Deref` projection.

This is helpful for analyses that must track state for locals, since an
assignment to `x` or `x.field` is fundamentally different than one to
`*x`, which may mutate any memory region.
2019-08-29 13:40:28 -07:00
Andreas Jonson
56ab485fbe support rustdoc test from stdin to rustc 2019-08-29 22:23:05 +02:00
Sam Radhakrishan
378c32bc90 Fix test. 2019-08-30 00:57:20 +05:30
Ilija Tovilo
c71004cd21
Also test isize and usize in wrapping arithmetics 2019-08-29 21:23:52 +02:00
bors
72b2abfd65 Auto merge of #63971 - flip1995:clippyup, r=oli-obk
Update Clippy

cc rust-lang/rust-clippy#4462

r? @oli-obk @Manishearth
2019-08-29 18:52:09 +00:00
Andreas Molzer
6fe31fefd8 Make allocation relocation field private 2019-08-29 20:02:21 +02:00
bors
fbdf1d2a71 Auto merge of #64000 - Centril:rollup-70s9ar3, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #62734 (Hide trait default methods)
 - #63953 (bootstrap: allow specifying mirror for bootstrap compiler download.)
 - #63956 (rustc: Handle modules in "fat" LTO more robustly)
 - #63979 (std: Remove the `wasm_syscall` feature)

Failed merges:

r? @ghost
2019-08-29 15:14:47 +00:00
Mazdak Farrokhzad
d920aa0e02
Rollup merge of #63979 - alexcrichton:remove-wasm-syscall, r=dtolnay
std: Remove the `wasm_syscall` feature

This commit removes the `wasm_syscall` feature from the
wasm32-unknown-unknown build of the standard library. This feature was
originally intended to allow an opt-in way to interact with the
operating system in a posix-like way but it was never stabilized.
Nowadays with the advent of the `wasm32-wasi` target that should
entirely replace the intentions of the `wasm_syscall` feature.
2019-08-29 17:14:03 +02:00
Mazdak Farrokhzad
137564d825
Rollup merge of #63956 - alexcrichton:fix-lto-all-cached, r=michaelwoerister
rustc: Handle modules in "fat" LTO more robustly

When performing a "fat" LTO the compiler has a whole mess of codegen
units that it links together. To do this it needs to select one module
as a "base" module and then link everything else into this module.
Previously LTO passes assume that there's at least one module in-memory
to link into, but nowadays that's not always true! With incremental
compilation modules may actually largely be cached and it may be
possible that there's no in-memory modules to work with.

This commit updates the logic of the LTO backend to handle modules a bit
more uniformly during a fat LTO. This commit immediately splits them
into two lists, one serialized and one in-memory. The in-memory list is
then searched for the largest module and failing that we simply
deserialize the first serialized module and link into that. This
refactoring avoids juggling three lists, two of which are serialized
modules and one of which is half serialized and half in-memory.

Closes #63349
2019-08-29 17:14:01 +02:00
Mazdak Farrokhzad
78e728e2c2
Rollup merge of #63953 - crlf0710:bootstrap_mirroring, r=Mark-Simulacrum
bootstrap: allow specifying mirror for bootstrap compiler download.
2019-08-29 17:13:59 +02:00
Mazdak Farrokhzad
1ea8fc587c
Rollup merge of #62734 - GuillaumeGomez:hide-default-methods, r=Mark-Simulacrum
Hide trait default methods

Fixes #62499.

However, the question remains: do we want to extend it to this point or not?

r? @QuietMisdreavus
2019-08-29 17:13:57 +02:00
Guillaume Gomez
0e7424653e Add missing links on AsRef trait 2019-08-29 16:04:13 +02:00
bors
7445622bcb Auto merge of #63998 - Centril:rollup-pfuwxz3, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #63867 (resolve: Block expansion of a derive container until all its derives are resolved)
 - #63880 (Validation: check raw wide pointer metadata)
 - #63914 (ty: use Align for ReprOptions pack and align.)
 - #63941 (rustbuild: allow disabling deny(warnings) for bootstrap)
 - #63949 (Fix build src/libtest)
 - #63984 (Update rust-installer to limit memory use)
 - #63992 (Small improvement for Ord implementation of integers)

Failed merges:

r? @ghost
2019-08-29 11:20:45 +00:00
Mazdak Farrokhzad
3f05cf6776
Rollup merge of #63992 - lzutao:integer-ord, r=nagisa
Small improvement for Ord implementation of integers

Godbolt link: https://godbolt.org/z/tuTDOg

### Before

**asm**
```asm
example::cmp:
  mov eax, dword ptr [rdi]
  xor ecx, ecx
  cmp eax, dword ptr [rsi]
  seta cl
  mov eax, 255
  cmovae eax, ecx
  ret
```

**llvm-mca**
```
Iterations:        100
Instructions:      700
Total Cycles:      217
Total uOps:        1100

Dispatch Width:    6
uOps Per Cycle:    5.07
IPC:               3.23
Block RThroughput: 1.8
```

### After

**asm**
```asm
example::cmp:
  mov eax, dword ptr [rdi]
  xor ecx, ecx
  cmp eax, dword ptr [rsi]
  setne cl
  mov eax, 255
  cmovae eax, ecx
  ret
```

**llvm-mca**
```
Iterations:        100
Instructions:      700
Total Cycles:      209
Total uOps:        1000

Dispatch Width:    6
uOps Per Cycle:    4.78
IPC:               3.35
Block RThroughput: 1.7
```

r? @nagisa
2019-08-29 13:18:01 +02:00
Mazdak Farrokhzad
c94ead7ad7
Rollup merge of #63984 - cuviper:rust-installer-mem, r=Mark-Simulacrum
Update rust-installer to limit memory use

See https://github.com/rust-lang/rust-installer/pull/98 -- on a many-core machine, the xz memory for so many threads is more than a 32-bit process can handle. The xz stream is now limited to 8 threads.

r? @alexcrichton
2019-08-29 13:18:00 +02:00
Mazdak Farrokhzad
808722e44f
Rollup merge of #63949 - JohnTitor:fix-quick-build, r=Mark-Simulacrum
Fix build src/libtest

Fixes #63928

r? @Mark-Simulacrum
2019-08-29 13:17:59 +02:00
Mazdak Farrokhzad
2b7f5ecc93
Rollup merge of #63941 - Keruspe:warnings, r=Mark-Simulacrum
rustbuild: allow disabling deny(warnings) for bootstrap

When deny-warnings is not specified or set to true, the behaviour is the same as before.
When deny-warnings is set to false, warnings are now allowed

Fixes #63911
2019-08-29 13:17:57 +02:00
Mazdak Farrokhzad
2c28e02710
Rollup merge of #63914 - hvenev:repr-fields, r=eddyb
ty: use Align for ReprOptions pack and align.
2019-08-29 13:17:55 +02:00
Mazdak Farrokhzad
d2ba571850
Rollup merge of #63880 - RalfJung:miri-meta, r=oli-obk
Validation: check raw wide pointer metadata

While I was at it, I also added a missing check for slices not to be too big.

r? @oli-obk
Fixes https://github.com/rust-lang/miri/issues/918
2019-08-29 13:17:53 +02:00
Mazdak Farrokhzad
e4e6b01ca1
Rollup merge of #63867 - petrochenkov:dhelpers, r=matthewjasper
resolve: Block expansion of a derive container until all its derives are resolved

So, it turns out there's one more reason to block expansion of a `#[derive]` container until all the derives inside it are resolved, beside `Copy` (https://github.com/rust-lang/rust/pull/63248).

The set of derive helper attributes registered by derives in the container also has to be known before the derives themselves are expanded, otherwise it may be too late (see https://github.com/rust-lang/rust/pull/63468#issuecomment-524550872 and the `#[stable_hasher]`-related test failures in https://github.com/rust-lang/rust/pull/63468).

So, we stop our attempts to unblock the container earlier, as soon as the `Copy` status is known, and just block until all its derives are resolved.
After all the derives are resolved we immediately go and process their helper attributes in the item, without delaying it until expansion of the individual derives.

Unblocks https://github.com/rust-lang/rust/pull/63468
r? @matthewjasper (as a reviewer of https://github.com/rust-lang/rust/pull/63248)
cc @c410-f3r
2019-08-29 13:17:52 +02:00
bors
85ed538d69 Auto merge of #63990 - Centril:rollup-q1nt0b0, r=Centril
Rollup of 11 pull requests

Successful merges:

 - #63811 (Correctly suggest adding bounds to `impl Trait` argument)
 - #63933 (Resolve some small issues related to #63580)
 - #63938 (or-pattern: fix typo in error message)
 - #63945 (Recover `mut $pat` and other improvements)
 - #63958 (const_prop: only call error_to_const_error if we are actually showing something)
 - #63961 (Add Option<Span> to `require_lang_item`)
 - #63963 (remove the reference to __cxa_thread_atexit_impl)
 - #63965 (Prevent syntax error in LD linker version script)
 - #63968 (rustc_apfloat: make the crate #![no_std] explicitly.)
 - #63970 (Notify me (flip1995) when Clippy toolstate changes)
 - #63980 (add missing `#[repr(C)]` on the Slices union)

Failed merges:

 - #63989 (Add Yaah to clippy toolstain notification list)

r? @ghost
2019-08-29 05:05:17 +00:00
Lzu Tao
ade191c70a Small improvement for Ord implementation of integers 2019-08-29 03:52:18 +00:00
Mazdak Farrokhzad
7391009236
Rollup merge of #63980 - DutchGhost:master, r=cramertj
add missing `#[repr(C)]` on the Slices union

Adds the `#[repr(C)]` attribute to the `Slices` union used to convert an `&str` into a `&[u8]`.
Without the attribute, the union has an unspecified layout: https://doc.rust-lang.org/reference/types/union.html, so performing the 'transmute' is unsound without the attribute (as far as I understand).

The `Repr` union, used for converting a raw ptr + len to a slice has this attribute as well:
https://github.com/rust-lang/rust/blob/master/src/libcore/ptr/mod.rs#L211-#L216
2019-08-29 05:32:58 +02:00
Mazdak Farrokhzad
e3028dbda8
Rollup merge of #63970 - flip1995:notify_clippy, r=oli-obk
Notify me (flip1995) when Clippy toolstate changes

I want in on the fun 🎉

Also friendly ping @llogiq @mcarton: Since you two aren't _that_ active on the Clippy repo anymore, do you still want to get pinged on Clippy toolstate changes?

r? @oli-obk
2019-08-29 05:32:57 +02:00
Mazdak Farrokhzad
75c8c211dc
Rollup merge of #63968 - eddyb:apfloat-nostd, r=matthewjasper
rustc_apfloat: make the crate #![no_std] explicitly.

We only need allocation, and even that could be made optional.
2019-08-29 05:32:56 +02:00
Mazdak Farrokhzad
1c4a9a9050
Rollup merge of #63965 - loganwendholt:linker-script-fix, r=michaelwoerister
Prevent syntax error in LD linker version script

As discussed in #63925, there is an edge case in which an invalid LD version script is generated when building a `cdylib` with no exported symbols. This PR makes a slight modification to the  LD version script generation by first checking to see if any symbols need to be exported. If not, the `global` section of the linker script is simply omitted, and the syntax error is averted.
2019-08-29 05:32:54 +02:00
Mazdak Farrokhzad
f0e2895cf8
Rollup merge of #63963 - Wind-River:master_003, r=alexcrichton
remove the reference to __cxa_thread_atexit_impl

r? @alexcrichton

cc @n-salim
2019-08-29 05:32:53 +02:00
Mazdak Farrokhzad
d4757d5bbf
Rollup merge of #63961 - JohnTitor:improve-require-lang-item, r=estebank
Add Option<Span> to `require_lang_item`

Fixes #63954

I'm not sure where to take `Some(span)` or something so I use `None` in many places.
r? @estebank
2019-08-29 05:32:51 +02:00
Mazdak Farrokhzad
99d271f400
Rollup merge of #63958 - RalfJung:silence-const-prop, r=oli-obk
const_prop: only call error_to_const_error if we are actually showing something

This makes `RUSTC_CTFE_BACKTRACE` useful again.

r? @oli-obk

Fixes https://github.com/rust-lang/rust/issues/63439
2019-08-29 05:32:50 +02:00
Mazdak Farrokhzad
52c3846d51
Rollup merge of #63945 - Centril:recover-mut-pat, r=estebank
Recover `mut $pat` and other improvements

- Recover on e.g. `mut Foo(x, y)` and suggest `Foo(mut x, mut y)`. Fixes https://github.com/rust-lang/rust/issues/63764.
- Recover on e.g. `let mut mut x;`
- Recover on e.g. `let keyword` and `let keyword(...)`.
- Cleanups in `token.rs` with `fn is_non_raw_ident_where` and friends.
2019-08-29 05:32:48 +02:00
Mazdak Farrokhzad
eb4ac32c59
Rollup merge of #63938 - tshepang:typo, r=Centril
or-pattern: fix typo in error message

cc https://github.com/rust-lang/rust/issues/54883.
2019-08-29 05:32:46 +02:00
Mazdak Farrokhzad
b6df8276f8
Rollup merge of #63933 - wesleywiser:cleanup_from_move_promoted, r=oli-obk
Resolve some small issues related to #63580

This resolves some feedback left on #63580 after it was merged:

- Adds documentation to `mir::Static` and `mir::StaticKind`
- Simplifies `maybe_get_optimized_mir()` and `maybe_get_promoted_mir()`

cc @bjorn3 @RalfJung
2019-08-29 05:32:45 +02:00
Mazdak Farrokhzad
4cae33a176
Rollup merge of #63811 - estebank:impl-trait-arg, r=cramertj
Correctly suggest adding bounds to `impl Trait` argument

Fix #63706.
2019-08-29 05:32:43 +02:00
bors
347654324d Auto merge of #62855 - Aaron1011:feature/rustdoc-reexport-final, r=petrochenkov
Improve Rustdoc's handling of procedural macros

Fixes #58700
Fixes #58696
Fixes #49553
Fixes #52210

This commit removes the special rustdoc handling for proc macros, as we can now
retrieve their span and attributes just like any other item.

A new command-line option is added to rustdoc: `--crate-type`. This takes the same options as rustc's `--crate-type` option. However, all values other than `proc-macro` are treated the same. This allows Rustdoc to enable 'proc macro mode' when handling a proc macro crate.

In compiletest, a new 'rustdoc-flags' option is added. This allows us to
pass in the '--proc-macro-crate' flag in the absence of Cargo.

I've opened [an additional PR to Cargo](https://github.com/rust-lang/cargo/pull/7159) to support passing in this flag.
These two PRS can be merged in any order - the Cargo changes will not
take effect until the 'cargo' submodule is updated in this repository.
2019-08-29 01:22:11 +00:00
Alessandro Ghedini
820aa5b2ef Stabilize pin_into_inner in 1.39.0
FCP: https://github.com/rust-lang/rust/issues/60245#issuecomment-522258129

Closes #60245
2019-08-28 23:59:46 +01:00
Aaron Hill
4c3e386bd7
Allow running rustdoc on proc-macro crates without specifying '--crate-type proc-macro'
Add a test to make sure that this works
2019-08-28 18:00:36 -04:00
Josh Stone
35717892b9 Update rust-installer to limit memory use 2019-08-28 14:48:02 -07:00
bors
0414dfa0aa Auto merge of #62941 - GuillaumeGomez:save-crate-filter, r=Mark-Simulacrum
Save crate filtering on rustdoc

Fixes #62929.

I added a hashmap and a hash encoding for the current crate list in case you have multiple crates handling on a same website (who talked about docs.rs?!). Like that, for each context, you have the filter crate selected.

r? @QuietMisdreavus
2019-08-28 21:42:52 +00:00
Sam Radhakrishan
fdd8b967c1 Fixes #63976. Incorrect error message.
Fix incorrect error message when accessing
private field of union
2019-08-29 02:48:36 +05:30
Nathan
12e0420268 Update dbg macro test to use check-run-results flag for run-pass test
Updates the dbg-macro-expected behavior test to remove the workaround and use the `check-run-result` flag/feature in compiletest. This serves to test the feature on a real use-case (as mentioned in #63751)
2019-08-28 15:00:40 -04:00
bors
17e73e801a Auto merge of #63875 - philipc:issue-57822, r=michaelwoerister
debuginfo: give unique names to closure and generator types

Closure types have been moved to the namespace where they
are defined, and both closure and generator type names now
include the disambiguator.

This fixes an exception when lldb prints nested closures.

Fixes #57822

I haven't included the `DW_AT_artificial` changes discussed in #57822 because they make the output worse IMO, but I can easily add these if still required. For example, for the new test case the output is now:
```
(lldb) p g
(issue_57822::main::closure-1) $1 = closure-1(closure(1))
```
but adding `DW_AT_artificial` changes this to:
```
(lldb) p g
(issue_57822::main::closure-1) $0 = closure-1 {

}
```

Note that nested generators didn't cause the exception. I haven't determined why, but I think it makes sense to add the disambiguator for them too. It feels like we still don't really understand why closures were causing an error though.

r? @michaelwoerister
2019-08-28 17:49:37 +00:00
Dodo
080fdb8184 add missing #[repr(C)] on a union 2019-08-28 17:38:24 +02:00
Alex Crichton
8fe65da935 std: Remove the wasm_syscall feature
This commit removes the `wasm_syscall` feature from the
wasm32-unknown-unknown build of the standard library. This feature was
originally intended to allow an opt-in way to interact with the
operating system in a posix-like way but it was never stabilized.
Nowadays with the advent of the `wasm32-wasi` target that should
entirely replace the intentions of the `wasm_syscall` feature.
2019-08-28 08:34:31 -07:00
bors
c4223726c3 Auto merge of #63853 - matthewjasper:test-ast-serialization, r=estebank
Add default serialization for `Ident`s

Also add tests for `-Zast-json` and `-Zast-json-noexpand`

closes #63728
2019-08-28 13:43:05 +00:00