]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #81271 - m-ou-se:rollup-xv7gq3w, r=m-ou-se
bors [Fri, 22 Jan 2021 16:04:36 +0000 (16:04 +0000)]
Auto merge of #81271 - m-ou-se:rollup-xv7gq3w, r=m-ou-se

Rollup of 10 pull requests

Successful merges:

 - #80573 (Deny rustc::internal lints for rustdoc and clippy)
 - #81173 (Expand docs on Iterator::intersperse)
 - #81194 (Stabilize std::panic::panic_any.)
 - #81202 (Don't prefix 0x for each segments in `dbg!(Ipv6)`)
 - #81225 (Make 'docs' nullable in rustdoc-json output)
 - #81227 (Remove doctree::StructType)
 - #81233 (Document why not use concat! in dbg! macro)
 - #81236 (Gracefully handle loop labels missing leading `'` in different positions)
 - #81241 (Turn alloc's force_expr macro into a regular macro_rules.)
 - #81242 (Enforce statically that `MIN_NON_ZERO_CAP` is calculated at compile time)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #81242 - jyn514:const-cap, r=sfackler
Mara Bos [Fri, 22 Jan 2021 14:30:22 +0000 (14:30 +0000)]
Rollup merge of #81242 - jyn514:const-cap, r=sfackler

Enforce statically that `MIN_NON_ZERO_CAP` is calculated at compile time

Previously, it would usually get computed by LLVM, but this enforces it. This removes the need for the comment saying "LLVM is smart enough".

I don't expect this to make a performance difference, but I do think it makes the performance properties easier to reason about.

3 years agoRollup merge of #81241 - m-ou-se:force-expr-macro-rules, r=oli-obk
Mara Bos [Fri, 22 Jan 2021 14:30:21 +0000 (14:30 +0000)]
Rollup merge of #81241 - m-ou-se:force-expr-macro-rules, r=oli-obk

Turn alloc's force_expr macro into a regular macro_rules.

This turns `alloc`'s `force_expr` macro into a regular `macro_rules`.

Otherwise rust-analyzer doesn't understand `vec![]`. See https://github.com/rust-analyzer/rust-analyzer/issues/7349 and https://github.com/rust-lang/rust/pull/81080#issuecomment-764741721

Edit: See https://github.com/rust-lang/rust/pull/81241#issuecomment-764812660 for a discussion of alternatives.

3 years agoRollup merge of #81236 - estebank:everybody-loop-now, r=oli-obk
Mara Bos [Fri, 22 Jan 2021 14:30:19 +0000 (14:30 +0000)]
Rollup merge of #81236 - estebank:everybody-loop-now, r=oli-obk

Gracefully handle loop labels missing leading `'` in different positions

Fix #81192.

* Account for labels when suggesting `loop` instead of `while true`
* Suggest `'a` when given `a` only when appropriate
* Add loop head span to hir
* Tweak error for invalid `break expr`
* Add more misspelled label tests
* Avoid emitting redundant "unused label" lint
* Parse loop labels missing a leading `'`

Each commit can be reviewed in isolation.

3 years agoRollup merge of #81233 - lzutao:dbg, r=KodrAus
Mara Bos [Fri, 22 Jan 2021 14:30:17 +0000 (14:30 +0000)]
Rollup merge of #81233 - lzutao:dbg, r=KodrAus

Document why not use concat! in dbg! macro

Original title: Reduce code generated by `dbg!` macro
The expanded code before/after: <https://rust.godbolt.org/z/hE3j95>.

---

We cannot use `concat!` since `file!` could contains `{` or the expression is a block (`{ .. }`).
Using it will generated malformed format strings.
So let's document this reason why we don't use `concat!` macro at all.

3 years agoRollup merge of #81227 - CraftSpider:struct-type-clean, r=jyn514
Mara Bos [Fri, 22 Jan 2021 14:30:16 +0000 (14:30 +0000)]
Rollup merge of #81227 - CraftSpider:struct-type-clean, r=jyn514

Remove doctree::StructType

