]> git.lizzy.rs Git - rust.git/log
rust.git
21 months agorustdoc: remove outdated CSS `.content table` etc
Michael Howell [Tue, 13 Sep 2022 19:25:32 +0000 (12:25 -0700)]
rustdoc: remove outdated CSS `.content table` etc

The `.content table` / `.content td` / `.content tr` family of selectors date
back to 4fd061c426902b0904c65e64a3780b21f9ab3afb, when module indexes and
other parts of rustdoc used `<table>` tags for layout and content
presentation. The `.content td h1, .content td h2` has only been changed
since then to tweak the font size in
dd5ff428edbc7cd4fa600b81f27bbec28589704f.

https://github.com/rust-lang/rust/blob/4fd061c426902b0904c65e64a3780b21f9ab3afb/src/rustdoc_ng/html/static/main.css#L155-L162

This CSS would have affected:

  * search result tables, which were removed in
    b615c0c85469c94041a5e68b9d8b68dcf799f9f1
  * module item tables, which were removed in
    6020c79ddeafe8d9760b27c14c39da81bac9b4a6
  * docblock tables from markdown, which still exist

It may also have affected a few other tables over the last decade, but
they've been gradually replaced with grid layouts and flexbox to make layouts
that work better on narrow viewports. For example,
34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9.

These rules have no affect on the appearance of docblock tables
===============================================================

    .content table {
        border-spacing: 0 5px;
    }

According to MDN, [border-spacing] only has an effect when `border-collapse`
is `separate`. However, `border-collapse: collapse` is set globally for all
tables, so this rule does nothing.

[border-spacing]: https://developer.mozilla.org/en-US/docs/Web/CSS/border-spacing

    .content td p:first-child { margin-top: 0; }

Tables with paragraphs in them are impossible without dropping down to raw
HTML. Also, the rustdoc stylesheet sets paragraphs to have no top margin
anyway, so this rule is a no-op.

    .content td h1, .content td h2 { margin-left: 0; font-size: 1.125rem; }

Tables with headers in them are impossible without dropping down to raw HTML.
This is considered unlikely, especially since it looks weird right now
(`.docblock h2` has an underline that is redundant with the table cell's own
border).

    .content tr:first-child td { border-top: 0; }

This has no effect because of border collapsing.

This rule is removed, because tables look fine without it
=========================================================

    .content td:first-child { padding-right: 20px; }

By removing this rule, the first cell in each row has the same padding as all
other cells in the row.

This rule is kept, and converted to directly target `.docblock`
===============================================================

    .content td { vertical-align: top; }

Removing this rule would cause it to be aligned to the middle instead.

21 months agoAuto merge of #101615 - compiler-errors:rpitit-perf, r=oli-obk
bors [Tue, 13 Sep 2022 15:33:06 +0000 (15:33 +0000)]
Auto merge of #101615 - compiler-errors:rpitit-perf, r=oli-obk

Make `compare_predicate_entailment` no longer a query

Make `compare_predicate_entailment` so it's no longer a query (again), and splits out the new logic (that equates the return types to infer RPITITs) into its own query. This means that this new query (now called `collect_trait_impl_trait_tys`) is no longer executed for non-RPITIT cases.

