Commit Graph

88182 Commits

Author SHA1 Message Date
Alexander Regueiro
ecacad0770 Added tests for feature. 2018-12-26 21:27:08 +00:00
Alexander Regueiro
c77fdbf2eb Implemented variants on type aliases in both ctor and pattern position. 2018-12-26 21:27:08 +00:00
Alexander Regueiro
1b150c4043 Store Ident rather than just Name in HIR types Item and ForeignItem. 2018-12-26 21:26:37 +00:00
David Wood
fcad209449
Add closure cannot be moved note.
This commit extends existing logic for checking whether a closure that
is `FnOnce` and therefore moves variables that it captures from the
environment has already been invoked when being invoked again.

Now, this logic will also check whether the closure is being moved after
previously being moved or invoked and add an appropriate note.
2018-12-26 21:55:45 +01:00
Taylor Cramer
11f4d3e40e Add Unpin to std prelude, not just core 2018-12-26 12:20:38 -08:00
Simon Sapin
7a09115280 Remove the private generic NonZero<T> wrapper type.
Instead, use `#[rustc_layout_scalar_valid_range_start(1)]` directly
on relevant libcore types.
2018-12-26 20:54:10 +01:00
bors
a7be40c65a Auto merge of #56534 - xfix:copied, r=@SimonSapin
Add unstable Iterator::copied()

Initially suggested at https://github.com/bluss/rust-itertools/pull/289, however the maintainers of itertools suggested this may be better of in a standard library.

The intent of `copied` is to avoid accidentally cloning iterator elements after doing a code refactoring which causes a structure to be no longer `Copy`. This is a relatively common pattern, as it can be seen by calling `rg --pcre2 '[.]map[(][|](?:(\w+)[|] [*]\1|&(\w+)[|] \2)[)]'` on Rust main repository. Additionally, many uses of `cloned` actually want to simply `Copy`, and changing something to be no longer copyable may introduce unnoticeable performance penalty.

Also, this makes sense because the standard library includes `[T].copy_from_slice` to pair with `[T].clone_from_slice`.

This also adds `Option::copied`, because it makes sense to pair it with `Iterator::copied`. I don't think this feature is particularly important, but it makes sense to update `Option` along with `Iterator` for consistency.
2018-12-26 19:39:19 +00:00
Sunjay Varma
1e82618613 Stabilize duration_as_u128 2018-12-26 12:12:06 -07:00
bors
79d8a0fcef Auto merge of #57108 - Mark-Simulacrum:license-remove, r=pietroalbini
Remove header licenses across the project

This pull request removes the header licenses from files across the Rust repository.

I've attempted to check for any remaining headers and removed all of them -- any we've missed can be removed in the future; there's nothing blocking that.

Unfortunately, not all of the changes are as basic as "removing a header" because some of them required test file updates or otherwise. However, I am fairly confident that the changes in this pull request, while wide-sweeping, are unlikely to actually make any tests fail to properly test the code; any non-script based changes were manual and carefully verified.

r? @pietroalbini cc @rust-lang/infra
2018-12-26 16:16:02 +00:00
Mark Rousskov
e132d9066d Account for no newline before test annotations
Previously the license comment would always provide that newline but
since that's been removed this change is needed.
2018-12-26 09:00:55 -07:00
Ralf Jung
fd69e6e910 make Alloc::check_bounds_ptr private; you should use Memory::check_bounds_ptr instead 2018-12-26 13:18:24 +01:00
Konrad Borowski
315401ddf8 Add a tracking issue for Iterator::copied 2018-12-26 10:13:44 +01:00
Konrad Borowski
2fcdc9c15d Add a tracking issue for Option::copied 2018-12-26 10:13:02 +01:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
bors
14b96659e4 Auto merge of #57088 - euclio:non-camel-case-early-lint, r=estebank
make non_camel_case_types an early lint

This allows us to catch these kinds of style violations much earlier, as evidenced by the large number of tests that had to be updated for this change.
2018-12-25 16:12:24 +00:00
bors
27a25df2e2 Auto merge of #56962 - nivkner:fixme_fixup4, r=pnkfelix
address some FIXME whose associated issues were marked as closed

part of #44366
2018-12-25 13:32:31 +00:00
bors
27c4335287 Auto merge of #56983 - ljedrz:parallel_query_tweaks, r=Zoxc
Parallel query tweaks

- faster stack reversal in `remove_cycle`
- insert visited queries more eagerly
- simplify stack trimming in `cycle_check`
- minor refactoring in 2 spots
2018-12-25 10:52:13 +00:00
bors
73dcb52198 Auto merge of #57116 - kennytm:revert-56944, r=alexcrichton
Revert #56944.

