]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoAuto merge of #50573 - oli-obk:tool_sanity, r=kennytm
bors [Sun, 13 May 2018 03:44:00 +0000 (03:44 +0000)]
Auto merge of #50573 - oli-obk:tool_sanity, r=kennytm

Don't require clippy/miri for beta

r? @kennytm

cc @alexcrichton

I'm trying this out locally atm to see if it works as I think it should. Not sure how to test it for real except wait for the next beta.

fixes #50557

6 years agoAuto merge of #50235 - Zoxc:rayon, r=michaelwoerister
bors [Sun, 13 May 2018 01:18:45 +0000 (01:18 +0000)]
Auto merge of #50235 - Zoxc:rayon, r=michaelwoerister

Add a Rayon thread pool

r? @michaelwoerister

6 years agoUpdate Cargo.lock
John Kåre Alsaker [Sat, 12 May 2018 02:11:03 +0000 (04:11 +0200)]
Update Cargo.lock

6 years agoAdd parallel abstractions
John Kåre Alsaker [Wed, 25 Apr 2018 22:50:33 +0000 (00:50 +0200)]
Add parallel abstractions

6 years agoAdd a Rayon thread pool
John Kåre Alsaker [Wed, 25 Apr 2018 22:49:52 +0000 (00:49 +0200)]
Add a Rayon thread pool

6 years agoAdd Sync bounds to the crate store
John Kåre Alsaker [Sat, 3 Mar 2018 05:19:15 +0000 (06:19 +0100)]
Add Sync bounds to the crate store

6 years agoFix impl PartialOrd for InternedString
John Kåre Alsaker [Sat, 5 May 2018 10:30:14 +0000 (12:30 +0200)]
Fix impl PartialOrd for InternedString

6 years agoAuto merge of #50536 - leodasvacas:report-fullfilment-errors-in-copy-derive, r=estebank
bors [Sat, 12 May 2018 22:48:16 +0000 (22:48 +0000)]
Auto merge of #50536 - leodasvacas:report-fullfilment-errors-in-copy-derive, r=estebank

Better error reporting in Copy derive

In Copy derive, report all fulfillment erros when present and do not report errors for types tainted with `TyErr`. Also report all fields which are not Copy rather than just the first.

Also refactored `fn fully_normalize`, removing the not very useful helper function along with a FIXME to the closed issue #26721 that looks out of context now.

Fixes #50480

r? @estebank

6 years agoUse fullpath instead of recreating it
Guillaume Gomez [Sat, 12 May 2018 21:44:40 +0000 (23:44 +0200)]
Use fullpath instead of recreating it

6 years agoFix self referential impl Trait substitutions
leonardo.yvens [Sat, 12 May 2018 19:43:42 +0000 (16:43 -0300)]
Fix self referential impl Trait substitutions

A high impact bug because a lot of common traits use a `Self`
substitution by default. Should be backported to beta.

There was a check for this which wasn't catching all cases, it was made
more robust.

Fixes #49376
Fixes #50626

r? @petrochenkov

6 years agoAuto merge of #50686 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
bors [Sat, 12 May 2018 18:45:00 +0000 (18:45 +0000)]
Auto merge of #50686 - Mark-Simulacrum:rollup, r=Mark-Simulacrum

Rollup of 13 pull requests

Successful merges:

 - #50544 (Cleanup some dependencies)
 - #50545 (Made some functions in time module const)
 - #50550 (use fmt::Result where applicable)
 - #50558 (Remove all reference to DepGraph::work_products)
 - #50602 (Update canonicalize docs)
 - #50607 (Allocate Symbol strings from an arena)
 - #50613 (Migrate the toolstate update bot to rust-highfive)
 - #50624 (fs::write: Add example writing a &str)
 - #50634 (Do not silently truncate offsets for `read_at`/`write_at` on emscripten)
 - #50644 (AppVeyor: Read back trace from crash dump on failure.)
 - #50661 (Ignore non .rs files for tidy libcoretest)
 - #50663 (rustc: Allow an edition's feature on that edition)
 - #50667 (rustc: Only suggest deleting `extern crate` if it works)

Failed merges:

6 years agoFix rebase
leonardo.yvens [Sat, 12 May 2018 18:07:15 +0000 (15:07 -0300)]
Fix rebase

6 years agorustdoc: Add support for pub(restricted)
Oliver Middleton [Sat, 12 May 2018 17:25:09 +0000 (18:25 +0100)]
rustdoc: Add support for pub(restricted)

6 years agoMerge all "Copy not implemented" errors
leonardo.yvens [Wed, 9 May 2018 13:05:59 +0000 (10:05 -0300)]
Merge all "Copy not implemented" errors

6 years agoBetter error reporting in Copy derive
leonardo.yvens [Tue, 8 May 2018 14:38:35 +0000 (11:38 -0300)]
Better error reporting in Copy derive

In Copy derive, report all fulfillment erros when present and do not
report errors for types tainted with `TyErr`. Also report all fields
which are not Copy rather than just the first.

Also refactored `fn fully_normalize`, removing the not very useful
helper function along with a FIXME to the closed issue #26721 that's
looks out of context now.

6 years agoFix invalid deduplication
Guillaume Gomez [Sat, 12 May 2018 12:57:52 +0000 (14:57 +0200)]
Fix invalid deduplication

6 years agoFix items counts in search results
Guillaume Gomez [Sat, 12 May 2018 11:52:25 +0000 (13:52 +0200)]
Fix items counts in search results

6 years agoReduce js files size
Guillaume Gomez [Sat, 5 May 2018 15:06:08 +0000 (17:06 +0200)]
Reduce js files size

6 years agoRemove extra span tags
Guillaume Gomez [Sat, 5 May 2018 14:36:49 +0000 (16:36 +0200)]
Remove extra span tags

6 years agoHandle blur on theme buttons nicely
Guillaume Gomez [Thu, 26 Apr 2018 21:44:25 +0000 (23:44 +0200)]
Handle blur on theme buttons nicely

