Commit graph

136783 commits

Author SHA1 Message Date
Joshua Nelson 3b8f1b7883 Make -Z time-passes less noisy
- Add the module name to `pre_AST_expansion_passes` and don't make it a
  verbose event (since it normally doesn't take very long, and it's
  emitted many times)
- Don't make the following rustdoc events verbose; they're emitted many times.
  + build_extern_trait_impl
  + build_local_trait_impl
  + build_primitive_trait_impl
  + get_auto_trait_impls
  + get_blanket_trait_impls
- Remove `get_auto_trait_and_blanket_synthetic_impls`; it's wholly
  covered by get_{auto,blanket}_trait_impls and not very useful.
2021-01-23 11:44:46 -05:00
bors 65767e5653 Auto merge of #81122 - tmiasko:no-drop, r=davidtwco
Visit only terminators when removing unneeded drops

No functional changes intended
2021-01-21 17:02:49 +00:00
bors a243ad280a Auto merge of #81240 - JohnTitor:rollup-ieaz82a, r=JohnTitor
Rollup of 11 pull requests

Successful merges:

 - #79655 (Add Vec visualization to understand capacity)
 - #80172 (Use consistent punctuation for 'Prelude contents' docs)
 - #80429 (Add regression test for mutual recursion in obligation forest)
 - #80601 (Improve grammar in documentation of format strings)
 - #81046 (Improve unknown external crate error)
 - #81178 (Visit only terminators when removing landing pads)
 - #81179 (Fix broken links with `--document-private-items` in the standard library)
 - #81184 (Remove unnecessary `after_run` function)
 - #81185 (Fix ICE in mir when evaluating SizeOf on unsized type)
 - #81187 (Fix typo in counters.rs)
 - #81219 (Document security implications of std::env::temp_dir)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-21 12:18:32 +00:00
Yuki Okushi d6c7a797fc
Rollup merge of #81219 - joshtriplett:temp_dir-docs, r=sfackler
Document security implications of std::env::temp_dir

Update the sample code to not create an insecure temporary file.
2021-01-21 20:04:56 +09:00
Yuki Okushi 2ebc036220
Rollup merge of #81187 - eltociear:patch-6, r=jonas-schievink
Fix typo in counters.rs

formating -> formatting
2021-01-21 20:04:55 +09:00
Yuki Okushi bc950c85c5
Rollup merge of #81185 - osa1:fix_80742, r=oli-obk
Fix ICE in mir when evaluating SizeOf on unsized type

Not quite ready yet. This tries to fix #80742 as discussed on [Zulip topic][1],
by using `delay_span_bug`.

I don't understand what `delay_span_bug` does. It seems like my error message
is never used. With this patch, in this program:

```rust
#![allow(incomplete_features)]
#![feature(const_evaluatable_checked)]
#![feature(const_generics)]

use std::fmt::Debug;
use std::marker::PhantomData;
use std::mem::size_of;

struct Inline<T>
where
    [u8; size_of::<T>() + 1]: ,
{
    _phantom: PhantomData<T>,
    buf: [u8; size_of::<T>() + 1],
}

impl<T> Inline<T>
where
    [u8; size_of::<T>() + 1]: ,
{
    pub fn new(val: T) -> Inline<T> {
        todo!()
    }
}

fn main() {
    let dst = Inline::<dyn Debug>::new(0); // line 27
}
```

these errors are printed, both for line 27 (annotated line above):