Also removes it from the Union type, as unions can only ever be 'Plain'. Adds a new StructType to JSON, 'union', as the easiest way to encode the type of a union there. This leaves only one item in doctree, `Module`.

r? `@jyn514`

3 years agoRollup merge of #81225 - CraftSpider:json-opt-docs, r=jyn514
Mara Bos [Fri, 22 Jan 2021 14:30:14 +0000 (14:30 +0000)]
Rollup merge of #81225 - CraftSpider:json-opt-docs, r=jyn514

Make 'docs' nullable in rustdoc-json output

Matches the backing better, and makes it so there's a difference between 'empty docs' and 'no docs'.

3 years agoRollup merge of #81202 - lzutao:dbg_ipv6, r=Amanieu
Mara Bos [Fri, 22 Jan 2021 14:30:12 +0000 (14:30 +0000)]
Rollup merge of #81202 - lzutao:dbg_ipv6, r=Amanieu

Don't prefix 0x for each segments in `dbg!(Ipv6)`

Fixes #81182

3 years agoRollup merge of #81194 - m-ou-se:stabilize-panic-any, r=m-ou-se
Mara Bos [Fri, 22 Jan 2021 14:30:11 +0000 (14:30 +0000)]
Rollup merge of #81194 - m-ou-se:stabilize-panic-any, r=m-ou-se

Stabilize std::panic::panic_any.

This stabilizes `std::panic::panic_any`.

3 years agoRollup merge of #81173 - lukaslueg:intersperse_docs, r=m-ou-se
Mara Bos [Fri, 22 Jan 2021 14:30:09 +0000 (14:30 +0000)]
Rollup merge of #81173 - lukaslueg:intersperse_docs, r=m-ou-se

Expand docs on Iterator::intersperse

Unstable feature in #79524. This expands on the docs to bring them more in line with how other methods of `Iterator` are demonstrated.

3 years agoRollup merge of #80573 - jyn514:tool-lints, r=GuillaumeGomez
Mara Bos [Fri, 22 Jan 2021 14:30:03 +0000 (14:30 +0000)]
Rollup merge of #80573 - jyn514:tool-lints, r=GuillaumeGomez

Deny rustc::internal lints for rustdoc and clippy