This should improve perf (https://github.com/rust-lang/rust/pull/101224#issuecomment-1241682203), though in practice we see that these some crates remain from the primary regressions list on the original report... They are all <= 0.43% regression and seemingly only on the incr-full scenario for all of them.

I am at a loss for what might be causing this regression other than what I fixed here, since we don't introduce much new non-RPITIT logic except for some `def_kind` query calls in some places, for example, like projection. Maybe that's it?

----

Originally this PR was opened to test enabling `cache_on_disk` (62164aaaa11) but that didn't turn out to be very useful (https://github.com/rust-lang/rust/pull/101615#issuecomment-1242403205), so that led me to just split the query (and rename the PR).

21 months agoAuto merge of #101757 - Dylan-DPC:rollup-wkt6oe9, r=Dylan-DPC
bors [Tue, 13 Sep 2022 12:35:55 +0000 (12:35 +0000)]
Auto merge of #101757 - Dylan-DPC:rollup-wkt6oe9, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #101602 (Streamline `AttrAnnotatedTokenStream`)
 - #101690 (Avoid `Iterator::last`)
 - #101700 (A `SubstitutionPart` is not considered a deletion if it replaces nothing with nothing)
 - #101745 (Fix typo in concat_bytes documentation)
 - #101748 (rustdoc: remove redundant CSS `#source-sidebar, #sidebar-toggle`)

Failed merges:

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

21 months agoRollup merge of #101748 - notriddle:notriddle/source-sidebar-sidebar-toggle, r=Guilla...
Dylan DPC [Tue, 13 Sep 2022 11:21:32 +0000 (16:51 +0530)]
Rollup merge of #101748 - notriddle:notriddle/source-sidebar-sidebar-toggle, r=GuillaumeGomez

rustdoc: remove redundant CSS `#source-sidebar, #sidebar-toggle`

These two elements are always nested below `<nav class="sidebar">`, and will inherit the font from their parent.

These selectors were added in 93520d2ad145b791b1b1a6c71cdea65b1943ffb6, and became redundant in 07e3f998b1ceb4b8d2a7992782e60f5e776aa114 when the source sidebar elements became nested below `nav.sidebar`.

21 months agoRollup merge of #101745 - jay3332:patch-1, r=JohnTitor
Dylan DPC [Tue, 13 Sep 2022 11:21:32 +0000 (16:51 +0530)]
Rollup merge of #101745 - jay3332:patch-1, r=JohnTitor

Fix typo in concat_bytes documentation

This fixes the typo `&[u8, _]` -> `&[u8; _]`

21 months agoRollup merge of #101700 - compiler-errors:deletion-span, r=davidtwco
Dylan DPC [Tue, 13 Sep 2022 11:21:31 +0000 (16:51 +0530)]
Rollup merge of #101700 - compiler-errors:deletion-span, r=davidtwco

A `SubstitutionPart` is not considered a deletion if it replaces nothing with nothing

Fixes #101689

21 months agoRollup merge of #101690 - kadiwa4:avoid_iterator_last, r=oli-obk
Dylan DPC [Tue, 13 Sep 2022 11:21:31 +0000 (16:51 +0530)]
Rollup merge of #101690 - kadiwa4:avoid_iterator_last, r=oli-obk

Avoid `Iterator::last`

Adapters like `Filter` and `Map` use the default implementation of `Iterator::last` which is not short-circuiting (and so does `core::str::Split`). The predicate function will be run for every single item of the underlying iterator. I hope that removing those calls to `last` results in slight performance improvements.

21 months agoRollup merge of #101602 - nnethercote:AttrTokenStream, r=petrochenkov
Dylan DPC [Tue, 13 Sep 2022 11:21:31 +0000 (16:51 +0530)]
Rollup merge of #101602 - nnethercote:AttrTokenStream, r=petrochenkov

Streamline `AttrAnnotatedTokenStream`

r? ```@petrochenkov```

21 months agoAuto merge of #96709 - jackh726:gats-stabilization, r=compiler-errors
bors [Tue, 13 Sep 2022 09:39:41 +0000 (09:39 +0000)]
Auto merge of #96709 - jackh726:gats-stabilization, r=compiler-errors

Stabilize generic associated types

Closes #44265

r? `@nikomatsakis`

# ⚡ Status of the discussion ⚡

* [x] There have been several serious concerns raised, [summarized here](https://github.com/rust-lang/rust/pull/96709#issuecomment-1129311660).
* [x] There has also been a [deep-dive comment](https://github.com/rust-lang/rust/pull/96709#issuecomment-1167220240) explaining some of the "patterns of code" that are enabled by GATs, based on use-cases posted to this thread or on the tracking issue.
* [x] We have modeled some aspects of GATs in [a-mir-formality](https://github.com/nikomatsakis/a-mir-formality) to give better confidence in how they will be resolved in the future. [You can read a write-up here](https://github.com/rust-lang/types-team/blob/master/minutes/2022-07-08-implied-bounds-and-wf-checking.md).
* [x] The major points of the discussion have been [summarized on the GAT initiative repository](https://rust-lang.github.io/generic-associated-types-initiative/mvp.html).
* [x] [FCP has been proposed](https://github.com/rust-lang/rust/pull/96709#issuecomment-1129311660) and we are awaiting final decisions and discussion amidst the relevant team members.

# Stabilization proposal

This PR proposes the stabilization of `#![feature(generic_associated_types)]`. While there a number of future additions to be made and bugs to be fixed (both discussed below), properly doing these will require significant language design and will ultimately likely be backwards-compatible. Given the overwhelming desire to have some form of generic associated types (GATs) available on stable and the stability of the "simple" uses, stabilizing the current subset of GAT features is almost certainly the correct next step.

Tracking issue: #44265
Initiative: https://rust-lang.github.io/generic-associated-types-initiative/
RFC: https://github.com/rust-lang/rfcs/blob/master/text/1598-generic_associated_types.md
Version: 1.65 (2022-08-22 => beta, 2022-11-03 => stable).

## Motivation

There are a myriad of potential use cases for GATs. Stabilization unblocks probable future language features (e.g. async functions in traits), potential future standard library features (e.g. a `LendingIterator` or some form of `Iterator` with a lifetime generic), and a plethora of user use cases (some of which can be seen just by scrolling through the tracking issue and looking at all the issues linking to it).

There are a myriad of potential use cases for GATs. First, there are many users that have chosen to not use GATs primarily because they are not stable (some of which can be seen just by scrolling through the tracking issue and looking at all the issues linking to it). Second, while language feature desugaring isn't *blocked* on stabilization, it gives more confidence on using the feature. Likewise, library features like `LendingIterator` are not necessarily blocked on stabilization to be implemented unstably; however few, if any, public-facing APIs actually use unstable features.

This feature has a long history of design, discussion, and developement - the RFC was first introduced roughly 6 years ago. While there are still a number of features left to implement and bugs left to fix, it's clear that it's unlikely those will have backwards-incompatibility concerns. Additionally, the bugs that do exist do not strongly impede the most-common use cases.

## What is stabilized

The primary language feature stabilized here is the ability to have generics on associated types, as so. Additionally, where clauses on associated types will now be accepted, regardless if the associated type is generic or not.

```rust
trait ATraitWithGATs {
    type Assoc<'a, T> where T: 'a;
}

trait ATraitWithoutGATs<'a, T> {
    type Assoc where T: 'a;
}
```

When adding an impl for a trait with generic associated types, the generics for the associated type are copied as well. Note that where clauses are allowed both after the specified type and before the equals sign; however, the latter is a warn-by-default deprecation.

```rust
struct X;
struct Y;

impl ATraitWithGATs for X {
    type Assoc<'a, T> = &'a T
      where T: 'a;
}
impl ATraitWithGATs for Y {
    type Assoc<'a, T>
      where T: 'a
    = &'a T;
}
```

To use a GAT in a function, generics are specified on the associated type, as if it was a struct or enum. GATs can also be specified in trait bounds:

```rust
fn accepts_gat<'a, T>(t: &'a T) -> T::Assoc<'a, T>
  where for<'x> T: ATraitWithGATs<Assoc<'a, T> = &'a T> {
    ...
}
```

GATs can also appear in trait methods. However, depending on how they are used, they may confer where clauses on the associated type definition. More information can be found [here](https://github.com/rust-lang/rust/issues/87479). Briefly, where clauses are required when those bounds can be proven in the methods that *construct* the GAT or other associated types that use the GAT in the trait. This allows impls to have maximum flexibility in the types defined for the associated type.

To take a relatively simple example:

```rust
trait Iterable {
    type Item<'a>;
    type Iterator<'a>: Iterator<Item = Self::Item<'a>>;

    fn iter<'x>(&'x self) -> Self::Iterator<'x>;
    //^ We know that `Self: 'a` for `Iterator<'a>`, so we require that bound on `Iterator`
    //  `Iterator` uses `Self::Item`, so we also require a `Self: 'a` on `Item` too
}
```

A couple well-explained examples are available in a previous [blog post](https://blog.rust-lang.org/2021/08/03/GATs-stabilization-push.html).

## What isn't stabilized/implemented

### Universal type/const quantification

Currently, you can write a bound like `X: for<'a> Trait<Assoc<'a> = &'a ()>`. However, you cannot currently write `for<T> X: Trait<Assoc<T> = T>` or `for<const N> X: Trait<Assoc<N> = [usize; N]>`.

Here is an example where this is needed:

```rust
trait Foo {}

trait Trait {
    type Assoc<F: Foo>;
}

trait Trait2: Sized {
    fn foo<F: Foo, T: Trait<Assoc<F> = F>>(_t: T);
}
```

In the above example, the *caller* must specify `F`, which is likely not what is desired.

### Object-safe GATs

Unlike non-generic associated types, traits with GATs are not currently object-safe. In other words the following are not allowed:

```rust
trait Trait {
    type Assoc<'a>;
}

fn foo(t: &dyn for<'a> Trait<Assoc<'a> = &'a ()>) {}
         //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not allowed

let ty: Box<dyn for<'a> Trait<Assoc<'a> = &'a ()>>;
          //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not allowed
```

### Higher-kinded types

You cannot write currently (and there are no current plans to implement this):

```rust
struct Struct<'a> {}

fn foo(s: for<'a> Struct<'a>) {}
```

## Tests

There are many tests covering GATs that can be found in  `src/test/ui/generic-associated-types`. Here, I'll list (in alphanumeric order) tests highlight some important behavior or contain important patterns.

- `./parse/*`: Parsing of GATs in traits and impls, and the trait path with GATs
- `./collections-project-default.rs`: Interaction with associated type defaults
- `./collections.rs`: The `Collection` pattern
- `./const-generics-gat-in-trait-return-type-*.rs`: Const parameters
- `./constraint-assoc-type-suggestion.rs`: Emit correct syntax in suggestion
- `./cross-crate-bounds.rs`: Ensure we handles bounds across crates the same
- `./elided-in-expr-position.rs`: Disallow lifetime elision in return position
- `./gat-in-trait-path-undeclared-lifetime.rs`: Ensure we error on undeclared lifetime in trait path
- `./gat-in-trait-path.rs`: Base trait path case
- `./gat-trait-path-generic-type-arg.rs`: Don't allow shadowing of parameters
- `./gat-trait-path-parenthesised-args.rs`: Don't allow paranthesized args in trait path
- `./generic-associated-types-where.rs`: Ensure that we require where clauses from trait to be met on impl
- `./impl_bounds.rs`: Check that the bounds on GATs in an impl are checked
- `./issue-76826.rs`: `Windows` pattern
- `./issue-78113-lifetime-mismatch-dyn-trait-box.rs`: Implicit 'static diagnostics
- `./issue-84931.rs`: Ensure that we have a where clause on GAT to ensure trait parameter lives long enough
- `./issue-87258_a.rs`: Unconstrained opaque type with TAITs
- `./issue-87429-2.rs`: Ensure we can use bound vars in the bounds
- `./issue-87429-associated-type-default.rs`: Ensure bounds hold with associated type defaults, for both trait and impl
- `./issue-87429-specialization.rs`: Check that bounds hold under specialization
- `./issue-88595.rs`: Under the outlives lint, we require a bound for both trait and GAT lifetime when trait lifetime is used in function
- `./issue-90014.rs`: Lifetime bounds are checked with TAITs
- `./issue-91139.rs`: Under migrate mode, but not NLL, we don't capture implied bounds from HRTB lifetimes used in a function and GATs
- `./issue-91762.rs`: We used to too eagerly pick param env candidates when normalizing with GATs. We now require explicit parameters specified.
- `./issue-95305.rs`: Disallow lifetime elision in trait paths
- `./iterable.rs`: `Iterable` pattern
- `./method-unsatified-assoc-type-predicate.rs`: Print predicates with GATs correctly in method resolve error
- `./missing_lifetime_const.rs`: Ensure we must specify lifetime args (not elidable)
- `./missing-where-clause-on-trait.rs`: Ensure we don't allow stricter bounds on impl than trait
- `./parameter_number_and_kind_impl.rs`: Ensure paramters on GAT in impl match GAT in trait
- `./pointer_family.rs`: `PointerFamily` pattern
- `./projection-bound-cycle.rs`: Don't allow invalid cycles to prove bounds
- `./self-outlives-lint.rs`: Ensures that an e.g. `Self: 'a` is written on the traits GAT if that bound can be implied from the GAT usage in the trait
- `./shadowing.rs`: Don't allow lifetime shadowing in params
- `./streaming_iterator.rs`: `StreamingIterator`(`LendingIterator`) pattern
- `./trait-objects.rs`: Disallow trait objects for traits with GATs
- `./variance_constraints.rs`: Require that GAT substs be invariant

## Remaining bugs and open issues

A full list of remaining open issues can be found at: https://github.com/rust-lang/rust/labels/F-generic_associated_types

There are some `known-bug` tests in-tree at `src/test/ui/generic-associated-types/bugs`.

Here I'll categorize most of those that GAT bugs (or involve a pattern found more with GATs), but not those that include GATs but not a GAT issue in and of itself. (I also won't include issues directly for things listed elsewhere here.)

Using the concrete type of a GAT instead of the projection type can give errors, since lifetimes are chosen to be early-bound vs late-bound.
- #85533
- #87803

In certain cases, we can run into cycle or overflow errors. This is more generally a problem with associated types.
- #87755
- #87758

Bounds on an associatd type need to be proven by an impl, but where clauses need to be proven by the usage. This can lead to confusion when users write one when they mean the other.
- #87831
- #90573

We sometimes can't normalize closure signatures fully. Really an asociated types issue, but might happen a bit more frequently with GATs, since more obvious place for HRTB lifetimes.
- #88382

When calling a function, we assign types to parameters "too late", after we already try (and fail) to normalize projections. Another associated types issue that might pop up more with GATs.
- #88460
- #96230

We don't fully have implied bounds for lifetimes appearing in GAT trait paths, which can lead to unconstrained type errors.
- #88526

Suggestion for adding lifetime bounds can suggest unhelpful fixes (`T: 'a` instead of `Self: 'a`), but the next compiler error after making the suggested change is helpful.
- #90816
- #92096
- #95268

We can end up requiring that `for<'a> I: 'a` when we really want `for<'a where I: 'a> I: 'a`. This can leave unhelpful errors than effectively can't be satisfied unless `I: 'static`. Requires bigger changes and not only GATs.
- #91693

Unlike with non-generic associated types, we don't eagerly normalize with param env candidates. This is intended behavior (for now), to avoid accidentaly stabilizing picking arbitrary impls.
- #91762

Some Iterator adapter patterns (namely `filter`) require Polonius or unsafe to work.
- #92985

## Potential Future work

### Universal type/const quantification

No work has been done to implement this. There are also some questions around implied bounds.

###  Object-safe GATs

The intention is to make traits with GATs object-safe. There are some design work to be done around well-formedness rules and general implementation.

### GATified std lib types

It would be helpful to either introduce new std lib traits (like `LendingIterator`) or to modify existing ones (adding a `'a` generic to `Iterator::Item`). There also a number of other candidates, like `Index`/`IndexMut` and `Fn`/`FnMut`/`FnOnce`.

### Reduce the need for `for<'a>`

Seen [here](https://github.com/rust-lang/rfcs/pull/1598#issuecomment-2611378730). One possible syntax:

```rust
trait Iterable {
    type Iter<'a>: Iterator<Item = Self::Item<'a>>;
}

fn foo<T>() where T: Iterable, T::Item<let 'a>: Display { } //note the `let`!
```

### Better implied bounds on higher-ranked things

Currently if we have a `type Item<'a> where self: 'a`, and a `for<'a> T: Iterator<Item<'a> = &'a ()`, this requires `for<'a> Self: 'a`. Really, we want `for<'a where T: 'a> ...`

There was some mentions of this all the back in the RFC thread [here](https://github.com/rust-lang/rfcs/pull/1598#issuecomment-264340514).

## Alternatives

### Make generics on associated type in bounds a binder

Imagine the bound `for<'a> T: Trait<Item<'a>= &'a ()>`. It might be that `for<'a>` is "too large" and it should instead be `T: Trait<for<'a> Item<'a>= &'a ()>`. Brought up in RFC thread [here](https://github.com/rust-lang/rfcs/pull/1598#issuecomment-229443863) and in a few places since.

Another related question: Is `for<'a>` the right syntax? Maybe `where<'a>`? Also originally found in RFC thread [here](https://github.com/rust-lang/rfcs/pull/1598#issuecomment-261639969).

### Stabilize lifetime GATs first

This has been brought up a few times. The idea is to only allow GATs with lifetime parameters to in initial stabilization. This was probably most useful prior to actual implementation. At this point, lifetimes, types, and consts are all implemented and work. It feels like an arbitrary split without strong reason.

## History

* On 2016-04-30, [RFC opened](https://github.com/rust-lang/rfcs/pull/1598)
* On 2017-09-02, RFC merged and [tracking issue opened](https://github.com/rust-lang/rust/issues/44265)
* On 2017-10-23, [Move Generics from MethodSig to TraitItem and ImplItem](https://github.com/rust-lang/rust/pull/44766)
* On 2017-12-01, [Generic Associated Types Parsing & Name Resolution](https://github.com/rust-lang/rust/pull/45904)
* On 2017-12-15, [https://github.com/rust-lang/rust/pull/46706](https://github.com/rust-lang/rust/pull/46706)
* On 2018-04-23, [Feature gate where clauses on associated types](https://github.com/rust-lang/rust/pull/49368)
* On 2018-05-10, [Extend tests for RFC1598 (GAT)](https://github.com/rust-lang/rust/pull/49423)
* On 2018-05-24, [Finish implementing GATs (Chalk)](https://github.com/rust-lang/chalk/pull/134)
* On 2019-12-21, [Make GATs less ICE-prone](https://github.com/rust-lang/rust/pull/67160)
* On 2020-02-13, [fix lifetime shadowing check in GATs](https://github.com/rust-lang/rust/pull/68938)
* On 2020-06-20, [Projection bound validation](https://github.com/rust-lang/rust/pull/72788)
* On 2020-10-06, [Separate projection bounds and predicates](https://github.com/rust-lang/rust/pull/73905)
* On 2021-02-05, [Generic associated types in trait paths](https://github.com/rust-lang/rust/pull/79554)
* On 2021-02-06, [Trait objects do not work with generic associated types](https://github.com/rust-lang/rust/issues/81823)
* On 2021-04-28, [Make traits with GATs not object safe](https://github.com/rust-lang/rust/pull/84622)
* On 2021-05-11, [Improve diagnostics for GATs](https://github.com/rust-lang/rust/pull/82272)
* On 2021-07-16, [Make GATs no longer an incomplete feature](https://github.com/rust-lang/rust/pull/84623)
* On 2021-07-16, [Replace associated item bound vars with placeholders when projecting](https://github.com/rust-lang/rust/pull/86993)
* On 2021-07-26, [GATs: Decide whether to have defaults for `where Self: 'a`](https://github.com/rust-lang/rust/issues/87479)
* On 2021-08-25, [Normalize projections under binders](https://github.com/rust-lang/rust/pull/85499)
* On 2021-08-03, [The push for GATs stabilization](https://blog.rust-lang.org/2021/08/03/GATs-stabilization-push.html)
* On 2021-08-12, [Detect stricter constraints on gats where clauses in impls vs trait](https://github.com/rust-lang/rust/pull/88336)
* On 2021-09-20, [Proposal: Change syntax of where clauses on type aliases](https://github.com/rust-lang/rust/issues/89122)
* On 2021-11-06, [Implementation of GATs outlives lint](https://github.com/rust-lang/rust/pull/89970)
* On 2021-12-29. [Parse and suggest moving where clauses after equals for type aliases](https://github.com/rust-lang/rust/pull/92118)
* On 2022-01-15, [Ignore static lifetimes for GATs outlives lint](https://github.com/rust-lang/rust/pull/92865)
* On 2022-02-08, [Don't constrain projection predicates with inference vars in GAT substs](https://github.com/rust-lang/rust/pull/92917)
* On 2022-02-15, [Rework GAT where clause check](https://github.com/rust-lang/rust/pull/93820)
* On 2022-02-19, [Only mark projection as ambiguous if GAT substs are constrained](https://github.com/rust-lang/rust/pull/93892)
* On 2022-03-03, [Support GATs in Rustdoc](https://github.com/rust-lang/rust/pull/94009)
* On 2022-03-06, [Change location of where clause on GATs](https://github.com/rust-lang/rust/pull/90076)
* On 2022-05-04, [A shiny future with GATs blog post](https://jackh726.github.io/rust/2022/05/04/a-shiny-future-with-gats.html)
* On 2022-05-04, [Stabilization PR](https://github.com/rust-lang/rust/pull/96709)

21 months agoAuto merge of #100640 - reitermarkus:socket-display-buffer, r=thomcc
bors [Tue, 13 Sep 2022 06:41:37 +0000 (06:41 +0000)]
Auto merge of #100640 - reitermarkus:socket-display-buffer, r=thomcc

Use `DisplayBuffer` for socket addresses.

Continuation of https://github.com/rust-lang/rust/pull/100625 for socket addresses.

Renames `net::addr` to `net::addr::socket`, `net::ip` to `net::addr::ip` and `net::ip::display_buffer::IpDisplayBuffer` to `net::addr::display_buffer::DisplayBuffer`.

21 months agorustdoc: remove redundant CSS `#source-sidebar, #sidebar-toggle`
Michael Howell [Tue, 13 Sep 2022 04:51:20 +0000 (21:51 -0700)]
rustdoc: remove redundant CSS `#source-sidebar, #sidebar-toggle`

These two elements are always nested below `<nav class="sidebar">`, and will
inherit the font from their parent.

These selectors were added in 93520d2ad145b791b1b1a6c71cdea65b1943ffb6, and
became redundant in 07e3f998b1ceb4b8d2a7992782e60f5e776aa114 when the source
sidebar elements became nested below `nav.sidebar`.

21 months agoAuto merge of #100101 - BelovDV:issue-99429, r=petrochenkov
bors [Tue, 13 Sep 2022 04:00:24 +0000 (04:00 +0000)]
Auto merge of #100101 - BelovDV:issue-99429, r=petrochenkov

change rlib format to distinguish native dependencies

Another one method to solve problem mentioned in #99429.

Changed .rlib format, it contains all bundled native libraries as archieves.
At link time rlib is unpacked and native dependencies linked separately.
New behavior hidden under separate_native_rlib_dependencies flag.

21 months agoDon't render inline suggestions of only spaces
Michael Goulet [Tue, 13 Sep 2022 00:44:02 +0000 (00:44 +0000)]
Don't render inline suggestions of only spaces

21 months agoFix typo in concat_bytes documentation
Jay3332 [Tue, 13 Sep 2022 01:40:28 +0000 (21:40 -0400)]
Fix typo in concat_bytes documentation

This fixes the typo `&[u8, _]` -> `&[u8; _]`

21 months agoAuto merge of #99556 - davidtwco:collapse-debuginfo, r=wesleywiser
bors [Tue, 13 Sep 2022 01:19:05 +0000 (01:19 +0000)]
Auto merge of #99556 - davidtwco:collapse-debuginfo, r=wesleywiser

ssa: implement `#[collapse_debuginfo]`

cc #39153 rust-lang/compiler-team#386

Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour.

When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed.

r? rust-lang/wg-debugging

21 months agoAuto merge of #101736 - GuillaumeGomez:rollup-f71kjdb, r=GuillaumeGomez
bors [Mon, 12 Sep 2022 22:15:47 +0000 (22:15 +0000)]
Auto merge of #101736 - GuillaumeGomez:rollup-f71kjdb, r=GuillaumeGomez

Rollup of 8 pull requests

Successful merges:

 - #100185 (Fix `ReErased` leaking into typeck due to `typeof(...)` recovery)
 - #100291 (constify some `CStr` methods)
 - #101677 (Add test for #101211)
 - #101723 (Impove diagnostic for `.await`ing non-futures)
 - #101724 (Allow unauthenticated users to add the `const-hack` label)
 - #101731 (rustdoc: improve rustdoc HTML suggestions handling of nested generics)
 - #101732 (Feature gate the `rustdoc::missing_doc_code_examples` lint)
 - #101735 (rustdoc: fix treatment of backslash-escaped HTML)

Failed merges:

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

21 months agoDon't trim substitution if it's only whitespace
Michael Goulet [Sun, 11 Sep 2022 20:02:33 +0000 (20:02 +0000)]
Don't trim substitution if it's only whitespace

21 months agoA SubstitutionPart is not a deletion if it replaces nothing with nothing
Michael Goulet [Sun, 11 Sep 2022 19:19:07 +0000 (19:19 +0000)]
A SubstitutionPart is not a deletion if it replaces nothing with nothing

21 months agoRollup merge of #101735 - notriddle:notriddle/backslash-escaped-html, r=GuillaumeGomez
Guillaume Gomez [Mon, 12 Sep 2022 20:47:18 +0000 (22:47 +0200)]
Rollup merge of #101735 - notriddle:notriddle/backslash-escaped-html, r=GuillaumeGomez

rustdoc: fix treatment of backslash-escaped HTML

Try generating HTML for this markup:

    \<a href="https://example.com">example</a>

It will produce text, not HTML, in both rustdoc's real HTML output and in the commonmark reference implementation:

https://spec.commonmark.org/dingus/?text=%5C%3Ca%20href%3D%22https%3A%2F%2Fexample.com%22%3Eexample%3C%2Fa%3E

21 months agoRollup merge of #101732 - Nemo157:gate-rustdoc-missing-examples, r=GuillaumeGomez
Guillaume Gomez [Mon, 12 Sep 2022 20:47:18 +0000 (22:47 +0200)]
Rollup merge of #101732 - Nemo157:gate-rustdoc-missing-examples, r=GuillaumeGomez

Feature gate the `rustdoc::missing_doc_code_examples` lint

Moves the lint from being implicitly active on nightly `rustdoc` to requiring a feature to activate, like other unstable lints.

Uses the new tracking issue https://github.com/rust-lang/rust/issues/101730

21 months agoRollup merge of #101731 - notriddle:notriddle/more-improved-html-check, r=GuillaumeGomez
Guillaume Gomez [Mon, 12 Sep 2022 20:47:17 +0000 (22:47 +0200)]
Rollup merge of #101731 - notriddle:notriddle/more-improved-html-check, r=GuillaumeGomez

rustdoc: improve rustdoc HTML suggestions handling of nested generics

Based on some poor suggestions produced when stablizing this lint and running it on `manformed-generics.rs` in #101720

21 months agoRollup merge of #101724 - fee1-dead-contrib:triage-const-hack, r=oli-obk
Guillaume Gomez [Mon, 12 Sep 2022 20:47:16 +0000 (22:47 +0200)]
Rollup merge of #101724 - fee1-dead-contrib:triage-const-hack, r=oli-obk

Allow unauthenticated users to add the `const-hack` label

Observed in #101401.

cc ```@oli-obk```

21 months agoRollup merge of #101723 - lukas-code:await-diag, r=compiler-errors
Guillaume Gomez [Mon, 12 Sep 2022 20:47:15 +0000 (22:47 +0200)]
Rollup merge of #101723 - lukas-code:await-diag, r=compiler-errors

Impove diagnostic for `.await`ing non-futures

Strip leading whitespace from the span and use a non-verbose suggestion.
fixes #101715

21 months agoRollup merge of #101677 - winxpqq955:issue-101211, r=fee1-dead
Guillaume Gomez [Mon, 12 Sep 2022 20:47:14 +0000 (22:47 +0200)]
Rollup merge of #101677 - winxpqq955:issue-101211, r=fee1-dead

Add test for #101211

Closes #101211

21 months agoRollup merge of #100291 - WaffleLapkin:cstr_const_methods, r=oli-obk
Guillaume Gomez [Mon, 12 Sep 2022 20:47:14 +0000 (22:47 +0200)]
Rollup merge of #100291 - WaffleLapkin:cstr_const_methods, r=oli-obk

constify some `CStr` methods

This PR marks the following public APIs as `const`:
```rust
impl CStr {
    // feature(const_cstr_from_bytes)
    pub const fn from_bytes_until_nul(bytes: &[u8]) -> Result<&CStr, FromBytesUntilNulError>;
    pub const fn from_bytes_with_nul(bytes: &[u8]) -> Result<&Self, FromBytesWithNulError>;

    // feature(const_cstr_to_bytes)
    pub const fn to_bytes(&self) -> &[u8];
    pub const fn to_bytes_with_nul(&self) -> &[u8];
    pub const fn to_str(&self) -> Result<&str, str::Utf8Error>;
}
```

r? ```@oli-obk``` (use of `const_eval_select` :P )
cc ```@mina86``` (you've asked for this <3 )

21 months agoRollup merge of #100185 - compiler-errors:issue-100183, r=wesleywiser
Guillaume Gomez [Mon, 12 Sep 2022 20:47:13 +0000 (22:47 +0200)]
Rollup merge of #100185 - compiler-errors:issue-100183, r=wesleywiser

Fix `ReErased` leaking into typeck due to `typeof(...)` recovery

Fixes #100183

21 months agorustdoc: fix treatment of backslash-escaped HTML
Michael Howell [Mon, 12 Sep 2022 19:48:22 +0000 (12:48 -0700)]
rustdoc: fix treatment of backslash-escaped HTML

Try generating HTML for this markup:

    \<a href="https://example.com">example</a>

It will produce text, not HTML, in both rustdoc's real HTML output and in
the commonmark reference implementation:

https://spec.commonmark.org/dingus/?text=%5C%3Ca%20href%3D%22https%3A%2F%2Fexample.com%22%3Eexample%3C%2Fa%3E

21 months agoAuto merge of #101729 - oli-obk:miriup, r=oli-obk
bors [Mon, 12 Sep 2022 19:34:30 +0000 (19:34 +0000)]
Auto merge of #101729 - oli-obk:miriup, r=oli-obk

Update miri submodule

r? `@ghost`

fixes #101649

21 months agoFeature gate the rustdoc::missing_doc_code_examples lint
Wim Looman [Mon, 12 Sep 2022 18:10:35 +0000 (20:10 +0200)]
Feature gate the rustdoc::missing_doc_code_examples lint

21 months agorustdoc: improve rustdoc HTML suggestions handling of nested generics
Michael Howell [Mon, 12 Sep 2022 18:11:37 +0000 (11:11 -0700)]
rustdoc: improve rustdoc HTML suggestions handling of nested generics

Based on some poor suggestions produced when stablizing this lint and running
it on `manformed-generics.rs`

21 months agoAllow tool-lints to specify a feature-gate too
Wim Looman [Mon, 12 Sep 2022 18:08:58 +0000 (20:08 +0200)]
Allow tool-lints to specify a feature-gate too

21 months agoSimplify `clippy` fix.
Markus Reiter [Mon, 12 Sep 2022 17:03:24 +0000 (19:03 +0200)]
Simplify `clippy` fix.

21 months agoUpdate miri submodule
Oli Scherer [Mon, 12 Sep 2022 17:19:31 +0000 (17:19 +0000)]
Update miri submodule

21 months agoFix clippy.
Markus Reiter [Thu, 1 Sep 2022 23:11:20 +0000 (01:11 +0200)]
Fix clippy.

21 months agoAdd `rustc_diagnostic_item` for IP addresses.
Markus Reiter [Thu, 1 Sep 2022 20:19:13 +0000 (22:19 +0200)]
Add `rustc_diagnostic_item` for IP addresses.

21 months agoFlatten `net` module again.
Markus Reiter [Wed, 24 Aug 2022 11:13:12 +0000 (13:13 +0200)]
Flatten `net` module again.

21 months agoMove `net::parser` into `net::addr` module.
Markus Reiter [Fri, 19 Aug 2022 22:24:49 +0000 (00:24 +0200)]
Move `net::parser` into `net::addr` module.

21 months agoAdd tests for `SockAddr` `Display`.
Markus Reiter [Fri, 19 Aug 2022 22:06:47 +0000 (00:06 +0200)]
Add tests for `SockAddr` `Display`.

21 months agoUse `DisplayBuffer` for socket addresses.
Markus Reiter [Tue, 16 Aug 2022 18:23:32 +0000 (20:23 +0200)]
Use `DisplayBuffer` for socket addresses.

21 months agoAuto merge of #99334 - NiklasJonsson:84447/error-privacy, r=oli-obk
bors [Mon, 12 Sep 2022 15:57:37 +0000 (15:57 +0000)]
Auto merge of #99334 - NiklasJonsson:84447/error-privacy, r=oli-obk

rustc_error, rustc_private: Switch to stable hash containers

Relates https://github.com/rust-lang/rust/issues/84447

21 months agoAllow unauthenticated users to add the `const-hack` label
fee1-dead [Mon, 12 Sep 2022 15:04:32 +0000 (23:04 +0800)]
Allow unauthenticated users to add the `const-hack` label

21 months agoImpove diagnostic for .await-ing non-futures
Lukas Markeffsky [Mon, 12 Sep 2022 14:54:25 +0000 (16:54 +0200)]
Impove diagnostic for .await-ing non-futures

21 months agochange rlib format to discern native dependencies
Daniil Belov [Wed, 24 Aug 2022 10:10:40 +0000 (13:10 +0300)]
change rlib format to discern native dependencies

21 months agoAuto merge of #101716 - Dylan-DPC:rollup-ayvh6nd, r=Dylan-DPC
bors [Mon, 12 Sep 2022 13:16:14 +0000 (13:16 +0000)]
Auto merge of #101716 - Dylan-DPC:rollup-ayvh6nd, r=Dylan-DPC

Rollup of 9 pull requests

Successful merges:

 - #100293 (Add inline-llvm option for disabling/enabling LLVM inlining)
 - #100767 (Remove manual <[u8]>::escape_ascii)
 - #101668 (Suggest pub instead of public for const type item)
 - #101671 (Fix naming format of IEEE 754 standard)
 - #101676 (Check that the types in return position `impl Trait` in traits are well-formed)
 - #101681 (Deny return-position `impl Trait` in traits for object safety)
 - #101693 (Update browser UI test 0 10)
 - #101701 (Rustdoc-Json: Add tests for trait impls.)
 - #101706 (rustdoc: remove no-op `#search`)

Failed merges:

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

21 months agoconstify `CStr` methods
Maybe Waffle [Mon, 8 Aug 2022 23:20:15 +0000 (03:20 +0400)]
constify `CStr` methods

21 months agoRollup merge of #101706 - notriddle:notriddle/search-mobile, r=GuillaumeGomez
Dylan DPC [Mon, 12 Sep 2022 09:51:36 +0000 (15:21 +0530)]
Rollup merge of #101706 - notriddle:notriddle/search-mobile, r=GuillaumeGomez

rustdoc: remove no-op `#search`

The margin rule was added in c729e4dca7581fcd060978bcb0d7f98ea4eb6b82 to remove an unnecessary left margin that was present on desktop. This desktop-mode margin was itself removed in 135281ed1525db15edd8ebd092aa10aa40df2386.

The padding rule was added in 135281ed1525db15edd8ebd092aa10aa40df2386 when converting the rule for `#main`, but didn't do anything even then.

21 months agoRollup merge of #101701 - aDotInTheVoid:rdj-impl-tests, r=GuillaumeGomez
Dylan DPC [Mon, 12 Sep 2022 09:51:35 +0000 (15:21 +0530)]
Rollup merge of #101701 - aDotInTheVoid:rdj-impl-tests, r=GuillaumeGomez

Rustdoc-Json: Add tests for trait impls.

21 months agoRollup merge of #101693 - GuillaumeGomez:update-browser-ui-test-0-10, r=notriddle
Dylan DPC [Mon, 12 Sep 2022 09:51:34 +0000 (15:21 +0530)]
Rollup merge of #101693 - GuillaumeGomez:update-browser-ui-test-0-10, r=notriddle

Update browser UI test 0 10

The biggest change from this browser-ui-test update is the upgrade of the puppeteer version to `17.1.3` (the latest in short).

I also added the command `click-with-offset` to still allow us to click on the `[-]` part.

cc `@jsha`
r? `@notriddle`

21 months agoRollup merge of #101681 - compiler-errors:rpitit-obj-safety, r=lcnr
Dylan DPC [Mon, 12 Sep 2022 09:51:33 +0000 (15:21 +0530)]
Rollup merge of #101681 - compiler-errors:rpitit-obj-safety, r=lcnr

Deny return-position `impl Trait` in traits for object safety

Fixes #101667

21 months agoRollup merge of #101676 - compiler-errors:rpitit-wf, r=lcnr
Dylan DPC [Mon, 12 Sep 2022 09:51:33 +0000 (15:21 +0530)]
Rollup merge of #101676 - compiler-errors:rpitit-wf, r=lcnr

Check that the types in return position `impl Trait` in traits are well-formed

This effectively duplicates `check_associated_type_bounds`, but that shouldn't be for long, since we're going to remove it once we refactor RPITITs into regular associated items.

Fixes #101663

---

We don't check

```rust
trait Foo {
  fn bar() -> impl ?Sized;
}
```

currently, but that's for a different reason, which is that we don't currently check that a trait function's return type is sized (i.e. `fn bar() -> [u8]` also works in a trait).

21 months agoRollup merge of #101671 - LingMan:ieee_754, r=Dylan-DPC
Dylan DPC [Mon, 12 Sep 2022 09:51:32 +0000 (15:21 +0530)]
Rollup merge of #101671 - LingMan:ieee_754, r=Dylan-DPC

Fix naming format of IEEE 754 standard

Currently the documentation of f64::min refers to "IEEE-754 2008" while the documentation of f64::minimum refers to "IEEE 754-2019".
Note that one has the format IEEE,hyphen,number,space,year while the other is IEEE,space,number,hyphen,year. The official IEEE site [1] uses the later format and it is also the one most commonly used throughout the codebase.

Update all comments and - more importantly - documentation to consistently use the official format.

[1] https://standards.ieee.org/ieee/754/4211/

21 months agoRollup merge of #101668 - chenyukang:fix-101626, r=TaKO8Ki
Dylan DPC [Mon, 12 Sep 2022 09:51:31 +0000 (15:21 +0530)]
Rollup merge of #101668 - chenyukang:fix-101626, r=TaKO8Ki

Suggest pub instead of public for const type item

Fixes #101626

21 months agoRollup merge of #100767 - kadiwa4:escape_ascii, r=jackh726
Dylan DPC [Mon, 12 Sep 2022 09:51:30 +0000 (15:21 +0530)]
Rollup merge of #100767 - kadiwa4:escape_ascii, r=jackh726

Remove manual <[u8]>::escape_ascii

`@rustbot` label: +C-cleanup

21 months agoRollup merge of #100293 - yanchen4791:add-inline-llvm-option, r=nnethercote
Dylan DPC [Mon, 12 Sep 2022 09:51:29 +0000 (15:21 +0530)]
Rollup merge of #100293 - yanchen4791:add-inline-llvm-option, r=nnethercote

Add inline-llvm option for disabling/enabling LLVM inlining

In this PR, a new -Z option `inline-llvm` is added in order to be able to turn on/off LLVM inlining.

The capability of turning on/off inlining in LLVM backend is needed for testing performance implications of using recently enabled inlining in rustc's frontend (with -Z inline-mir=yes option, #91743). It would be interesting to see the performance effect using rustc's frontend inlining only without LLVM inlining enabled. Currently LLVM is still doing inlining no mater what value inline-mir is set to. With the option `inline-llvm` being added in this PR, user can turn off LLVM inlining by using `-Z inline-llvm=no` option (the default of inline-llvm is 'yes', LLVM inlining enabled).

21 months agoAuto merge of #101604 - compiler-errors:issue-101465, r=lcnr
bors [Mon, 12 Sep 2022 08:46:40 +0000 (08:46 +0000)]
Auto merge of #101604 - compiler-errors:issue-101465, r=lcnr

Fix ICE in opt_suggest_box_span

We were _totally_ mishandling substs and obligations in `opt_suggest_box_span`, so I reworked that function pretty heavily.

Also some drive-by changes, namely removing `ret_type_span`.

Fixes #101465

21 months agoAuto merge of #100502 - chenyukang:fix-100478, r=jackh726
bors [Mon, 12 Sep 2022 06:05:32 +0000 (06:05 +0000)]
Auto merge of #100502 - chenyukang:fix-100478, r=jackh726

Avoid infinite loop in function arguments checking

Fixes #100478
Fixes #101097

21 months agoAuto merge of #100251 - compiler-errors:tuple-trait-2, r=jackh726
bors [Mon, 12 Sep 2022 03:24:29 +0000 (03:24 +0000)]
Auto merge of #100251 - compiler-errors:tuple-trait-2, r=jackh726

Implement `std::marker::Tuple`

Split out from #99943 (https://github.com/rust-lang/rust/pull/99943#pullrequestreview-1064459183).

Implements part of rust-lang/compiler-team#537
r? `@jackh726`

21 months agoFix ICE in opt_suggest_box_span
Michael Goulet [Fri, 9 Sep 2022 05:50:25 +0000 (05:50 +0000)]
Fix ICE in opt_suggest_box_span

21 months agoNo more ret_type_span
Michael Goulet [Fri, 9 Sep 2022 03:10:06 +0000 (03:10 +0000)]
No more ret_type_span

21 months agorustdoc: remove no-op `#search`
Michael Howell [Mon, 12 Sep 2022 01:43:52 +0000 (18:43 -0700)]
rustdoc: remove no-op `#search`

The padding rule was added in 135281ed1525db15edd8ebd092aa10aa40df2386 when
converting the rule for #main, but didn't do anything even then.

21 months agorustdoc: remove no-op `#search { margin-left: 0 }`
Michael Howell [Mon, 12 Sep 2022 01:15:09 +0000 (18:15 -0700)]
rustdoc: remove no-op `#search { margin-left: 0 }`

This rule was added in c729e4dca7581fcd060978bcb0d7f98ea4eb6b82 to remove an
unnecessary left margin that was present on desktop. This desktop-mode margin
was itself removed in 135281ed1525db15edd8ebd092aa10aa40df2386.

21 months agoAuto merge of #101688 - cjgillot:verify-hir-parent, r=petrochenkov
bors [Mon, 12 Sep 2022 00:41:56 +0000 (00:41 +0000)]
Auto merge of #101688 - cjgillot:verify-hir-parent, r=petrochenkov

Assert that HIR nodes are not their own parent.

Fixes https://github.com/rust-lang/rust/issues/101505.
Replaces #101513

r? `@petrochenkov` `@nnethercote`

21 months agoAuto merge of #101442 - joboet:null_check_tcs, r=thomcc
bors [Sun, 11 Sep 2022 22:19:24 +0000 (22:19 +0000)]
Auto merge of #101442 - joboet:null_check_tcs, r=thomcc

Check if TCS is a null pointer on SGX

The `EENTER` instruction only checks if the TCS is aligned, not if it zero. Saying the address returned is a `NonNull<u8>` (for which `Tcs` is a type alias) is unsound. As well-behaved runners will not put the TCS at address zero, so the definition of `Tcs` is correct. However, `std` should check the address before casting it to a `NonNull`.

ping `@jethrogb` `@raoulstrackx`
`@rustbot` label I-unsound

21 months agoUpdate tests for new browser-ui-test version
Guillaume Gomez [Sat, 10 Sep 2022 15:36:17 +0000 (17:36 +0200)]
Update tests for new browser-ui-test version

21 months agoAuto merge of #101299 - saethlin:vecdeque-drain-drop, r=thomcc
bors [Sun, 11 Sep 2022 19:50:41 +0000 (19:50 +0000)]
Auto merge of #101299 - saethlin:vecdeque-drain-drop, r=thomcc

Remove &[T] from vec_deque::Drain

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

I don't know what the right approach is here. There were a few suggestions in the issue, and they all seem a bit thorny to implement. So I just picked one that was kind of familiar.

21 months agoRustdoc-Json: Add tests for trait impls.
Nixon Enraght-Moony [Sun, 11 Sep 2022 19:32:47 +0000 (20:32 +0100)]
Rustdoc-Json: Add tests for trait impls.

21 months agoAssert that HIR nodes are not their own parent.
Camille GILLOT [Sun, 11 Sep 2022 13:11:58 +0000 (15:11 +0200)]
Assert that HIR nodes are not their own parent.

21 months agoAuto merge of #101678 - jannic:fix-101640, r=jyn514
bors [Sun, 11 Sep 2022 16:30:59 +0000 (16:30 +0000)]
Auto merge of #101678 - jannic:fix-101640, r=jyn514

Add diagnostic arg 'current_crate'

With this fix, I get almost the same error message as on stable, again.

However, I expected to get the new error message `std is required by {$current_crate} because it does not declare #![no_std]`, but I didn't. Instead, I got a new line `help: consider building the standard library from source with cargo build -Zbuild-std`. So I obviously do not fully understand what is going on.

In any case, the bug itself seems to be fixed by this patch.

Closes #101640

21 months agoAvoid `Iterator::last`
KaDiWa [Sun, 11 Sep 2022 15:23:00 +0000 (17:23 +0200)]
Avoid `Iterator::last`

21 months agoAuto merge of #101682 - compiler-errors:rpitit-encode, r=fee1-dead
bors [Sun, 11 Sep 2022 13:49:52 +0000 (13:49 +0000)]
Auto merge of #101682 - compiler-errors:rpitit-encode, r=fee1-dead

Only encode return-position `impl Trait` in trait when parent function has a default body

Semi-blocked on #101679, because I can't currently write a test for when we _should_ encode the type of the return-position `impl Trait` in trait, which is when a trait has a default function body, like so:

```rust
trait Foo {
  fn bar() -> impl Sized { }
}
```

Though this can land even without #101679, since it does prevent ICEs from occuring any time you use `#![feature(return_position_impl_trait_in_trait)]` in a library, which is kind annoying.

21 months agostd: check if TCS is a null pointer
joboet [Mon, 5 Sep 2022 09:42:46 +0000 (11:42 +0200)]
std: check if TCS is a null pointer

21 months agoOnly encode RPITIT when trait method has default body
Michael Goulet [Sun, 11 Sep 2022 09:35:43 +0000 (09:35 +0000)]
Only encode RPITIT when trait method has default body

21 months agoDeny RPITIT for object safety
Michael Goulet [Sun, 11 Sep 2022 09:13:55 +0000 (09:13 +0000)]
Deny RPITIT for object safety

21 months agoAuto merge of #101673 - crlf0710:generator_clone, r=oli-obk
bors [Sun, 11 Sep 2022 08:50:35 +0000 (08:50 +0000)]
Auto merge of #101673 - crlf0710:generator_clone, r=oli-obk

Allow generators to impl Clone/Copy

Revives #95137. It's a pity that the original pr didn't land because the implementation is almost complete! All credits goes to `@canndrew,` and i just resolved the merge conflicts and updated the feature gate version number.

r? `@oli-obk`

21 months agoAdd diagnostic arg 'current_crate'
Jan Niehusmann [Sat, 10 Sep 2022 23:01:36 +0000 (23:01 +0000)]
Add diagnostic arg 'current_crate'

21 months agoAdd test for #101211
winxpqq955 [Sun, 11 Sep 2022 07:09:39 +0000 (15:09 +0800)]
Add test for #101211

21 months agoCheck that the types in RPITITs are WF
Michael Goulet [Sun, 11 Sep 2022 06:58:11 +0000 (06:58 +0000)]
Check that the types in RPITITs are WF

21 months agoAuto merge of #101670 - obi1kenobi:patch-1, r=jyn514
bors [Sun, 11 Sep 2022 06:27:29 +0000 (06:27 +0000)]
Auto merge of #101670 - obi1kenobi:patch-1, r=jyn514

Add @obi1kenobi to the cc list for rustdoc-json-types

I'm one of the maintainers of `cargo-semver-checks`, and as mentioned [in Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Long.20Term.20Rustdoc.20JSON.20Stability) it's very useful to me to know about upcoming rustdoc JSON types changes so I can be ready to publish new `cargo-semver-checks` releases compatible with the new JSON format.

21 months agoUpdate unit test outputs
Charles Lew [Sun, 11 Sep 2022 06:21:40 +0000 (14:21 +0800)]
Update unit test outputs

21 months agoUse current rustc version.
Charles Lew [Sun, 11 Sep 2022 05:57:41 +0000 (13:57 +0800)]
Use current rustc version.

21 months agofix tests after rebase
Andrew Cann [Sun, 10 Apr 2022 07:28:31 +0000 (15:28 +0800)]
fix tests after rebase

21 months agotest async diagnostics for feature(generator_clone)
Andrew Cann [Sun, 10 Apr 2022 07:04:04 +0000 (15:04 +0800)]
test async diagnostics for feature(generator_clone)

21 months agominor fixups as per PR feedback
Andrew Cann [Sun, 10 Apr 2022 06:05:31 +0000 (14:05 +0800)]
minor fixups as per PR feedback

21 months agoAdd some comments to generator clone shim code
Andrew Cann [Sun, 10 Apr 2022 06:04:44 +0000 (14:04 +0800)]
Add some comments to generator clone shim code

21 months agoAdd tracking issue number to feature(generator_clone)
Andrew Cann [Sun, 27 Mar 2022 07:50:40 +0000 (15:50 +0800)]
Add tracking issue number to feature(generator_clone)

21 months agoAdd feature gate tests for generator_clone
Andrew Cann [Mon, 21 Mar 2022 05:57:10 +0000 (13:57 +0800)]
Add feature gate tests for generator_clone

21 months agoApply formatting fixes
Andrew Cann [Mon, 21 Mar 2022 04:57:06 +0000 (12:57 +0800)]
Apply formatting fixes

21 months agomove generator_clone feature definition
Andrew Cann [Mon, 21 Mar 2022 04:56:22 +0000 (12:56 +0800)]
move generator_clone feature definition

Move it to the list of features with no tracking issue, since it has no
tracking issue.

21 months agofix GeneratorWitness: Clone check
Andrew Cann [Fri, 18 Mar 2022 06:24:54 +0000 (14:24 +0800)]
fix GeneratorWitness: Clone check

21 months agoloosen restriction on when GeneratorWitness: Clone
Andrew Cann [Mon, 14 Mar 2022 02:24:10 +0000 (10:24 +0800)]
loosen restriction on when GeneratorWitness: Clone

21 months agoadd generator_clone feature gate
Andrew Cann [Sun, 13 Mar 2022 06:41:44 +0000 (14:41 +0800)]
add generator_clone feature gate

21 months agoimplement Copy/Clone for generators
Andrew Cann [Sun, 13 Mar 2022 05:39:20 +0000 (13:39 +0800)]
implement Copy/Clone for generators

21 months agoAuto merge of #101482 - joboet:netbsd_parker, r=sanxiyn
bors [Sun, 11 Sep 2022 04:07:17 +0000 (04:07 +0000)]
Auto merge of #101482 - joboet:netbsd_parker, r=sanxiyn

Optimize thread parking on NetBSD

As the futex syscall is not present in the latest stable release, NetBSD cannot use the efficient thread parker and locks Linux uses. Currently, it therefore relies on a pthread-based parker, consisting of a mutex and semaphore which protect a state variable. NetBSD however has more efficient syscalls available: [`_lwp_park`](https://man.netbsd.org/_lwp_park.2) and [`_lwp_unpark`](https://man.netbsd.org/_lwp_unpark.2). These already provide the exact semantics of `thread::park` and `Thread::unpark`, but work with thread ids. In `std`, this ID is here stored in an atomic state variable, which is also used to optimize cases were the parking token is already available at the time `thread::park` is called.

r? `@m-ou-se`

21 months agoFix naming format of IEEE 754 standard
LingMan [Sat, 10 Sep 2022 05:30:29 +0000 (07:30 +0200)]
Fix naming format of IEEE 754 standard

Currently the documentation of f64::min refers to "IEEE-754 2008" while the documentation of
f64::minimum refers to "IEEE 754-2019".
Note that one has the format IEEE,hyphen,number,space,year while the other is
IEEE,space,number,hyphen,year. The official IEEE site [1] uses the later format and it is also the
one most commonly used throughout the codebase.

Update all comments and - more importantly - documentation to consistently use the official format.

[1] https://standards.ieee.org/ieee/754/4211/

21 months agoAdd @obi1kenobi to the cc list for rustdoc-json-types
Predrag Gruevski [Sun, 11 Sep 2022 02:04:57 +0000 (22:04 -0400)]
Add @obi1kenobi to the cc list for rustdoc-json-types

21 months agoAuto merge of #101643 - ChrisDenton:alloc-link-kernel32, r=thomcc
bors [Sun, 11 Sep 2022 01:44:09 +0000 (01:44 +0000)]
Auto merge of #101643 - ChrisDenton:alloc-link-kernel32, r=thomcc

Explicitly link kernel32.lib from alloc

21 months agofix #101626, suggest pub instead of public for const type item
yukang [Sun, 11 Sep 2022 00:29:38 +0000 (08:29 +0800)]
fix #101626, suggest pub instead of public for const type item

21 months agoAuto merge of #101613 - GuillaumeGomez:codeblock-tooltip, r=notriddle
bors [Sat, 10 Sep 2022 23:13:23 +0000 (23:13 +0000)]
Auto merge of #101613 - GuillaumeGomez:codeblock-tooltip, r=notriddle

Simplify codeblock and their associated tooltip

It is based on https://github.com/rust-lang/rust/pull/101600 so it needs to wait for this one to be merged first.

This PR does two things:

 * Remove CSS class duplication by setting CSS classes such as `compile_fail` directly on the `div` wrapping both the codeblock and the tooltip.
 * Simplify DOM: no need to wrap the tooltip into a `<div>`, it can work just as well without it.

You can test it [here](https://rustdoc.crud.net/imperio/codeblock-tooltip/std/string/struct.String.html#deref).

r? `@notriddle`

21 months agoAlternate approach; just modify Drain
Ben Kimock [Sat, 10 Sep 2022 20:24:28 +0000 (16:24 -0400)]
Alternate approach; just modify Drain

21 months agoRemove &[T] from vec_deque::Drain
Ben Kimock [Fri, 2 Sep 2022 00:29:39 +0000 (20:29 -0400)]
Remove &[T] from vec_deque::Drain