Commit graph

141026 commits

Author SHA1 Message Date
Amanieu d'Antras
5dabc80796 Refactor #82270 as lint instead of an error 2021-03-25 13:12:29 +00:00
bors
6e17a5c5fd Auto merge of #83387 - cuviper:min-llvm-10, r=nagisa
Update the minimum external LLVM to 10

r? `@nikic`
2021-03-25 13:11:18 +00:00
Michael Woerister
517d5ac230 Allow for reading raw bytes from rustc_serialize::Decoder without unsafe code. 2021-03-25 14:05:00 +01:00
Ian Jackson
88ca6c2219 ExitStatusExt: Fix missing word in two docs messages
Looks like I missed the lack of these "and"s.

Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-03-25 10:48:27 +00:00
bors
bba40880c0 Auto merge of #82565 - m-ou-se:ununstabilize-bits, r=kennytm
Revert reverting of stabilizing integer::BITS.

Now that `lexical-core` has an updated version that won't break with this stabilization, let's try to stabilize this again.

See https://github.com/rust-lang/rust/issues/81654#issuecomment-778564715

Tracking issue with FCP: https://github.com/rust-lang/rust/issues/76904
2021-03-25 10:29:58 +00:00
Ian Jackson
11e40ce240 ExitStatus: print "exit status: {}" rather than "exit code: {}"
Proper Unix terminology is "exit status" (vs "wait status").  "exit
code" is imprecise on Unix and therefore unclear.  (As far as I can
tell, "exit code" is correct terminology on Windows.)

This new wording is unfortunately inconsistent with the identifier
names in the Rust stdlib.

It is the identifier names that are wrong, as discussed at length in eg
  https://doc.rust-lang.org/nightly/std/process/struct.ExitStatus.html
  https://doc.rust-lang.org/nightly/std/os/unix/process/trait.ExitStatusExt.html

Unfortunately for API stability reasons it would be a lot of work, and
a lot of disruption, to change the names in the stdlib (eg to rename
`std::process::ExitStatus` to `std::process::ChildStatus` or
something), but we should fix the message output.  Many (probably
most) readers of these messages about exit statuses will be users and
system administrators, not programmers, who won't even know that Rust
has this wrong terminology.

So I think the right thing is to fix the documentation (as I have
already done) and, now, the terminology in the implementation.

This is a user-visible change to the behaviour of all Rust programs
which run Unix subprocesses.  Hopefully no-one is matching against the
exit status string, except perhaps in tests.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-03-25 10:27:53 +00:00
Michael Howell
ef1bd5776d
Change wording 2021-03-25 02:58:34 -07:00
bors
372afcf93b Auto merge of #83445 - erikdesjardins:rmunion, r=RalfJung
RemoveZsts: don't touch unions

This should fix a Miri ICE

r? `@RalfJung`
2021-03-25 07:48:52 +00:00
bors
dbc37a97dc Auto merge of #83307 - richkadel:cov-unused-functions-1.1, r=tmandry
coverage bug fixes and optimization support

Adjusted LLVM codegen for code compiled with `-Zinstrument-coverage` to
address multiple, somewhat related issues.