- Fix rustc::internal lints for rustdoc
- Deny internal lints only for rustdoc and clippy (previously the lints were ignored for clippy because -Zunstable-options didn't get passed)

3 years agoAuto merge of #81101 - tmiasko:combine-now, r=nagisa
bors [Fri, 22 Jan 2021 13:10:48 +0000 (13:10 +0000)]
Auto merge of #81101 - tmiasko:combine-now, r=nagisa

Combine instructions immediately

3 years agoAuto merge of #80558 - lcnr:gat-variance, r=matthewjasper
bors [Fri, 22 Jan 2021 10:12:05 +0000 (10:12 +0000)]
Auto merge of #80558 - lcnr:gat-variance, r=matthewjasper

require gat substs to be invariant

fixes #69184, fixes #80766

r? `@matthewjasper` probably

3 years agoAuto merge of #81135 - jyn514:no-backticks, r=flip1995
bors [Fri, 22 Jan 2021 06:13:19 +0000 (06:13 +0000)]
Auto merge of #81135 - jyn514:no-backticks, r=flip1995

Fix formatting for removed lints

- Don't add backticks for the reason a lint was removed. This is almost
never a code block, and when it is the backticks should be in the reason
itself.
- Don't assume clippy is the only tool that needs to be checked for
backwards compatibility

I split this out of https://github.com/rust-lang/rust/pull/80527/ because it kept causing tests to fail, and it's a good change to have anyway.

r? `@flip1995`

3 years agoDo not suggest using a break label when one is already present
Esteban Küber [Fri, 22 Jan 2021 02:13:05 +0000 (18:13 -0800)]
Do not suggest using a break label when one is already present

3 years agoFix clippy and comment
Esteban Küber [Fri, 22 Jan 2021 00:48:17 +0000 (16:48 -0800)]
Fix clippy and comment

3 years agoParse loop labels missing a leading `'`
Esteban Küber [Thu, 21 Jan 2021 04:03:29 +0000 (20:03 -0800)]
Parse loop labels missing a leading `'`

When encountering the following typo:

```rust
a: loop { break 'a; }
```

provide an appropriate suggestion.

3 years agoAvoid emitting redundant "unused label" lint
Esteban Küber [Thu, 21 Jan 2021 01:57:47 +0000 (17:57 -0800)]
Avoid emitting redundant "unused label" lint

3 years agoAdd more misspelled label tests
Esteban Küber [Thu, 21 Jan 2021 01:50:21 +0000 (17:50 -0800)]
Add more misspelled label tests

3 years agoTweak error for invalid `break expr`
Esteban Küber [Thu, 21 Jan 2021 01:25:27 +0000 (17:25 -0800)]
Tweak error for invalid `break expr`

Point at loop head on invalid `break expr`.
Suggest removing `expr` or using label if available.

3 years agoAdd loop head span to hir
Esteban Küber [Thu, 21 Jan 2021 01:15:08 +0000 (17:15 -0800)]
Add loop head span to hir

3 years agoSuggest `'a` when given `a` only when appropriate
Esteban Küber [Wed, 20 Jan 2021 01:51:48 +0000 (17:51 -0800)]
Suggest `'a` when given `a` only when appropriate

When encountering a name `a` that isn't resolved, but a label `'a` is
found in the current ribs, only suggest `'a` if this name is the value
expression of a `break` statement.

Solve FIXME.

3 years agoAccount for labels when suggesting `loop` instead of `while true`
Esteban Küber [Tue, 19 Jan 2021 23:51:51 +0000 (15:51 -0800)]
Account for labels when suggesting `loop` instead of `while true`

3 years agoDeny internal lints for rustdoc
Joshua Nelson [Fri, 22 Jan 2021 03:51:58 +0000 (22:51 -0500)]
Deny internal lints for rustdoc

3 years agoFix rustc::internal lints on rustdoc
Joshua Nelson [Fri, 1 Jan 2021 04:25:30 +0000 (23:25 -0500)]
Fix rustc::internal lints on rustdoc

3 years agoAuto merge of #81177 - Aaron1011:fix/force-capture-tokens, r=petrochenkov
bors [Fri, 22 Jan 2021 02:42:38 +0000 (02:42 +0000)]
Auto merge of #81177 - Aaron1011:fix/force-capture-tokens, r=petrochenkov

Force token collection to run when parsing nonterminals

Fixes #81007

Previously, we would fail to collect tokens in the proper place when
only builtin attributes were present. As a result, we would end up with
attribute tokens in the collected `TokenStream`, leading to duplication
when we attempted to prepend the attributes from the AST node.

We now explicitly track when token collection must be performed due to
nomterminal parsing.

3 years agoBump format version
Rune Tynan [Fri, 22 Jan 2021 02:18:31 +0000 (21:18 -0500)]
Bump format version

3 years agoAuto merge of #81160 - RalfJung:swap, r=oli-obk
bors [Fri, 22 Jan 2021 00:01:53 +0000 (00:01 +0000)]
Auto merge of #81160 - RalfJung:swap, r=oli-obk

use raw-ptr-addr-of for slice::swap

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

3 years agoAuto merge of #81152 - lzutao:intersperse_fold, r=m-ou-se
bors [Thu, 21 Jan 2021 21:05:34 +0000 (21:05 +0000)]
Auto merge of #81152 - lzutao:intersperse_fold, r=m-ou-se

Fix intersperse_fold

Here is a standalone playground link in case anybody wants to modify code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=626b4d044fb74f044a36098ad907e40f

Fixes #81145

cc #79479 `@jonas-schievink`

3 years agoFix typo
Lukas Lueg [Thu, 21 Jan 2021 19:31:37 +0000 (20:31 +0100)]
Fix typo

3 years agoExpand docs on Iterator::intersperse
Lukas Lueg [Mon, 18 Jan 2021 19:40:25 +0000 (20:40 +0100)]
Expand docs on Iterator::intersperse

3 years agoRename alloc::force_expr to __rust_force_expr.
Mara Bos [Thu, 21 Jan 2021 17:30:49 +0000 (18:30 +0100)]
Rename alloc::force_expr to __rust_force_expr.

3 years agoTurn alloc's force_expr macro into a regular macro_rules!{}.
Mara Bos [Thu, 21 Jan 2021 16:12:14 +0000 (17:12 +0100)]
Turn alloc's force_expr macro into a regular macro_rules!{}.

Otherwise rust-analyzer doesn't understand vec![].

3 years agoAuto merge of #81122 - tmiasko:no-drop, r=davidtwco
bors [Thu, 21 Jan 2021 17:02:49 +0000 (17:02 +0000)]
Auto merge of #81122 - tmiasko:no-drop, r=davidtwco

Visit only terminators when removing unneeded drops

No functional changes intended

3 years agoEnforce statically that `MIN_NON_ZERO_CAP` is calculated at compile time
Joshua Nelson [Thu, 21 Jan 2021 16:57:01 +0000 (11:57 -0500)]
Enforce statically that `MIN_NON_ZERO_CAP` is calculated at compile time

Previously, it would usually get computed by LLVM, but this enforces it.

3 years agorequire gat substs to be invariant
Bastian Kauschke [Thu, 31 Dec 2020 14:35:21 +0000 (15:35 +0100)]
require gat substs to be invariant

3 years agoAuto merge of #81240 - JohnTitor:rollup-ieaz82a, r=JohnTitor
bors [Thu, 21 Jan 2021 12:18:32 +0000 (12:18 +0000)]
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

3 years agoRollup merge of #81219 - joshtriplett:temp_dir-docs, r=sfackler
Yuki Okushi [Thu, 21 Jan 2021 11:04:56 +0000 (20:04 +0900)]
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.

3 years agoRollup merge of #81187 - eltociear:patch-6, r=jonas-schievink
Yuki Okushi [Thu, 21 Jan 2021 11:04:55 +0000 (20:04 +0900)]
Rollup merge of #81187 - eltociear:patch-6, r=jonas-schievink

Fix typo in counters.rs

formating -> formatting

3 years agoRollup merge of #81185 - osa1:fix_80742, r=oli-obk
Yuki Okushi [Thu, 21 Jan 2021 11:04:53 +0000 (20:04 +0900)]
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

3 years agoRollup merge of #81184 - jyn514:combine-after, r=CraftSpider
Yuki Okushi [Thu, 21 Jan 2021 11:04:51 +0000 (20:04 +0900)]
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.

3 years agoRollup merge of #81179 - CPerezz:fix_interal_doc_warns, r=jyn514
Yuki Okushi [Thu, 21 Jan 2021 11:04:50 +0000 (20:04 +0900)]
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.

3 years agoRollup merge of #81178 - tmiasko:no-landing-pads, r=oli-obk
Yuki Okushi [Thu, 21 Jan 2021 11:04:48 +0000 (20:04 +0900)]
Rollup merge of #81178 - tmiasko:no-landing-pads, r=oli-obk

Visit only terminators when removing landing pads

No functional changes intended

3 years agoRollup merge of #81046 - rylev:unknown-external-crate, r=estebank
Yuki Okushi [Thu, 21 Jan 2021 11:04:45 +0000 (20:04 +0900)]
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```

3 years agoRollup merge of #80601 - steffahn:improve_format_string_grammar, r=m-ou-se
Yuki Okushi [Thu, 21 Jan 2021 11:04:43 +0000 (20:04 +0900)]
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

3 years agoRollup merge of #80429 - JulianKnodt:ob_forest, r=Mark-Simulacrum
Yuki Okushi [Thu, 21 Jan 2021 11:04:41 +0000 (20:04 +0900)]
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.

3 years agoRollup merge of #80172 - camelid:prelude-docs-consistent-punct, r=steveklabnik
Yuki Okushi [Thu, 21 Jan 2021 11:04:39 +0000 (20:04 +0900)]
Rollup merge of #80172 - camelid:prelude-docs-consistent-punct, r=steveklabnik

Use consistent punctuation for 'Prelude contents' docs

3 years agoRollup merge of #79655 - pickfire:visual-vec, r=m-ou-se
Yuki Okushi [Thu, 21 Jan 2021 11:04:38 +0000 (20:04 +0900)]
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

3 years agoDocument why cannot use concat! in dbg!
Lzu Tao [Thu, 21 Jan 2021 01:42:37 +0000 (01:42 +0000)]
Document why cannot use concat! in dbg!

Co-authored-by: Miguel Ojeda <ojeda@users.noreply.github.com>
3 years agoAuto merge of #80958 - bstrie:deptbdnums, r=KodrAus
bors [Thu, 21 Jan 2021 09:14:37 +0000 (09:14 +0000)]
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).

3 years agoAuto merge of #81231 - jyn514:flaky-test-2, r=Mark-Simulacrum
bors [Thu, 21 Jan 2021 05:27:30 +0000 (05:27 +0000)]
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`

3 years agoRemove link to current section
Ivan Tham [Thu, 21 Jan 2021 05:18:12 +0000 (13:18 +0800)]
Remove link to current section

Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
3 years agoDeprecate-in-future the constants superceded by RFC 2700
bstrie [Sun, 10 Jan 2021 21:57:21 +0000 (16:57 -0500)]
Deprecate-in-future the constants superceded by RFC 2700

3 years agoRemove flaky test
Joshua Nelson [Thu, 21 Jan 2021 00:18:23 +0000 (19:18 -0500)]
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.

3 years agoAuto merge of #81229 - m-ou-se:solaris-workaround, r=pietroalbini
bors [Wed, 20 Jan 2021 23:40:09 +0000 (23:40 +0000)]
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`

3 years agoForce token collection to run when parsing nonterminals
Aaron Hill [Mon, 18 Jan 2021 21:47:37 +0000 (16:47 -0500)]
Force token collection to run when parsing nonterminals

Fixes #81007

Previously, we would fail to collect tokens in the proper place when
only builtin attributes were present. As a result, we would end up with
attribute tokens in the collected `TokenStream`, leading to duplication
when we attempted to prepend the attributes from the AST node.

We now explicitly track when token collection must be performed due to
nomterminal parsing.

3 years agoAdd explanation of None vs Some("")
Rune Tynan [Wed, 20 Jan 2021 22:52:52 +0000 (17:52 -0500)]
Add explanation of None vs Some("")

3 years agoWork around missing -dev packages in solaris docker image.
Mara Bos [Wed, 20 Jan 2021 22:29:55 +0000 (23:29 +0100)]
Work around missing -dev packages in solaris docker image.

3 years agoRemove StructType entirely and replace it with CtorKind
Rune Tynan [Wed, 20 Jan 2021 22:19:46 +0000 (17:19 -0500)]
Remove StructType entirely and replace it with CtorKind

3 years agoMove StructType to clean, remove it from Unions, make JSON output whether something...
Rune Tynan [Wed, 20 Jan 2021 21:46:34 +0000 (16:46 -0500)]
Move StructType to clean, remove it from Unions, make JSON output whether something is a union

3 years agoMake 'docs' optional
Rune Tynan [Wed, 20 Jan 2021 20:58:03 +0000 (15:58 -0500)]
Make 'docs' optional

3 years agoDocument security implications of std::env::temp_dir
Josh Triplett [Wed, 20 Jan 2021 19:24:47 +0000 (11:24 -0800)]
Document security implications of std::env::temp_dir

Update the sample code to not create an insecure temporary file.

3 years agoAdd more details explaning the Vec visualization
Ivan Tham [Sat, 5 Dec 2020 02:21:54 +0000 (10:21 +0800)]
Add more details explaning the Vec visualization

Suggested by oli-obk

3 years agoAdd Vec visualization to understand capacity
Ivan Tham [Thu, 3 Dec 2020 02:56:13 +0000 (10:56 +0800)]
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

3 years agoAuto merge of #81118 - ojeda:metadata-obj, r=nagisa
bors [Wed, 20 Jan 2021 07:15:40 +0000 (07:15 +0000)]
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.

3 years agoDont prefix 0x when `dbg!(ipv6)`
Lzu Tao [Wed, 20 Jan 2021 03:06:49 +0000 (03:06 +0000)]
Dont prefix 0x when `dbg!(ipv6)`

3 years agoUse slice::split_first instead of manuall slicing
Lzu Tao [Wed, 20 Jan 2021 01:33:38 +0000 (01:33 +0000)]
Use slice::split_first instead of manuall slicing

3 years agoAuto merge of #81063 - CraftSpider:jsondocck, r=jyn514
bors [Wed, 20 Jan 2021 04:10:36 +0000 (04:10 +0000)]
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`

3 years agoNo longer require unstable for jsondocck, only build it for json tests
Rune Tynan [Wed, 20 Jan 2021 00:15:04 +0000 (19:15 -0500)]
No longer require unstable for jsondocck, only build it for json tests

3 years agoAuto merge of #79578 - alexcrichton:update-waasi, r=KodrAus
bors [Tue, 19 Jan 2021 22:20:58 +0000 (22:20 +0000)]
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.

3 years agoAddress review v2
Rune Tynan [Tue, 19 Jan 2021 19:21:05 +0000 (14:21 -0500)]
Address review v2

3 years agoMake 'static bound on panic_any explicit.
Mara Bos [Tue, 19 Jan 2021 20:41:41 +0000 (21:41 +0100)]
Make 'static bound on panic_any explicit.

This was already implied because Any: 'static, but this makes it
explicit.

3 years agoStabilize std::panic::panic_any.
Mara Bos [Tue, 19 Jan 2021 20:30:49 +0000 (21:30 +0100)]
Stabilize std::panic::panic_any.

3 years agoAuto merge of #80957 - tgnottingham:direct_serialize_depgraph, r=michaelwoerister
bors [Tue, 19 Jan 2021 19:36:41 +0000 (19:36 +0000)]
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.

3 years agoShift another panic into an exit
Rune Tynan [Sat, 16 Jan 2021 06:27:26 +0000 (01:27 -0500)]
Shift another panic into an exit

3 years agoAddress review comments
Rune Tynan [Sat, 16 Jan 2021 05:29:47 +0000 (00:29 -0500)]
Address review comments

3 years agoAdd jsondocck tool, and use it for rustdoc JSON
Rune Tynan [Sat, 16 Jan 2021 01:34:15 +0000 (20:34 -0500)]
Add jsondocck tool, and use it for rustdoc JSON

3 years agoAdd SpecFromIter ref in the comments directly
CPerezz [Tue, 19 Jan 2021 17:28:33 +0000 (18:28 +0100)]
Add SpecFromIter ref in the comments directly

3 years agoAuto merge of #79705 - ijackson:bufwriter-disassemble, r=m-ou-se
bors [Tue, 19 Jan 2021 16:42:19 +0000 (16:42 +0000)]
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.*

3 years agoFix ICE in mir when evaluating SizeOf on unsized type
Ömer Sinan Ağacan [Tue, 19 Jan 2021 07:11:24 +0000 (10:11 +0300)]
Fix ICE in mir when evaluating SizeOf on unsized type

Fixes #80742

3 years agoFix typo in counters.rs
Ikko Ashimine [Tue, 19 Jan 2021 14:42:18 +0000 (23:42 +0900)]
Fix typo in counters.rs

formating -> formatting

3 years agoStop `fold` at first None when iterator yield
Mara Bos [Tue, 19 Jan 2021 12:17:58 +0000 (12:17 +0000)]
Stop `fold` at first None when iterator yield

3 years agoAuto merge of #81186 - GuillaumeGomez:rollup-y2d04g9, r=GuillaumeGomez
bors [Tue, 19 Jan 2021 12:04:22 +0000 (12:04 +0000)]
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

3 years agoRollup merge of #81168 - soniasingla:doc/sonia, r=jonas-schievink
Guillaume Gomez [Tue, 19 Jan 2021 09:28:04 +0000 (10:28 +0100)]
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

3 years agoRollup merge of #81166 - RalfJung:debug-assert-comments, r=Mark-Simulacrum
Guillaume Gomez [Tue, 19 Jan 2021 09:28:03 +0000 (10:28 +0100)]
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.

3 years agoRollup merge of #81164 - eltociear:patch-5, r=jonas-schievink
Guillaume Gomez [Tue, 19 Jan 2021 09:28:00 +0000 (10:28 +0100)]
Rollup merge of #81164 - eltociear:patch-5, r=jonas-schievink

Fix typo in simplify.rs

prexisting -> preexisting

3 years agoRollup merge of #81161 - GuillaumeGomez:remove-inline-script, r=Nemo157
Guillaume Gomez [Tue, 19 Jan 2021 09:27:58 +0000 (10:27 +0100)]
Rollup merge of #81161 - GuillaumeGomez:remove-inline-script, r=Nemo157

Remove inline script tags

Fixes #81133.

cc ``@pietroalbini``

r? ``@Nemo157``

3 years agoRollup merge of #81147 - estebank:drop-suggestion, r=varkor
Guillaume Gomez [Tue, 19 Jan 2021 09:27:56 +0000 (10:27 +0100)]
Rollup merge of #81147 - estebank:drop-suggestion, r=varkor

Fix structured suggestion for explicit `drop` call

3 years agoRollup merge of #81115 - ssomers:btree_drainy_refactor_4, r=Mark-Simulacrum
Guillaume Gomez [Tue, 19 Jan 2021 09:27:54 +0000 (10:27 +0100)]
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``

3 years agoRollup merge of #81112 - m-ou-se:alloc-std-ops-reexport, r=KodrAus
Guillaume Gomez [Tue, 19 Jan 2021 09:27:53 +0000 (10:27 +0100)]
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.

3 years agoRollup merge of #80382 - GuillaumeGomez:search-result-tab-picking, r=Nemo157,pickfire
Guillaume Gomez [Tue, 19 Jan 2021 09:27:50 +0000 (10:27 +0100)]
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`

3 years agoAuto merge of #81110 - LeSeulArtichaut:fix-unused-unsafe-label, r=RalfJung
bors [Tue, 19 Jan 2021 08:59:37 +0000 (08:59 +0000)]
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

3 years agoRemove unnecessary `after_run` function
Joshua Nelson [Tue, 19 Jan 2021 06:59:45 +0000 (01:59 -0500)]
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.

3 years agoAuto merge of #81169 - dylni:fix-soundness-issue-for-replace-range, r=KodrAus
bors [Tue, 19 Jan 2021 05:58:51 +0000 (05:58 +0000)]
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).

3 years agoFix soundness issue for `replace_range` and `range`
dylni [Tue, 19 Jan 2021 03:14:38 +0000 (22:14 -0500)]
Fix soundness issue for `replace_range` and `range`

3 years agoAuto merge of #81103 - zackmdavis:comma_trail, r=davidtwco
bors [Tue, 19 Jan 2021 02:54:58 +0000 (02:54 +0000)]
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`

3 years agoFix intersperse_fold
Lzu Tao [Mon, 18 Jan 2021 03:02:47 +0000 (03:02 +0000)]
Fix intersperse_fold

3 years agoAuto merge of #81042 - sasurau4:fix/unclear-error-with-trait, r=estebank
bors [Tue, 19 Jan 2021 00:00:21 +0000 (00:00 +0000)]
Auto merge of #81042 - sasurau4:fix/unclear-error-with-trait, r=estebank

Add suggestion for impl_candidates with E0283

Fix #42226

3 years agoFix internal rustdoc broken links
CPerezz [Mon, 18 Jan 2021 22:47:01 +0000 (23:47 +0100)]
Fix internal rustdoc broken links

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

This fixes #81037 by adding the trait in the scope
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.

3 years agoAuto merge of #80707 - oli-obk:stability_hole_const_intrinsics, r=RalfJung
bors [Mon, 18 Jan 2021 20:54:36 +0000 (20:54 +0000)]
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.