6 years agoAdd missing description in alias items
Guillaume Gomez [Thu, 26 Apr 2018 20:27:12 +0000 (22:27 +0200)]
Add missing description in alias items

6 years agoImprove alias rendering
Guillaume Gomez [Thu, 26 Apr 2018 19:14:10 +0000 (21:14 +0200)]
Improve alias rendering

6 years agoImprove results
Guillaume Gomez [Wed, 25 Apr 2018 22:36:00 +0000 (00:36 +0200)]
Improve results

6 years agoUpdate js tester tool
Guillaume Gomez [Fri, 11 May 2018 22:45:41 +0000 (00:45 +0200)]
Update js tester tool

6 years agoAdd minification process
Guillaume Gomez [Thu, 10 May 2018 22:02:05 +0000 (00:02 +0200)]
Add minification process

6 years agoAuto merge of #50684 - nikic:prepare-thinlto, r=nagisa
bors [Sat, 12 May 2018 16:23:15 +0000 (16:23 +0000)]
Auto merge of #50684 - nikic:prepare-thinlto, r=nagisa

Set PrepareForThinLTO flag when using ThinLTO

The LLVM PassManager has a PrepareForThinLTO flag, which is intended for use when compilation occurs in conjunction with linking by ThinLTO. The flag has two effects:

 * The NameAnonGlobal pass is run after all other passes, which ensures that all globals have a name.
 * In optimized builds, a number of late passes (mainly related to vectorization and unrolling) are disabled, on the rationale that these a) will increase codesize of the intermediate artifacts and b) will be run by ThinLTO again anyway.

This patch enables the use of PrepareForThinLTO if Thin or ThinLocal linking is used.

The background for this change is the CI failure in #49479, which we assume to be caused by the NameAnonGlobal pass not being run. As this changes which passes LLVM runs, this might have performance (or other) impact, so we want to land this separately.

6 years agorustc: Only suggest deleting `extern crate` if it works
Alex Crichton [Fri, 11 May 2018 18:31:08 +0000 (11:31 -0700)]
rustc: Only suggest deleting `extern crate` if it works

This commit updates one of the edition lints to only suggest deleting `extern
crate` if it actually works. Otherwise this can yield some confusing behavior
with rustfix specifically where if you accidentally deny the `rust_2018_idioms`
lint in the 2015 edition it's suggesting features that don't work!

6 years agorustc: Allow an edition's feature on that edition
Alex Crichton [Fri, 11 May 2018 16:14:23 +0000 (09:14 -0700)]
rustc: Allow an edition's feature on that edition

This commit fixes a hard error where the `#![feature(rust_2018_preview)]`
feature was forbidden to be mentioned when the `--edition 2018` flag was passed.
This instead silently accepts that feature gate despite it not being necessary.
It's intended that this will help ease the transition into the 2018 edition as
users will, for the time being, start off with the `rust_2018_preview` feature
and no longer immediately need to remove it.

Closes #50662

6 years agoDisplay the name of the failed file in tidy/libcoretest
varkor [Fri, 11 May 2018 20:36:24 +0000 (21:36 +0100)]
Display the name of the failed file in tidy/libcoretest

6 years agoIgnore non .rs files for tidy libcoretest
varkor [Fri, 11 May 2018 16:04:50 +0000 (17:04 +0100)]
Ignore non .rs files for tidy libcoretest

Previously, any file would be read, which is both unnecessary, and causes issues if irrelevant non-Unicode files were read (e.g. `.DS_STORE`).

6 years agoAppVeyor: Dump crash log on failure.
kennytm [Fri, 11 May 2018 04:30:50 +0000 (12:30 +0800)]
AppVeyor: Dump crash log on failure.

6 years agoDo not silently truncate offsets for `read_at`/`write_at` on emscripten
Tobias Bucher [Sat, 12 May 2018 00:31:38 +0000 (02:31 +0200)]
Do not silently truncate offsets for `read_at`/`write_at` on emscripten

Generate an IO error if the offset is out of bounds for the system call.

6 years agofs::write: Add example writing a &str
Aaron DeVore [Thu, 10 May 2018 18:47:31 +0000 (11:47 -0700)]
fs::write: Add example writing a &str

6 years agoRollup merge of #50607 - Zoxc:symbol-arena, r=michaelwoerister
Mark Simulacrum [Sat, 12 May 2018 13:32:30 +0000 (07:32 -0600)]
Rollup merge of #50607 - Zoxc:symbol-arena, r=michaelwoerister

Allocate Symbol strings from an arena

This is an alternative to https://github.com/rust-lang/rust/pull/50549

cc @nnethercote

r? @michaelwoerister

6 years agoRollup merge of #50602 - Screwtapello:update-canonicalize-docs, r=cramertj
Mark Simulacrum [Sat, 12 May 2018 13:32:29 +0000 (07:32 -0600)]
Rollup merge of #50602 - Screwtapello:update-canonicalize-docs, r=cramertj

Update canonicalize docs

I was recently working with file-paths in Rust, and I felt let down by the `std::fs::canonicalize` docs, so I figured I should submit a PR with some suggestions.

I was looking for a method to turn a relative path into an absolute path. The `canonicalize` docs didn't mention the words "relative" or "absolute", but they did mention resolving symlinks (which is a kind of canonicalisation and does not imply converting to absolute), so I assumed that's all it did. To remedy this, I've added the word "absolute" to the description of both `std::fs::canonicalize` and `std::path::Path::canonicalize`.

After calling `canonicalize` on Windows, I ran into a bunch of other problems I would not have expected from the function's behaviour on Linux. Specifically, if you call `canonicalize` on a path:

  - it's allowed to be much longer than it otherwise would
  - `.join("a/slash/delimited/path")` gives you a broken path that Windows can't use, where the same operation would have worked perfectly without `canonicalize` (if the path were short enough)
  - the resulting path may confuse other Windows programs if you pass it to them on the command-line, or write it to a config file that they read, etc.

