]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoRollup merge of #51614 - csmoe:lit_sugg, r=estebank
Mark Rousskov [Wed, 11 Jul 2018 18:38:32 +0000 (12:38 -0600)]
Rollup merge of #51614 - csmoe:lit_sugg, r=estebank

Correct suggestion for println

Closes https://github.com/rust-lang/rust/issues/51585
r? @estebank

6 years agoAuto merge of #51702 - ecstatic-morse:infinite-loop-detection, r=oli-obk
bors [Wed, 11 Jul 2018 16:24:46 +0000 (16:24 +0000)]
Auto merge of #51702 - ecstatic-morse:infinite-loop-detection, r=oli-obk

Infinite loop detection for const evaluation

Resolves #50637.

An `EvalContext` stores the transient state (stack, heap, etc.) of the MIRI virtual machine while it executing code. As long as MIRI only executes pure functions, we can detect if a program is in a state where it will never terminate by periodically taking a "snapshot" of this transient state and comparing it to previous ones. If any two states are exactly equal, the machine must be in an infinite loop.

Instead of fully cloning a snapshot every time the detector is run, we store a snapshot's hash. Only when a hash collision occurs do we fully clone the interpreter state. Future snapshots which cause a collision will be compared against this clone, causing the interpreter to abort if they are equal.

At the moment, snapshots are not taken until MIRI has progressed a certain amount. After this threshold, snapshots are taken every `DETECTOR_SNAPSHOT_PERIOD` steps. This means that an infinite loop with period `P` will be detected after a maximum of `2 * P * DETECTOR_SNAPSHOT_PERIOD` interpreter steps. The factor of 2 arises because we only clone a snapshot after it causes a hash collision.

6 years agoAuto merge of #51553 - jD91mZM2:uds, r=sfackler
bors [Wed, 11 Jul 2018 14:15:01 +0000 (14:15 +0000)]
Auto merge of #51553 - jD91mZM2:uds, r=sfackler

Unix sockets on redox

This is done using the ipcd daemon. It's not exactly like unix sockets because there is not actually a physical file for the path, but it's close enough for a basic implementation :)
This allows mio-uds and tokio-uds to work with a few modifications as well, which is exciting!

6 years agoAuto merge of #51230 - nikic:no-verify-lto, r=pnkfelix
bors [Wed, 11 Jul 2018 12:12:13 +0000 (12:12 +0000)]
Auto merge of #51230 - nikic:no-verify-lto, r=pnkfelix

Disable LLVM verification by default

Currently -Z no-verify only controls IR verification prior to LLVM codegen, while verification is performed unconditionally both before and after linking with (Thin)LTO.

Also wondering what the sentiment is on disabling verification by default (and e.g. only enabling it on ALT builds with assertions). This does not seem terribly useful outside of rustc development and it does seem to show up in profiles (at something like 3%).

**EDIT:** A table showing the various configurations and what is enabled when.

| Configuration | Dynamic verification performed | LLVM static assertions compiled in |
| --- | --- | --- |
| alt builds | | yes |
| nightly builds | | no |
| stable builds | | no |
| CI builds | | |
| dev builds in a checkout | | |

6 years agosuggest on new snippet
csmoe [Wed, 11 Jul 2018 00:50:21 +0000 (08:50 +0800)]
suggest on new snippet

6 years agoAuto merge of #52245 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Wed, 11 Jul 2018 10:00:30 +0000 (10:00 +0000)]
Auto merge of #52245 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 5 pull requests

Successful merges:

 - #51701 (Better docs for copy_from_slice & clone_from_slice)
 - #52231 (Fix typo in error message E0277)
 - #52233 (Improve lint handling in rustdoc)
 - #52238 (Avoid unwrapping in PanicInfo doc example.)
 - #52241 (Fix typo in E0433 docs)

Failed merges:

r? @ghost

6 years agoRollup merge of #52241 - felixrabe:patch-1, r=oli-obk
Guillaume Gomez [Wed, 11 Jul 2018 08:02:04 +0000 (10:02 +0200)]
Rollup merge of #52241 - felixrabe:patch-1, r=oli-obk

Fix typo in E0433 docs

6 years agoRollup merge of #52238 - frewsxcv:frewsxcv-unwrap, r=GuillaumeGomez
Guillaume Gomez [Wed, 11 Jul 2018 08:02:03 +0000 (10:02 +0200)]
Rollup merge of #52238 - frewsxcv:frewsxcv-unwrap, r=GuillaumeGomez

Avoid unwrapping in PanicInfo doc example.

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

6 years agoRollup merge of #52233 - GuillaumeGomez:rustdoc-lint-handling, r=oli-obk
Guillaume Gomez [Wed, 11 Jul 2018 08:02:01 +0000 (10:02 +0200)]
Rollup merge of #52233 - GuillaumeGomez:rustdoc-lint-handling, r=oli-obk

Improve lint handling in rustdoc

r? @oli-obk

6 years agoRollup merge of #52231 - lqd:error_mesg, r=GuillaumeGomez
Guillaume Gomez [Wed, 11 Jul 2018 08:02:00 +0000 (10:02 +0200)]
Rollup merge of #52231 - lqd:error_mesg, r=GuillaumeGomez

Fix typo in error message E0277

Fix a typo we stumbled upon by accident :)

r? @estebank

6 years agoRollup merge of #51701 - anirudhb:master, r=frewsxcv
Guillaume Gomez [Wed, 11 Jul 2018 08:01:58 +0000 (10:01 +0200)]
Rollup merge of #51701 - anirudhb:master, r=frewsxcv

