Commit graph

125621 commits

Author SHA1 Message Date
Tomasz Miąsko
4fae04968e MatchBranchSimplification: copy discriminant instead of moving it
It might be necessary to use its value more than once.
2020-08-14 22:21:56 +02:00
Tomasz Miąsko
60d7d28948 MatchBranchSimplification: optimize when switching on copy operand 2020-08-14 21:58:10 +02:00
Esteban Küber
0afb9c28bb Tweak output of E0225
When encountering multiple non-auto trait bounds suggest creating a new
trait and explain what auto-traits are.
2020-08-14 12:08:49 -07:00
Denis Vasilik
75c1e2dfbb Use intra-doc links 2020-08-14 20:50:38 +02:00
chansuke
61866bc60c Use intra-doc links in mem::manually_drop & mem::maybe_uninit 2020-08-15 02:33:39 +09:00
Alexis Bourget
e97fa1e3da libstd/ffi/c_str.rs: #![deny(unsafe_op_in_unsafe_fn)], enclose unsafe operations in unsafe blocks 2020-08-14 19:33:04 +02:00
Esteban Küber
4ecdec1fb6 review comment: suggestion message wording 2020-08-14 10:16:34 -07:00
Poliorcetics
ee4f893e27
Apply suggestions from code review
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-14 19:08:09 +02:00
Matthew Jasper
c4f91bb281 Fix rustc_serialize unit tests 2020-08-14 17:34:32 +01:00
Matthew Jasper
ae7951ed43 Fix rustc_ast unit test 2020-08-14 17:34:32 +01:00
Matthew Jasper
e80654a4f1 Fix run-make test 2020-08-14 17:34:32 +01:00
Matthew Jasper
5cb4f4ed7d Fix ui fulldeps tests 2020-08-14 17:34:32 +01:00
Matthew Jasper
e46c58fa7e Fix tests and address review comments 2020-08-14 17:34:32 +01:00
Matthew Jasper
a225dddc2e Add some documentation for (De|En)codable 2020-08-14 17:34:32 +01:00
Matthew Jasper
b90018e987 Simplify arena_types macros 2020-08-14 17:34:32 +01:00
Matthew Jasper
cbcef3effc Rework rustc_serialize
- Move the type parameter from `encode` and `decode` methods to
  the trait.
- Remove `UseSpecialized(En|De)codable` traits.
- Remove blanket impls for references.
- Add `RefDecodable` trait to allow deserializing to arena-allocated
  references safely.
- Remove ability to (de)serialize HIR.
- Create proc-macros `(Ty)?(En|De)codable` to help implement these new
  traits.
2020-08-14 17:34:30 +01:00
Prabakaran Kumaresshan
84539eb7b5 remove primitive type links 2020-08-14 21:57:42 +05:30
bors
8e21bd0633 Auto merge of #75416 - richkadel:llvm-coverage-map-gen-5.3, r=richkadel
LLVM IR coverage encoding aligns closer to Clang's

I found some areas for improvement while attempting to debug the
SegFault issue when running rust programs compiled using MSVC, with
coverage instrumentation.

I discovered that LLVM's coverage writer was generating incomplete
function name variable names (that's not a typo: the name of the
variable that holds a function name).

The existing implementation used one-up numbers to distinguish
variables, and correcting the names did not fix the MSVC coverage bug,
but the fix in this PR makes the names and resulting LLVM IR easier to
follow and more consistent with Clang's implementation.

I also changed the way the `-Zinstrument-coverage` option is supported in
symbol_export.rs. The original implementation was incorrect, and the
corrected version matches the handling for `-Zprofile-generate`, as it
turns out.

(An argument could be made that maybe `-Zinstrument-coverage` should
automatically enable `-Cprofile-generate`. In fact, if
`-Cprofile-generate` is analagous to Clang's `-fprofile-generate`, as
some documentation implies, Clang always requires this flag for its
implementation of source-based code coverage. This would require a
little more validation, and if implemented, would probably require
updating some of the user-facing messages related to
`-Cprofile-generate` to not be so specific to the PGO use case.)

None of these changes fixed the MSVC coverage problems, but they should
still be welcome improvements.