...so I tried to summarize those behaviours too.

If I understand correctly, those behaviours are a side-effect of calling `GetFinalPathNameByHandle`, and the documentation says `canonicalize` might not call that function in future, so maybe those side-effects shouldn't be part of the function's documentation. However, I bet there's a lot of applications deliberately calling `canonicalize` just for the path-length-extension alone, so that particular side-effect is de-facto part of the `canonicalize` interface.

6 years agoRollup merge of #50558 - whitfin:issue-50500, r=michaelwoerister
Mark Simulacrum [Sat, 12 May 2018 13:32:28 +0000 (07:32 -0600)]
Rollup merge of #50558 - whitfin:issue-50500, r=michaelwoerister

Remove all reference to DepGraph::work_products

This is an attempt at fixing #50500. It will remove the `work_products` key from `DepGraphData` completely, in favour of just passing the relevant data around. I went in a little blindly; everything appears to work just fine but I'd appreciate any additional advice people.

I didn't want to remove too much of what was already there, so I kept the structure pretty much the same (aside from some naming tweaks) - if anyone has suggestions on how to streamline it a little better, happy to follow up.

r? @michaelwoerister

6 years agoRollup merge of #50550 - llogiq:fmt-result, r=petrochenkov
Mark Simulacrum [Sat, 12 May 2018 13:32:27 +0000 (07:32 -0600)]
Rollup merge of #50550 - llogiq:fmt-result, r=petrochenkov

use fmt::Result where applicable

This is a quite boring PR, but I think the type alias improves readability, so why not use it?

6 years agoRollup merge of #50545 - rizakrko:const_time, r=oli-obk
Mark Simulacrum [Sat, 12 May 2018 13:32:25 +0000 (07:32 -0600)]
Rollup merge of #50545 - rizakrko:const_time, r=oli-obk

Made some functions in time module const

They may be const, or i missed something?

6 years agoRollup merge of #50544 - Eijebong:cleanup_deps, r=alexcrichton
Mark Simulacrum [Sat, 12 May 2018 13:32:24 +0000 (07:32 -0600)]
Rollup merge of #50544 - Eijebong:cleanup_deps, r=alexcrichton

Cleanup some dependencies

6 years agoSet PrepareForThinLTO flag when using ThinLTO
Nikita Popov [Sat, 12 May 2018 12:07:20 +0000 (14:07 +0200)]
Set PrepareForThinLTO flag when using ThinLTO

The LLVM PassManager has a PrepareForThinLTO flag, which is intended
when compilation occurs in conjunction with linking by ThinLTO. The
flag has two effects:

 * The NameAnonGlobal pass is run after all other passes, which
   ensures that all globals have a name.
 * In optimized builds, a number of late passes (mainly related to
   vectorization and unrolling) are disabled, on the rationale that
   these a) will increase codesize of the intermediate artifacts
   and b) will be run by ThinLTO again anyway.

This patch enables the use of PrepareForThinLTO if Thin or ThinLocal
linking is used.

The background for this change is the CI failure in #49479, which
we assume to be caused by the NameAnonGlobal pass not being run.
As this changes which passes LLVM runs, this might have performance
(or other) impact, so we want to land this separately.

6 years agoAuto merge of #50352 - porglezomp:btree-no-empty-alloc, r=Gankro
bors [Sat, 12 May 2018 09:42:11 +0000 (09:42 +0000)]
Auto merge of #50352 - porglezomp:btree-no-empty-alloc, r=Gankro

Don't allocate when creating an empty BTree

Following the discussion in #50266, this adds a static instance of `LeafNode` that empty BTrees point to, and then replaces it on `insert`, `append`, and `entry`. This avoids allocating for empty maps.

Fixes #50266

r? @Gankro

6 years agoadd aarch64-unknown-openbsd support
Sébastien Marie [Sat, 12 May 2018 07:45:35 +0000 (09:45 +0200)]
add aarch64-unknown-openbsd support

6 years agoopenbsd-i686: use lld as linker by default
Sébastien Marie [Sat, 12 May 2018 07:46:07 +0000 (09:46 +0200)]
openbsd-i686: use lld as linker by default

standard binutils on openbsd is too old to do proper job with i128
code.

6 years agoAuto merge of #50476 - zackmdavis:tame_unreachable_pub_suggestion, r=Manishearth
bors [Sat, 12 May 2018 05:42:10 +0000 (05:42 +0000)]
Auto merge of #50476 - zackmdavis:tame_unreachable_pub_suggestion, r=Manishearth

don't make crazy suggestion for unreachable braced pub-use

The Higher Intermediate Representation doesn't have spans for visibility
keywords, so we were assuming that the first whitespace-delimited token
in the item span was the `pub` to be weakened. This doesn't work for
brace-grouped `use`s, which get lowered as if they were several
individual `use` statements, but with spans that only cover the braced
path-segments. Constructing a correct suggestion here presents some
challenges—until someone works those out, we can at least protect the
dignity of our compiler by not offering any suggestion at all for `use` items.

This resolves #50455 (but again, it would be desirable in the future to
make a correct suggestion instead of copping out like this).

r? @Manishearth

6 years agotypeck: Fix ICE with struct update syntax
Dan Robertson [Fri, 11 May 2018 03:56:08 +0000 (03:56 +0000)]
typeck: Fix ICE with struct update syntax

If check_expr_struct_fields fails, do not continue to record update.
If we continue to record update, the struct may cause us to ICE later
on indexing a field that may or may not exist.

6 years agoAuto merge of #50249 - Zoxc:allocation-const, r=oli-obk
bors [Sat, 12 May 2018 01:48:11 +0000 (01:48 +0000)]
Auto merge of #50249 - Zoxc:allocation-const, r=oli-obk

Introduce ConstValue and use it instead of miri's Value for constant values

r? @oli-obk