This should fix #57111, since #56944 is the only PR involving LLVM.

#57111 is caused by both the rustc and rust-std tarballs providing libLLVM.

r? @alexcrichton
2018-12-25 08:08:10 +00:00
Jethro Beekman
be565615db Add io and arch modules to std::os::fortanix_sgx 2018-12-25 13:11:04 +05:30
Jethro Beekman
505167d7c5 Fix build on latest git master 2018-12-25 13:10:16 +05:30
John Kåre Alsaker
0257c5adca Add a command line flag to print some query stats 2018-12-25 08:04:53 +01:00
kennytm
07f5dbc490
Revert "Rollup merge of #56944 - alexcrichton:less-thin2, r=michaelwoerister"
This reverts commit f1051b574c, reversing
changes made to 833e0b3b8a.
2018-12-25 13:25:57 +08:00
bors
e57ab2699d Auto merge of #56926 - alexcrichton:update-stdsimd, r=TimNN
Update the stdsimd submodule

This brings in a few updates:

* Update wasm intrinsic naming for atomics
* Update and reimplement most simd128 wasm intrinsics
* Other misc improvements here and there, including a small start to
  AVX-512 intrinsics
2018-12-25 03:04:14 +00:00
bors
ad781a065a Auto merge of #56836 - alexcrichton:std-backtrace-sys, r=Mark-Simulacrum
std: Use backtrace-sys from crates.io

This commit switches the standard library to using the `backtrace-sys`
crate from crates.io instead of duplicating the logic here in the Rust
repositor with the `backtrace-sys`'s crate's logic.

Eventually this will hopefully be a good step towards using the
`backtrace` crate directly from crates.io itself, but we're not quite
there yet! Hopefully this is a small incremental first step we can take.
2018-12-24 23:28:04 +00:00
bors
f960f377fd Auto merge of #57082 - matthiaskrgr:revert_56933, r=pietroalbini
x.py: fixup 6130fc884b, fix submodule handling

./x.py used to automatically check out the right commit when a submodule was outdated and ./x.py build was run
and submodules handling was enabled in config.toml (submodules = true).

But it threw an error:
[...]
failed to run: git submodule -q sync --progress src/tools/clippy

The commit removes the --progress from git submodule call.

Fixes #57080
2018-12-24 20:46:10 +00:00
Matthias Krüger
49eb1e5419 x.py: fixup 6130fc884b
./x.py used to automatically check out the right commit when a submodule was outdated and ./x.py build was run
and submodules handling was enabled in config.toml (submodules = true).

But it threw an error:
[...]
failed to run: git submodule -q sync --progress src/tools/clippy

The commit removes the --progress from git submodule call.

Fixes #57080
2018-12-24 20:23:00 +01:00
Andy Russell
6474de904c
make non_camel_case_types an early lint 2018-12-24 12:58:52 -05:00
Guillaume Gomez
dbcf68951c Add no-crate filter option on rustdoc 2018-12-24 18:19:36 +01:00
Alex Crichton
8d500572fa std: Use backtrace-sys from crates.io
This commit switches the standard library to using the `backtrace-sys`
crate from crates.io instead of duplicating the logic here in the Rust
repositor with the `backtrace-sys`'s crate's logic.

Eventually this will hopefully be a good step towards using the
`backtrace` crate directly from crates.io itself, but we're not quite
there yet! Hopefully this is a small incremental first step we can take.
2018-12-24 08:32:57 -08:00
bors
37551e9396 Auto merge of #56770 - satyarohith:patch-1, r=Centril
docs(rustc): make hello() public

