Commit Graph

136747 Commits

Author SHA1 Message Date
Ivan Tham
9844d9ee97
Remove link to current section
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2021-01-21 13:18:12 +08:00
Ivan Tham
9f338e18af Add more details explaning the Vec visualization
Suggested by oli-obk
2021-01-20 23:41:56 +08:00
Ivan Tham
9e42d14927 Add Vec visualization to understand capacity
Visualize vector while differentiating between stack and heap.

Inspired by cheats.rs, as this is probably the first place beginner go,
they could understand stack and heap, length and capacity with this. Not
sure if adding this means we should add to other places too.

Superseeds #76066
2021-01-20 23:41:55 +08:00
bors
a4cbb44ae2 Auto merge of #81118 - ojeda:metadata-obj, r=nagisa
Skip linking if it is not required

This allows to use `--emit=metadata,obj` and other metadata + non-link combinations.

Fixes #81117.
2021-01-20 07:15:40 +00:00
bors
e05409a02c Auto merge of #81063 - CraftSpider:jsondocck, r=jyn514
Add JsonDocCk Tool for rustdoc-json

Implements a new test system for rustdoc JSON output, jsondocck. Modeled after htmldocck, this tool reads directives in the test file and checks them against the output. These directives use JSONPath, a pair to XPath for json. This obsoletes the old strict subset tool, allowing both finer-grained control of what is tested and better errors on failure.

Not sure on the changes to Cargo.lock, I can back that out if needed.

r? `@jyn514`
2021-01-20 04:10:36 +00:00
Rune Tynan
ba6803e6b4
No longer require unstable for jsondocck, only build it for json tests 2021-01-19 19:28:28 -05:00
bors
14265f9c55 Auto merge of #79578 - alexcrichton:update-waasi, r=KodrAus
std: Update wasi-libc commit of the wasm32-wasi target

This brings in an implementation of `current_dir` and `set_current_dir`
(emulation in `wasi-libc`) as well as an updated version of finding
relative paths. This also additionally updates clang to the latest
release to build wasi-libc with.
2021-01-19 22:20:58 +00:00
Rune Tynan
728ffc8c03
Address review v2 2021-01-19 17:02:34 -05:00
bors
c5a96fb797 Auto merge of #80957 - tgnottingham:direct_serialize_depgraph, r=michaelwoerister
Serialize dependency graph directly from DepGraph

Reduce memory usage by serializing dep graph directly from `DepGraph`,
rather than copying it into `SerializedDepGraph` and serializing that.
2021-01-19 19:36:41 +00:00
Rune Tynan
a3df483974
Shift another panic into an exit 2021-01-19 14:24:40 -05:00
Rune Tynan
66a5714c63
Address review comments 2021-01-19 14:24:39 -05:00
Rune Tynan
7715656edd
Add jsondocck tool, and use it for rustdoc JSON 2021-01-19 14:24:25 -05:00
bors
cf04ae54e6 Auto merge of #79705 - ijackson:bufwriter-disassemble, r=m-ou-se
BufWriter: Provide into_raw_parts

If something goes wrong, one might want to unpeel the layers of nested
Writers to perform recovery actions on the underlying writer, or reuse
its resources.

`into_inner` can be used for this when the inner writer is still
working.  But when the inner writer is broken, and returning errors,
`into_inner` simply gives you the error from flush, and the same
`Bufwriter` back again.

Here I provide the necessary function, which I have chosen to call
`into_raw_parts`.

I had to do something with `panicked`.  Returning it to the caller as
a boolean seemed rather bare.  Throwing the buffered data away in this
situation also seems unfriendly: maybe the programmer knows something
about the underlying writer and can recover somehow.

So I went for a custom Error.  This may be overkill, but it does have
the nice property that a caller who actually wants to look at the
buffered data, rather than simply extracting the inner writer, will be
told by the type system if they forget to handle the panicked case.

If a caller doesn't need the buffer, it can just be discarded.  That
WriterPanicked is a newtype around Vec<u8> means that hopefully the
layouts of the Ok and Err variants can be very similar, with just a
boolean discriminant.  So this custom error type should compile down
to nearly no code.