6 years agoDo not silently truncate offsets for `read_at`/`write_at` on emscripten
Tobias Bucher [Sat, 12 May 2018 00:31:38 +0000 (02:31 +0200)]
Do not silently truncate offsets for `read_at`/`write_at` on emscripten

Generate an IO error if the offset is out of bounds for the system call.

6 years agoAuto merge of #50161 - rizakrko:impl_note, r=estebank
bors [Fri, 11 May 2018 23:06:27 +0000 (23:06 +0000)]
Auto merge of #50161 - rizakrko:impl_note, r=estebank

added missing implementation hint

Fixes [#50151](https://github.com/rust-lang/rust/issues/50151).
Actually, i don't know, should following code
`let x = |ref x: isize| { x += 1; };`
emit
`note: an implementation of std::ops::AddAssign might be missing for &isize`
or
`note: this is a reference to a type that + can be applied to; you need to dereference this variable once for this operation to work`
or both

6 years agoDisplay the name of the failed file in tidy/libcoretest
varkor [Fri, 11 May 2018 20:36:24 +0000 (21:36 +0100)]
Display the name of the failed file in tidy/libcoretest

6 years agorustc: Only suggest deleting `extern crate` if it works
Alex Crichton [Fri, 11 May 2018 18:31:08 +0000 (11:31 -0700)]
rustc: Only suggest deleting `extern crate` if it works

This commit updates one of the edition lints to only suggest deleting `extern
crate` if it actually works. Otherwise this can yield some confusing behavior
with rustfix specifically where if you accidentally deny the `rust_2018_idioms`
lint in the 2015 edition it's suggesting features that don't work!

6 years agoAuto merge of #50105 - mixi:crt-included, r=alexcrichton
bors [Fri, 11 May 2018 19:46:16 +0000 (19:46 +0000)]
Auto merge of #50105 - mixi:crt-included, r=alexcrichton

Use the correct crt*.o files when linking musl targets.

This is supposed to support optionally using the system copy of musl
libc instead of the included one if supported. This currently only
affects the start files, which is enough to allow building rustc on musl
targets.

Most of the changes are analogous to crt-static.

Excluding the start files is something musl based distributions usually patch into their copy of rustc:
  - https://github.com/alpinelinux/aports/blob/eb064c8/community/rust/musl-fix-linux_musl_base.patch
  - https://github.com/voidlinux/void-packages/blob/77400fc/srcpkgs/rust/patches/link-musl-dynamically.patch

For third-party distributions that not yet carry those patches it would be nice if it was supported without the need to patch upstream sources.

## Reasons
### What breaks?
Some start files were missed when originally writing the logic to swap in musl start files (gcc comes with its own start files, which are suppressed by -nostdlib, but not manually included later on). This caused #36710, which also affects rustc with the internal llvm copy or any other system libraries that need crtbegin/crtend.

### How is it fixed?
The system linker already has all the logic to decide which start files to include, so we can just defer to it (except of course if it doesn't target musl).

### Why is it optional?
In #40113 it was first tried to remove the start files, which broke compiling musl-targeting static binaries with a glibc-targeting compiler. This is why it eventually landed without removing the start files. Being an option side-steps the issue.

### Why are the start files still installed?
This has the nice side-effect, that the produced rust-std-* binaries can still be used by on a glibc-targeting system with a rustc built against glibc.

## Does it work?
With the following build script (using [musl-cross-make](https://github.com/richfelker/musl-cross-make)): https://shadowice.org/~mixi/rust-musl/build.sh, I was able to cross-compile a musl-host musl-targeting rustc on a glibc-based system. The resulting binaries are at https://shadowice.org/~mixi/rust-musl/binaries/. This also requires #50103 and #50104 (which are also applied to the branch the build script uses).

6 years agorustc: Include semicolon when removing `extern crate`
Alex Crichton [Fri, 11 May 2018 19:34:56 +0000 (12:34 -0700)]
rustc: Include semicolon when removing `extern crate`

Currently the lint for removing `extern crate` suggests removing `extern crate`
most of the time, but the rest of the time it suggest replacing it with `use
crate_name`. Unfortunately though when spliced into the original code you're
replacing

    extern crate foo;

with

    use foo

which is syntactically invalid! This commit ensure that the trailing semicolon
is included in rustc's suggestion to ensure that the code continues to compile
afterwards.

6 years agorustc: Allow an edition's feature on that edition
Alex Crichton [Fri, 11 May 2018 16:14:23 +0000 (09:14 -0700)]
rustc: Allow an edition's feature on that edition

This commit fixes a hard error where the `#![feature(rust_2018_preview)]`
feature was forbidden to be mentioned when the `--edition 2018` flag was passed.
This instead silently accepts that feature gate despite it not being necessary.
It's intended that this will help ease the transition into the 2018 edition as
users will, for the time being, start off with the `rust_2018_preview` feature
and no longer immediately need to remove it.

Closes #50662

6 years agoIgnore non .rs files for tidy libcoretest
varkor [Fri, 11 May 2018 16:04:50 +0000 (17:04 +0100)]
Ignore non .rs files for tidy libcoretest

Previously, any file would be read, which is both unnecessary, and causes issues if irrelevant non-Unicode files were read (e.g. `.DS_STORE`).

6 years agoAuto merge of #50650 - oli-obk:clippy, r=Manishearth
bors [Fri, 11 May 2018 15:40:35 +0000 (15:40 +0000)]
Auto merge of #50650 - oli-obk:clippy, r=Manishearth

Update the clippy and miri submodules

r? @Manishearth

6 years agoUpdate an old method name in debug logging
Isaac Whitfield [Wed, 9 May 2018 15:32:04 +0000 (08:32 -0700)]
Update an old method name in debug logging

6 years agoUpdate naming in line with PR comments
Isaac Whitfield [Wed, 9 May 2018 15:16:08 +0000 (08:16 -0700)]
Update naming in line with PR comments

6 years agoNeaten a couple of long signatures
Isaac Whitfield [Wed, 9 May 2018 06:10:03 +0000 (23:10 -0700)]
Neaten a couple of long signatures

6 years agoCatch a bad reference in use clauses
Isaac Whitfield [Wed, 9 May 2018 05:26:50 +0000 (22:26 -0700)]
Catch a bad reference in use clauses

6 years agoRemove shared access to DepGraph::work_products
Isaac Whitfield [Wed, 9 May 2018 05:20:09 +0000 (22:20 -0700)]
Remove shared access to DepGraph::work_products

6 years agoAuto merge of #50332 - Zoxc:interner-split, r=michaelwoerister
bors [Fri, 11 May 2018 13:26:13 +0000 (13:26 +0000)]
Auto merge of #50332 - Zoxc:interner-split, r=michaelwoerister

Only lookup types in one interner

6 years agoresolved merge conflict
Roman Stoliar [Fri, 11 May 2018 12:14:23 +0000 (15:14 +0300)]
resolved merge conflict

6 years agofixed double ref hint
Roman Stoliar [Wed, 9 May 2018 09:38:09 +0000 (12:38 +0300)]
fixed double ref hint

6 years ago[wip] fixed some error, added missing test
Roman Stoliar [Wed, 9 May 2018 07:47:09 +0000 (10:47 +0300)]
[wip] fixed some error, added missing test

6 years agounary op filter, dereference hint
Roman Stoliar [Tue, 8 May 2018 19:20:41 +0000 (22:20 +0300)]
unary op filter, dereference hint

6 years agoadded missing implementation hint
Roman Stoliar [Sun, 22 Apr 2018 17:35:21 +0000 (20:35 +0300)]
added missing implementation hint

6 years agoUpdate the clippy and miri submodules
Oliver Schneider [Fri, 11 May 2018 12:11:06 +0000 (14:11 +0200)]
Update the clippy and miri submodules

6 years agoAdd a query to convert from ConstValue to Allocation
John Kåre Alsaker [Thu, 3 May 2018 16:29:14 +0000 (18:29 +0200)]
Add a query to convert from ConstValue to Allocation

6 years agoIntroduce ConstValue and use it instead of miri's Value for constant values
John Kåre Alsaker [Thu, 26 Apr 2018 07:18:19 +0000 (09:18 +0200)]
Introduce ConstValue and use it instead of miri's Value for constant values

6 years agoAuto merge of #50620 - alexcrichton:change-names-again, r=nikomatsakis
bors [Fri, 11 May 2018 07:28:51 +0000 (07:28 +0000)]
Auto merge of #50620 - alexcrichton:change-names-again, r=nikomatsakis

Rename the 2018 edition lint names

* `rust_2018_breakage` -> `rust_2018_compatibility` - the lint for ensuring
  that your code, in the 2015 edition, is compatible with the 2018 edition's
  semantics. This is required to pass *before* you enable the 2018 edition.
* `rust_2018_migration` -> `rust_2018_idioms` - the lint for writing idiomatic
  code after you've already enabled the 2018 edition

6 years agocompiletest: escape CXX the same way as CC for MSVC
Johannes Nixdorf [Thu, 10 May 2018 08:58:51 +0000 (10:58 +0200)]
compiletest: escape CXX the same way as CC for MSVC

6 years agoAdd a test for issue 36710.
Johannes Nixdorf [Wed, 2 May 2018 08:26:00 +0000 (10:26 +0200)]
Add a test for issue 36710.

6 years agoAuto merge of #50609 - alexcrichton:no-nll-preview, r=nikomatsakis
bors [Fri, 11 May 2018 04:45:25 +0000 (04:45 +0000)]
Auto merge of #50609 - alexcrichton:no-nll-preview, r=nikomatsakis

Remove `nll` from `rust_2018_preview`

NLL isn't quite ready yet so gonna hold off on inserting it into the preview.

6 years agoAppVeyor: Dump crash log on failure.
kennytm [Fri, 11 May 2018 04:30:50 +0000 (12:30 +0800)]
AppVeyor: Dump crash log on failure.

6 years agodon't make crazy suggestion for unreachable braced pub-use
Zack M. Davis [Sun, 6 May 2018 05:14:33 +0000 (22:14 -0700)]
don't make crazy suggestion for unreachable braced pub-use

The Higher Intermediate Representation doesn't have spans for visibility
keywords, so we were assuming that the first whitespace-delimited token
in the item span was the `pub` to be weakened. This doesn't work for
brace-grouped `use`s, which get lowered as if they were several
individual `use` statements, but with spans that only cover the braced
path-segments. Constructing a correct suggestion here presents some
challenges—until someone works those out, we can at least protect the
dignity of our compiler marking the suggestion for `use` items as
potentially incorrect.

This resolves #50455 (but again, it would be desirable in the future to
make a correct suggestion instead of copping out like this).

6 years agoAuto merge of #50440 - nikomatsakis:single-use-lifetimes, r=cramertj
bors [Fri, 11 May 2018 02:14:25 +0000 (02:14 +0000)]
Auto merge of #50440 - nikomatsakis:single-use-lifetimes, r=cramertj

Improve single-use and zero-use lifetime lints

The code now correctly identifies *when* to lint -- or more correctly, anyhow -- but it doesn't yet offer suggestions for how to fix.

(I just remembered when writing this I had meant to go back over some of these cases around e.g. impl Trait and double check that everything is right...)

cc #44752

r? @cramertj

6 years agoensure lint are issued in a stable order
Niko Matsakis [Thu, 10 May 2018 23:04:02 +0000 (19:04 -0400)]
ensure lint are issued in a stable order

6 years agoAuto merge of #50611 - alexcrichton:rollup, r=alexcrichton
bors [Thu, 10 May 2018 23:33:13 +0000 (23:33 +0000)]
Auto merge of #50611 - alexcrichton:rollup, r=alexcrichton

Rollup of 18 pull requests

Successful merges:

 - #49423 (Extend tests for RFC1598 (GAT))
 - #50010 (Give SliceIndex impls a test suite of girth befitting the implementation (and fix a UTF8 boundary check))
 - #50447 (Fix update-references for tests within subdirectories.)
 - #50514 (Pull in a wasm fix from LLVM upstream)
 - #50524 (Make DepGraph::previous_work_products immutable)
 - #50532 (Don't use Lock for heavily accessed CrateMetadata::cnum_map.)
 - #50538 ( Make CrateNum allocation more thread-safe. )
 - #50564 (Inline `Span` methods.)
 - #50565 (Use SmallVec for DepNodeIndex within dep_graph.)
 - #50569 (Allow for specifying a linker plugin for cross-language LTO)
 - #50572 (Clarify in the docs that `mul_add` is not always faster.)
 - #50574 (add fn `into_inner(self) -> (Idx, Idx)` to RangeInclusive (#49022))
 - #50575 (std: Avoid `ptr::copy` if unnecessary in `vec::Drain`)
 - #50588 (Move "See also" disambiguation links for primitive types to top)
 - #50590 (Fix tuple struct field spans)
 - #50591 (Restore RawVec::reserve* documentation)
 - #50598 (Remove unnecessary mutable borrow and resizing in DepGraph::serialize)
 - #50606 (Retry when downloading the Docker cache.)

Failed merges:

 - #50161 (added missing implementation hint)
 - #50558 (Remove all reference to DepGraph::work_products)

6 years agoSkip a memory-hungry test that OOMs
Alex Crichton [Thu, 10 May 2018 20:51:51 +0000 (13:51 -0700)]
Skip a memory-hungry test that OOMs

Attempting to fix https://travis-ci.org/rust-lang/rust/jobs/377407894 via some
selective ignoring tests

6 years agoAuto merge of #50331 - MartinHusemann:master, r=Kimundi
bors [Thu, 10 May 2018 21:02:24 +0000 (21:02 +0000)]
Auto merge of #50331 - MartinHusemann:master, r=Kimundi

Map the stack guard page with max protection on NetBSD

On NetBSD the initial mmap() protection of a mapping can not be made
less restrictive with mprotect().

So when mapping a stack guard page, use the maximum protection
we ever want to use, then mprotect() it to the permission we
want it to have initially.

Fixes #50313

6 years agoconst time
Roman Stoliar [Tue, 8 May 2018 20:47:50 +0000 (23:47 +0300)]
const time

added rustc_const_unstable attribute

extended tests

added conversion test

fixed tidy test

added feature attribute

6 years agofs::write: Add example writing a &str
Aaron DeVore [Thu, 10 May 2018 18:47:31 +0000 (11:47 -0700)]
fs::write: Add example writing a &str

6 years agorustc: leave space for fields of uninhabited types to allow partial initialization.
Eduard-Mihai Burtescu [Thu, 10 May 2018 16:24:06 +0000 (19:24 +0300)]
rustc: leave space for fields of uninhabited types to allow partial initialization.

6 years agoRename the 2018 edition lint names
Alex Crichton [Thu, 10 May 2018 18:28:11 +0000 (11:28 -0700)]
Rename the 2018 edition lint names

* `rust_2018_breakage` -> `rust_2018_compatibility` - the lint for ensuring
  that your code, in the 2015 edition, is compatible with the 2018 edition's
  semantics. This is required to pass *before* you enable the 2018 edition.
* `rust_2018_migration` -> `rust_2018_idioms` - the lint for writing idiomatic
  code after you've already enabled the 2018 edition

6 years agoRollup merge of #50606 - kennytm:retry-docker-cache, r=alexcrichton
Alex Crichton [Thu, 10 May 2018 16:35:38 +0000 (11:35 -0500)]
Rollup merge of #50606 - kennytm:retry-docker-cache, r=alexcrichton

Retry when downloading the Docker cache.

As a safety measure, prevent spuriously needing to rebuild the docker image in case the network was reset while downloading.

Also, adjusted the retry function to insert a sleep between retries, because retrying immediately will often just hit the same issue.

6 years agoRollup merge of #50598 - whitfin:unnecessary-mut-borrow, r=michaelwoerister
Alex Crichton [Thu, 10 May 2018 16:35:37 +0000 (11:35 -0500)]
Rollup merge of #50598 - whitfin:unnecessary-mut-borrow, r=michaelwoerister

Remove unnecessary mutable borrow and resizing in DepGraph::serialize

I might be mistaken, but I noticed this whilst in this file for something else. It appears that this mutable borrow is unnecessary and since it's locking it should be removed. The resizing looks redundant since nothing additional is added to the fingerprints in this function, so that can also be removed.

6 years agoRollup merge of #50591 - glandium:cleanup, r=dtolnay
Alex Crichton [Thu, 10 May 2018 16:35:35 +0000 (11:35 -0500)]
Rollup merge of #50591 - glandium:cleanup, r=dtolnay

Restore RawVec::reserve* documentation

When the RawVec::try_reserve* methods were added, they took the place of
the ::reserve* methods in the source file, and new ::reserve* methods
wrapping the new try_reserve* methods were created. But the
documentation didn't move along, such that:
 - reserve_* methods are barely documented.
 - try_reserve_* methods have unmodified documentation from reserve_*,
   such that their documentation indicate they are panicking/aborting.

This moves the documentation back to the right methods, with a
placeholder documentation for the try_reserve* methods.

6 years agoRollup merge of #50590 - estebank:off-by-one, r=nikomatsakis
Alex Crichton [Thu, 10 May 2018 16:35:34 +0000 (11:35 -0500)]
Rollup merge of #50590 - estebank:off-by-one, r=nikomatsakis

Fix tuple struct field spans

Fix #50578. Will have a merge conflict with #50536.

6 years agoRollup merge of #50588 - ExpHP:i-can-see-my-house-from-here, r=frewsxcv
Alex Crichton [Thu, 10 May 2018 16:35:33 +0000 (11:35 -0500)]
Rollup merge of #50588 - ExpHP:i-can-see-my-house-from-here, r=frewsxcv

Move "See also" disambiguation links for primitive types to top

Closes #50384.

<details>
<summary>Images</summary>

![rust-slice](https://user-images.githubusercontent.com/1411280/39843148-caa41c3e-53b7-11e8-8123-b57c25a4d9e0.png)

![rust-isize](https://user-images.githubusercontent.com/1411280/39843146-ca94b384-53b7-11e8-85f3-3f5e5d353a05.png)

</details>

r? @steveklabnik

6 years agoRollup merge of #50575 - alexcrichton:faster-drain-drop, r=sfackler
Alex Crichton [Thu, 10 May 2018 16:35:32 +0000 (11:35 -0500)]
Rollup merge of #50575 - alexcrichton:faster-drain-drop, r=sfackler

std: Avoid `ptr::copy` if unnecessary in `vec::Drain`

This commit is spawned out of a performance regression investigation in #50496.
In tracking down this regression it turned out that the `expand_statements`
function in the compiler was taking quite a long time. Further investigation
showed two key properties:

* The function was "fast" on glibc 2.24 and slow on glibc 2.23
* The hottest function was memmove from glibc

Combined together it looked like glibc gained an optimization to the memmove
function in 2.24. Ideally we don't want to rely on this optimization, so I
wanted to dig further to see what was happening.

The hottest part of `expand_statements` was `Drop for Drain` in the call to
`splice` where we insert new statements into the original vector. This *should*
be a cheap operation because we're draining and replacing iterators of the exact
same length, but under the hood memmove was being called a lot, causing a
slowdown on glibc 2.23.

It turns out that at least one of the optimizations in glibc 2.24 was that
`memmove` where the src/dst are equal becomes much faster. [This program][prog]
executes in ~2.5s against glibc 2.23 and ~0.3s against glibc 2.24, exhibiting
how glibc 2.24 is optimizing `memmove` if the src/dst are equal.

And all that brings us to what this commit itself is doing. The change here is
purely to `Drop for Drain` to avoid the call to `ptr::copy` if the region being
copied doesn't actually need to be copied. For normal usage of just `Drain`
itself this check isn't really necessary, but because `Splice` internally
contains `Drain` this provides a nice speed boost on glibc 2.23. Overall this
should fix the regression seen in #50496 on glibc 2.23 and also fix the
regression on Windows where `memmove` looks to not have this optimization.

Note that the way `splice` was called in `expand_statements` would cause a
quadratic number of elements to be copied via `memmove` which is likely why the
tuple-stress benchmark showed such a severe regression.

Closes #50496

[prog]: https://gist.github.com/alexcrichton/c05bc51c6771bba5ae5b57561a6c1cd3

6 years agoRollup merge of #50574 - s3bk:range_inclusive_into_inner, r=SimonSapin
Alex Crichton [Thu, 10 May 2018 16:35:31 +0000 (11:35 -0500)]
Rollup merge of #50574 - s3bk:range_inclusive_into_inner, r=SimonSapin

add fn `into_inner(self) -> (Idx, Idx)` to RangeInclusive (#49022)

adds `into_inner(self) -> (Idx, Idx)` to RangeInclusive
https://github.com/rust-lang/rust/issues/49022#issuecomment-387645176

6 years agoRollup merge of #50572 - frewsxcv:frewsxcv-fma, r=sfackler
Alex Crichton [Thu, 10 May 2018 16:35:29 +0000 (11:35 -0500)]
Rollup merge of #50572 - frewsxcv:frewsxcv-fma, r=sfackler

Clarify in the docs that `mul_add` is not always faster.

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

Other resources:

- https://users.rust-lang.org/t/why-does-the-mul-add-method-produce-a-more-accurate-result-with-better-performance/1626
- https://en.wikipedia.org/wiki/Multiply%E2%80%93accumulate_operation

6 years agoRollup merge of #50569 - michaelwoerister:cross-lang-lto-2, r=alexcrichton
Alex Crichton [Thu, 10 May 2018 16:35:28 +0000 (11:35 -0500)]
Rollup merge of #50569 - michaelwoerister:cross-lang-lto-2, r=alexcrichton

Allow for specifying a linker plugin for cross-language LTO

This PR makes the `-Zcross-lang-lto` flag optionally take the path to the `LLVMgold.so` linker plugin. If this path is specified, `rustc` will invoke the linker with the correct arguments (i.e. `-plugin` and various `-plugin-opt`s).

This can be used to ergonomically enable cross-language LTO for Rust programs with C/C++ dependencies:
```
clang -O2 test.c -otest.o -c -flto=thin
llvm-ar -rv libxxx.a test.o
rustc -L. main.rs -Zcross-lang-lto=/usr/lib64/LLVMgold.so -O -Clink-arg=-fuse-ld=gold
```

- Note that in theory this should work with Gold, LLD, and newer versions of binutils' LD but on my current system I could only get it to work with Gold.
- Also note that this will work best if the Clang version and Rust's LLVM version are close enough. Clang 6.0 works well with the current nightly.

r? @alexcrichton

6 years agoRollup merge of #50565 - nnethercote:try_mark_green, r=michaelwoerister
Alex Crichton [Thu, 10 May 2018 16:35:27 +0000 (11:35 -0500)]
Rollup merge of #50565 - nnethercote:try_mark_green, r=michaelwoerister

Use SmallVec for DepNodeIndex within dep_graph.

This avoids a decent number of allocations, enough to speed up
incremental runs of many rustc-benchmarks, the best by 2%.

Here are the rustc-perf benchmarks that showed an improvement of at least 1% on one run:
```
unused-warnings-check
avg: -1.7% min: -2.4% max: 0.0%
unused-warnings-opt
avg: -1.4% min: -2.0% max: 0.0%
unused-warnings
avg: -1.4% min: -2.0% max: -0.0%
tokio-webpush-simple-check
avg: -1.0% min: -1.7% max: 0.0%
futures-opt
avg: -0.9% min: -1.6% max: 0.0%
encoding
avg: -1.2% min: -1.6% max: -0.6%
encoding-check
avg: -0.9% min: -1.6% max: 0.0%
encoding-opt
avg: -0.8% min: -1.6% max: -0.1%
futures
avg: -0.9% min: -1.5% max: 0.0%
futures-check
avg: -0.9% min: -1.5% max: 0.1%
regression-31157-check
avg: -0.9% min: -1.5% max: 0.0%
regex
avg: -0.6% min: -1.4% max: 0.0%
regression-31157-opt
avg: -0.5% min: -1.4% max: 0.1%
regression-31157
avg: -0.7% min: -1.4% max: 0.2%
regex-opt
avg: -0.6% min: -1.4% max: 0.1%
hyper-check
avg: -0.8% min: -1.4% max: -0.1%
regex-check
avg: -1.0% min: -1.4% max: 0.0%
hyper-opt
avg: -0.7% min: -1.4% max: -0.1%
hyper
avg: -0.7% min: -1.3% max: 0.1%
piston-image-opt
avg: -0.4% min: -1.3% max: 0.0%
tokio-webpush-simple-opt
avg: -0.3% min: -1.3% max: 0.0%
piston-image-check
avg: -0.5% min: -1.3% max: -0.0%
syn-opt
avg: -0.5% min: -1.3% max: 0.0%
clap-rs-check
avg: -0.3% min: -1.3% max: 0.2%
piston-image
avg: -0.5% min: -1.2% max: 0.1%
syn
avg: -0.5% min: -1.2% max: 0.1%
syn-check
avg: -0.6% min: -1.2% max: -0.1%
issue-46449-opt
avg: -0.4% min: -1.2% max: -0.1%
parser-check
avg: -0.7% min: -1.2% max: 0.1%
issue-46449
avg: -0.5% min: -1.2% max: -0.0%
```

6 years agoRollup merge of #50564 - nnethercote:inline-Span-methods, r=petrochenkov
Alex Crichton [Thu, 10 May 2018 16:35:26 +0000 (11:35 -0500)]
Rollup merge of #50564 - nnethercote:inline-Span-methods, r=petrochenkov

Inline `Span` methods.

Because they are simple and hot.

This change speeds up some incremental runs of a few rustc-perf
benchmarks, the best by 3%.

Here are the ones with a speedup of at least 1%:
```
coercions
        avg: -1.1%      min: -3.4%      max: -0.2%
html5ever-opt
        avg: -0.8%      min: -1.7%      max: -0.2%
clap-rs-check
        avg: -0.3%      min: -1.4%      max: 0.7%
html5ever
        avg: -0.7%      min: -1.2%      max: -0.4%
html5ever-check
        avg: -0.9%      min: -1.1%      max: -0.8%
clap-rs
        avg: -0.4%      min: -1.1%      max: -0.1%
crates.io-check
        avg: -0.8%      min: -1.0%      max: -0.6%
serde-opt
        avg: -0.6%      min: -1.0%      max: -0.3%
```

6 years agoRollup merge of #50538 - michaelwoerister:atomic-cnums, r=Zoxc
Alex Crichton [Thu, 10 May 2018 16:35:24 +0000 (11:35 -0500)]
Rollup merge of #50538 - michaelwoerister:atomic-cnums, r=Zoxc

 Make CrateNum allocation more thread-safe.

This PR makes sure that we can't have race conditions when assigning CrateNums. It's a slight improvement but a larger refactoring of the CrateStore/CrateLoader infrastructure would be good, I think.

r? @Zoxc

6 years agoRollup merge of #50532 - michaelwoerister:lockless-cnum-map, r=Zoxc
Alex Crichton [Thu, 10 May 2018 16:35:23 +0000 (11:35 -0500)]
Rollup merge of #50532 - michaelwoerister:lockless-cnum-map, r=Zoxc

Don't use Lock for heavily accessed CrateMetadata::cnum_map.

The `cnum_map` in `CrateMetadata` is used for two things:
1. to map `CrateNums` between crates (used a lot during decoding)
2. to construct the (reverse) post order of the crate graph

For the second case, we need to modify the map after the fact, which is why the map is wrapped in a `Lock`. This is bad for the first case, which does not need the modification and does lots of small reads from the map.

This PR splits case (2) out into a separate `dependencies` field. This allows to make the `cnum_map` immutable (and shifts the interior mutability to a less busy data structure).

Fixes #50502

r? @Zoxc

6 years agoRollup merge of #50524 - wesleywiser:immutable_prev_work_products, r=michaelwoerister
Alex Crichton [Thu, 10 May 2018 16:35:21 +0000 (11:35 -0500)]
Rollup merge of #50524 - wesleywiser:immutable_prev_work_products, r=michaelwoerister

Make DepGraph::previous_work_products immutable

Fixes #50501

r? @michaelwoerister

6 years agoRollup merge of #50514 - alexcrichton:update-llvm, r=kennytm
Alex Crichton [Thu, 10 May 2018 16:35:20 +0000 (11:35 -0500)]
Rollup merge of #50514 - alexcrichton:update-llvm, r=kennytm

Pull in a wasm fix from LLVM upstream

This pulls in a fix for https://bugs.llvm.org/show_bug.cgi?id=36564 which has
already landed in upstream LLVM and should...

Closes rust-lang-nursery/rust-wasm#168

6 years agoRollup merge of #50447 - ehuss:fix-update-references, r=alexcrichton
Alex Crichton [Thu, 10 May 2018 16:35:19 +0000 (11:35 -0500)]
Rollup merge of #50447 - ehuss:fix-update-references, r=alexcrichton

Fix update-references for tests within subdirectories.

Fixes #50438.

I'll make this more robust later for #49815.