Commit Graph

78332 Commits

Author SHA1 Message Date
bors
ed9a29a976 Auto merge of #50665 - alexcrichton:fix-single-item-path-warnings, r=oli-obk
rustc: Fix `crate` lint for single-item paths

This commit fixes recommending the `crate` prefix when migrating to 2018 for
paths that look like `use foo;` or `use {bar, baz}`

Closes #50660
2018-05-17 05:00:14 +00:00
bors
b559710e58 Auto merge of #50807 - kennytm:rollup, r=kennytm
Rollup of 17 pull requests

Successful merges:

 - #50170 (Implement From for more types on Cow)
 - #50638 (Don't unconditionally set CLOEXEC twice on every fd we open on Linux)
 - #50656 (Fix `fn main() -> impl Trait` for non-`Termination` trait)
 - #50669 (rustdoc: deprecate `#![doc(passes, plugins, no_default_passes)]`)
 - #50726 (read2: Use inner function instead of closure)
 - #50728 (Fix rustdoc panic with `impl Trait` in type parameters)
 - #50736 (env: remove unwrap in examples in favor of try op)
 - #50740 (Remove LazyBTreeMap.)
 - #50752 (Add missing error codes in libsyntax-ext asm)
 - #50779 (Make mutable_noalias and arg_align_attributes be tracked)
 - #50787 (Fix run-make wasm tests)
 - #50788 (Fix an ICE when casting a nonexistent const)
 - #50789 (Ensure libraries built in stage0 have unique metadata)
 - #50793 (tidy: Add a check for empty UI test files)
 - #50797 (fix a typo in signed-integer::from_str_radix())
 - #50808 (Stabilize num::NonZeroU*)
 - #50809 (GitHub: Stop treating Cargo.lock as a generated file.)

Failed merges:
2018-05-17 02:05:39 +00:00
Nicholas Nethercote
47bc774ab6 Avoid allocations in opt_normalize_projection_type.
This patch changes `opt_normalize_project_type` so it appends
obligations to a given obligations vector, instead of returning a new
obligations vector.

This change avoids lots of allocations. In the most extreme case, for a
clean "Check" build of serde it reduces the total number of allocations
by 20%.
2018-05-17 10:35:39 +10:00
bors
4208bd5ed8 Auto merge of #50696 - ehuss:cargo-update, r=alexcrichton
Update Cargo

Unblocking PRs:
- rust-lang/cargo#5535 - Ignore tab in libtest output. (unblocks #50387)
- rust-lang/cargo#5537 - Remove -Zno-trans test. (unblocks #50615)
- rust-lang/cargo#5540 - Fix tests when CARGO_TARGET_DIR is set. (unblocks self)

Regression fixes:
- rust-lang/cargo#5503 - cargo rustc broken for tests in project with bins
- rust-lang/cargo#5520 - shared proc-macro dependency built incorrectly

Changes:
- rust-lang/cargo#5527 - Point Source Replacement to the Overriding Dependencies section
- rust-lang/cargo#5533 - Detail how to run locally-built nightly cargo
- rust-lang/cargo#5522 - Add option to set user-agent
- rust-lang/cargo#5519 - NFC: fix a couple of typos, found by codespell.
- rust-lang/cargo#5513 - Fix `panic` for binaries built during tests.
- rust-lang/cargo#5512 - simplify build_requirements
- rust-lang/cargo#5301 - Add --build-plan for 'cargo build'
- rust-lang/cargo#5460 - Be more conservative about which files are linked to the output dir.
- rust-lang/cargo#5509 - Use the new stable
- rust-lang/cargo#5507 - Does not print seconds fraction with minutes
- rust-lang/cargo#5498 - Bump to 0.29.0
- rust-lang/cargo#5497 - Mention +nightly in ARCHITECTURE.md