Fixed a significant flaw in prior coverage solution: Every counter
generated a new counter variable, but there should have only been one
counter variable per function. This appears to have bloated .profraw
files significantly. (For a small program, it increased the size by
about 40%. I have not tested large programs, but there is anecdotal
evidence that profraw files were way too large. This is a good fix,
regardless, but hopefully it also addresses related issues.

Fixes: #82144

Invalid LLVM coverage data produced when compiled with -C opt-level=1

Existing tests now work up to at least `opt-level=3`. This required a
detailed analysis of the LLVM IR, comparisons with Clang C++ LLVM IR
when compiled with coverage, and a lot of trial and error with codegen
adjustments.

The biggest hurdle was figuring out how to continue to support coverage
results for unused functions and generics. Rust's coverage results have
three advantages over Clang's coverage results:

1. Rust's coverage map does not include any overlapping code regions,
   making coverage counting unambiguous.
2. Rust generates coverage results (showing zero counts) for all unused
   functions, including generics. (Clang does not generate coverage for
   uninstantiated template functions.)
3. Rust's unused functions produce minimal stubbed functions in LLVM IR,
   sufficient for including in the coverage results; while Clang must
   generate the complete LLVM IR for each unused function, even though
   it will never be called.

This PR removes the previous hack of attempting to inject coverage into
some other existing function instance, and generates dedicated instances
for each unused function. This change, and a few other adjustments
(similar to what is required for `-C link-dead-code`, but with lower
impact), makes it possible to support LLVM optimizations.

Fixes: #79651

Coverage report: "Unexecuted instantiation:..." for a generic function
from multiple crates

Fixed by removing the aforementioned hack. Some "Unexecuted
instantiation" notices are unavoidable, as explained in the
`used_crate.rs` test, but `-Zinstrument-coverage` has new options to
back off support for either unused generics, or all unused functions,
which avoids the notice, at the cost of less coverage of unused
functions.

Fixes: #82875

Invalid LLVM coverage data produced with crate brotli_decompressor

Fixed by disabling the LLVM function attribute that forces inlining, if
`-Z instrument-coverage` is enabled. This attribute is applied to
Rust functions with `#[inline(always)], and in some cases, the forced
inlining breaks coverage instrumentation and reports.

FYI: `@wesleywiser`

r? `@tmandry`
2021-03-25 05:07:34 +00:00
bors
981ffa7c14 Auto merge of #6959 - ebobrow:iss-6927-fix, r=camsteffen
Check for `.to_string().into_bytes()` in string_lit_to_bytes

fixes #6927

changelog: Add a check for `into_bytes()` to string_lit_to_bytes lint
2021-03-25 03:01:35 +00:00
bors
26c7e55f47 Auto merge of #83454 - JohnTitor:rollup-9ae0565, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #83041 (stabilize debug_non_exhaustive)
 - #83349 (Remove Option::{unwrap_none, expect_none}.)
 - #83420 (Add documentation for rustdoc-gui tests)
 - #83421 (Add Result::into_err where the Ok variant is the never type)
 - #83427 (small cleanups in rustc_errors / emitter)
 - #83434 (Update RELEASES.md)
 - #83440 (Use intra-doc link in core::cell)
 - #83442 (LLVMWrapper: attractive nuisance macros)

Failed merges:

 - #83438 (Update RELEASES.md)

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-25 02:26:19 +00:00
Michael Howell
b3321e2860 Add docs for Vec::from functions
Part of #51430
2021-03-24 18:43:18 -07:00
Elliot Bobrow
e9ebc27525 check for .to_string().into_bytes() in string_lit_to_bytes
apply changes from review
2021-03-24 17:31:20 -07:00
Yuki Okushi
67436c11c2
Rollup merge of #83442 - durin42:remove-questionable-macros, r=cuviper
LLVMWrapper: attractive nuisance macros

This came up in the review of #83425: it's hard to imagine a use of
LLVM_VERSION_LE() or LLVM_VERSION_EQ() that's not asking for trouble
when a point release gets created, so let's just discard them to prevent
the issue.
2021-03-25 09:07:32 +09:00
Yuki Okushi
ee34453a10
Rollup merge of #83440 - fee1-dead:core-cell-intralink, r=jyn514
Use intra-doc link in core::cell

``@rustbot`` label T-doc A-intra-doc-links

r? ``@jyn514``
2021-03-25 09:07:31 +09:00
Yuki Okushi
5a525c3fd2
Rollup merge of #83434 - wesleywiser:update_releases, r=Mark-Simulacrum
Update RELEASES.md

This change was backed out in #83412 so we should remove the reference
to it from the release notes.
2021-03-25 09:07:30 +09:00
Yuki Okushi
5ca3f0d51f
Rollup merge of #83427 - llogiq:refactor-emitter, r=estebank
small cleanups in rustc_errors / emitter

This is either moving code around so it gets called less often or using if let instead of match in a few cases.
2021-03-25 09:07:29 +09:00
Yuki Okushi
921a82007a
Rollup merge of #83421 - faern:add-into-err, r=joshtriplett
Add Result::into_err where the Ok variant is the never type

Equivalent of #66045 but for the inverse situation where `T: Into<!>` rather than `E: Into<!>`.

I'm using the same feature gate name. I can't see why one of these methods would be OK to stabilize but not the other.

Tracking issue: #61695
2021-03-25 09:07:28 +09:00
Yuki Okushi
72a2d0e386
Rollup merge of #83420 - GuillaumeGomez:rustdoc-gui-tests-doc, r=CraftSpider
Add documentation for rustdoc-gui tests

I think a bit of documentation doesn't hurt in this case considering how "out of the ordinary" this is.

r? ``@jyn514``
2021-03-25 09:07:27 +09:00
Yuki Okushi
29e64e913a
Rollup merge of #83349 - m-ou-se:unwrap-none, r=dtolnay
Remove Option::{unwrap_none, expect_none}.

This removes `Option::unwrap_none` and `Option::expect_none` since we're not going to stabilize them, see https://github.com/rust-lang/rust/issues/62633.

Closes #62633
2021-03-25 09:07:26 +09:00
Yuki Okushi
a6ababb162
Rollup merge of #83041 - guswynn:stable_debug_struct, r=m-ou-se
stabilize debug_non_exhaustive

tracking issue: https://github.com/rust-lang/rust/issues/67364

but it is still an open question whether the other `Debug*` struct's should have a similar method. I would guess that would best be put underneath a new feature gate, as this one seems uncontroversial enough to stabilize as is
2021-03-25 09:07:24 +09:00
Mara Bos
b1fac3a5e1
Bump debug_non_exhaustive stabilization to 1.53. 2021-03-24 22:54:04 +01:00
Mara Bos
bacd5226b7 Bump int_bits_const stable version to 1.53. 2021-03-24 22:34:38 +01:00
Mara Bos
81932be5e7 Revert "Revert stabilizing integer::BITS." 2021-03-24 22:34:36 +01:00
bors
4a1825a609 Auto merge of #6952 - Jarcho:new_ret_no_self_fp, r=Manishearth
Fix `new_ret_no_self` false positive

fixes: #1724

changelog: Fix false positive with `new_ret_no_self` when returning `Self` with different generic arguments
2021-03-24 21:09:01 +00:00
Guillaume Gomez
7b59089316 Split clean::Constant enum into a struct and an enum 2021-03-24 21:52:20 +01:00
bors
07e0e2ec26 Auto merge of #83220 - Aaron1011:fix/eval-region-cache, r=nikomatsakis
Use `EvaluatedToOkModuloRegions` whenever we erase regions

Fixes #80691

When we evaluate a trait predicate, we convert an
`EvaluatedToOk` result to `EvaluatedToOkModuloRegions` if we erased any
regions. We cache the result under a region-erased 'freshened'
predicate, so `EvaluatedToOk` may not be correct for other predicates
that have the same cache key.
2021-03-24 20:51:37 +00:00
Guillaume Gomez
ee5093374e Rename clean::Constant did fields to def_id 2021-03-24 21:48:36 +01:00
Guillaume Gomez
d61a1786a7 Improve new Constant variants' name 2021-03-24 21:48:36 +01:00
Guillaume Gomez
e25e15ce99 Store tcx and cache when they are used multiple times instead of calling functions every time 2021-03-24 21:48:36 +01:00
Guillaume Gomez
0cde85523f Rework rustdoc const type 2021-03-24 21:48:34 +01:00
Jack Huey
cfbd0eed98 Review comments 2021-03-24 16:45:41 -04:00
Jack Huey
19ecfcd0e2 resolve late lifetimes by item
This reverts commit 22ae20733515d710c1134600bc1e29cdd76f6b9b.
2021-03-24 16:45:41 -04:00
Jason Newcomb
6e88900f9e
Rename contains_adt to contains_adt_constructor 2021-03-24 16:23:02 -04:00
Jason Newcomb
99b8a67198
Fix false positive with new_ret_no_self when returning Self with different generic arguments 2021-03-24 16:22:28 -04:00
Aaron Hill
102b5789b2
Use EvaluatedToOkModuloRegions whenever we erase regions
Fixes #80691

When we evaluate a trait predicate, we convert an
`EvaluatedToOk` result to `EvaluatedToOkModuloRegions` if we erased any
regions. We cache the result under a region-erased 'freshened'
predicate, so `EvaluatedToOk` may not be correct for other predicates
that have the same cache key.
2021-03-24 16:01:37 -04:00
Nixon Enraght-Moony
d9e2d8d665 Rename span to source
Caused by
b0659f9b1b (diff-ede26372490522288745c5b3df2b6b2a1cc913dcd09b29af3a49935afe00c7e6L464-R464)
2021-03-24 19:44:23 +00:00
bors
917b538c68 Auto merge of #6962 - TaKO8Ki:fix-false-positive-in-manual-flatten, r=llogiq
Fix false positive in `manual_flatten`

This pull request fixes false positive in `manual_flatten` in case using a slice of references .

closes: #6893

changelog: fix false positive in `manual_flatten`
2021-03-24 18:42:20 +00:00
Augie Fackler
04961d2405 LLVMWrapper: attractive nuisance macros
THis came up in the review of #83425: it's hard to imagine a use of
LLVM_VERSION_LE() or LLVM_VERSION_EQ() that's not asking for trouble
when a point release gets created, so let's just discard them to prevent
the issue.
2021-03-24 14:39:13 -04:00
Erik Desjardins
d5c1ad5ca1 RemoveZsts: don't touch unions 2021-03-24 13:00:36 -04:00
Nixon Enraght-Moony
9ba92972ed Don't call item on modules for json renderer
Closes #80664
2021-03-24 16:54:13 +00:00
Nixon Enraght-Moony
ce21447c01 Better errors in jsondocck 2021-03-24 16:54:12 +00:00
Mark Rousskov
e36573b68e Fix bootstrap tests on beta 2021-03-24 12:04:31 -04:00
Takayuki Maeda
2f8d71b9dc merge imports 2021-03-25 00:17:43 +09:00
Takayuki Maeda
3b8e85a5dc fix false positive in manual_flatten 2021-03-25 00:15:21 +09:00
bors
f5fe425c92 Auto merge of #83364 - sexxi-goose:fix-83176, r=nikomatsakis
2229 migration: Don't try resolve regions before writeback

In the analysis use `resolve_vars_if_possible` instead of `fully_resolve`,
because we might not have performed regionck yet.

Fixes: #83176

r? `@nikomatsakis`
2021-03-24 14:45:16 +00:00
Deadbeef
c0fe54fedd
Use intra-doc link in core::cell 2021-03-24 21:42:49 +08:00
bors
2e012ce681 Auto merge of #83050 - osa1:issue83048, r=matthewjasper
Run analyses before thir-tree dumps

Fixes #83048
2021-03-24 12:02:13 +00:00
bors
680d9fcac1 Auto merge of #83408 - ijackson:expose-splitinclusive, r=dtolnay
Expose str::SplitInclusive in alloc and therefore in std

This seems to have been omitted from the beginning when this feature was first introduced in 86bf96291d.  Most users won't need to name this type which is probably why this wasn't noticed in the meantime.

See #83372 for a different but related bug.

### Notes for reviewers

I think I have got this right but TBH I am not very familiar with the relationship between core and std and so on.  <strike>I also haven't don't any kind of test (not even a build) yet.  I will do a local docs build to see that the type now appears in the std docs.</strike>  I did a local docs build and it has made this type appear as `std::str::SplitInclusive` as expected

The linkification of the return value from `str::split_inclusive` teleports me to the online url for `core::str::SplitInclusive`.  I think this may be a rustdoc anomaly (similar to #79630 maybe) but I am not sure.  Perhaps it means I haven't done the `std` -> `core` referrence correctly.

I made this insta-stable since it seems like simply a bug.  Please LMK if that is not right.  *(edited to add:)* In particular, IDK how this ought to relate to the (?)current release process.
2021-03-24 09:21:06 +00:00
bors
5b33de3340 Auto merge of #75384 - JulianKnodt:cg_def, r=varkor,lcnr
implement `feature(const_generics_defaults)`

Implements const generics defaults `struct Example<const N: usize=3>`, as well as a query for getting the default of a given const-parameter's def id. There are some remaining FIXME's but they were specified as not blocking for merging this PR. This also puts the defaults behind the unstable feature gate `#![feature(const_generics_defaults)]`.

~~This currently creates a field which is always false on `GenericParamDefKind` for future use when
consts are permitted to have defaults. I'm not sure if this is exactly what is best for adding default parameters, but I mimicked the style of type defaults, so hopefully this is ok.~~

r? `@lcnr`
2021-03-24 04:13:27 +00:00