*If this general idea is felt appropriate, I will open a tracking issue, etc.*
2021-01-19 16:42:19 +00:00
bors
f09fb488f7 Auto merge of #81186 - GuillaumeGomez:rollup-y2d04g9, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #80382 (Improve search result tab handling)
 - #81112 (Remove unused alloc::std::ops re-export.)
 - #81115 (BTreeMap: prefer bulk_steal functions over specialized ones)
 - #81147 (Fix structured suggestion for explicit `drop` call)
 - #81161 (Remove inline script tags)
 - #81164 (Fix typo in simplify.rs)
 - #81166 (remove some outdated comments regarding  debug assertions)
 - #81168 (Fixes #81109 - Typo in pointer::wrapping_sub)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-19 12:04:22 +00:00
Guillaume Gomez
dcb74796c0
Rollup merge of #81168 - soniasingla:doc/sonia, r=jonas-schievink
Fixes #81109 - Typo in pointer::wrapping_sub

Signed-off-by: soniasingla <soniasingla.1812@gmail.com>

Related to issue #81109
2021-01-19 10:28:04 +01:00
Guillaume Gomez
7aa3920488
Rollup merge of #81166 - RalfJung:debug-assert-comments, r=Mark-Simulacrum
remove some outdated comments regarding  debug assertions

https://github.com/rust-lang/rust/pull/79684 removed those debug assertions.
2021-01-19 10:28:03 +01:00
Guillaume Gomez
2f1d5c4d40
Rollup merge of #81164 - eltociear:patch-5, r=jonas-schievink
Fix typo in simplify.rs

prexisting -> preexisting
2021-01-19 10:28:00 +01:00
Guillaume Gomez
1f777f36e8
Rollup merge of #81161 - GuillaumeGomez:remove-inline-script, r=Nemo157
Remove inline script tags

Fixes #81133.

cc ``@pietroalbini``

r? ``@Nemo157``
2021-01-19 10:27:58 +01:00
Guillaume Gomez
348997a05f
Rollup merge of #81147 - estebank:drop-suggestion, r=varkor
Fix structured suggestion for explicit `drop` call
2021-01-19 10:27:56 +01:00
Guillaume Gomez
6af6c40a12
Rollup merge of #81115 - ssomers:btree_drainy_refactor_4, r=Mark-Simulacrum
BTreeMap: prefer bulk_steal functions over specialized ones

The `steal_` functions (apart from their return value) are basically specializations of the more general `bulk_steal_` functions. This PR removes the specializations. The library/alloc benchmarks say this is never slower and up to 6% faster.

r? ``@Mark-Simulacrum``
2021-01-19 10:27:54 +01:00
Guillaume Gomez
de02bf399e
Rollup merge of #81112 - m-ou-se:alloc-std-ops-reexport, r=KodrAus
Remove unused alloc::std::ops re-export.

Removes unused re-export in alloc/lib.rs.
2021-01-19 10:27:53 +01:00
Guillaume Gomez
670acf7483
Rollup merge of #80382 - GuillaumeGomez:search-result-tab-picking, r=Nemo157,pickfire
Improve search result tab handling

Fixes #80378.

If the current search result tab is empty, it picks the first non-empty one. If all are empty, the current one doesn't change. It can be tested with "-> string" (where only the "returned elements" tab is not empty).

r? `@jyn514`
2021-01-19 10:27:50 +01:00
bors
47121d6d88 Auto merge of #81110 - LeSeulArtichaut:fix-unused-unsafe-label, r=RalfJung
Fix `unused_unsafe` label with `unsafe_block_in_unsafe_fn

Previously, the following code:

```rust
#![feature(unsafe_block_in_unsafe_fn)]

unsafe fn foo() {
    unsafe { unsf() }
}

unsafe fn unsf() {}
```

Would give the following warning:

```
warning: unnecessary `unsafe` block
 --> src/lib.rs:4:5
  |
4 |     unsafe { unsf() }
  |     ^^^^^^ unnecessary `unsafe` block
  |
  = note: `#[warn(unused_unsafe)]` on by default
