Commit Graph

78321 Commits

Author SHA1 Message Date
Mark Simulacrum
53ea73a5cd
Rollup merge of #50837 - steveklabnik:revert-49767, r=QuietMisdreavus
Revert #49767

There was [some confusion](https://github.com/rust-lang/rust/pull/49767#issuecomment-389250815) and I accidentally merged a PR that wasn't ready.
2018-05-17 13:51:28 -06:00
Mark Simulacrum
54df1bf200
Rollup merge of #50818 - nnethercote:faster-normalize, r=nikomatsakis
Speed up `opt_normalize_projection_type`

`opt_normalize_projection_type` is hot in the serde and futures benchmarks in rustc-perf. These two patches speed up the execution of most runs for them by 2--4%.
2018-05-17 13:51:27 -06:00
Mark Simulacrum
f83e4d7407
Rollup merge of #50806 - oli-obk:gesundheit, r=ehuss
Add `bless` x.py subcommand for easy ui test replacement

fixes #49815

r? @nikomatsakis
2018-05-17 13:51:26 -06:00
Mark Simulacrum
c95267e3a1
Rollup merge of #50791 - bstrie:null, r=QuietMisdreavus
Fix null exclusions in grammar docs

The grammar documentation incorrectly says that comments, character literals,
and string literals may not include null.
2018-05-17 13:51:25 -06:00
Mark Simulacrum
77a4296b07
Rollup merge of #50790 - bstrie:grammar, r=steveklabnik
Fix grammar documentation wrt Unicode identifiers

The grammar defines identifiers in terms of XID_start and XID_continue,
but this is referring to the unstable non_ascii_idents feature.
The documentation implies that non_ascii_idents is forthcoming, but this
is left over from pre-1.0 documentation; in reality, non_ascii_idents
has been without even an RFC for several years now, and will not be
stabilized anytime soon. Furthermore, according to the tracking issue at
https://github.com/rust-lang/rust/issues/28979 , it's highly
questionable whether or not this feature will use XID_start or
XID_continue even when or if non_ascii_idents is stabilized.
This commit fixes this by respecifying identifiers as the usual
[a-zA-Z_][a-zA-Z0-9_]*
2018-05-17 13:51:24 -06:00
Mark Simulacrum
e1848df181
Rollup merge of #50649 - nnethercote:tweak-nearest_common_ancestor, r=nikomatsakis
Tweak `nearest_common_ancestor()`.

- Remove the "no nearest common ancestor found" case, because it's never
  hit in practise. (This means `closure_is_enclosed_by` can also be
  removed.)

- Add a comment about why `SmallVec` is used for the "seen" structures.

- Use `&Scope` instead of `Scope` to avoid some `map()` calls.

- Use `any(p)` instead of `position(p).is_some()`.

r? @nikomatsakis
2018-05-17 13:51:22 -06:00
Mark Simulacrum
b3734bd78f
Rollup merge of #50610 - estebank:fmt-str, r=Kimundi
Improve format string errors

Point at format string position inside the formatting string:
```
error: invalid format string: unmatched `}` found
  --> $DIR/format-string-error.rs:21:22
   |
LL |     let _ = format!("}");
   |                      ^ unmatched `}` in format string
```

Explain that argument names can't start with an underscore:
```
error: invalid format string: invalid argument name `_foo`
  --> $DIR/format-string-error.rs:15:23
   |
LL |     let _ = format!("{_foo}", _foo = 6usize);
   |                       ^^^^ invalid argument name in format string
   |
   = note: argument names cannot start with an underscore
```

Fix #23476.

The more accurate spans will only be seen when using `format!` directly, when using `println!` the diagnostics machinery makes the span be the entire statement.
2018-05-17 13:51:21 -06:00
Mark Simulacrum
0c0bb18a5b
Rollup merge of #50553 - clarcharr:option_xor, r=sfackler
Add Option::xor method