- "no function or associated item named `new` found for struct `Inline<dyn
  Debug>` in the current scope"
- "the size for values of type `dyn Debug` cannot be known at compilation time"

Second error makes sense, but I'm not sure about the first one and why it's
even printed.

Finally, I'm not sure about the span passing in `const_eval`.

[1]: https://rust-lang.zulipchat.com/#narrow/stream/269128-miri/topic/Help.20fixing.20.2380742
2021-01-21 20:04:53 +09:00
Yuki Okushi 0aeb2fcba1
Rollup merge of #81184 - jyn514:combine-after, r=CraftSpider
Remove unnecessary `after_run` function

It's called at the same time and in the same place as `after_krate`, so
they can be combined.
2021-01-21 20:04:51 +09:00
Yuki Okushi b76f0f92ab
Rollup merge of #81179 - CPerezz:fix_interal_doc_warns, r=jyn514
Fix broken links with `--document-private-items` in the standard library

As it was suggested in #81037 `SpecFromIter` is not
in the scope and therefore we get a warning when we try to
do document private intems in `rust/library/alloc/`.

This addresses #81037 by adding the trait in the scope as ```@jyn514```
suggested and also adding an `allow(unused_imports)` flag so that
the compiler does not complain, Since the trait is not used
per se in the code, it's just needed to have properly documented
docs.
2021-01-21 20:04:50 +09:00
Yuki Okushi cd0c54abb9
Rollup merge of #81178 - tmiasko:no-landing-pads, r=oli-obk
Visit only terminators when removing landing pads

No functional changes intended
2021-01-21 20:04:48 +09:00
Yuki Okushi a77c1d836a
Rollup merge of #81046 - rylev:unknown-external-crate, r=estebank
Improve unknown external crate error

This improves error messages when unknown items in the crate root are encountered.

Fixes #63799

r? ```@estebank```
2021-01-21 20:04:45 +09:00
Yuki Okushi 8be36b1b3a
Rollup merge of #80601 - steffahn:improve_format_string_grammar, r=m-ou-se
Improve grammar in documentation of format strings

The docs previously were
* using some weird `<` and `>` around some nonterminals
  * _correct me if these **did** have any meaning_
* using of a (not explicitly defined) `text` nonterminal that didn’t explicitly disallow productions containing `'{'` or `'}'`
* incorrect in not allowing for `x?` and `X?` productions of `type`
* unnecessarily ambiguous, both
  * allowing `type` to be `''`, and
  * using an optional `[type]`
* using inconsistent underscore/hyphenation style between `format_string` and `format_spec` vs `maybe-format`

_Rendered:_
![Screenshot_20210101_230901](https://user-images.githubusercontent.com/3986214/103447038-69d7a180-4c86-11eb-8fa0-0a6160a7ff7a.png)
_(current docs: https://doc.rust-lang.org/nightly/std/fmt/#syntax)_

```@rustbot``` modify labels: T-doc
2021-01-21 20:04:43 +09:00
Yuki Okushi bcaf7dfc8f
Rollup merge of #80429 - JulianKnodt:ob_forest, r=Mark-Simulacrum
Add regression test for mutual recursion in obligation forest

Add regression test for #75860 with a slightly smaller example.
I was looking at what caused the issue and was surprised when it errors out on nightly, so I just added a regression test which should effectively close the issue, altho it would be nice to find the fix for reference.

Also I found that 80066 is not fixed by whatever fixed 75860.
2021-01-21 20:04:41 +09:00
Yuki Okushi 9abd746a32
Rollup merge of #80172 - camelid:prelude-docs-consistent-punct, r=steveklabnik
Use consistent punctuation for 'Prelude contents' docs
2021-01-21 20:04:39 +09:00
Yuki Okushi a18813f6cc
Rollup merge of #79655 - pickfire:visual-vec, r=m-ou-se
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

r? `@m-ou-se`

cc `@the8472` I put back the order of the fields as it feels weird, the note already explains that the order of fields is not guaranteed
2021-01-21 20:04:38 +09:00
bors 339e19697a Auto merge of #80958 - bstrie:deptbdnums, r=KodrAus
Deprecate-in-future the constants superceded by RFC 2700

Successor to #78335, re-opened after addressing the issues tracked in #68490.

This PR makes use of the new ability to explicitly annotate an item as triggering the deprecated-in-future lint (via `rustc_deprecated(since="TBD"`, see #78381). We might call this *soft deprecation*; unlike with deprecation, users will *not* receive warnings when compiling code that uses these items *unless* they opt-in via `#[warn(deprecated_in_future)]`. Like deprecation, soft deprecation causes documentation to formally acknowledge that an item is marked for eventual deprecation (at a non-specific point in the future).

With this new ability, we can sidestep all debate about when or on what timeframe something ought to be deprecated; as long as we can agree that something ought to be deprecated, we can receive much of the benefits of deprecation with none of the drawbacks. For these items specifically, the libs team has already agreed that they should be deprecated (see https://github.com/rust-lang/rust/issues/68490#issuecomment-747022696).
2021-01-21 09:14:37 +00:00
bors 57a71ac0e1 Auto merge of #81231 - jyn514:flaky-test-2, r=Mark-Simulacrum
Remove flaky test

See https://github.com/rust-lang/rust/pull/81197 for what's going on
here; this is a temporary stopgap until someone has time to review the
proper fix.

r? `@ghost`
2021-01-21 05:27:30 +00:00
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
bstrie 6f3df00610 Deprecate-in-future the constants superceded by RFC 2700 2021-01-20 20:08:11 -05:00
Joshua Nelson 1f6f750ade Remove flaky test
See https://github.com/rust-lang/rust/pull/81197 for what's going on
here; this is a temporary stopgap until someone has time to review the
proper fix.
2021-01-20 19:18:23 -05:00
bors 3aa3252210 Auto merge of #81229 - m-ou-se:solaris-workaround, r=pietroalbini
Work around missing -dev packages in solaris docker image.

This should hopefully make the `dist-various-2` docker build work again on CI, which is now blocking everything from getting merged.

r? `@pietroalbini`
2021-01-20 23:40:09 +00:00
Mara Bos 49b3d9c22a Work around missing -dev packages in solaris docker image. 2021-01-20 23:29:55 +01:00
Josh Triplett 27f3764519 Document security implications of std::env::temp_dir
Update the sample code to not create an insecure temporary file.
2021-01-20 11:24:47 -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
CPerezz bc6720f872
Add SpecFromIter ref in the comments directly 2021-01-19 18:28:33 +01: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
Ömer Sinan Ağacan 3fb53c2c85 Fix ICE in mir when evaluating SizeOf on unsized type
Fixes #80742
2021-01-19 18:35:21 +03:00
Ikko Ashimine 203df1764c
Fix typo in counters.rs
formating -> formatting
2021-01-19 23:42:18 +09: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
Joshua Nelson d926147ccb Remove unnecessary after_run function
It's called at the same time and in the same place as `after_krate`, so
they can be combined.
2021-01-19 02:04:18 -05: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