```
which doesn't point out that the block is in an `unsafe fn`.

Tracking issue: #71668
cc #79208
2021-01-19 08:59:37 +00:00
bors
7d7b22d78f Auto merge of #81169 - dylni:fix-soundness-issue-for-replace-range, r=KodrAus
Fix soundness issue for `replace_range` and `range`

Fixes #81138 by only calling `start_bound` and `end_bound` once.

I also fixed the same issue for [`BTreeMap::range`](https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.range) and [`BTreeSet::range`](https://doc.rust-lang.org/std/collections/struct.BTreeSet.html#method.range).
2021-01-19 05:58:51 +00:00
dylni
b96063cf47 Fix soundness issue for replace_range and range 2021-01-18 22:14:38 -05:00
bors
94e6ea9fc9 Auto merge of #81103 - zackmdavis:comma_trail, r=davidtwco
don't suggest erroneous trailing comma after `..`

In #76612, suggestions were added for missing fields in patterns. However, the suggestions are being inserted just at the end
of the last field in the pattern—before any trailing comma after the last field. This resulted in the "if you don't care about missing fields" suggestion to recommend code with a trailing comma after the field ellipsis (`..,`), which is actually not legal ("`..` must be at the end and cannot have a trailing comma")!

Incidentally, the doc-comment on `error_unmentioned_fields` was using `you_cant_use_this_field` as an example field name (presumably copy-paste inherited from the description of Issue #76077), but the present author found this confusing, because unmentioned fields aren't necessarily unusable.

The suggested code in the diff this commit introduces to `destructuring-assignment/struct_destructure_fail.stderr` doesn't work, but it didn't work beforehand, either (because of the "found reserved identifier `_`" thing), so you can't really call it a regression; it could be fixed in a separate PR.

Resolves #78511.

r? `@davidtwco` or `@estebank`
2021-01-19 02:54:58 +00:00
bors
4ba1aaf35f Auto merge of #81042 - sasurau4:fix/unclear-error-with-trait, r=estebank
Add suggestion for impl_candidates with E0283

Fix #42226
2021-01-19 00:00:21 +00:00
bors
d98d2f57d9 Auto merge of #80707 - oli-obk:stability_hole_const_intrinsics, r=RalfJung
Stability oddity with const intrinsics

cc `@RalfJung`

In https://github.com/rust-lang/rust/pull/80699#discussion_r551495670 `@usbalbin` realized we accepted some intrinsics as `const` without a `#[rustc_const_(un)stable]` attribute. I did some digging, and that example works because intrinsics inherit their stability from their parents... including `#[rustc_const_(un)stable]` attributes. While we may want to fix that (not sure, wasn't there just a MCPed PR that caused this on purpose?), we definitely want tests for it, thus this PR adding tests and some fun tracing statements.
2021-01-18 20:54:36 +00:00
bors
73f233b3ad Auto merge of #81159 - ssomers:btree_cleanup_search, r=Mark-Simulacrum
BTreeMap: convert search functions to methods

And further tweak the signature of `search_linear`, in preparation of a better #81094.

r? `@Mark-Simulacrum`
2021-01-18 17:30:38 +00:00
Stein Somers
4775334f36 BTreeMap: prefer bulk_steal functions over specialized ones 2021-01-18 17:23:26 +01:00
soniasingla
47c2476c68 Fixes #81109 - Typo in pointer::wrapping_sub
Signed-off-by: soniasingla <soniasingla.1812@gmail.com>
2021-01-18 20:31:47 +05:30
bors
5e91c4ecc0 Auto merge of #81165 - KodrAus:rollup-s7llxis, r=KodrAus
Rollup of 12 pull requests

Successful merges:

 - #81038 (Update Clippy)
 - #81071 (rustc_parse_format: Fix character indices in find_skips)
 - #81100 (prevent potential bug in `encode_with_shorthand`.)
 - #81105 (Initialize a few variables directly)
 - #81116 (ConstProp: Copy body span instead of querying it)
 - #81121 (Avoid logging the whole MIR body in SimplifyCfg)
 - #81123 (Update cmp.rs)
 - #81125 (Add track_caller to .steal())
 - #81128 (validation test: turn some const_err back into validation failures)
 - #81131 (Edit rustc_middle::ty::cast docs)
 - #81142 (Replace let Some(..) = with .is_some())
 - #81153 (Remove unused linkcheck exceptions)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-18 14:36:30 +00:00
Daiki Ihara
8b041cd8f9 Add test case for suggestion E0283 2021-01-18 21:57:15 +09:00
Daiki Ihara
db95b5ca9b Add suggestion for impl_candidates with E0283
Update compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs

Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2021-01-18 21:57:15 +09:00
Ralf Jung
712d065061 remove some outdated comments regarding debug assertions 2021-01-18 13:06:01 +01:00
Ashley Mannix
33d184bfd0
Rollup merge of #81153 - jyn514:linkcheck, r=Manishearth
Remove unused linkcheck exceptions