Better docs for copy_from_slice & clone_from_slice

I copy-pasted the text from clone_from_slice to copy_from_slice :smile:

@steveklabnik feel free to suggest changes.

edit: closes #49769

6 years agoAuto merge of #51966 - alexcrichton:llvm7, r=michaelwoerister
bors [Wed, 11 Jul 2018 07:20:14 +0000 (07:20 +0000)]
Auto merge of #51966 - alexcrichton:llvm7, r=michaelwoerister

Upgrade to LLVM's master branch (LLVM 7)

### Current status

~~Blocked on a [performance regression](https://github.com/rust-lang/rust/pull/51966#issuecomment-402320576). The performance regression has an [upstream LLVM issue](https://bugs.llvm.org/show_bug.cgi?id=38047) and has also [been bisected](https://reviews.llvm.org/D44282) to an LLVM revision.~~

Ready to merge!

---

This commit upgrades the main LLVM submodule to LLVM's current master branch.
The LLD submodule is updated in tandem as well as compiler-builtins.

Along the way support was also added for LLVM 7's new features. This primarily
includes the support for custom section concatenation natively in LLD so we now
add wasm custom sections in LLVM IR rather than having custom support in rustc
itself for doing so.

Some other miscellaneous changes are:

* We now pass `--gc-sections` to `wasm-ld`
* The optimization level is now passed to `wasm-ld`
* A `--stack-first` option is passed to LLD to have stack overflow always cause
  a trap instead of corrupting static data
* The wasm target for LLVM switched to `wasm32-unknown-unknown`.
* The syntax for aligned pointers has changed in LLVM IR and tests are updated
  to reflect this.
* ~~The `thumbv6m-none-eabi` target is disabled due to an [LLVM bug][llbug]~~

Nowadays we've been mostly only upgrading whenever there's a major release of
LLVM but enough changes have been happening on the wasm target that there's been
growing motivation for quite some time now to upgrade out version of LLD. To
upgrade LLD, however, we need to upgrade LLVM to avoid needing to build yet
another version of LLVM on the builders.

The revision of LLVM in use here is arbitrarily chosen. We will likely need to
continue to update it over time if and when we discover bugs. Once LLVM 7 is
fully released we can switch to that channel as well.

[llbug]: https://bugs.llvm.org/show_bug.cgi?id=37382

cc #50543

6 years agoFix typo in E0433 docs
Felix Rabe [Wed, 11 Jul 2018 05:43:10 +0000 (07:43 +0200)]
Fix typo in E0433 docs

6 years agoAvoid unwrapping in PanicInfo doc example.
Corey Farwell [Wed, 11 Jul 2018 02:25:38 +0000 (22:25 -0400)]
Avoid unwrapping in PanicInfo doc example.

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

6 years agoAuto merge of #52232 - arielb1:ill-adjusted-tuples, r=pnkfelix
bors [Wed, 11 Jul 2018 00:37:25 +0000 (00:37 +0000)]
Auto merge of #52232 - arielb1:ill-adjusted-tuples, r=pnkfelix

 use the adjusted type for cat_pattern in tuple patterns

This looks like a typo introduced in #51686.

Fixes #52213.

r? @pnkfelix

beta + stable nominating because regression + unsoundness.

6 years agoAuto merge of #52229 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Tue, 10 Jul 2018 22:40:17 +0000 (22:40 +0000)]
Auto merge of #52229 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #51612 (NLL: fix E0594 "change to mutable ref" suggestion)
 - #51722 (Updated RELEASES for 1.28.0)
 - #52064 (Clarifying how the alignment of the struct works)
 - #52149 (Add #[repr(transparent)] to Atomic* types)
 - #52151 (Trait impl settings)
 - #52171 (Correct some codegen stats counter inconsistencies)
 - #52195 (rustc: Avoid /tmp/ in graphviz writing)

Failed merges:

 - #52164 (use proper footnote syntax for references)

r? @ghost

6 years agoImprove lint handling in rustdoc
Guillaume Gomez [Tue, 10 Jul 2018 22:36:31 +0000 (00:36 +0200)]
Improve lint handling in rustdoc

6 years agoadd test for #52213
Ariel Ben-Yehuda [Tue, 10 Jul 2018 22:11:59 +0000 (01:11 +0300)]
add test for #52213

6 years agoadd a debug log for more MC failures
Ariel Ben-Yehuda [Tue, 10 Jul 2018 22:09:48 +0000 (01:09 +0300)]
add a debug log for more MC failures

I don't see why MC should fail on well-formed code, so it might be a
better idea to just add a `delay_span_bug` there (anyone remember the
`cat_expr Errd` bug from the 1.0 days?).

However, I don't think this is a good idea to backport a new delay_span_bug
into stable and this code is going away soon-ish anyway.

6 years agouse the adjusted type for cat_pattern in tuple patterns
Ariel Ben-Yehuda [Tue, 10 Jul 2018 22:08:15 +0000 (01:08 +0300)]
use the adjusted type for cat_pattern in tuple patterns

This looks like a typo introduced in #51686.

Fixes #52213.

6 years agoFix typo in error message E0277
Rémy Rakic [Tue, 10 Jul 2018 21:10:13 +0000 (23:10 +0200)]
Fix typo in error message E0277

6 years agoRollup merge of #52195 - alexcrichton:no-tmp, r=pnkfelix
Guillaume Gomez [Tue, 10 Jul 2018 20:56:43 +0000 (22:56 +0200)]
Rollup merge of #52195 - alexcrichton:no-tmp, r=pnkfelix

rustc: Avoid /tmp/ in graphviz writing

This issue was reported to security@rust-lang.org by Sebastien Marie following
our recent [security advisory][1]. Because `/tmp` is typically globally writable
it's possible for one user to place symlinks in `/tmp` pointing to files in
another user's directories, causing `rustc` to overwrite the contents of
innocent files by accident.

This patch instead defaults the output path here to the cwd which should avoid
this issue.

[1]: https://blog.rust-lang.org/2018/07/06/security-advisory-for-rustdoc.html

6 years agoRollup merge of #52171 - bharrisau:fsub-count, r=estebank
Guillaume Gomez [Tue, 10 Jul 2018 20:56:42 +0000 (22:56 +0200)]
Rollup merge of #52171 - bharrisau:fsub-count, r=estebank

Correct some codegen stats counter inconsistencies

I noticed some possible typos/inconsistencies in the codegen counters. For example, `fsub` was getting counted as an integer `sub`, whereas `fadd` was counted as an add. And `addincoming` was only being counted on the initial call.

https://github.com/rust-lang/rust/blob/dbd10f81758381339f98994b8d31814cf5e98707/src/librustc_codegen_llvm/builder.rs#L831-L841

Only remaining inconsistencies I can see are things like `fadd_fast` are counted as `fadd`. But the vector versions like `vector_reduce_fmax_fast` are counted as `vector.reduce.fmax_fast` not as their 'base' versions (`vector_reduce_fmax` is counted as `vector.reduce.fmax`).

6 years agoRollup merge of #52151 - GuillaumeGomez:trait-impl-settings, r=QuietMisdreavus
Guillaume Gomez [Tue, 10 Jul 2018 20:56:40 +0000 (22:56 +0200)]
Rollup merge of #52151 - GuillaumeGomez:trait-impl-settings, r=QuietMisdreavus

Trait impl settings

Fixes #51797.

r? @QuietMisdreavus

PS: I was annoyed by some intra link failures so I fixed them as well.

6 years agoRollup merge of #52149 - willmo:transparent-atomics, r=cramertj
Guillaume Gomez [Tue, 10 Jul 2018 20:56:39 +0000 (22:56 +0200)]
Rollup merge of #52149 - willmo:transparent-atomics, r=cramertj

Add #[repr(transparent)] to Atomic* types

This allows them to be used in `#[repr(C)]` structs without warnings. Since rust-lang/rfcs#1649 and rust-lang/rust#35603 they are already documented to have "the same in-memory representation as" their corresponding primitive types. This just makes that explicit.

This was briefly part of #51395, but was controversial and therefore dropped. But it turns out that it's essentially already documented (which I had forgotten).

6 years agoRollup merge of #52064 - Valloric:patch-1, r=cramertj
Guillaume Gomez [Tue, 10 Jul 2018 20:56:38 +0000 (22:56 +0200)]
Rollup merge of #52064 - Valloric:patch-1, r=cramertj

Clarifying how the alignment of the struct works

The docs were not specifying how to compute the alignment of the struct, so I had to spend some time trying to figure out how that works. Found the answer [on this page](http://camlorn.net/posts/April%202017/rust-struct-field-reordering.html):

> The total size of this struct is 5, but the most-aligned field is b with alignment 2, so we round up to 6 and give the struct an alignment of 2 bytes.

6 years agoRollup merge of #51722 - Aaronepower:master, r=Mark-Simulacrum
Guillaume Gomez [Tue, 10 Jul 2018 20:56:36 +0000 (22:56 +0200)]
Rollup merge of #51722 - Aaronepower:master, r=Mark-Simulacrum

Updated RELEASES for 1.28.0

[Rendered](https://github.com/Aaronepower/rust/blob/master/RELEASES.md)
r? @Mark-Simulacrum
cc @rust-lang/release

6 years agoRollup merge of #51612 - ashtneoi:51515-missing-first-char, r=pnkfelix
Guillaume Gomez [Tue, 10 Jul 2018 20:56:35 +0000 (22:56 +0200)]
Rollup merge of #51612 - ashtneoi:51515-missing-first-char, r=pnkfelix

NLL: fix E0594 "change to mutable ref" suggestion

Fix #51515.
Fix #51879.

Questions:
- [x] Is this the right place to fix this? It feels brittle, being so close to the frontend. **It's probably fine.**
- [ ] Have I missed any other cases that trigger this behavior?
- [x] Is it okay to use HELP and SUGGESTION in the UI test? **Yes.**
- [x] Do I need more tests for this? **No.**

6 years agoUpgrade to LLVM's master branch (LLVM 7)
Alex Crichton [Fri, 1 Jun 2018 17:20:00 +0000 (10:20 -0700)]
Upgrade to LLVM's master branch (LLVM 7)

This commit upgrades the main LLVM submodule to LLVM's current master branch.
The LLD submodule is updated in tandem as well as compiler-builtins.

Along the way support was also added for LLVM 7's new features. This primarily
includes the support for custom section concatenation natively in LLD so we now
add wasm custom sections in LLVM IR rather than having custom support in rustc
itself for doing so.

Some other miscellaneous changes are:

* We now pass `--gc-sections` to `wasm-ld`
* The optimization level is now passed to `wasm-ld`
* A `--stack-first` option is passed to LLD to have stack overflow always cause
  a trap instead of corrupting static data
* The wasm target for LLVM switched to `wasm32-unknown-unknown`.
* The syntax for aligned pointers has changed in LLVM IR and tests are updated
  to reflect this.
* The `thumbv6m-none-eabi` target is disabled due to an [LLVM bug][llbug]

Nowadays we've been mostly only upgrading whenever there's a major release of
LLVM but enough changes have been happening on the wasm target that there's been
growing motivation for quite some time now to upgrade out version of LLD. To
upgrade LLD, however, we need to upgrade LLVM to avoid needing to build yet
another version of LLVM on the builders.

The revision of LLVM in use here is arbitrarily chosen. We will likely need to
continue to update it over time if and when we discover bugs. Once LLVM 7 is
fully released we can switch to that channel as well.

[llbug]: https://bugs.llvm.org/show_bug.cgi?id=37382

6 years agoAuto merge of #51612 - ashtneoi:51515-missing-first-char, r=pnkfelix
bors [Tue, 10 Jul 2018 20:36:13 +0000 (20:36 +0000)]
Auto merge of #51612 - ashtneoi:51515-missing-first-char, r=pnkfelix

NLL: fix E0594 "change to mutable ref" suggestion

Fix #51515.
Fix #51879.

Questions:
- [x] Is this the right place to fix this? It feels brittle, being so close to the frontend. **It's probably fine.**
- [ ] Have I missed any other cases that trigger this behavior?
- [x] Is it okay to use HELP and SUGGESTION in the UI test? **Yes.**
- [x] Do I need more tests for this? **No.**

6 years agoChange wording for {copy, clone}_from_slice
Anirudh Balaji [Tue, 10 Jul 2018 17:56:58 +0000 (10:56 -0700)]
Change wording for {copy, clone}_from_slice

6 years agoAuto merge of #52196 - ollie27:rustdoc_ctor_imports, r=QuietMisdreavus
bors [Tue, 10 Jul 2018 17:29:30 +0000 (17:29 +0000)]
Auto merge of #52196 - ollie27:rustdoc_ctor_imports, r=QuietMisdreavus

rustdoc: Hide struct and enum variant constructor imports

This is fallout from #51425. The duplicate variant imports can be seen [here](https://doc.rust-lang.org/nightly/std/prelude/v1/index.html) for example.

This is fixing a regression so could be backported to beta.

r? @QuietMisdreavus

6 years agoAuto merge of #52191 - SimonSapin:alloc_error_handler, r=alexcrichton
bors [Tue, 10 Jul 2018 15:20:17 +0000 (15:20 +0000)]
Auto merge of #52191 - SimonSapin:alloc_error_handler, r=alexcrichton

Implement #[alloc_error_handler]

This to-be-stable attribute is equivalent to `#[lang = "oom"]`. It is required when using the `alloc` crate without the `std` crate. It is called by `handle_alloc_error`, which is in turned called by "infallible" allocations APIs such as `Vec::push`.

6 years agoAuto merge of #52168 - nikomatsakis:nll-region-name, r=estebank
bors [Tue, 10 Jul 2018 11:19:31 +0000 (11:19 +0000)]
Auto merge of #52168 - nikomatsakis:nll-region-name, r=estebank

find and highlight the `&` or `'_` in `region_name`

Before:

```
   --> $DIR/dyn-trait-underscore.rs:18:5
    |
 LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
-   |         ----- lifetime `'1` appears in this argument
 LL |     Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
    |     ^^^^^^^^^^^^^^^^^^^^^^ cast requires that `'1` must outlive `'static`
```

After:

```
   --> $DIR/dyn-trait-underscore.rs:18:5
    |
 LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
+   |                - let's call the lifetime of this reference `'1`
 LL |     Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
    |     ^^^^^^^^^^^^^^^^^^^^^^ cast requires that `'1` must outlive `'static`
```

Not intended as the final end point necessarily in any sense. I intentionally left some to-do points to fill in later:

- Does not apply to upvars in closures yet (should be relatively easy)
- Does not handle the case where we can't find a precise match very well
- And of course we can still tweak wording

but shows the basic idea of how to make the `Ty` and `hir::Ty` to find a good spot to highlight.

r? @estebank
cc @davidtwco

6 years agoAuto merge of #52204 - zackmdavis:and_the_crate_of_the_missing_module, r=oli-obk
bors [Tue, 10 Jul 2018 09:05:46 +0000 (09:05 +0000)]
Auto merge of #52204 - zackmdavis:and_the_crate_of_the_missing_module, r=oli-obk

correct import suggestions for edition 2018

For #52202.

6 years agoAuto merge of #52177 - ljedrz:bare_gcc_warning, r=alexcrichton
bors [Tue, 10 Jul 2018 06:52:20 +0000 (06:52 +0000)]
Auto merge of #52177 - ljedrz:bare_gcc_warning, r=alexcrichton

Warn windows-gnu users that the bundled gcc can't compile

Add a `DO NOT USE THIS gcc.exe FOR COMPILATION.txt` file to `lib\rustlib\*-pc-windows-gnu\bin` folders in `windows-gnu` installations in order to warn against attempting to use the bundled `gcc.exe` as a C compiler. I'm pretty sure that location is usually found manually, so this should be easily noticeable.

This mistake has been made plenty of times and has lead to misunderstandings:
Rust: [Bundled gcc (windows x64) is unable to build any c file](https://github.com/rust-lang/rust/issues/24418)
gtk-rs:    [Compiling on windows](https://github.com/gtk-rs/gtk/issues/625)
bzip2-rs: [Build failure at gcc level: blocksort.c not found](https://github.com/alexcrichton/bzip2-rs/issues/30)

Alternatives: rename the bundled `gcc.exe` to e.g. `rustc-gcc.exe` or `gcc-linker.exe`. This might require a more comprehensive change or break crates already using it as a linker.

r? @alexcrichton

6 years agoin which `use` suggestions meet edition 2018
Zack M. Davis [Tue, 10 Jul 2018 05:13:47 +0000 (22:13 -0700)]
in which `use` suggestions meet edition 2018

The intent here is to resolve #52202.

6 years agoAuto merge of #51583 - cuviper:packed_pair-bool, r=Mark-Simulacrum
bors [Tue, 10 Jul 2018 03:08:47 +0000 (03:08 +0000)]
Auto merge of #51583 - cuviper:packed_pair-bool, r=Mark-Simulacrum

Store scalar pair bools as i8 in memory

We represent `bool` as `i1` in a `ScalarPair`, unlike other aggregates,
to optimize IR for checked operators and the like.  With this patch, we
still do so when the pair is an immediate value, but we use the `i8`
memory type when the value is loaded or stored as an LLVM aggregate.

So `(bool, bool)` looks like an `{ i1, i1 }` immediate, but `{ i8, i8 }`
in memory.  When a pair is a direct function argument, `PassMode::Pair`,
it is still passed using the immediate `i1` type, but as a return value
it will use the `i8` memory type.  Also, `bool`-like` enum tags will now
use scalar pairs when possible, where they were previously excluded due
to optimization issues.

Fixes #51516.
Closes #51566.

r? @eddyb
cc @nox

6 years agoAuto merge of #52100 - nielx:fix/rust_driver-stacklimit, r=cramertj
bors [Tue, 10 Jul 2018 01:07:23 +0000 (01:07 +0000)]
Auto merge of #52100 - nielx:fix/rust_driver-stacklimit, r=cramertj

Haiku: work around the lack of setrlimit

The default Unix codepath fails, because Haiku does not implement
setrlimit for stack size. Thus we create an additional path.

By default, Haiku has the desired 16 MB stack, therefore in general
we do not have to spawn a new thread. The code has been written in
such a way that any changes in Haiku or in Rust will be adapted to.

6 years agorustdoc: Hide struct and enum variant constructor imports
Oliver Middleton [Mon, 9 Jul 2018 23:16:18 +0000 (00:16 +0100)]
rustdoc: Hide struct and enum variant constructor imports

6 years agoAuto merge of #51899 - gnzlbg:llvm501, r=alexcrichton
bors [Mon, 9 Jul 2018 23:08:51 +0000 (23:08 +0000)]
Auto merge of #51899 - gnzlbg:llvm501, r=alexcrichton

bump minimum LLVM version to 5.0

Closes #51878 .

r? @alexcrichton

--

cc @cuviper @infinity0

6 years agorustc: Avoid /tmp/ in graphviz writing
Alex Crichton [Mon, 9 Jul 2018 22:26:57 +0000 (15:26 -0700)]
rustc: Avoid /tmp/ in graphviz writing

This issue was reported to security@rust-lang.org by Sebastien Marie following
our recent [security advisory][1]. Because `/tmp` is typically globally writable
it's possible for one user to place symlinks in `/tmp` pointing to files in
another user's directories, causing `rustc` to overwrite the contents of
innocent files by accident.

This patch instead defaults the output path here to the cwd which should avoid
this issue.

[1]: https://blog.rust-lang.org/2018/07/06/security-advisory-for-rustdoc.html

6 years agoImplement #[alloc_error_handler]
Simon Sapin [Fri, 6 Jul 2018 13:49:52 +0000 (15:49 +0200)]
Implement #[alloc_error_handler]

This to-be-stable attribute is equivalent to `#[lang = "oom"]`.
It is required when using the alloc crate without the std crate.
It is called by `handle_alloc_error`, which is in turned called
by "infallible" allocations APIs such as `Vec::push`.

6 years agoAdd a test for the default allocation error hook
Simon Sapin [Tue, 19 Jun 2018 22:49:59 +0000 (00:49 +0200)]
Add a test for the default allocation error hook

6 years agoRemove `extern` on the `pub fn rust_oom` lang item in libstd, to match ABI of the...
Simon Sapin [Sun, 8 Jul 2018 14:07:08 +0000 (16:07 +0200)]
Remove `extern` on the `pub fn rust_oom` lang item in libstd, to match ABI of the declaration in liballoc

This turned out to be important on Windows.
Calling `handle_alloc_error(Layout::new::<[u8; 42]>())` caused:

```
Exception thrown at 0x00007FF7C70DC399 in a.exe: 0xC0000005:
Access violation reading location 0x000000000000002A.
```

0x2A equals 42, so it looks like the `Layout::size` field of type `usize`
was interpreted as a pointer to read from.

6 years agoAuto merge of #50250 - csmoe:wf_traitref, r=scalexm
bors [Mon, 9 Jul 2018 21:01:58 +0000 (21:01 +0000)]
Auto merge of #50250 - csmoe:wf_traitref, r=scalexm

Chalk lowering rule: WellFormed-TraitRef

Address chalk lowering "Implemented-From-Env" as part of #49177.
r? @nikomatsakis

6 years agoAdd "or destination" to {copy, clone}_from_slice example
Anirudh Balaji [Mon, 9 Jul 2018 20:41:46 +0000 (13:41 -0700)]
Add "or destination" to {copy, clone}_from_slice example

6 years agoFix issue #51515 and update test
ashtneoi [Mon, 9 Jul 2018 20:33:57 +0000 (13:33 -0700)]
Fix issue #51515 and update test

6 years agoAdd test case from issue #51515
ashtneoi [Mon, 9 Jul 2018 20:16:02 +0000 (13:16 -0700)]
Add test case from issue #51515

6 years agoChange gcc warning file name, remove unnecessary reference
ljedrz [Mon, 9 Jul 2018 19:25:16 +0000 (21:25 +0200)]
Change gcc warning file name, remove unnecessary reference

6 years agoChange wording
scalexm [Mon, 9 Jul 2018 19:20:26 +0000 (21:20 +0200)]
Change wording

6 years agoAuto merge of #51956 - GuillaumeGomez:shutdown-doc-lints, r=oli-obk
bors [Mon, 9 Jul 2018 18:50:37 +0000 (18:50 +0000)]
Auto merge of #51956 - GuillaumeGomez:shutdown-doc-lints, r=oli-obk

Fix rustdoc run failures by shutting down definitely some lints

Fixes #51661.

cc @oli-obk @arielb1 @eddyb

6 years agoadd comment about lints whitelisting
Guillaume Gomez [Mon, 9 Jul 2018 16:10:08 +0000 (18:10 +0200)]
add comment about lints whitelisting

6 years agorevert travis-ci changes
gnzlbg [Mon, 9 Jul 2018 15:25:00 +0000 (17:25 +0200)]
revert travis-ci changes

6 years agoAuto merge of #52159 - SimonSapin:alloc-prelude, r=alexcrichton
bors [Mon, 9 Jul 2018 14:29:59 +0000 (14:29 +0000)]
Auto merge of #52159 - SimonSapin:alloc-prelude, r=alexcrichton

Add the `alloc::prelude` module

It contains the re-exports that are in `std::prelude::v1` but not in `core::prelude::v1`.

Calling it prelude is somewhat of a misnomer since (unlike those modules in `std` or `core`) its contents are never implicitly imported in modules. Rather it is intended to be used with an explicit glob import like `use alloc::prelude::*;`. However there is precedent for the same misnomer with `std::io::prelude`, for example.

This new module is unstable with the same feature name as the `alloc` care. They are proposed for stabilization together in RFC https://github.com/rust-lang/rfcs/pull/2480.

6 years agoWarn windows-gnu users that the bundled gcc can't compile
ljedrz [Mon, 9 Jul 2018 13:28:12 +0000 (15:28 +0200)]
Warn windows-gnu users that the bundled gcc can't compile

6 years agorun asmjs and emscripten builds on CI (temporary)
gnzlbg [Mon, 9 Jul 2018 09:29:32 +0000 (11:29 +0200)]
run asmjs and emscripten builds on CI (temporary)

6 years agostill support LLVM4 for emscripten
gnzlbg [Mon, 9 Jul 2018 09:29:13 +0000 (11:29 +0200)]
still support LLVM4 for emscripten

6 years agobump llvm version of failing codegen test
gnzlbg [Mon, 2 Jul 2018 09:13:34 +0000 (11:13 +0200)]
bump llvm version of failing codegen test

6 years agobump minimum LLVM version to 5.0
gnzlbg [Fri, 29 Jun 2018 08:28:51 +0000 (10:28 +0200)]
bump minimum LLVM version to 5.0

6 years agoAuto merge of #52160 - euclio:include-macros, r=oli-obk
bors [Mon, 9 Jul 2018 08:41:43 +0000 (08:41 +0000)]
Auto merge of #52160 - euclio:include-macros, r=oli-obk

add regression test for #48835

Fixes #48835.

The underlying issue was fixed in #51978.

6 years agoCorrect some codegen stats counters
Ben Harris [Mon, 9 Jul 2018 07:24:42 +0000 (09:24 +0200)]
Correct some codegen stats counters

6 years agoAuto merge of #52066 - benjaminp:obligation-select, r=Mark-Simulacrum
bors [Mon, 9 Jul 2018 06:38:47 +0000 (06:38 +0000)]
Auto merge of #52066 - benjaminp:obligation-select, r=Mark-Simulacrum

Remove obsolete documentation from FufillmentContext::select comment.

The `only_new_obligations` parameter has not existed since 43756934d255603a0fb7a871f2a145380e488b71.

6 years agoAuto merge of #52166 - orlp:master, r=joshtriplett
bors [Mon, 9 Jul 2018 04:42:27 +0000 (04:42 +0000)]
Auto merge of #52166 - orlp:master, r=joshtriplett

Performance improvement of Vec's swap_remove.

The old implementation *literally* swapped and then removed, which resulted in unnecessary move instructions. The new implementation does use unsafe code, but is easy to see that it is correct.

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

6 years agoRemoved a single trailing space. Oops.
Orson Peters [Mon, 9 Jul 2018 04:31:24 +0000 (06:31 +0200)]
Removed a single trailing space. Oops.

6 years agofind and highlight the `&` or `'_` in `region_name`
Niko Matsakis [Sat, 7 Jul 2018 23:53:52 +0000 (19:53 -0400)]
find and highlight the `&` or `'_` in `region_name`

6 years agoReimplemented Vec's swap_remove to not rely on pop.
Orson Peters [Mon, 9 Jul 2018 04:13:58 +0000 (06:13 +0200)]
Reimplemented Vec's swap_remove to not rely on pop.

6 years agoPerformance improvement of Vec's swap_remove.
Orson Peters [Mon, 9 Jul 2018 03:01:39 +0000 (05:01 +0200)]
Performance improvement of Vec's swap_remove.

6 years agoadd regression test for #48835
Andy Russell [Sun, 8 Jul 2018 18:52:23 +0000 (14:52 -0400)]
add regression test for #48835

Fixes #48835.

The underlying issue was fixed in #51978.

6 years agoDelete leftover files
jD91mZM2 [Sun, 8 Jul 2018 18:48:11 +0000 (20:48 +0200)]
Delete leftover files

6 years agoAuto merge of #52152 - fabric-and-ink:edit-file-open-example, r=frewsxcv
bors [Sun, 8 Jul 2018 16:08:54 +0000 (16:08 +0000)]
Auto merge of #52152 - fabric-and-ink:edit-file-open-example, r=frewsxcv

Edit code example for File::open

It looked kinda strange and is now aligned with the other examples for `File`.

6 years agoAuto merge of #52106 - PramodBisht:issue/52049, r=oli-obk
bors [Sun, 8 Jul 2018 14:08:36 +0000 (14:08 +0000)]
Auto merge of #52106 - PramodBisht:issue/52049, r=oli-obk

Don't suggest `let` bindings if they don't help with borrows

@oli-obk I have added a condition to address #52049, right now, this is on WIP because I think code change is also required on `error_reporting.rs`. Plus I need to check if any test cases fail.
I will ping you again if everything passes

r? @oli-obk

6 years agoEdit code example for File::open
Fabian Drinck [Sun, 8 Jul 2018 14:07:09 +0000 (16:07 +0200)]
Edit code example for File::open

6 years agoFix some links
Guillaume Gomez [Sun, 8 Jul 2018 13:07:17 +0000 (15:07 +0200)]
Fix some links

6 years agoAdd setting to prevent doc auto-hide of trait implementations
Guillaume Gomez [Sun, 8 Jul 2018 13:07:06 +0000 (15:07 +0200)]
Add setting to prevent doc auto-hide of trait implementations

6 years agoAdd #[repr(transparent)] to Atomic* types
willmo [Sun, 8 Jul 2018 03:09:34 +0000 (20:09 -0700)]
Add #[repr(transparent)] to Atomic* types

This allows them to be used in #[repr(C)] structs without warnings. Since rust-lang/rfcs#1649 and rust-lang/rust#35603 they are already documented to have "the same in-memory representation as" their corresponding primitive types. This just makes that explicit.

6 years agoAuto merge of #51955 - zackmdavis:item_semi, r=oli-obk
bors [Sun, 8 Jul 2018 02:51:54 +0000 (02:51 +0000)]
Auto merge of #51955 - zackmdavis:item_semi, r=oli-obk

clarify why we're suggesting removing semicolon after braced items

Previously (issue #46186, pull-request #46258), a suggestion was added
to remove the semicolon after we fail to parse an item, but issue #51603
complains that it's still insufficiently obvious why. Let's add a note.

Resolves #51603.

6 years agoAuto merge of #51590 - bjorn3:codegen_llvm_extract, r=alexcrichton
bors [Sun, 8 Jul 2018 00:52:36 +0000 (00:52 +0000)]
Auto merge of #51590 - bjorn3:codegen_llvm_extract, r=alexcrichton

Mostly fix metadata_only backend and extract some code out of rustc_codegen_llvm

Removes dependency on the `ar` crate and removes the `llvm.enabled` config option in favour of setting `rust.codegen-backends` to `[]`.

6 years agoReformat std prelude source to show it is the sum of core and alloc preludes
Simon Sapin [Sat, 7 Jul 2018 21:16:27 +0000 (23:16 +0200)]
Reformat std prelude source to show it is the sum of core and alloc preludes

6 years agoAdd the `alloc::prelude` module
Simon Sapin [Fri, 6 Jul 2018 22:43:11 +0000 (00:43 +0200)]
Add the `alloc::prelude` module

It contains the re-exports that are in `std::prelude::v1`
but not in `core::prelude::v1`.

Calling it prelude is somewhat of a misnomer since (unlike those modules
in `std` or `core`) its contents are never implicitly imported in modules.
Rather it is intended to be used with an explicit glob import like
`use alloc::prelude::*;`.
However there is precedent for the same misnomer with `std::io::prelude`,
for example.

This new module is unstable with the same feature name as the `alloc` care.
They are proposed for stabilization together in RFC
https://github.com/rust-lang/rfcs/pull/2480

6 years agoAuto merge of #52132 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
bors [Sat, 7 Jul 2018 16:21:28 +0000 (16:21 +0000)]
Auto merge of #52132 - Mark-Simulacrum:rollup, r=Mark-Simulacrum

Rollup of 3 pull requests

Successful merges:

 - #52087 (Update musl to 1.1.19 and add patch to fix tls issue)
 - #52107 (removed redundant header file import in rustllvm.h)
 - #52131 (Ship clippy in manifests)

Failed merges:

r? @ghost

6 years agoRollup merge of #52131 - Mark-Simulacrum:ship-clippy, r=kennytm
Mark Rousskov [Sat, 7 Jul 2018 14:27:02 +0000 (08:27 -0600)]
Rollup merge of #52131 - Mark-Simulacrum:ship-clippy, r=kennytm

Ship clippy in manifests

cc @Manishearth
r? @kennytm

6 years agoRollup merge of #52107 - PramodBisht:feature/52105, r=rkruppe
Mark Rousskov [Sat, 7 Jul 2018 14:27:01 +0000 (08:27 -0600)]
Rollup merge of #52107 - PramodBisht:feature/52105, r=rkruppe

removed redundant header file import in rustllvm.h

fix #52105
removed redundant header file import in rustllvm.h
cc @wqweto

6 years agoRollup merge of #52087 - malbarbo:musl-1.1.19, r=alexcrichton
Mark Rousskov [Sat, 7 Jul 2018 14:27:00 +0000 (08:27 -0600)]
Rollup merge of #52087 - malbarbo:musl-1.1.19, r=alexcrichton

Update musl to 1.1.19 and add patch to fix tls issue

This fixes https://github.com/rust-lang/rust/issues/48967

6 years agoShip clippy in manifests
Mark Rousskov [Sat, 7 Jul 2018 14:17:24 +0000 (08:17 -0600)]
Ship clippy in manifests

6 years agoAuto merge of #52109 - michaelwoerister:ir-objs, r=alexcrichton
bors [Sat, 7 Jul 2018 14:09:49 +0000 (14:09 +0000)]
Auto merge of #52109 - michaelwoerister:ir-objs, r=alexcrichton

When doing linker-plugin based LTO, write LLVM bitcode obj-files instead of embedding the bitcode into the regular object file.

This PR makes the compiler emit LLVM bitcode object files instead of regular object files with the IR embed when compiling for linker-plugin-based LTO. The reasoning for switching the strategy is this:
- Embedding bitcode in a section of the object file actually makes us save bitcode twice in rlibs and Rust dylibs, once for linker-based LTO and once for rustc-based LTO. That's a waste of space.
- When compiling for plugin-based LTO, one usually has no use for the machine code also present in the object file. Generating it is a waste of time.
- When compiling for plugin-based LTO, `rustc` will skip running ThinLTO because the linker will do that anyway. This has the side effect of then generating poorly optimized machine code, which makes it even less useful (and may lead to users not knowing why their code is slow instead of getting an error).
- Not having machine code available makes it impossible for the linker to silently fall back to not inlining stuff across language boundaries.
- This is what Clang does and according to [the documentation](https://llvm.org/docs/BitCodeFormat.html#native-object-file-wrapper-format) is the better supported option.
- The current behavior (minus the runtime performance problems) is still available via `-Z embed-bitcode` (we might want to do this for `libstd` at some point).

r? @alexcrichton

6 years agoAdded UI testcases for #52049
Pramod Bisht [Sat, 7 Jul 2018 10:21:50 +0000 (15:51 +0530)]
Added UI testcases for #52049

6 years agoAuto merge of #51993 - TheDarkula:master, r=oli-obk
bors [Sat, 7 Jul 2018 09:09:43 +0000 (09:09 +0000)]
Auto merge of #51993 - TheDarkula:master, r=oli-obk

Omitted the walks in visit_expr() and visit_stmt()

@oli-obk

6 years agoUpdate Cargo.lock
bjorn3 [Sat, 7 Jul 2018 09:05:21 +0000 (11:05 +0200)]
Update Cargo.lock

6 years agoRevert changes to bootstrap, rustc_driver and fix {core,std}simd
bjorn3 [Sat, 30 Jun 2018 08:45:14 +0000 (10:45 +0200)]
Revert changes to bootstrap, rustc_driver and fix {core,std}simd

6 years agoHopefully fix it
bjorn3 [Sun, 24 Jun 2018 11:32:33 +0000 (13:32 +0200)]
Hopefully fix it

6 years agoOnly use coresimd when codegen_backend is LLVM
bjorn3 [Sat, 23 Jun 2018 15:23:04 +0000 (17:23 +0200)]
Only use coresimd when codegen_backend is LLVM

6 years agoMove llvm_target_features back to llvm_util
bjorn3 [Sat, 23 Jun 2018 15:22:35 +0000 (17:22 +0200)]
Move llvm_target_features back to llvm_util

6 years agoAdd missing ) to comment
bjorn3 [Sat, 23 Jun 2018 15:01:40 +0000 (17:01 +0200)]
Add missing ) to comment

6 years agoMove time_graph.rs to rustc/util
bjorn3 [Sat, 23 Jun 2018 11:52:52 +0000 (13:52 +0200)]
Move time_graph.rs to rustc/util

6 years agoUpdate Cargo.lock and move size_and_align_of_dst back
bjorn3 [Fri, 22 Jun 2018 17:28:06 +0000 (19:28 +0200)]
Update Cargo.lock and move size_and_align_of_dst back

6 years agoRemove unused rustc_driver dependency on ar
bjorn3 [Fri, 22 Jun 2018 12:35:53 +0000 (14:35 +0200)]
Remove unused rustc_driver dependency on ar

6 years agoChange comment on setting codegen-backend empty
bjorn3 [Fri, 22 Jun 2018 12:32:49 +0000 (14:32 +0200)]
Change comment on setting codegen-backend empty

6 years agoAdd comment about disabling LLVM by setting codegen-backends empty
bjorn3 [Thu, 21 Jun 2018 11:12:56 +0000 (13:12 +0200)]
Add comment about disabling LLVM by setting codegen-backends empty

6 years agoLeave fixme comment
bjorn3 [Wed, 20 Jun 2018 07:35:01 +0000 (09:35 +0200)]
Leave fixme comment