Implements the method requested in #50512.
2018-05-17 13:51:20 -06:00
Mark Simulacrum
6e95b8715c
Rollup merge of #50387 - phansch:remove_leftover_tab, r=alexcrichton
Remove leftover tab in libtest outputs

This removes some tabs that were present in the output of libtest.

Related #19299
Closes #50362
2018-05-17 13:51:19 -06:00
Simonas Kazlauskas
d45378216b Change align_offset to support different strides
This is necessary if we want to implement `[T]::align_to` and is more
useful in general.

This implementation effort has begun during the All Hands and represents
a month of my futile efforts to do any sort of maths. Luckily, I
found the very very nice Chris McDonald (cjm) on IRC who figured out the
core formulas for me! All the thanks for existence of this PR go to
them!

Anyway… Those formulas were mangled by yours truly into the arcane forms
you see here to squeeze out the best assembly possible on most of the
modern architectures (x86 and ARM were evaluated in practice). I mean,
just look at it: *one actual* modulo operation and everything else is
just the cheap single cycle ops! Admitedly, the naive solution might be
faster in some common scenarios, but this code absolutely butchers the
naive solution on the worst case scenario.

Alas, the result of this arcane magic also means that the code pretty
heavily relies on the preconditions holding true and breaking those
preconditions will unleash the UB-est of all UBs! So don’t.
2018-05-17 22:46:02 +03:00
Mikela
cfa26da963
Update tutorial.md 2018-05-17 12:25:24 -07:00
Keith Yeung
8b24644c42 Use EverInit instead of MaybeInit to determine initialization 2018-05-17 12:09:29 -07:00
Alex Crichton
acc874fbcd Revert "bootstrap.py: respect crt-static"
This reverts commit 5ecf29df05.
2018-05-17 10:37:22 -07:00
Alex Crichton
4796871fb7 Revert "musl: don't use the included startfiles with -crt-static"
This reverts commit a5a875d17b.
2018-05-17 10:37:22 -07:00
Alex Crichton
4ac82b4946 Revert "bootstrap: pass crt-static for the compiler host as well"
This reverts commit ec2b861c2f.
2018-05-17 10:37:22 -07:00
Alex Crichton
250bff145f Revert "musl: link crt{begin,end}.o from the system compiler"
This reverts commit 6d9154a830.
2018-05-17 10:37:22 -07:00
Alex Crichton
14507f50df Revert "Add a test for issue 36710."
This reverts commit bd94bf5738.
2018-05-17 10:37:22 -07:00
Alex Crichton
127977153a Revert "compiletest: escape CXX the same way as CC for MSVC"
This reverts commit 490d05055a.
2018-05-17 10:37:22 -07:00
steveklabnik
eac94d1053 Revert #49767
There was [some confusion](https://github.com/rust-lang/rust/pull/49767#issuecomment-389250815) and I accidentally merged a PR that wasn't ready.
2018-05-17 13:19:41 -04:00
varkor
f90033303b Make sure the type we think is uninhabited actually is 2018-05-17 18:16:59 +01:00
varkor
05067cf99e Fix an ICE when attempting to transmute an uninhabited type 2018-05-17 18:15:24 +01:00
Mikela
ec0d946b28
Make sure people know the book is free oline 2018-05-17 09:49:28 -07:00
bors
90463a6bdc Auto merge of #50629 - Mark-Simulacrum:stage-step, r=alexcrichton
Switch to bootstrapping from 1.27

It's possible the Float trait could be removed from core, but I couldn't tell whether it was intended to be removed or not. @SimonSapin may be able to comment more here; we can presumably also do that in a follow up PR as this one is already quite large.
2018-05-17 16:44:38 +00:00
Mark Simulacrum
a22af69c8f Remove MAKEFLAGS to prevent accidental inheritance 2018-05-17 08:47:25 -06:00
Mark Simulacrum
1ae3cff1eb Fix rustc binary metadata overwriting librustc metadata
In #49289, rustc was changed to emit metadata for binaries, which made
it so that the librustc.rmeta file created when compiling librustc was
overwritten by the rustc-main compilation. This commit renames the
rustc-main binary to avoid this problem.

https://github.com/rust-lang/cargo/issues/5524 has also been filed to
see if Cargo can learn to warn on this situation instead of leaving it
for the user to debug.
2018-05-17 08:47:25 -06:00
Mark Simulacrum
47f88e17ab Rename rustdoc to use underscores 2018-05-17 08:47:25 -06:00
Mark Simulacrum
9e3432447a Switch to 1.26 bootstrap compiler 2018-05-17 08:47:25 -06:00
Oliver Schneider
0ac2fd1ce2 Update docs and diagnostics 2018-05-17 16:28:36 +02:00
bors
dbd10f8175 Auto merge of #50615 - irinagpopa:rename-trans, r=nikomatsakis
Rename trans to codegen everywhere.

Part of #45274.
2018-05-17 14:10:11 +00:00
Oliver Schneider
74bfd94ec5 bless also produces .nll files now 2018-05-17 16:03:59 +02:00
Oliver Schneider
0356a61948 Fix selftests 2018-05-17 16:03:59 +02:00
Oliver Schneider
ceed8eb89c Make bless a flag instead of a subcommand 2018-05-17 16:03:59 +02:00
Oliver Schneider
37dee69dac Add bless x.py subcommand for easy ui test replacement 2018-05-17 16:03:59 +02:00
Irina Popa
b63d7e2b1c Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
est31
5e30f6b916 CheckLoopVisitor: also visit break expressions
Fixes #50802
2018-05-17 13:18:24 +02:00
Nicholas Nethercote
6872377357 Change TokenTreeOrTokenTreeVec to TokenTreeOrTokenTreeSlice.
This avoids a `to_owned` call that can be hot, speeding up the various
runs of html5ever by 1--5%, and some runs of crates.io by 2--3%.
2018-05-17 20:41:38 +10:00
bors
e3150564f8 Auto merge of #50400 - ehuss:compiletest-revisions, r=alexcrichton
compiletest: Run revisions as independent tests.

Fixes #47604.

- The output of each test is now in its own directory.
- "auxiliary" output is now under the respective test directory.
- `stage_id` removed from filenames, and instead placed in the stamp file as a hash.  This helps keep path lengths down for Windows.

In brief, the new layout looks like this:
```
<build_base>/<relative_dir>/<testname>.<revision>.<mode>/
    stamp
    <testname>.err
    <testname>.out
    a (binary)
    auxiliary/lib<auxname>.dylib
    auxiliary/<auxname>/<auxname>.err
    auxiliary/<auxname>/<auxname>.out
```
(revision and mode are optional)
2018-05-17 08:29:11 +00:00
Eric Huss
b8473de7b9 Fix running multiple targets.
The aux dir, which previously had the `stage_id` embedded in it, was picking up remnants from previous runs.
2018-05-16 22:25:20 -07:00
Eric Huss
6f414b1408 Fix update-references for tests within subdirectories. 2018-05-16 22:25:20 -07:00
Eric Huss
e3d8fc5044 compiletest: Run revisions as independent tests.
- The output of each test is now in its own directory.
- "auxiliary" output is now under the respective test directory.
- `stage_id` removed from filenames, and instead placed in the stamp file as a hash.  This helps keep path lengths down for Windows.

In brief, the new layout looks like this:
```
<build_base>/<relative_dir>/<testname>.<revision>.<mode>/
    stamp
    <testname>.err
    <testname>.out
    a (binary)
    auxiliary/lib<auxname>.dylib
    auxiliary/<auxname>/<auxname>.err
    auxiliary/<auxname>/<auxname>.out
```
(revision and mode are optional)
2018-05-16 22:25:20 -07:00
Eric Huss
2438434054 compiletest: rustfmt 2018-05-16 22:00:30 -07:00
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