Commit Graph

106879 Commits

Author SHA1 Message Date
Esteban Küber
24be307b53 Suggestion when encountering assoc types from hrtb
When encountering E0212, detect whether this is a representable case or
not, i.e. if it's happening on an `fn` or on an ADT. If the former,
provide a structured suggestion, otherwise note that this can't be
represented in Rust.
2020-02-11 10:49:11 -08:00
Jason Liquorish
388431160d Add self to .mailmap 2020-02-11 18:33:00 +00:00
Andreas Jonson
3b23d22e75 remove some dependencies on itertools 2020-02-11 19:28:38 +01:00
Dario Gonzalez
1f6fb338a5 make the sgx arg cleanup implementation a no op 2020-02-11 10:11:58 -08:00
bors
3f32e3001e Auto merge of #69062 - Dylan-DPC:rollup-7wpjpqu, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #66498 (Remove unused feature gates)
 - #68816 (Tweak borrow error on `FnMut` when `Fn` is expected)
 - #68824 (Enable Control Flow Guard in rustbuild)
 - #69022 (traits: preallocate 2 Vecs of known initial size)
 - #69031 (Use `dyn Trait` more in tests)
 - #69044 (Don't run coherence twice for future-compat lints)
 - #69047 (Don't rustfmt check the vendor directory.)
 - #69055 (Clean up E0307 explanation)

Failed merges:

r? @ghost
2020-02-11 17:45:49 +00:00
Jane Lusby
ec8ee7fb81 remove intentionally failing test 2020-02-11 08:39:27 -08:00
Dylan DPC
82a366ad86
Rollup merge of #69055 - GuillaumeGomez:clean-up-e0307, r=Dylan-DPC
Clean up E0307 explanation

r? @Dylan-DPC
2020-02-11 16:37:06 +01:00
Dylan DPC
c88b3494b0
Rollup merge of #69047 - ehuss:rustfmt-vendor, r=Centril
Don't rustfmt check the vendor directory.

I need to be able to run `x.py tidy` to do license checks (which requires vendored dependencies).  However, when vendoring is enabled, it wants to rustfmt check the entire vendor directory, which doesn't work.
2020-02-11 16:37:04 +01:00
Dylan DPC
0ba5e8a88f
Rollup merge of #69044 - jonas-schievink:dont-run-coherence-twice, r=davidtwco
Don't run coherence twice for future-compat lints

This fixes the regression introduced by https://github.com/rust-lang/rust/pull/65232 (which I mentioned in https://github.com/rust-lang/rust/pull/65232#issuecomment-583739037).

Old algorithm:
* Run coherence with all future-incompatible checks off, reporting errors on any overlap.
* If there's no overlap (common case), run it *again*, with the future-incompatible checks on. Report warnings for any overlap found.

New algorithm:
* Run coherence with all additional future-incompatible checks *on*, which means that we'll find *all* potentially overlapping impls immediately.
* If this found overlap, run coherence again, with the future-incompatible checks off. If that *still* gives an error, we report it. If not, it ought to be a warning.

This reduces time spent in coherence checking for the nrf52810-pac by roughly 50% relative to current master.
2020-02-11 16:37:02 +01:00
Dylan DPC
dc98cb09c0
Rollup merge of #69031 - Centril:dyntest, r=eddyb
Use `dyn Trait` more in tests

Here are some tests using the old trait object type syntax which are not testing the syntax itself.

This has been extracted from https://github.com/rust-lang/rust/pull/66364.
2020-02-11 16:37:01 +01:00
Dylan DPC
d8b4abc4ad
Rollup merge of #69022 - ljedrz:traits_tweak_vecs, r=petrochenkov
traits: preallocate 2 Vecs of known initial size

The 2 preallocations are pretty obvious; both vectors will be as big as or larger than the collections they are created from.

In `WfPredicates::normalize` the change from a functional style improves readability and should be perf-friendly, too.
2020-02-11 16:36:59 +01:00
Dylan DPC
c8c2b2bc54
Rollup merge of #68824 - ajpaverd:cfguard-rustbuild, r=Mark-Simulacrum
Enable Control Flow Guard in rustbuild