Running the example code [here](https://doc.rust-lang.org/rustc/what-is-rustc.html#basic-usage) throws error:
```
error[E0603]: function `hello` is private
 --> src/main.rs:4:10
  |
4 |     foo::hello();
  |          ^^^^^
```
Making  `hello()` public fixes the problem.
2018-12-24 16:16:07 +00:00
O01eg
4e7d53db71
Search codegen backends based on target libdir instead of sysroot.
Fixes cases with custom libdir when it consists of two or more parts.
2018-12-24 18:52:03 +03:00
bors
50f3d6eccb Auto merge of #57094 - Centril:rollup, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #55470 (box: Add documentation for `From` impls)
 - #56242 (Add missing link in docs)
 - #56944 (bootstrap: Link LLVM as a dylib with ThinLTO)
 - #56978 (Add `std::os::fortanix_sgx` module)
 - #56985 (Allow testing pointers for inboundedness while forbidding dangling pointers)
 - #56986 (rustc: Move jemalloc from rustc_driver to rustc)
 - #57010 (Actually run compiletest tests on CI)
 - #57021 (Enable emission of alignment attrs for pointer params)
 - #57074 (Fix recursion limits)
 - #57085 (librustc_codegen_llvm: Don't eliminate empty structs in C ABI on linux-sparc64)

Failed merges:

r? @ghost
2018-12-24 12:31:41 +00:00
Mazdak Farrokhzad
6ce748ac38
Rollup merge of #57085 - glaubitz:sparc64-abi-fix, r=nagisa
librustc_codegen_llvm: Don't eliminate empty structs in C ABI on linux-sparc64

This is in accordance with the SPARC Compliance Definition 2.4.1,
Page 3P-12. It says that structs of up to 8 bytes (which applies
to empty structs as well) are to be passed in one register.
2018-12-24 13:29:37 +01:00
Mazdak Farrokhzad
8b0b70d327
Rollup merge of #57074 - Zoxc:pq-rec-limits, r=oli-obk
Fix recursion limits

r? @michaelwoerister
2018-12-24 13:29:36 +01:00
Mazdak Farrokhzad
c44bb0230e
Rollup merge of #57021 - nikic:arg-pointer-align, r=nagisa
Enable emission of alignment attrs for pointer params

Instead disable creation of assumptions during inlining using an LLVM opt flag. For non-inlined functions, this gives us alignment information, while not inserting any assumes that kill other optimizations.

The `-Z arg-align-attributes` option which previously controlled this behavior is removed.

Fixes #54982.

r? @nagisa

cc @eddyb who added the current behavior, and @scottmcm, who added the `-Z arg-align-attributes` flag.
2018-12-24 13:29:35 +01:00
Mazdak Farrokhzad
7011035c1c
Rollup merge of #57010 - phansch:run_compiletest_tests_on_ci, r=kennytm
Actually run compiletest tests on CI

I was assuming that https://github.com/rust-lang/rust/pull/56792 would
have resulted in compiletest tests being executed on CI. However, I
couldn't find any mentions of the unit test names in any CI logs.

This adds the compiletest test execution to the checktools.sh script.
2018-12-24 13:29:33 +01:00
Mazdak Farrokhzad
a0538c8f79
Rollup merge of #56986 - alexcrichton:move-jemalloc, r=Mark-Simulacrum
rustc: Move jemalloc from rustc_driver to rustc

This commit moves jemalloc to just the rustc binary rather than the
rustc_driver shared library, enusring that it's only used for binaries
that opt-in to it like rustc rather than other binaries using
librustc_driver like rustdoc/rls/etc. This will hopefully address #56980
2018-12-24 13:29:32 +01:00
Mazdak Farrokhzad
51f90a1313
Rollup merge of #56985 - oli-obk:const_check_bounds, r=RalfJung
Allow testing pointers for inboundedness while forbidding dangling pointers

r? @RalfJung
2018-12-24 13:29:31 +01:00
Mazdak Farrokhzad
05f3b3cbce
Rollup merge of #56978 - jethrogb:jb/sgx-os-mod, r=joshtriplett
Add `std::os::fortanix_sgx` module

This PR adds the `std::os::sgx` module to expose platform-specific APIs behind the `sgx_platform` feature gate.

Depends on https://github.com/rust-lang/rust/pull/56972 to be able to meaningfully build `std::os` documentation for non-standard targets.

Tracking issue: https://github.com/rust-lang/rust/issues/56975
2018-12-24 13:29:30 +01:00
Mazdak Farrokhzad
f1051b574c
Rollup merge of #56944 - alexcrichton:less-thin2, r=michaelwoerister
bootstrap: Link LLVM as a dylib with ThinLTO

When building a distributed compiler on Linux where we use ThinLTO to
create the LLVM shared object this commit switches the compiler to
dynamically linking that LLVM artifact instead of statically linking to
LLVM. The primary goal here is to reduce CI compile times, avoiding two+
ThinLTO builds of all of LLVM. By linking dynamically to LLVM we'll
reuse the one ThinLTO step done by LLVM's build itself.

Lots of discussion about this change can be found [here] and down. A
perf run will show whether this is worth it or not!

[here]: https://github.com/rust-lang/rust/pull/53245#issuecomment-417015334
2018-12-24 13:29:28 +01:00
Mazdak Farrokhzad
833e0b3b8a
Rollup merge of #56242 - GuillaumeGomez:iterator-missing-link, r=Centril
Add missing link in docs

r? @steveklabnik
2018-12-24 13:29:27 +01:00
Mazdak Farrokhzad
1eb87869d1
Rollup merge of #55470 - daniellimws:box-from-docs, r=Centril
box: Add documentation for `From` impls

This is a part of #51430. A brief description of the behaviour and examples are added to the documentation.

I am not sure what sort of examples to put for the `From` for `Pin` as my [code](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2015&gist=97c908f44e41c9faeffec5b61d72a03e) doesn't even manage to compile using the nightly build.

Somehow I feel that I missed out something so do let me know if more information is needed in the documentation or any of the examples require change.
2018-12-24 13:29:26 +01:00
bors
94bf2c15eb Auto merge of #57087 - Centril:rollup, r=Centril
Rollup of 14 pull requests

Successful merges:

 - #56188 (enum type instead of variant suggestion unification )
 - #56342 (Improve docs for collecting into `Option`s)
 - #56916 (Fix mutable references in `static mut`)
 - #56917 (Simplify MIR generation for logical operations)
 - #56939 (Pin stabilization)
 - #56953 (Mark tuple structs as live if their constructors are used)
 - #56964 (Remove `TokenStream::JointTree`.)
 - #56966 (Correct strings for raw pointer deref and array access suggestions)
 - #57020 (Point to cause of `fn` expected return type)
 - #57032 (fix deprecation warnings in liballoc benches)
 - #57053 (Fix alignment for array indexing)
 - #57062 (Fix a comment)
 - #57067 (Stabilize min_const_unsafe_fn in 1.33)
 - #57078 (Ignore two tests on s390x)

Failed merges:

r? @ghost
2018-12-24 07:26:19 +00:00
bors
e16928082a Auto merge of #57079 - matthiaskrgr:clippy, r=oli-obk
submodules: update clippy from a416c5e0 to fc24fce7

Fixes clippy tool state

Changes:
````
FIXME > TODO
rustup https://github.com/rust-lang/rust/pull/56992
Document map_clone known problems #498
Remove header link
test: panic at map_unit_fn.rs:202 for map() without args
rm unused file map_unit_fn.stderr
panic at map_unit_fn.rs:202 for map() without args
Change contrib.md hierarchy, link to it from readme
Workaround rust-lang/rust#43081
Teach `suspicious_else_formatting` about `if .. {..} {..}`
Link to `rustc_driver` crate in plugin
mutex_atomic: Correct location of AtomicBool and friends
Update README local run command to specify syspath
Do not mark as_ref as useless if it's followed by a method call
Changes lint sugg to bitwise and operator `&`
Run update_lints after renaming
Rename lint to MODULE_NAME_REPETITIONS
Add renaming tests
Move renaming to the right place
Implements lint for order comparisons against bool
fix(module_name_repeat): Try to register renamed lint, not valid yet
Fix an endless loop in the tests.
Fix `implicit_return` false positives.
chore(moduel_name_repeat): Rename stutter lint to module_name_repeat to avoid ableist language
Make integration tests fail on 'E0463'
base tests: make sure cargo-clippy binary can be called directly
Revert "Merge pull request #3257 from o01eg/remove-sysroot"
````

r? @oli-obk
2018-12-24 03:41:25 +00:00
Michael Karcher
65dabd6eaf librustc_codegen_llvm: Don't eliminate empty structs in C ABI on linux-sparc64
This is in accordance with the SPARC Compliance Definition 2.4.1,
Page 3P-12. It says that structs of up to 8 bytes (which applies
to empty structs as well) are to be passed in one register.
2018-12-23 23:46:45 +01:00
Mazdak Farrokhzad
dff3e41914
Rollup merge of #57078 - glaubitz:ignore-tests, r=nikic
Ignore two tests on s390x

Ignore two tests on s390x which don't make sense on s390x as they are x86-specific.
2018-12-23 23:09:15 +01:00
Mazdak Farrokhzad
975a7f01f0
Rollup merge of #57067 - Centril:stabilize-min_const_unsafe_fn, r=oli-obk
Stabilize min_const_unsafe_fn in 1.33

Fixes #55607

r? @oli-obk
2018-12-23 23:09:14 +01:00
Mazdak Farrokhzad
e4826775f2
Rollup merge of #57062 - bjorn3:patch-1, r=varkor
Fix a comment
2018-12-23 23:09:13 +01:00
Mazdak Farrokhzad
4ebc7b7e63
Rollup merge of #57053 - nikic:fix-gep-align, r=nagisa
Fix alignment for array indexing

We need to reduce the alignment with the used offset. If the offset isn't known, use the element size, as this will yield the minimum possible alignment.

This handles both direct array indexing, and array repeat expressions.

Fixes #56927.

r? @nagisa
2018-12-23 23:09:12 +01:00
Mazdak Farrokhzad
93bc72f19f
Rollup merge of #57032 - RalfJung:alloc-bench-deprecations, r=Centril
fix deprecation warnings in liballoc benches
2018-12-23 23:09:10 +01:00