The PR fixes #50640.
2018-05-16 23:46:19 +00:00
Nicholas Nethercote
f778bdefdd Avoid repeated HashMap lookups in opt_normalize_projection_type.
There is a hot path through `opt_normalize_projection_type`:
- `try_start` does a cache lookup (#1).
- The result is a `NormalizedTy`.
- There are no unresolved type vars, so we call `complete`.
- `complete` does *another* cache lookup (#2), then calls
  `SnapshotMap::insert`.
- `insert` does *another* cache lookup (#3), inserting the same value
  that's already in the cache.

This patch optimizes this hot path by introducing `complete_normalized`,
for use when the value is known in advance to be a `NormalizedTy`. It
always avoids lookup #2. Furthermore, if the `NormalizedTy`'s
obligations are empty (the common case), we know that lookup #3 would be
a no-op, so we avoid it, while inserting a Noop into the `SnapshotMap`'s
undo log.
2018-05-17 09:34:20 +10:00
kennytm
3c261a4ea9
Rollup merge of #50809 - kennytm:show-cargo-lock-diff, r=alexcrichton
GitHub: Stop treating Cargo.lock as a generated file.

We do want to inspect the changes to Cargo.lock, hiding the diff by default would make it easier to miss important details like https://github.com/rust-lang/rust/pull/50629#discussion_r187556602 and https://github.com/rust-lang/rust/pull/50696#pullrequestreview-119648156
2018-05-17 05:24:42 +08:00
kennytm
8366780164
Rollup merge of #50170 - burtonageo:more_cow_from, r=alexcrichton
Implement From for more types on Cow

This is basically https://github.com/rust-lang/rust/pull/48191, except that it should be implemented in a way that doesn't break third party crates.
2018-05-17 05:22:07 +08:00
kennytm
02aedec722
Rollup merge of #50808 - SimonSapin:nonzero, r=alexcrichton
Stabilize num::NonZeroU*

Tracking issue: https://github.com/rust-lang/rust/issues/49137
2018-05-17 05:18:21 +08:00
kennytm
63ea42fd3c
Rollup merge of #50793 - jrlusby:master, r=petrochenkov
tidy: Add a check for empty UI test files

Check for empty `.stderr` and `.stdout` files in UI test directories.
Empty files could  still pass testing for `compile-pass` tests with no output
so they can get into the repo accidentally, but they are not necessary and can
be removed.

This is very much an in progress pull request. I'm having an issue with rustfmt. It wanted to reformat the entire file for almost every file by default. And when I run tidy it just errors out because it catches the empty files that are already in the repo.

My next step is goin got be to remove those empty file and see if running tidy again will actually reformat things outside of the context of `cargo fmt`

Fixes https://github.com/rust-lang/rust/issues/50785
2018-05-17 05:18:19 +08:00
kennytm
0306630925
Rollup merge of #50797 - shamiao:patch-1, r=kennytm
fix a typo in signed-integer::from_str_radix()

a minor typo in docs.
2018-05-17 05:18:18 +08:00
kennytm
e4f8132a32
Rollup merge of #50789 - cuviper:bootstrap-metadata, r=alexcrichton
Ensure libraries built in stage0 have unique metadata

Issue #50786 shows a case with local rebuild where the libraries built
by stage0 had the same suffix as stage0's own, and were accidentally
loaded by that stage0 rustc when compiling `librustc_trans`.

Now we set `__CARGO_DEFAULT_LIB_METADATA` to "bootstrap" during stage0,
rather than the release channel like usual, so the library suffix will
always be completely distinct from the stage0 compiler.
2018-05-17 05:18:17 +08:00
kennytm
d3bf72142c
Rollup merge of #50788 - varkor:missing-const-cast, r=cramertj
Fix an ICE when casting a nonexistent const

Fixes https://github.com/rust-lang/rust/issues/50599.
2018-05-17 05:18:16 +08:00
kennytm
9ced69dd57
Rollup merge of #50787 - ehuss:fix-run-make-wasm, r=alexcrichton
Fix run-make wasm tests

Fixes #50711
2018-05-17 05:18:14 +08:00
kennytm
380066bb66
Rollup merge of #50779 - nox:untracked-options, r=rkruppe
Make mutable_noalias and arg_align_attributes be tracked
2018-05-17 05:18:13 +08:00
kennytm
39129a5492
Rollup merge of #50752 - GuillaumeGomez:more-error-code-in-libsyntax-ext, r=frewsxcv
Add missing error codes in libsyntax-ext asm
2018-05-17 05:18:12 +08:00
kennytm
bb20dc124e
Rollup merge of #50740 - nnethercote:rm-LazyBTreeMap, r=cramertj
Remove LazyBTreeMap.

It was introduced in #50240 to avoid an allocation when creating a new
BTreeMap, which gave some speed-ups. But then #50352 made that the
default behaviour for BTreeMap, so LazyBTreeMap is no longer necessary.
2018-05-17 05:18:11 +08:00
kennytm
06e6173868
Rollup merge of #50736 - udoprog:env-try-op, r=shepmaster
env: remove unwrap in examples in favor of try op
2018-05-17 05:18:09 +08:00
kennytm
539a376c7e
Rollup merge of #50728 - sinkuu:fix_50702, r=GuillaumeGomez
Fix rustdoc panic with `impl Trait` in type parameters

Fixes #50702.

I'm not sure `impl Trait`s neither in arguments nor in return types are supposed to work, though.
2018-05-17 05:18:08 +08:00
kennytm
fc6c08e799
Rollup merge of #50726 - udoprog:read2-inner-fn, r=alexcrichton
read2: Use inner function instead of closure

Very minor thing, but there doesn't appear to be a reason to use a closure here.

Generated code is identical in my tests, but I believe it's clearer that nothing from the environment is being used.
2018-05-17 05:18:06 +08:00
bors
2f2a11dfc4 Auto merge of #50710 - Zoxc:value_to_constvalue, r=oli-obk
Fix conversion from Miri Value to ConstValue

This fixes an error compiling the `immeta` 0.3.6 crate. https://github.com/rust-lang/rust/issues/50707 may be fixed too.

r? @oli-obk
2018-05-16 21:01:31 +00:00
Paolo Teti
d1e7ab9cd3 Add target for Big-endian ARM Cortex-R4F/R5F MCUs
The ARM Real-Time (‘R’) profile provides high-performing processors
for safety-critical environments.
2018-05-16 22:19:02 +02:00
Jane Lusby
6ed200aaea Remove empty file introduced by rebase 2018-05-16 10:21:15 -07:00
Jane Lusby
16adb0c725 Remove empty files 2018-05-16 10:19:45 -07:00
Jane Lusby
5c10185aee tidy: Add a check for empty UI test files
Check for empty `.stderr` and `.stdout` files in UI test directories.
Empty files could  still pass testing for `compile-pass` tests with no output
so they can get into the repo accidentally, but they are not necessary and can
be removed.
2018-05-16 10:19:45 -07:00
bors
e1151c9819 Auto merge of #49479 - nox:merge-funcs, r=nagisa
Reenable the MergeFunctions pass

The crash that happened in #23566 doesn't happen anymore with the LLVM mergefunc
pass enabled and it hugely reduces code size (for example it shaves off 10% of the
final Servo executable). This patch reenables it.

For those wondering, [here are the docs from LLVM about this pass](http://llvm.org/docs/MergeFunctions.html).
2018-05-16 17:15:37 +00:00
Simon Sapin
89d9ca9b50 Stabilize num::NonZeroU*
Tracking issue: https://github.com/rust-lang/rust/issues/49137
2018-05-16 19:11:31 +02:00
Simon Sapin
c536639c1e Remove unstable deprecated num::NonZeroI* types 2018-05-16 19:09:03 +02:00
Simon Sapin
ee85bfdcc2 Make core::nonzero private
It is now an implementation detail of ptr::NonNull and num::NonZero*
2018-05-16 19:08:41 +02:00
kennytm
2d46b9032a
GitHub: Stop treating Cargo.lock as a generated file.
We do want to inspect the changes to Cargo.lock, hiding the diff by default
would miss important details like
https://github.com/rust-lang/rust/pull/50629#discussion_r187556602
2018-05-16 23:49:58 +08:00
kennytm
5074a7e130
Rollup merge of #50669 - QuietMisdreavus:deprecated-attrs, r=GuillaumeGomez
rustdoc: deprecate `#![doc(passes, plugins, no_default_passes)]`

Closes https://github.com/rust-lang/rust/issues/48164

Blocked on https://github.com/rust-lang/rust/pull/50541 - this includes those changes, which were necessary to create the UI test

cc https://github.com/rust-lang/rust/issues/44136

Turns out, there were special attributes to mess with rustdoc passes and plugins! Who knew! Since we deprecated the CLI flags for this functionality, it makes sense that we do the same for the attributes.

This PR also introduces a `#![doc(document_private_items)]` attribute, to match the `--document-private-items` flag introduced in https://github.com/rust-lang/rust/pull/44138 when the passes/plugins flags were deprecated.

I haven't done a search to see whether these attributes are being used at all, but if the flags were any indication, i don't expect to see any users of these.
2018-05-16 23:22:48 +08:00
kennytm
5cc6fd35c1
Rollup merge of #50656 - leodasvacas:fix-impl-trait-in-main-ret, r=nikomatsakis
Fix `fn main() -> impl Trait` for non-`Termination` trait

Fixes #50595.

This bug currently affects stable. Why I think we can go for hard error:
- It will in stable for at most one cycle and there is no legitimate reason to abuse it, nor any known uses in the wild.
- It only affects `bin` crates (which have a `main`), so there is little practical difference between a hard error or a deny lint, both are a one line fix.

The fix was to just unshadow a variable. Thanks @nikomatsakis for the mentoring!

r? @nikomatsakis
2018-05-16 23:22:47 +08:00
kennytm
d623f45a40
Rollup merge of #50638 - tbu-:pr_open_cloexec_once, r=nagisa
Don't unconditionally set CLOEXEC twice on every fd we open on Linux

Previously, every `open64` was accompanied by a `ioctl(…, FIOCLEX)`,
because some old Linux version would ignore the `O_CLOEXEC` flag we pass
to the `open64` function.

Now, we check whether the `CLOEXEC` flag is set on the first file we
open – if it is, we won't do extra syscalls for every opened file. If it
is not set, we fall back to the old behavior of unconditionally calling
`ioctl(…, FIOCLEX)` on newly opened files.

On old Linuxes, this amounts to one extra syscall per process, namely
the `fcntl(…, F_GETFD)` call to check the `CLOEXEC` flag.

On new Linuxes, this reduces the number of syscalls per opened file by
one, except for the first file, where it does the same number of
syscalls as before (`fcntl(…, F_GETFD)` to check the flag instead of
`ioctl(…, FIOCLEX)` to set it).
2018-05-16 23:22:45 +08:00
bors
0e325d0141 Auto merge of #50045 - est31:label_break_value, r=eddyb
Implement label break value (RFC 2046)

Implement label-break-value (#48594).
2018-05-16 14:22:17 +00:00
Eric Huss
a233268678 Update Cargo
Unblocking PRs:
- rust-lang/cargo#5535 - Ignore <tab> in libtest output. (unblocks #50387)
- rust-lang/cargo#5537 - Remove -Zno-trans test. (unblocks #50615)
- rust-lang/cargo#5540 - Fix tests when CARGO_TARGET_DIR is set. (unblocks self)

Regression fixes:
- rust-lang/cargo#5503 - cargo rustc broken for tests in project with bins
- rust-lang/cargo#5520 - (#50640) shared proc-macro dependency built incorrectly

Changes:
- rust-lang/cargo#5527 - Point Source Replacement to the Overriding Dependencies section
- rust-lang/cargo#5533 - Detail how to run locally-built nightly cargo
- rust-lang/cargo#5522 - Add option to set user-agent
- rust-lang/cargo#5519 - NFC: fix a couple of typos, found by codespell.
- rust-lang/cargo#5513 - Fix `panic` for binaries built during tests.
- rust-lang/cargo#5512 - simplify build_requirements
- rust-lang/cargo#5301 - Add --build-plan for 'cargo build'
- rust-lang/cargo#5460 - Be more conservative about which files are linked to the output dir.
- rust-lang/cargo#5509 - Use the new stable
- rust-lang/cargo#5507 - Does not print seconds fraction with minutes
- rust-lang/cargo#5498 - Bump to 0.29.0
- rust-lang/cargo#5497 - Mention +nightly in ARCHITECTURE.md
2018-05-16 06:52:43 -07:00
Eduard-Mihai Burtescu
d1f117df0f rustc_mir: allow promotion of promotable temps indexed at runtime. 2018-05-16 15:40:54 +03:00
est31
ae1553aa02 Address review comments 2018-05-16 13:58:47 +02:00
est31
dfa98318e1 Add feature gate label_break_value 2018-05-16 13:58:41 +02:00
est31
128f2b5870 Test that label break value only works on actual blocks 2018-05-16 13:56:25 +02:00
est31
f8c2598dfc Add E0696 for continue pointing to a labeled block 2018-05-16 13:56:25 +02:00
est31
50f063c75b Extend error E0695 to unlabeled continue statements 2018-05-16 13:56:25 +02:00
est31
63ef53f21d Add E0695 for unlabeled breaks 2018-05-16 13:56:24 +02:00
est31
5665980ad8 Make the compiler support the label-break-value feature
No error checking or feature gating yet
2018-05-16 13:56:24 +02:00
est31
ebca9c6ab9 Add a file with test cases 2018-05-16 13:56:24 +02:00
est31
11f5893610 label-break-value: Parsing and AST/HIR changes 2018-05-16 13:56:24 +02:00
Eduard-Mihai Burtescu
22275f46b2 rustc_mir: focus const-checking logic on whether mutation is forbidden. 2018-05-16 14:19:47 +03:00
bors
2a3f5367a2 Auto merge of #50473 - petrochenkov:pmapi, r=alexcrichton
Review proc macro API 1.2

cc https://github.com/rust-lang/rust/issues/38356

Summary of applied changes:
- Documentation for proc macro API 1.2 is expanded.
- Renamed APIs: `Term` -> `Ident`, `TokenTree::Term` -> `TokenTree::Ident`, `Op` -> `Punct`, `TokenTree::Op` -> `TokenTree::Punct`, `Op::op` -> `Punct::as_char`.
- Removed APIs: `Ident::as_str`, use `Display` impl for `Ident` instead.
- New APIs (not stabilized in 1.2): `Ident::new_raw` for creating a raw identifier (I'm not sure `new_x` it's a very idiomatic name though).
- Runtime changes:
    - `Punct::new` now ensures that the input `char` is a valid punctuation character in Rust.
    - `Ident::new` ensures that the input `str` is a valid identifier in Rust.
    - Lifetimes in proc macros are now represented as two joint tokens - `Punct('\'', Spacing::Joint)` and `Ident("lifetime_name_without_quote")` similarly to multi-character operators.
- Stabilized APIs: None yet.

A bit of motivation for renaming (although it was already stated in the review comments):
- With my compiler frontend glasses on `Ident` is the single most appropriate name for this thing, *especially* if we are doing input validation on construction. `TokenTree::Ident` effectively wraps `token::Ident` or `ast::Ident + is_raw`, its meaning is "identifier" and it's already named `ident` in declarative macros.
- Regarding `Punct`, the motivation is that `Op` is actively misleading. The thing doesn't mean an operator, it's neither a subset of operators (there is non-operator punctuation in the language), nor superset (operators can be multicharacter while this thing is always a single character). So I named it `Punct` (first proposed in [the original RFC](https://github.com/rust-lang/rfcs/pull/1566), then [by @SimonSapin](https://github.com/rust-lang/rust/issues/38356#issuecomment-276676526)) , together with input validation it's now a subset of ASCII punctuation character category (`u8::is_ascii_punctuation`).
2018-05-16 11:18:05 +00:00
Eduard-Mihai Burtescu
4fec5ef81a rustc_mir: promote borrows' underlying temps, and project at runtime. 2018-05-16 14:11:02 +03:00
Eduard-Mihai Burtescu
d79dee0b62 rustc_mir: also promote interior borrows, not just whole temps. 2018-05-16 14:11:01 +03:00
Eduard-Mihai Burtescu
b9af400a46 rustc_mir: generate an extra temporary during borrowed rvalue promotion. 2018-05-16 14:11:01 +03:00
bors
448cc578a9 Auto merge of #48557 - matthewjasper:allow-trvial-bounds, r=nikomatsakis
Implement RFC 2056 trivial constraints in where clauses

This is an implementation of the new behaviour for #48214. Tests are mostly updated to show the effects of this. Feature gate hasn't been added yet.

Some things that are worth noting and are maybe not want we want

* `&mut T: Copy` doesn't allow as much as someone might expect because there is often an implicit reborrow.
* ~There isn't a check that a where clause is well-formed any more, so `where Vec<str>: Debug` is now allowed (without a `str: Sized` bound).~

r? @nikomatsakis
2018-05-16 09:03:38 +00:00