Now that Rust supports Control Flow Guard (#68180), add a config.toml option to build the standard library with CFG enabled.

r? @nagisa
2020-02-11 16:36:57 +01:00
Dylan DPC
b6024c4766
Rollup merge of #68816 - estebank:fn-mut-closure, r=varkor
Tweak borrow error on `FnMut` when `Fn` is expected

Fix #31701, fix #66097.
2020-02-11 16:36:55 +01:00
Dylan DPC
ec0cfd1d01
Rollup merge of #66498 - bjorn3:less_feature_flags, r=Dylan-DPC
Remove unused feature gates

I think many of the remaining unstable things can be easily be replaced with stable things. I have kept the `#![feature(nll)]` even though it is only necessary in `libstd`, to make regressions of it harder.
2020-02-11 16:36:54 +01:00
bors
95e0a2c50d Auto merge of #68725 - jumbatm:invert-control-in-struct_lint_level, r=Centril
Invert control in struct_lint_level.

Closes #67927

Changes the `struct_lint*` methods to take a  `decorate` function instead of a message string. This decorate function is also responsible for eventually stashing, emitting or cancelling the diagnostic. If the lint was allowed after all, the decorate function is not run at all, saving us from spending time formatting messages (and potentially other expensive work) for lints that don't end up being emitted.

r? @Centril
2020-02-11 14:45:00 +00:00
Tim Diekmann
76aa29ff5e
Preparation for allocator aware Box 2020-02-11 13:16:20 +01:00
Guillaume Gomez
e20108f9c4 Clean up E0307 explanation 2020-02-11 11:39:41 +01:00
jumbatm
b959da2f4c Fix stage2 test failures from call to span_lint.
span_lint was removed. Callers should use the `lint` method now, and
call `set_span` within the closure passed to this method.
2020-02-11 19:50:26 +10:00
jumbatm
e450996193 Avoid allocs in a few places.
- AnonymousParameters::check_trait_item
- TypeAliasBounds::check_item
- NonSnakeCase::check_snake_case
2020-02-11 19:50:26 +10:00
jumbatm
284982df60 Address review nitpicks. 2020-02-11 19:50:26 +10:00
jumbatm
0b2436f3a4 Move more into decorate functions. 2020-02-11 19:50:26 +10:00
jumbatm
aa3c458c06 Run RustFmt 2020-02-11 19:50:21 +10:00
jumbatm
2f0430a163 Make cx.span_lint methods lazy
- Make report_unsafe take decorate function
- Remove span_lint, replacing calls with struct_span_lint, as caller is
now responsible for emitting.
- Remove lookup_and_emit, replacing with just lookup which takes a
decorate function.
- Remove span_lint_note, span_lint_help.  These methods aren't easily
made lazy as standalone methods, private, and unused. If this
functionality is needed, to be lazy, they can easily be made into
Fn(&mut DiagnosticBuilder) that are meant to be called _within_ the
decorate function.
- Rename lookup_and_emit_with_diagnostics to lookup_with_diagnostics to
better reflect the fact that it doesn't emit for you.
2020-02-11 19:49:01 +10:00
jumbatm
b2e78faa15 Move more work into decorate functions. 2020-02-11 19:49:01 +10:00
jumbatm
d246385122 Run RustFmt 2020-02-11 19:49:01 +10:00
jumbatm
0634a50073 Also check for "use fully-qualified syntax". 2020-02-11 19:47:40 +10:00
jumbatm
0df1ca3033 Box decorate to avoid code bloat. 2020-02-11 19:47:40 +10:00
jumbatm
7c58ffe874 Invert control in struct_lint_level.
Caller now passes in a `decorate` function, which is only run if the
lint is allowed.
2020-02-11 19:47:40 +10:00
Andrea Canciani
4e7aeaf1b5 Improve char::is_ascii_* code
These methods explicitly check if a char is in a specific ASCII range,
therefore the `is_ascii()` check is not needed, but LLVM seems to be
unable to remove it.

WARNING: this change improves the performance on ASCII `char`s, but
complex checks such as `is_ascii_punctuation` become slower on
non-ASCII `char`s.
2020-02-11 10:22:47 +01:00
Victor Ding
a47fdb99c0 Support linking from a .rlink file
Flag `-Z no-link` was previously introduced, which allows creating
an `.rlink` file to perform compilation without linking.
This change enables linking from an `.rlink` file.
2020-02-11 20:19:28 +11:00
Mazdak Farrokhzad
ebbaf4611a simplify_try: address some of eddyb's comments 2020-02-11 10:14:50 +01:00
Marc-Antoine Perennou
1bba9cfb90 rustbuild: include channel in sanitizers installed name
Allows parallel install of different rust channels

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2020-02-11 09:40:58 +01:00
Nicholas Nethercote
ad7802f9d4 Micro-optimize the heck out of LEB128 reading and writing.
This commit makes the following writing improvements:
- Removes the unnecessary `write_to_vec` function.
- Reduces the number of conditions per loop from 2 to 1.
- Avoids a mask and a shift on the final byte.

And the following reading improvements:
- Removes an unnecessary type annotation.
- Fixes a dangerous unchecked slice access. Imagine a slice `[0x80]` --
  the current code will read past the end of the slice some number of
  bytes. The bounds check at the end will subsequently trigger, unless
  something bad (like a crash) happens first. The cost of doing bounds
  check in the loop body is negligible.
- Avoids a mask on the final byte.

And the following improvements for both reading and writing:
- Changes `for` to `loop` for the loops, avoiding an unnecessary
  condition on each iteration. This also removes the need for
  `leb128_size`.

All of these changes give significant perf wins, up to 5%.
2020-02-11 19:07:43 +11:00
bors
b6690a8c35 Auto merge of #68961 - eddyb:dbg-stack-dunk, r=nagisa
rustc_codegen_ssa: only "spill" SSA-like values to the stack for debuginfo.

This is an implementation of the idea described in https://github.com/rust-lang/rust/issues/68817#issuecomment-583719182.

In short, instead of debuginfo forcing otherwise-SSA-like MIR locals into `alloca`s, and requiring a `load` for each use (or two, for scalar pairs), the `alloca` is now *only* used for attaching debuginfo with `llvm.dbg.declare`: the `OperandRef` is stored to the `alloca`, but *never loaded* from it.

Outside of `debug_introduce_local`, nothing cares about the debuginfo-only `alloca`, and instead works with `OperandRef` the same as MIR locals without debuginfo before this PR.

This should have some of the benefits of `llvm.dbg.value`, while working today.

cc @nagisa @nikomatsakis
2020-02-11 07:36:59 +00:00
Jane Lusby
c8817aa521 backwards again, god damnit 2020-02-10 21:54:27 -08:00
Jane Lusby
6797bfd203 rule over the code in libstd with an iron fist 2020-02-10 21:38:59 -08:00
Jane Lusby
7064a0ec59 maximum alternative consistency! 2020-02-10 21:07:36 -08:00
Aaron Hill
34cf0b3267
Only use the parent if it's an opaque type 2020-02-10 23:41:16 -05:00
Eric Huss
6575abcb36 Don't rustfmt the vendor directory. 2020-02-10 19:08:24 -08:00
ImgBotApp
c18476e231
[ImgBot] Optimize images
*Total -- 10.65kb -> 8.44kb (20.82%)

/src/etc/installer/gfx/rust-logo.png -- 5.71kb -> 3.82kb (33.11%)
/src/librustdoc/html/static/down-arrow.svg -- 0.63kb -> 0.50kb (20.44%)
/src/librustdoc/html/static/wheel.svg -- 3.86kb -> 3.68kb (4.66%)
/src/librustdoc/html/static/brush.svg -- 0.47kb -> 0.44kb (4.61%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>
2020-02-11 03:01:20 +00:00
bors
dc4242d905 Auto merge of #68929 - matprec:consistent-issue-references, r=Dylan-DPC
Make issue references consistent

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

cc https://github.com/rust-lang/rust/pull/63008

r? @varkor because you reviewed the original pr
2020-02-11 02:00:27 +00:00
Jane Lusby
192b103917 make symbol printing consistent with backtrace_rs 2020-02-10 17:45:58 -08:00
Jane Lusby
de25048a23 add nice alt fmt for debug 2020-02-10 17:42:04 -08:00
Jane Lusby
230ed3ea75 use debug_map and skip empty frames 2020-02-10 17:28:04 -08:00
Jane Lusby
70c9133014 remove Some from fn name 2020-02-10 15:48:09 -08:00
Jane Lusby
87117783fb final format cleanups 2020-02-10 15:39:32 -08:00
Jane Lusby
583dd2c3ee make it compile 2020-02-10 15:18:29 -08:00
Jonas Schievink
f66793757f Don't run coherence twice for future-compat lints 2020-02-11 00:17:47 +01:00
Jane Lusby
76e6d6fe11 remove unnecessary Debug impl for BacktraceFrame 2020-02-10 15:17:40 -08:00
Jane Lusby
0d5444ffa6 remove unnecessary derives 2020-02-10 15:16:24 -08:00