Lastly, I added some additional FIXME comments in instrument_coverage.rs
describing issues I found with the generated LLVM IR that would be
resolved if the coverage instrumentation is injected with a `Statement`
instead of as a new `BasicBlock`. I describe seven advantages of this
change, but it requires some discussion before making a change like
this.

r? @tmandry
2020-08-14 16:27:00 +00:00
Stein Somers
ff45df2acf Move btree unit test to their native, privileged location 2020-08-14 17:54:09 +02:00
Prabakaran Kumaresshan
232e3d04b3 Switch to intra-doc links in os/raw/*.md 2020-08-14 21:09:35 +05:30
Stein Somers
8d1c3c116b BTreeMap: refactor splitpoint and move testing over to unit test 2020-08-14 16:41:54 +02:00
bors
55b9adfafa Auto merge of #75157 - rodrimati1992:patch-1, r=oli-obk
Constified str::from_utf8_unchecked

This would be useful for const code to use an array to construct a string using guaranteed utf8 inputs, and then create a `&str` from it.
2020-08-14 14:08:05 +00:00
Stein Somers
421e0ff3d9 BTreeMap: refactor splitpoint and move testing over to unit test 2020-08-14 14:50:30 +02:00
Jonas Berlin
90e4c905d3 Improve documentation on process::Child.std* fields
As a relative beginner, it took a while for me to figure out I could just steal the references to avoid partially moving the child and thus retain ability to call functions on it (and store it in structs etc).
2020-08-14 08:25:45 -04:00
bors
7996182bc1 Auto merge of #74777 - ssomers:btree_cleanup_7, r=Mark-Simulacrum
Stop BTreeMap casts from reborrowing

Down in btree/node.rs, the interface and use of `cast_unchecked` look a bit shady. It's really just there for inverting `forget_type` which does not borrow. By borrowing we can't write the same `cast_unchecked` in the same way at the Handle level.

No change in undefined behaviour or performance.
2020-08-14 12:00:59 +00:00
Ralf Jung
d0d9048d6c add a FIXME concerning interning of promoteds 2020-08-14 13:23:26 +02:00
Rich Kadel
ba18978875 LLVM IR coverage encoding aligns closer to Clang's
I found some areas for improvement while attempting to debug the
SegFault issue when running rust programs compiled using MSVC, with
coverage instrumentation.

I discovered that LLVM's coverage writer was generating incomplete
function name variable names (that's not a typo: the name of the
variable that holds a function name).

The existing implementation used one-up numbers to distinguish
variables, and correcting the names did not fix the MSVC coverage bug,
but the fix in this PR makes the names and resulting LLVM IR easier to
follow and more consistent with Clang's implementation.

I also changed the way the `-Zinstrument-coverage` option is supported
in symbol_export.rs. The original implementation was incorrect, and the
corrected version matches the handling for `-Zprofile-generate`, as it
turns out.

(An argument could be made that maybe `-Zinstrument-coverage` should
automatically enable `-Cprofile-generate`. In fact, if
`-Cprofile-generate` is analagous to Clang's `-fprofile-generate`, as
some documentation implies, Clang always requires this flag for its
implementation of source-based code coverage. This would require a
little more validation, and if implemented, would probably require
updating some of the user-facing messages related to
`-Cprofile-generate` to not be so specific to the PGO use case.)

None of these changes fixed the MSVC coverage problems, but they should
still be welcome improvements.

Lastly, I added some additional FIXME comments in instrument_coverage.rs
describing issues I found with the generated LLVM IR that would be
resolved if the coverage instrumentation is injected with a `Statement`
instead of as a new `BasicBlock`. I describe seven advantages of this
change, but it requires some discussion before making a change like
this.
2020-08-14 02:24:35 -07:00
bors
6b2ca8457a Auto merge of #75503 - JulianKnodt:opt_opt, r=oli-obk
Clean up some mir transform passes

I noticed a few places where there were intermediates being created
in MIR optimization passes, so I removed them.

I also changed some `Some(..)` into just `..` and wrap `Some(..)` at the function end, doing early returns for `None`.

I was generally looking for some easy optimizations in theses passes, and hopefully these should improve the runtime of these passes by a tinnnyyyyy bit.

r? @oli-obk
2020-08-14 09:23:22 +00:00
Ralf Jung
7805c200d9 answer an old question re: intern kinds 2020-08-14 11:18:55 +02:00
Ralf Jung
6e11329b54 mention 'lifetime extension' in promotion doc comments 2020-08-14 11:17:03 +02:00
kadmin
fd63bf7262 Rm allocation in uninhabited_enum_branching
Also convert `uninhabited_enum_branching` `Cow<[u128]>::to_mut`
2020-08-14 08:22:32 +00:00
Jubilee
28bca67708
Bump std's libc version to 0.2.74 2020-08-14 00:37:19 -07:00
bors
43bec40138 Auto merge of #73383 - ecstatic-morse:test-unoptimized-std, r=Mark-Simulacrum
Run standard library unit tests without optimizations in `nopt` CI jobs

This was discussed in #73288 as a way to catch similar issues in the future. This builds an unoptimized standard library with the bootstrap compiler and runs the unit tests. This takes about 2 minutes on my laptop.

I confirmed that this method works locally, although there may be a better way of implementing it. It would be better to use the stage 2 compiler instead of the bootstrap one.

Notably, there are currently four `libstd` unit tests that fail in debug mode on `i686-unkown-linux-gnu` (a tier one target):

```
failures:
    f32::tests::test_float_bits_conv
    f32::tests::test_total_cmp
    f64::tests::test_float_bits_conv
    f64::tests::test_total_cmp
```

These are the tests that prompted #73288 as well as the ones added in #72568, which is currently broken due to #73328.
2020-08-14 07:10:36 +00:00
Esteban Küber
2e9b45e1dd Recover gracefully from struct parse errors 2020-08-13 21:15:36 -07:00
bors
8e5a27766f Auto merge of #75510 - tmandry:rollup-tb9mllu, r=tmandry
Rollup of 12 pull requests

Successful merges:

 - #74650 (Correctly parse `{} && false` in tail expression)
 - #75319 (Fix ICE #75307 in `format`)
 - #75417 (Don't spill operands onto the stack in naked functions)
 - #75452 (self-profile: Cache more query key strings when doing self-profiling.)
 - #75459 (fix LocalInfo doc comment)
 - #75462 (Remove unused tcx parameter)
 - #75467 (Fix E0741 error code explanation)
 - #75471 (Change registered "program name" for -Cllvm-args usage messages)
 - #75477 (Expand function pointer docs)
 - #75479 (make rustc-docs component available to rustup)
 - #75496 (Prioritization WG: Open Zulip topics only for `I-prioritize` issues)
 - #75500 (Disable zlib in LLVM on aarch64-apple-darwin)

Failed merges:

r? @ghost
2020-08-14 02:59:44 +00:00
Ivan Tham
d2ecfcf21d Update liballoc vec doc link 2020-08-14 10:52:09 +08:00
Ivan Tham
e0d215ff9e Update src/liballoc/vec.rs
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-14 10:50:30 +08:00
Ivan Tham
dba647ef32 Remove liballoc unneeded explicit link 2020-08-14 10:50:30 +08:00
Esteban Küber
b77c40e42d Do not emit E0228 when it is implied by E0106
Emit E0288 (lifetime bound for trait object cannot be deduced) only on
bare trait objects. When the trait object is in the form of
`&dyn Trait`, E0106 (missing lifetime specifier) will have been emitted,
making the former redundant.
2020-08-13 18:30:00 -07:00
kadmin
fd740266de Add fix
This also explicitly checks that the types are `bool`. `try_eval_bool` also appears to just
succeed for `u8`, so this ensures that it actually is a bool before casting.
2020-08-14 01:03:16 +00:00
Esteban Küber
360388b160 Suggest adding &self when accessing self in static assoc fn 2020-08-13 18:00:56 -07:00
Tyler Mandry
e8acafd9d3
Rollup merge of #75500 - glandium:arm64-mac-zlib, r=Mark-Simulacrum
Disable zlib in LLVM on aarch64-apple-darwin

For some reason, building rustc on the Apple Silicon DTK fails with some undefined symbols from zlib, which I guess is similar to some issues that appeared on *-apple-ios and *-apple-tvos.
2020-08-13 18:00:26 -07:00
Tyler Mandry
912b5b3067
Rollup merge of #75496 - spastorino:prioritization-zulip-topics, r=Mark-Simulacrum
Prioritization WG: Open Zulip topics only for `I-prioritize` issues

This was discussed in https://rust-lang.zulipchat.com/#narrow/stream/227806-t-compiler.2Fwg-prioritization/topic/nominations.20and.20other.20automatically.20opened.20topics
Is not being helpful to open topics on any of these events and it's even causing more work for the group.

@LeSeulArtichaut ... I think this is all that's needed to get rid of this, right?.

r? @Mark-Simulacrum

cc @rust-lang/wg-prioritization

@bors rollup=always
2020-08-13 18:00:25 -07:00
Tyler Mandry
9cbc03112f
Rollup merge of #75479 - matthiaskrgr:package_docs, r=Mark-Simulacrum
make rustc-docs component available to rustup

The `rustc-docs` component was generated but not selectable via rustup.

Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/rustc.20nightly.20docs.20as.20component.3F

r? @Mark-Simulacrum
2020-08-13 18:00:23 -07:00
Tyler Mandry
33fca5ab8a
Rollup merge of #75477 - RalfJung:fn-ptrs, r=Mark-Simulacrum
Expand function pointer docs

Be more explicit in the ABI section, and add a section on how to obtain a function pointer, which can be somewhat confusing.

Cc https://github.com/rust-lang/rust/issues/75239
2020-08-13 18:00:21 -07:00
Tyler Mandry
d000fb1ca8
Rollup merge of #75471 - richkadel:llvm-program-name, r=wesleywiser
Change registered "program name" for -Cllvm-args usage messages

While debugging a codegen issue, I tried adding LLVM options with
the rustc -Cllvm-args option, and was confused by the error and usage
messaging.

The LLVM "program name" argument is set to "rustc", and command line
error messages make it look like invalid arguments are "rustc"
arguments, not LLVM.

I changed this argument so error messages and the "-help" usage feedback
is easier to understand and react to. (Clang does something similar.)

r? @wesleywiser
2020-08-13 18:00:19 -07:00
Tyler Mandry
b4966a8936
Rollup merge of #75467 - rubenrua:rubenrua-patch-E0477, r=oli-obk
Fix E0741 error code explanation

Using `ok !` into fixed SRC like in other explanations.
2020-08-13 18:00:17 -07:00
Tyler Mandry
84f7991bf4
Rollup merge of #75462 - Mark-Simulacrum:clean-queries, r=petrochenkov
Remove unused tcx parameter

We shouldn't need access to a query context when storing already computed values.
2020-08-13 18:00:15 -07:00
Tyler Mandry
c76259a937
Rollup merge of #75459 - RalfJung:local-info, r=oli-obk
fix LocalInfo doc comment

The doc comment makes it sound like this is diagnostics-only, but that is not true -- even [unsafety checking uses this information](ded20c98be/src/librustc_mir/transform/check_unsafety.rs (L206)), so it is crucial for soundness, not just "nice to have".

Cc @oli-obk
2020-08-13 18:00:13 -07:00
Tyler Mandry
6f964f0a07
Rollup merge of #75452 - michaelwoerister:sp-cache-more-query-keys, r=lcnr
self-profile: Cache more query key strings when doing self-profiling.

This PR adds optimized `SpecIntoSelfProfilingString` implementations for two common query key types (`LocalDefId` and `WithOptConstParam`). This makes raw self-profiling data on disk 8-9% smaller for my two test cases (`regex` and `cargo`).

The on-disk format is not affected, so no tooling updates need to happen.

I also tried adding an impl for `Ty<'tcx>` (which should reduce size quite a bit) but the compiler did not allow me to add a specialized impl parameterized with `'tcx`. I don't know if there is an actual problem with that or if the implementation of specialization just doesn't support it yet.

cc @wesleywiser @Mark-Simulacrum
2020-08-13 18:00:11 -07:00