Found while working on https://github.com/deadlinks/cargo-deadlinks/issues/133.

r? `@Manishearth`
2021-01-18 21:53:43 +10:00
Ashley Mannix
0068358ba4
Rollup merge of #81142 - wcampbell0x2a:replace-Some-with-is-some, r=jonas-schievink
Replace let Some(..) = with .is_some()
2021-01-18 21:53:41 +10:00
Ashley Mannix
d3cc598a02
Rollup merge of #81131 - pierwill:edit-rustc_middle-cast, r=varkor
Edit rustc_middle::ty::cast docs

Link to RFC 401 and add missing punctuation.
2021-01-18 21:53:40 +10:00
Ashley Mannix
8f1716c1f9
Rollup merge of #81128 - RalfJung:validation-testing, r=oli-obk
validation test: turn some const_err back into validation failures

This resolves the problem I raised at https://github.com/rust-lang/rust/pull/78407#discussion_r556732926.
r? `@oli-obk`
2021-01-18 21:53:37 +10:00
Ashley Mannix
f82100eeed
Rollup merge of #81125 - jyn514:track-caller, r=lcnr
Add track_caller to .steal()

Before:

```
thread 'rustc' panicked at 'attempt to read from stolen value', /home/joshua/rustc/compiler/rustc_data_structures/src/steal.rs:43:15
```

After:

```
thread 'rustc' panicked at 'attempt to steal from stolen value', compiler/rustc_mir/src/transform/mod.rs:423:25
```

r? `@lcnr`
2021-01-18 21:53:35 +10:00
Ashley Mannix
0654e20195
Rollup merge of #81123 - sirh3e:sirh3e-patch-1, r=sfackler
Update cmp.rs

Fixed space
2021-01-18 21:53:33 +10:00
Ashley Mannix
e1d70bc697
Rollup merge of #81121 - tmiasko:simplify-cfg-no-dbg, r=jonas-schievink
Avoid logging the whole MIR body in SimplifyCfg
2021-01-18 21:53:31 +10:00
Ashley Mannix
064e47b99e
Rollup merge of #81116 - bugadani:body-span, r=wesleywiser
ConstProp: Copy body span instead of querying it
2021-01-18 21:53:30 +10:00
Ashley Mannix
b4defec768
Rollup merge of #81105 - LingMan:init_directly, r=nagisa
Initialize a few variables directly

Currently they are declared as `mut`, get initialized to a default value, and
then possibly overwritten.

By initializing to the final value directly, they don't need to be `mut` and
it's clear that they don't get mutated elsewhere later on.
2021-01-18 21:53:28 +10:00
Ashley Mannix
d3ff9ac8e8
Rollup merge of #81100 - lcnr:encode_with_shorthand, r=oli-obk
prevent potential bug in `encode_with_shorthand`.

see https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Remove.20PredicateKind.20in.20favor.20of.20only.20Bin.E2.80.A6.20compiler-team.23397/near/223012169
2021-01-18 21:53:26 +10:00
Ashley Mannix
c7ca540da2
Rollup merge of #81071 - osa1:fix_81006, r=estebank
rustc_parse_format: Fix character indices in find_skips

Fixes #81006
2021-01-18 21:53:24 +10:00
Ashley Mannix
090ab8c02e
Rollup merge of #81038 - flip1995:clippyup, r=Manishearth
Update Clippy

Biweekly Clippy update

r? ``@Manishearth``
2021-01-18 21:53:22 +10:00
Ikko Ashimine
222e0e4fe2
Fix typo in simplify.rs
prexisting -> preexisting
2021-01-18 20:52:10 +09:00
bors
66eb982166 Auto merge of #81015 - jyn514:feature-gate-ptr, r=camelid
Feature-gate `pointer` and `reference` in intra-doc links

r? `@camelid`

Addresses (but does not close) https://github.com/rust-lang/rust/issues/80896.
2021-01-18 11:35:19 +00:00
oli
5bac1c9229 Only inherit const stability for methods of impl const Trait blocks 2021-01-18 11:07:35 +00:00