]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAdd note to documentation of HashSet::intersection
nzrq [Fri, 3 Jun 2022 17:05:57 +0000 (13:05 -0400)]
Add note to documentation of HashSet::intersection

2 years agoAuto merge of #89862 - lcnr:path-generics-diagnostics, r=estebank
bors [Fri, 3 Jun 2022 12:37:16 +0000 (12:37 +0000)]
Auto merge of #89862 - lcnr:path-generics-diagnostics, r=estebank

rewrite error handling for unresolved inference vars

Pretty much completely rewrites `fn emit_inference_failure_err`.

This new setup should hopefully be easier to extend and is already a lot better when looking for generic arguments.
Because this is a rewrite there are still some parts which are lacking, these are tracked in #94483 and will be fixed in later PRs.

r? `@estebank` `@petrochenkov`

2 years agoAuto merge of #97679 - Dylan-DPC:rollup-nswmgmx, r=Dylan-DPC
bors [Fri, 3 Jun 2022 09:56:21 +0000 (09:56 +0000)]
Auto merge of #97679 - Dylan-DPC:rollup-nswmgmx, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #97366 (Stabilize `{slice,array}::from_ref`)
 - #97653 (add cast kind of from_exposed_addr (int-to-ptr casts))
 - #97663 (take back half-baked noaliasing check in Assignment)
 - #97664 (On E0204 suggest missing type param bounds)
 - #97668 (rustdoc: clean up primitive.slice.html links)

Failed merges:

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

2 years agoRollup merge of #97668 - notriddle:notriddle/slice-link, r=jsha
Dylan DPC [Fri, 3 Jun 2022 09:18:27 +0000 (11:18 +0200)]
Rollup merge of #97668 - notriddle:notriddle/slice-link, r=jsha

rustdoc: clean up primitive.slice.html links

Before: <a href="https://doc.rust-lang.org/stable/std/boxed/struct.Box.html">Box</a>&lt;<a href="https://doc.rust-lang.org/stable/std/primitive.slice.html">[</a>T<a href="https://doc.rust-lang.org/stable/std/primitive.slice.html">]</a>&gt;

After: <a href="https://doc.rust-lang.org/stable/std/boxed/struct.Box.html">Box</a>&lt;<a href="https://doc.rust-lang.org/stable/std/primitive.slice.html">[T]</a>&gt;

2 years agoRollup merge of #97664 - estebank:suggest-bound-derive-copy, r=compiler-errors
Dylan DPC [Fri, 3 Jun 2022 09:18:26 +0000 (11:18 +0200)]
Rollup merge of #97664 - estebank:suggest-bound-derive-copy, r=compiler-errors

On E0204 suggest missing type param bounds

```
error[E0204]: the trait `Copy` may not be implemented for this type
  --> f42.rs:9:17
   |
9  | #[derive(Debug, Copy, Clone)]
   |                 ^^^^
10 | pub struct AABB<K>{
11 |     pub loc: Vector2<K>,
   |     ------------------- this field does not implement `Copy`
12 |     pub size: Vector2<K>
   |     -------------------- this field does not implement `Copy`
   |
note: the `Copy` impl for `Vector2<K>` requires that `K: Debug`
  --> f42.rs:11:5
   |
11 |     pub loc: Vector2<K>,
   |     ^^^^^^^^^^^^^^^^^^^
note: the `Copy` impl for `Vector2<K>` requires that `K: Debug`
  --> f42.rs:12:5
   |
12 |     pub size: Vector2<K>
   |     ^^^^^^^^^^^^^^^^^^^^
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `K`
   |
10 | pub struct AABB<K: Debug>{
   |                  +++++++
```

Fix #89137.

2 years agoRollup merge of #97663 - RalfJung:keine-halben-sachen, r=oli-obk
Dylan DPC [Fri, 3 Jun 2022 09:18:25 +0000 (11:18 +0200)]
Rollup merge of #97663 - RalfJung:keine-halben-sachen, r=oli-obk

take back half-baked noaliasing check in Assignment

Doing an aliasing check in `copy_op` does not make a ton of sense. We have to eventually do something in the `Assignment` statement handling instead.

2 years agoRollup merge of #97653 - RalfJung:int-to-ptr, r=oli-obk
Dylan DPC [Fri, 3 Jun 2022 09:18:24 +0000 (11:18 +0200)]
Rollup merge of #97653 - RalfJung:int-to-ptr, r=oli-obk

add cast kind of from_exposed_addr (int-to-ptr casts)

This is basically the dual to https://github.com/rust-lang/rust/pull/97582, for int2ptr casts.

Cc `@tmiasko` https://github.com/rust-lang/rust/issues/97649

2 years agoRollup merge of #97366 - WaffleLapkin:stabilize_array_slice_from_ref, r=dtolnay
Dylan DPC [Fri, 3 Jun 2022 09:18:23 +0000 (11:18 +0200)]
Rollup merge of #97366 - WaffleLapkin:stabilize_array_slice_from_ref, r=dtolnay

Stabilize `{slice,array}::from_ref`

This PR stabilizes the following APIs as `const` functions in Rust `1.63`:
```rust
// core::array
pub const fn from_ref<T>(s: &T) -> &[T; 1];

// core::slice
pub const fn from_ref<T>(s: &T) -> &[T];
```

Note that the `mut` versions are not stabilized as unique references (`&mut _`) are [unstable in const context].

FCP: https://github.com/rust-lang/rust/issues/90206#issuecomment-1134586665

r? rust-lang/libs-api `@rustbot` label +T-libs-api -T-libs

[unstable in const context]: https://github.com/rust-lang/rust/issues/57349

2 years agoAuto merge of #96296 - cjgillot:remove-label-lt-shadow, r=petrochenkov
bors [Fri, 3 Jun 2022 07:27:09 +0000 (07:27 +0000)]
Auto merge of #96296 - cjgillot:remove-label-lt-shadow, r=petrochenkov

Remove label/lifetime shadowing warnings

This PR removes some pre-1.0 shadowing warnings for labels and lifetimes.

The current behaviour of the compiler is to warn
* labels that shadow unrelated labels in the same function --> removed
```rust
'a: loop {}
'a: loop {} // STOP WARNING
```

* labels that shadow enclosing labels --> kept, but only if shadowing is hygienic
```rust
'a: loop {
  'a: loop {} // KEEP WARNING
}
```

* labels that shadow lifetime --> removed
```rust
fn foo<'a>() {
  'a: loop {} // STOP WARNING
}
```

* lifetimes that shadow labels --> removed
```rust
'a: loop {
  let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>; // STOP WARNING
}
```

* lifetimes that shadow lifetimes --> kept
```rust
fn foo<'a>() {
  let b = Box::new(|x: &i8| *x) as Box<dyn for <'a> Fn(&'a i8) -> i8>; // KEEP WARNING
}
```

Closes https://github.com/rust-lang/rust/issues/31745.

-----

From `@petrochenkov` in https://github.com/rust-lang/rust/pull/95781#issuecomment-1105199014
> I think we should remove these silly checks entirely.
> They were introduced long time ago in case some new language features appear and require this space.
> Now we have another mechanism for such language changes - editions, and if "lifetimes in expressions" or something like that needs to be introduced it could be introduced as an edition change.
> However, there was no plans to introduce anything like for years, so it's unlikely that even the edition mechanism will be necessary.

r? rust-lang/lang

2 years agoUse the same message as type & const generics.
Camille GILLOT [Thu, 2 Jun 2022 18:46:40 +0000 (20:46 +0200)]
Use the same message as type & const generics.

2 years agoReuse resolve_label to check lifetime shadowing.
Camille GILLOT [Thu, 2 Jun 2022 18:35:14 +0000 (20:35 +0200)]
Reuse resolve_label to check lifetime shadowing.

2 years agoDo not lower generic lifetime params when AST resolution emitted an error.
Camille GILLOT [Fri, 27 May 2022 09:29:18 +0000 (11:29 +0200)]
Do not lower generic lifetime params when AST resolution emitted an error.

2 years agoAuto merge of #97497 - c410-f3r:z-errors, r=petrochenkov
bors [Fri, 3 Jun 2022 04:46:10 +0000 (04:46 +0000)]
Auto merge of #97497 - c410-f3r:z-errors, r=petrochenkov

Move some tests to more reasonable places

r? `@petrochenkov`

2 years agoAuto merge of #97667 - matthiaskrgr:rollup-5cfxc85, r=matthiaskrgr
bors [Fri, 3 Jun 2022 00:21:29 +0000 (00:21 +0000)]
Auto merge of #97667 - matthiaskrgr:rollup-5cfxc85, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #97502 (rustdoc: Add more test coverage)
 - #97627 (update explicit impls error msg)
 - #97640 (Fix wrong suggestion for adding where clauses)
 - #97645 (don't use a `span_note` for ignored impls)
 - #97655 (Improve documentation for constructors of pinned `Box`es)

Failed merges:

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

2 years agoTweak output
Esteban Küber [Thu, 2 Jun 2022 20:15:56 +0000 (13:15 -0700)]
Tweak output

2 years agorustdoc: add channel normalization to htmldocck.py
Michael Howell [Thu, 2 Jun 2022 22:02:26 +0000 (15:02 -0700)]
rustdoc: add channel normalization to htmldocck.py

2 years agorustdoc: clean up primitive.slice.html links
Michael Howell [Thu, 2 Jun 2022 21:28:18 +0000 (14:28 -0700)]
rustdoc: clean up primitive.slice.html links

2 years agoRollup merge of #97655 - steffahn:better-pin-box-construction-docs, r=thomcc
Matthias Krüger [Thu, 2 Jun 2022 21:39:07 +0000 (23:39 +0200)]
Rollup merge of #97655 - steffahn:better-pin-box-construction-docs, r=thomcc

Improve documentation for constructors of pinned `Box`es

Adds a cross-references between `Box::pin` and `Box::into_pin` (and other related methods, i.e. the equivalent `From` implementation, and the unstable `pin_in` method), in particular now that `into_pin` [was stabilized](https://github.com/rust-lang/rust/pull/97397). The main goal is to further improve visibility of the fact that `Box<T> -> Pin<Box<T>>` conversion exits in the first place, and that `Box::pin(x)` is – essentially – just a convenience function for `Box::into_pin(Box::new(x))`

The motivating context why I think this is important is even experienced Rust users overlooking the existence this kind of conversion, [e.g. in this thread on IRLO](https://internals.rust-lang.org/t/pre-rfc-function-variants/16732/7?u=steffahn); and also the fact that that discussion brought up that there would be a bunch of Box-construction methods "missing" such as e.g. methods with fallible allocation a la "`Box::try_pin`", and similar; while those are in fact *not* necessary, because you can use `Box::into_pin(Box::try_new(x)?)` instead.

I have *not* included explicit mention of methods (e.g. `try_new`) in the docs of stable methods (e.g. `into_pin`). (Referring to unstable API in stable API docs would be bad style IMO.) Stable examples I have in mind with the statement "constructing a (pinned) Box in a different way than with `Box::new`" are things like cloning a `Box`, or `Box::from_raw`. If/when `try_new` would get stabilized, it would become a very good concrete example use-case of `Box::into_pin` IMO.

2 years agoRollup merge of #97645 - lcnr:derived-impl-debug, r=cjgillot
Matthias Krüger [Thu, 2 Jun 2022 21:39:06 +0000 (23:39 +0200)]
Rollup merge of #97645 - lcnr:derived-impl-debug, r=cjgillot

don't use a `span_note` for ignored impls

Searching for the `derive` isn't too difficult as it's right above the field definition.

By using a span these errors are a lot more verbose than they should be, which is especially annoying as one can end up with a lot of `dead_code` warnings.

2 years agoRollup merge of #97640 - TaKO8Ki:fix-wrong-suggestion-for-adding-where-clauses, r...
Matthias Krüger [Thu, 2 Jun 2022 21:39:05 +0000 (23:39 +0200)]
Rollup merge of #97640 - TaKO8Ki:fix-wrong-suggestion-for-adding-where-clauses, r=lcnr

Fix wrong suggestion for adding where clauses

closes #97576

2 years agoRollup merge of #97627 - lcnr:comment-tick, r=Dylan-DPC
Matthias Krüger [Thu, 2 Jun 2022 21:39:04 +0000 (23:39 +0200)]
Rollup merge of #97627 - lcnr:comment-tick, r=Dylan-DPC

update explicit impls error msg

2 years agoRollup merge of #97502 - onlineSoftwareDevOK:rustdocTests, r=GuillaumeGomez
Matthias Krüger [Thu, 2 Jun 2022 21:39:03 +0000 (23:39 +0200)]
Rollup merge of #97502 - onlineSoftwareDevOK:rustdocTests, r=GuillaumeGomez

rustdoc: Add more test coverage

Related issue https://github.com/rust-lang/rust/issues/91113

2 years agoAuto merge of #97598 - spastorino:simplify-universal-impl-trait-lowering, r=cjgillot
bors [Thu, 2 Jun 2022 21:37:38 +0000 (21:37 +0000)]
Auto merge of #97598 - spastorino:simplify-universal-impl-trait-lowering, r=cjgillot

Simplify universal impl trait lowering

Closes #96644

r? `@cjgillot`

2 years agoOn E0204 suggest missing type param bounds
Esteban Küber [Thu, 2 Jun 2022 19:34:55 +0000 (12:34 -0700)]
On E0204 suggest missing type param bounds

```
error[E0204]: the trait `Copy` may not be implemented for this type
  --> f42.rs:9:17
   |
9  | #[derive(Debug, Copy, Clone)]
   |                 ^^^^
10 | pub struct AABB<K>{
11 |     pub loc: Vector2<K>,
   |     ------------------- this field does not implement `Copy`
12 |     pub size: Vector2<K>
   |     -------------------- this field does not implement `Copy`
   |
note: the `Copy` impl for `Vector2<K>` requires that `K: Debug`
  --> f42.rs:11:5
   |
11 |     pub loc: Vector2<K>,
   |     ^^^^^^^^^^^^^^^^^^^
note: the `Copy` impl for `Vector2<K>` requires that `K: Debug`
  --> f42.rs:12:5
   |
12 |     pub size: Vector2<K>
   |     ^^^^^^^^^^^^^^^^^^^^
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `K`
   |
10 | pub struct AABB<K: Debug>{
   |                  +++++++
```

Fix #89137.

2 years agotake back half-baked noaliasing check in Assignment
Ralf Jung [Thu, 2 Jun 2022 19:12:08 +0000 (15:12 -0400)]
take back half-baked noaliasing check in Assignment

2 years agoAuto merge of #97575 - nnethercote:lazify-SourceFile-lines, r=Mark-Simulacrum
bors [Thu, 2 Jun 2022 18:45:29 +0000 (18:45 +0000)]
Auto merge of #97575 - nnethercote:lazify-SourceFile-lines, r=Mark-Simulacrum

Lazify `SourceFile::lines`.

`SourceFile::lines` is a big part of metadata. It's stored in a compressed form
(a difference list) to save disk space. Decoding it is a big fraction of
compile time for very small crates/programs.

This commit introduces a new type `SourceFileLines` which has a `Lines`
form and a `Diffs` form. The latter is used when the metadata is first
read, and it is only decoded into the `Lines` form when line data is
actually needed. This avoids the decoding cost for many files,
especially in `std`. It's a performance win of up to 15% for tiny
crates/programs where metadata decoding is a high part of compilation
costs.

A `RefCell` is needed because the methods that access lines data (which can
trigger decoding) take `&self` rather than `&mut self`. To allow for this,
`SourceFile::lines` now takes a `FnMut` that operates on the lines slice rather
than returning the lines slice.

r? `@Mark-Simulacrum`

2 years agoRebase fallout.
Camille GILLOT [Thu, 5 May 2022 18:49:48 +0000 (20:49 +0200)]
Rebase fallout.

2 years agoStop warning against unrelated labels.
Camille GILLOT [Sun, 1 May 2022 11:07:57 +0000 (13:07 +0200)]
Stop warning against unrelated labels.

2 years agoBless tests.
Camille GILLOT [Thu, 21 Apr 2022 20:44:48 +0000 (22:44 +0200)]
Bless tests.

2 years agoDo not report mixed label/lifetime shadowing.
Camille GILLOT [Thu, 21 Apr 2022 17:48:40 +0000 (19:48 +0200)]
Do not report mixed label/lifetime shadowing.

2 years agoBless tests.
Camille GILLOT [Wed, 8 Dec 2021 21:40:16 +0000 (22:40 +0100)]
Bless tests.

2 years agoDiagnose shadowing on AST.
Camille GILLOT [Sat, 4 Dec 2021 20:20:58 +0000 (21:20 +0100)]
Diagnose shadowing on AST.

2 years agoAuto merge of #97654 - Dylan-DPC:rollup-w6zrzxf, r=Dylan-DPC
bors [Thu, 2 Jun 2022 16:04:42 +0000 (16:04 +0000)]
Auto merge of #97654 - Dylan-DPC:rollup-w6zrzxf, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #97420 (Be a little nicer with casts when formatting `fn` pointers)
 - #97450 ([RFC 2011] Basic compiler infrastructure)
 - #97599 (Fix JSON reexport ICE)
 - #97617 (Rustdoc anonymous reexports)
 - #97636 (Revert #96682.)

Failed merges:

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

2 years agocomment
Ralf Jung [Thu, 2 Jun 2022 15:10:34 +0000 (11:10 -0400)]
comment

Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2 years agorustdoc: Add more test coverage
onlinesoftwaredevok@protonmail.com [Thu, 2 Jun 2022 14:50:36 +0000 (11:50 -0300)]
rustdoc: Add more test coverage

2 years agoadd cast kind of from_exposed_addr (int-to-ptr casts)
Ralf Jung [Thu, 2 Jun 2022 13:05:37 +0000 (09:05 -0400)]
add cast kind of from_exposed_addr (int-to-ptr casts)

2 years agoImprove documentation for constructors of pinned `Box`es
Frank Steffahn [Thu, 2 Jun 2022 10:36:11 +0000 (12:36 +0200)]
Improve documentation for constructors of pinned `Box`es

2 years agoRollup merge of #97636 - nnethercote:revert-96682, r=dtolnay
Dylan DPC [Thu, 2 Jun 2022 13:27:01 +0000 (15:27 +0200)]
Rollup merge of #97636 - nnethercote:revert-96682, r=dtolnay

Revert #96682.

The change was "Show invisible delimiters (within comments) when pretty
printing". It's useful to show these delimiters, but is a breaking
change for some proc macros.

Fixes #97608.

r? ``@petrochenkov``

2 years agoRollup merge of #97617 - GuillaumeGomez:rustdoc-anonymous-reexports, r=Nemo157
Dylan DPC [Thu, 2 Jun 2022 13:27:00 +0000 (15:27 +0200)]
Rollup merge of #97617 - GuillaumeGomez:rustdoc-anonymous-reexports, r=Nemo157

Rustdoc anonymous reexports

Fixes #97615.

r? `@Nemo157`

2 years agoRollup merge of #97599 - GuillaumeGomez:reexport-json, r=CraftSpider
Dylan DPC [Thu, 2 Jun 2022 13:26:59 +0000 (15:26 +0200)]
Rollup merge of #97599 - GuillaumeGomez:reexport-json, r=CraftSpider

Fix JSON reexport ICE

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

The problem was that the ID was conflicting because the reexports have the same one. To fix it, I "extended" it by adding the `Symbol` into it as well.

r? `@notriddle`

2 years agoRollup merge of #97450 - c410-f3r:assert-compiler, r=oli-obk
Dylan DPC [Thu, 2 Jun 2022 13:26:58 +0000 (15:26 +0200)]
Rollup merge of #97450 - c410-f3r:assert-compiler, r=oli-obk

[RFC 2011] Basic compiler infrastructure

Splitting https://github.com/rust-lang/rust/pull/96496 into smaller pieces as was done in https://github.com/rust-lang/rust/pull/97233. Hope review will be easier.

This PR practically contains no logic and only serves as a building ground for the actual code that will be placed in a posterior step.

* Adds `context.rs` to place the new `assert!` logic. Has a lot of unused elements but all of them are used by the implementation.
* Creates an unstable flag because the feature is not yet complete and also to allow external feedback.
* Creates the necessary `sym` identifiers that are mostly based on the library elements -> https://github.com/rust-lang/rust/blob/master/library/core/src/asserting.rs
* Modifies `assert.rs` to branch to `context.rs` if the unstable flag is enabled.
* Adds a test to satisfy tidy but the test does nothing in reality.

2 years agoRollup merge of #97420 - WaffleLapkin:no_oxford_casts_qqq, r=Mark-Simulacrum
Dylan DPC [Thu, 2 Jun 2022 13:26:57 +0000 (15:26 +0200)]
Rollup merge of #97420 - WaffleLapkin:no_oxford_casts_qqq, r=Mark-Simulacrum

Be a little nicer with casts when formatting `fn` pointers

This removes a `fn(...) -> ...` -> `usize` -> `*const ()` -> `usize` cast. cc #95489.

2 years agoAuto merge of #97293 - est31:remove_box, r=oli-obk
bors [Thu, 2 Jun 2022 13:20:19 +0000 (13:20 +0000)]
Auto merge of #97293 - est31:remove_box, r=oli-obk

Add #[rustc_box] and use it inside alloc

This commit adds an alternative content boxing syntax, and uses it inside alloc.

```Rust
#![feature(box_syntax)]

fn foo() {
    let foo = box bar;
}
```

is equivalent to

```Rust
#![feature(rustc_attrs)]

fn foo() {
    let foo = #[rustc_box] Box::new(bar);
}
```

The usage inside the very performance relevant code in
liballoc is the only remaining relevant usage of box syntax
in the compiler (outside of tests, which are comparatively easy to port).

box syntax was originally designed to be used by all Rust
developers. This introduces a replacement syntax more tailored
to only being used inside the Rust compiler, and with it,
lays the groundwork for eventually removing box syntax.

[Earlier work](https://github.com/rust-lang/rust/pull/87781#issuecomment-894714878) by `@nbdd0121` to lower `Box::new` to `box` during THIR -> MIR building ran into borrow checker problems, requiring the lowering to be adjusted in a way that led to [performance regressions](https://github.com/rust-lang/rust/pull/87781#issuecomment-894872367). The proposed change in this PR lowers `#[rustc_box] Box::new` -> `box` in the AST -> HIR lowering step, which is way earlier in the compiler, and thus should cause less issues both performance wise as well as regarding type inference/borrow checking/etc. Hopefully, future work can move the lowering further back in the compiler, as long as there are no performance regressions.

2 years agoBasic compiler infra
Caio [Thu, 2 Jun 2022 12:00:04 +0000 (09:00 -0300)]
Basic compiler infra

2 years agofix wrong suggestion for adding where clauses
Takayuki Maeda [Thu, 2 Jun 2022 11:50:01 +0000 (20:50 +0900)]
fix wrong suggestion for adding where clauses

2 years agoAuto merge of #97644 - Dylan-DPC:rollup-xaeio91, r=Dylan-DPC
bors [Thu, 2 Jun 2022 10:39:24 +0000 (10:39 +0000)]
Auto merge of #97644 - Dylan-DPC:rollup-xaeio91, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #96894 (Apply track_caller to closure on `expect_non_local()`)
 - #97023 (Diagnose anonymous lifetimes errors more uniformly between async and regular fns)
 - #97397 (Stabilize `box_into_pin`)
 - #97587 (Migrate more diagnostics to use the `#[derive(SessionDiagnostic)]`)
 - #97603 (Arc make_mut doc comment spelling correction.)
 - #97635 (Fix file metadata documentation for Windows)

Failed merges:

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

2 years agoAdd regression test for json reexport bug
Guillaume Gomez [Tue, 31 May 2022 20:45:31 +0000 (22:45 +0200)]
Add regression test for json reexport bug

2 years agoAdd Symbol into rustdoc JSON ID to prevent conflicts between reexports
Guillaume Gomez [Tue, 31 May 2022 19:47:19 +0000 (21:47 +0200)]
Add Symbol into rustdoc JSON ID to prevent conflicts between reexports

2 years agodon't use a `span_note` for ignored impls
lcnr [Thu, 2 Jun 2022 09:13:31 +0000 (11:13 +0200)]
don't use a `span_note` for ignored impls

2 years agoRollup merge of #97635 - rgwood:patch-1, r=ChrisDenton
Dylan DPC [Thu, 2 Jun 2022 09:13:26 +0000 (11:13 +0200)]
Rollup merge of #97635 - rgwood:patch-1, r=ChrisDenton

Fix file metadata documentation for Windows

I noticed that the documentation for `fs::symlink_metadata()` and `fs::metadata()` is incorrect; [the underlying code](https://github.com/rust-lang/rust/blob/481db40311cdd241ae4d33f34f2f75732e44d8e8/library/std/src/sys/windows/fs.rs#L334) calls [`GetFileInformationByHandle()`](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfileinformationbyhandle) on Windows, not [`GetFileAttributesEx()`](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfileattributesexw). There are currently [no uses of `GetFileAttributesEx()` in this repo](https://github.com/rust-lang/rust/search?q=GetFileAttributesEx).

2 years agoRollup merge of #97603 - ximon18:arc-make-mut-spelling-correction, r=GuillaumeGomez
Dylan DPC [Thu, 2 Jun 2022 09:13:25 +0000 (11:13 +0200)]
Rollup merge of #97603 - ximon18:arc-make-mut-spelling-correction, r=GuillaumeGomez

Arc make_mut doc comment spelling correction.

2 years agoRollup merge of #97587 - pvdrz:maybe-recover-from-bad-qpath-stage-2, r=davidtwco
Dylan DPC [Thu, 2 Jun 2022 09:13:24 +0000 (11:13 +0200)]
Rollup merge of #97587 - pvdrz:maybe-recover-from-bad-qpath-stage-2, r=davidtwco

Migrate more diagnostics to use the `#[derive(SessionDiagnostic)]`

r? ``@davidtwco``

2 years agoRollup merge of #97397 - JohnTitor:stabilize-box-into-pin, r=Mark-Simulacrum
Dylan DPC [Thu, 2 Jun 2022 09:13:23 +0000 (11:13 +0200)]
Rollup merge of #97397 - JohnTitor:stabilize-box-into-pin, r=Mark-Simulacrum

Stabilize `box_into_pin`

FCP has been completed: https://github.com/rust-lang/rust/issues/62370#issuecomment-1012162279
Also, adds notes as per https://github.com/rust-lang/rust/issues/62370#issuecomment-1004108116
Closes #62370

2 years agoRollup merge of #97023 - cjgillot:uniform-anon, r=estebank
Dylan DPC [Thu, 2 Jun 2022 09:13:22 +0000 (11:13 +0200)]
Rollup merge of #97023 - cjgillot:uniform-anon, r=estebank

Diagnose anonymous lifetimes errors more uniformly between async and regular fns

Async fns and regular fns are desugared differently.  For the former, we create a generic parameter at HIR level.  For the latter, we just create an anonymous region for typeck.

I plan to migrate regular fns to the async fn desugaring.

Before that, this PR attempts to merge the diagnostics for both cases.

r? ```@estebank```

2 years agoRollup merge of #96894 - JohnTitor:expect-non-local-track-caller, r=petrochenkov
Dylan DPC [Thu, 2 Jun 2022 09:13:21 +0000 (11:13 +0200)]
Rollup merge of #96894 - JohnTitor:expect-non-local-track-caller, r=petrochenkov

Apply track_caller to closure on `expect_non_local()`

r? `@petrochenkov`

Alternatively we could remove the closure by replicating the same logic of `map_id()`. I'm happy to switch to it if you'd like.

2 years agorebase
lcnr [Thu, 2 Jun 2022 08:25:47 +0000 (10:25 +0200)]
rebase

2 years agoremove unnecessary change
lcnr [Fri, 27 May 2022 06:25:50 +0000 (08:25 +0200)]
remove unnecessary change

2 years ago`generic_arg_contains_target`: ignore closures
lcnr [Thu, 26 May 2022 10:26:30 +0000 (12:26 +0200)]
`generic_arg_contains_target`: ignore closures

2 years agoeagerly fetch the typeck_results
lcnr [Thu, 26 May 2022 09:40:23 +0000 (11:40 +0200)]
eagerly fetch the typeck_results

2 years agouse verbose suggestions
lcnr [Tue, 24 May 2022 07:57:14 +0000 (09:57 +0200)]
use verbose suggestions

2 years agoadd new `emit_inference_failure_err`
lcnr [Mon, 14 Feb 2022 12:25:26 +0000 (13:25 +0100)]
add new `emit_inference_failure_err`

2 years agoremove the old `emit_inference_failure_err`
lcnr [Mon, 14 Feb 2022 11:48:27 +0000 (12:48 +0100)]
remove the old `emit_inference_failure_err`

2 years agoAuto merge of #96737 - ChrisDenton:win-manifest, r=wesleywiser
bors [Thu, 2 Jun 2022 07:58:29 +0000 (07:58 +0000)]
Auto merge of #96737 - ChrisDenton:win-manifest, r=wesleywiser

Add Windows application manifest to rustc-main

Windows allows setting some runtime options using a manifest file. The format of the XML file is documented here: https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests

The manifest file in this PR does three things:

* Declares which Windows versions we support. This may help avoid unnecessary compatibility shims.
* Uses the UTF-8 code page. While Rust itself uses UTF-16 APIs, other code may rely on the code page.
* Makes the application long path aware (if also enabled by the user). This allows for the current directory to be longer than `PATH_MAX`.

These changes only affect the `rustc` process and not any other DLLs or compiled programs.

2 years agoAuto merge of #97414 - LYF1999:yf/cachealign, r=Mark-Simulacrum
bors [Thu, 2 Jun 2022 04:14:02 +0000 (04:14 +0000)]
Auto merge of #97414 - LYF1999:yf/cachealign, r=Mark-Simulacrum

use 128 cache align for aarch64

the cache line size of m1 mac is 128.
so use `align(128)` for m1 mac

here is `sysctl -a hw machdep.cpu` output on m1 mac
```
hw.ncpu: 10
hw.byteorder: 1234
hw.memsize: 68719476736
hw.activecpu: 10
hw.perflevel0.physicalcpu: 8
hw.perflevel0.physicalcpu_max: 8
hw.perflevel0.logicalcpu: 8
hw.perflevel0.logicalcpu_max: 8
hw.perflevel0.l1icachesize: 196608
hw.perflevel0.l1dcachesize: 131072
hw.perflevel0.l2cachesize: 12582912
hw.perflevel0.cpusperl2: 4
hw.perflevel1.physicalcpu: 2
hw.perflevel1.physicalcpu_max: 2
hw.perflevel1.logicalcpu: 2
hw.perflevel1.logicalcpu_max: 2
hw.perflevel1.l1icachesize: 131072
hw.perflevel1.l1dcachesize: 65536
hw.perflevel1.l2cachesize: 4194304
hw.perflevel1.cpusperl2: 2
hw.optional.arm.FEAT_FlagM: 1
hw.optional.arm.FEAT_FlagM2: 1
hw.optional.arm.FEAT_FHM: 1
hw.optional.arm.FEAT_DotProd: 1
hw.optional.arm.FEAT_SHA3: 1
hw.optional.arm.FEAT_RDM: 1
hw.optional.arm.FEAT_LSE: 1
hw.optional.arm.FEAT_SHA256: 1
hw.optional.arm.FEAT_SHA512: 1
hw.optional.arm.FEAT_SHA1: 1
hw.optional.arm.FEAT_AES: 1
hw.optional.arm.FEAT_PMULL: 1
hw.optional.arm.FEAT_SPECRES: 0
hw.optional.arm.FEAT_SB: 1
hw.optional.arm.FEAT_FRINTTS: 1
hw.optional.arm.FEAT_LRCPC: 1
hw.optional.arm.FEAT_LRCPC2: 1
hw.optional.arm.FEAT_FCMA: 1
hw.optional.arm.FEAT_JSCVT: 1
hw.optional.arm.FEAT_PAuth: 1
hw.optional.arm.FEAT_PAuth2: 0
hw.optional.arm.FEAT_FPAC: 0
hw.optional.arm.FEAT_DPB: 1
hw.optional.arm.FEAT_DPB2: 1
hw.optional.arm.FEAT_BF16: 0
hw.optional.arm.FEAT_I8MM: 0
hw.optional.arm.FEAT_ECV: 1
hw.optional.arm.FEAT_LSE2: 1
hw.optional.arm.FEAT_CSV2: 1
hw.optional.arm.FEAT_CSV3: 1
hw.optional.arm.FEAT_FP16: 1
hw.optional.arm.FEAT_SSBS: 1
hw.optional.arm.FEAT_BTI: 0
hw.optional.floatingpoint: 1
hw.optional.neon: 1
hw.optional.neon_hpfp: 1
hw.optional.neon_fp16: 1
hw.optional.armv8_1_atomics: 1
hw.optional.armv8_2_fhm: 1
hw.optional.armv8_2_sha512: 1
hw.optional.armv8_2_sha3: 1
hw.optional.armv8_3_compnum: 1
hw.optional.watchpoint: 4
hw.optional.breakpoint: 6
hw.optional.armv8_crc32: 1
hw.optional.armv8_gpi: 1
hw.optional.AdvSIMD: 1
hw.optional.AdvSIMD_HPFPCvt: 1
hw.optional.ucnormal_mem: 1
hw.optional.arm64: 1
hw.features.allows_security_research: 0
hw.physicalcpu: 10
hw.physicalcpu_max: 10
hw.logicalcpu: 10
hw.logicalcpu_max: 10
hw.cputype: 16777228
hw.cpusubtype: 2
hw.cpu64bit_capable: 1
hw.cpufamily: 458787763
hw.cpusubfamily: 5
hw.cacheconfig: 10 1 2 0 0 0 0 0 0 0
hw.cachesize: 3373957120 65536 4194304 0 0 0 0 0 0 0
hw.pagesize: 16384
hw.pagesize32: 16384
hw.cachelinesize: 128
hw.l1icachesize: 131072
hw.l1dcachesize: 65536
hw.l2cachesize: 4194304
hw.tbfrequency: 24000000
hw.packages: 1
hw.osenvironment:
hw.ephemeral_storage: 0
hw.use_recovery_securityd: 0
hw.use_kernelmanagerd: 1
hw.serialdebugmode: 0
hw.nperflevels: 2
hw.targettype: J316c
machdep.cpu.cores_per_package: 10
machdep.cpu.core_count: 10
machdep.cpu.logical_per_package: 10
machdep.cpu.thread_count: 10
machdep.cpu.brand_string: Apple M1 Max
```

2 years agoAddress review comments.
Nicholas Nethercote [Thu, 2 Jun 2022 01:43:14 +0000 (11:43 +1000)]
Address review comments.

2 years agoRevert #96682.
Nicholas Nethercote [Thu, 2 Jun 2022 00:49:22 +0000 (10:49 +1000)]
Revert #96682.

The change was "Show invisible delimiters (within comments) when pretty
printing". It's useful to show these delimiters, but is a breaking
change for some proc macros.

Fixes #97608.

2 years agoFix Windows file metadata docs
Reilly Wood [Thu, 2 Jun 2022 00:32:33 +0000 (20:32 -0400)]
Fix Windows file metadata docs

Retrieving file metadata on Windows now uses GetFileInformationByHandle not GetFileAttributesEx

2 years agoAuto merge of #97632 - JohnTitor:rollup-d2ucrjw, r=JohnTitor
bors [Wed, 1 Jun 2022 22:34:38 +0000 (22:34 +0000)]
Auto merge of #97632 - JohnTitor:rollup-d2ucrjw, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #95594 (Additional `*mut [T]` methods)
 - #97130 (rustdoc: avoid including impl blocks with filled-in generics)
 - #97166 (Move conditions out of recover/report functions.)
 - #97605 (Mention filename in suggestion when it differs from primary span)
 - #97613 (rustdoc: Improve calculation of "Impls on Foreign Types")
 - #97626 (rename PointerAddress → PointerExposeAddress)

Failed merges:

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

2 years agoStabilize `box_into_pin`
Yuki Okushi [Wed, 25 May 2022 12:45:35 +0000 (21:45 +0900)]
Stabilize `box_into_pin`

2 years agoAdd test for anonymous reexports
Guillaume Gomez [Wed, 1 Jun 2022 10:25:04 +0000 (12:25 +0200)]
Add test for anonymous reexports

2 years agoRollup merge of #97626 - RalfJung:expose, r=tmiasko
Yuki Okushi [Wed, 1 Jun 2022 21:44:29 +0000 (06:44 +0900)]
Rollup merge of #97626 - RalfJung:expose, r=tmiasko

rename PointerAddress → PointerExposeAddress

`PointerAddress` sounds a bit too much like `ptr.addr()`, but this corresponds to `ptr.expose_addr()`.

r? `@tmiasko`

2 years agoRollup merge of #97613 - jsha:implementation-is-on-local-type, r=GuillaumeGomez
Yuki Okushi [Wed, 1 Jun 2022 21:44:29 +0000 (06:44 +0900)]
Rollup merge of #97613 - jsha:implementation-is-on-local-type, r=GuillaumeGomez

rustdoc: Improve calculation of "Impls on Foreign Types"

The existing code to calculate whether an implementation was on a "Foreign Type" was duplicated across the sidebar generation and the page generation. It also came to the wrong conclusion for some cases where both the trait and the "for" type were re-exports.

This PR extracts the logic into a method of `Impl`, breaks it into a multi-line method so it can be commented, and adds a case for when the trait and the "for" type came from the same crate. This fixes some cases - like the platform-specific integer types (`__m256`, `__m128`, etc). But it doesn't fix all cases. See the screenshots below.

[Before](https://doc.rust-lang.org/nightly/std/clone/trait.Clone.html#foreign-impls):

<img src="https://user-images.githubusercontent.com/220205/171338226-59ce6daf-3d76-4bad-bc8d-72a8259a8f43.png" width=200>

[After](https://rustdoc.crud.net/jsha/implementation-is-on-local-type/std/clone/trait.Clone.html):

<img src="https://user-images.githubusercontent.com/220205/171338147-28308a65-1597-4223-be47-9550062404dd.png" width=200>

The remaining types (`CString`, `NulError`, etc) are all from the `alloc` crate, while the `Clone` trait is from the `core` crate. Since `CString` and `Clone` are both re-exported by `std`, they are logically local to each other, but I couldn't figure out a good way to detect that in this code. I figure this is still a good step forward.

Related: #97610

r? `@camelid`

2 years agoRollup merge of #97605 - estebank:suggestion-filename, r=oli-obk
Yuki Okushi [Wed, 1 Jun 2022 21:44:28 +0000 (06:44 +0900)]
Rollup merge of #97605 - estebank:suggestion-filename, r=oli-obk

Mention filename in suggestion when it differs from primary span

2 years agoRollup merge of #97166 - nnethercote:move-conditions-out, r=estebank
Yuki Okushi [Wed, 1 Jun 2022 21:44:27 +0000 (06:44 +0900)]
Rollup merge of #97166 - nnethercote:move-conditions-out, r=estebank

Move conditions out of recover/report functions.

`Parser` has six recover/report functions that are passed a boolean, and
nothing is done if the boolean has a particular value.

This PR moves the tests outside the functions. This has the following effects.
- The number of lines of code goes down.
- Some `use` items become shorter.
- Avoids the strangeness whereby 11 out of 12 calls to
  `maybe_recover_from_bad_qpath` pass `true` as the second argument.
- Makes it clear at the call site that only one of
  `maybe_recover_from_bad_type_plus` and `maybe_report_ambiguous_plus` will be
  run.

r? `@estebank`

2 years agoRollup merge of #97130 - notriddle:notriddle/collect-trait-impls-dup, r=GuillaumeGomez
Yuki Okushi [Wed, 1 Jun 2022 21:44:26 +0000 (06:44 +0900)]
Rollup merge of #97130 - notriddle:notriddle/collect-trait-impls-dup, r=GuillaumeGomez

rustdoc: avoid including impl blocks with filled-in generics

Fixes #94937

# Before

![image](https://user-images.githubusercontent.com/1593513/168933282-02ccc4ae-9c89-4836-ba34-e2bd83946105.png)

# After

![image](https://user-images.githubusercontent.com/1593513/168933255-4c17407d-d8d1-406e-87f5-9ea809437173.png)

2 years agoRollup merge of #95594 - the8472:raw_slice_methods, r=yaahc
Yuki Okushi [Wed, 1 Jun 2022 21:44:25 +0000 (06:44 +0900)]
Rollup merge of #95594 - the8472:raw_slice_methods, r=yaahc

Additional `*mut [T]` methods

Split out from #94247

This adds the following methods to raw slices that already exist on regular slices

* `*mut [T]::is_empty`
* `*mut [T]::split_at_mut`
* `*mut [T]::split_at_mut_unchecked`

These methods reduce the amount of unsafe code needed to migrate `ChunksMut` and related iterators
to raw slices (#94247)

r? `@m-ou-se`

2 years agoAuto merge of #97612 - ehuss:update-cargo, r=ehuss
bors [Wed, 1 Jun 2022 20:06:14 +0000 (20:06 +0000)]
Auto merge of #97612 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in 39ad1039d9e3e1746177bf5d134af4c164f95528..38472bc19f2f76e245eba54a6e97ee6821b3c1db
2022-05-25 00:50:02 +0000 to 2022-05-31 02:03:24 +0000
- Emit warning upon encountering multiple packages with the same name (rust-lang/cargo#10701)
- Guide new users to add use `super::*;` to `mod test` (rust-lang/cargo#10706)
- Document how to debug change detection events (rust-lang/cargo#10708)
- fix(publish): add more check when use `publish -p &lt;SPEC&gt;` (rust-lang/cargo#10677)
- fix key formatting when switching to a dotted `WorkspaceSource` (rust-lang/cargo#10705)

2 years agoAlways assert that impl_trait_def|bounds are empty at start
Santiago Pastorino [Wed, 1 Jun 2022 18:38:37 +0000 (15:38 -0300)]
Always assert that impl_trait_def|bounds are empty at start

2 years agoupdate explicit impls error msg
lcnr [Wed, 1 Jun 2022 18:36:20 +0000 (20:36 +0200)]
update explicit impls error msg

2 years agorename PointerAddress → PointerExposeAddress
Ralf Jung [Wed, 1 Jun 2022 17:24:44 +0000 (13:24 -0400)]
rename PointerAddress → PointerExposeAddress

2 years agoinstrument lower_fn_decl
Santiago Pastorino [Wed, 1 Jun 2022 17:48:02 +0000 (14:48 -0300)]
instrument lower_fn_decl

2 years agorustdoc: add test case for auto traits on slice primitive
Michael Howell [Wed, 1 Jun 2022 18:00:25 +0000 (11:00 -0700)]
rustdoc: add test case for auto traits on slice primitive

2 years agoSplit extend + inner chain into to extend calls
Santiago Pastorino [Wed, 1 Jun 2022 17:42:16 +0000 (14:42 -0300)]
Split extend + inner chain into to extend calls

2 years agoAdd debug_assert comment
Santiago Pastorino [Wed, 1 Jun 2022 17:43:16 +0000 (14:43 -0300)]
Add debug_assert comment

Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
2 years agoAuto merge of #97624 - matthiaskrgr:rollup-rtcqjx9, r=matthiaskrgr
bors [Wed, 1 Jun 2022 17:25:29 +0000 (17:25 +0000)]
Auto merge of #97624 - matthiaskrgr:rollup-rtcqjx9, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #96271 (suggest `?` when method is missing on `Result<T, _>` but found on `T`)
 - #97264 (Suggest `extern crate foo` when failing to resolve `use foo`)
 - #97592 (rustdoc: also index impl trait and raw pointers)
 - #97621 (update Miri)

Failed merges:

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

2 years agoUpdate src/librustdoc/passes/collect_trait_impls.rs
Michael Howell [Wed, 1 Jun 2022 15:40:19 +0000 (08:40 -0700)]
Update src/librustdoc/passes/collect_trait_impls.rs

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2 years agoMention filename in suggestion when it differs from primary span
Esteban Küber [Tue, 31 May 2022 23:38:03 +0000 (16:38 -0700)]
Mention filename in suggestion when it differs from primary span

2 years agoImprove calculation of "Impls on Foreign Types"
Jacob Hoffman-Andrews [Tue, 31 May 2022 05:53:59 +0000 (22:53 -0700)]
Improve calculation of "Impls on Foreign Types"

2 years agoRollup merge of #97621 - RalfJung:miri, r=RalfJung
Matthias Krüger [Wed, 1 Jun 2022 15:11:07 +0000 (17:11 +0200)]
Rollup merge of #97621 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/97563
Cc ``@rust-lang/miri`` r? ``@ghost``

2 years agoRollup merge of #97592 - notriddle:notriddle/impl-trait, r=GuillaumeGomez
Matthias Krüger [Wed, 1 Jun 2022 15:11:06 +0000 (17:11 +0200)]
Rollup merge of #97592 - notriddle:notriddle/impl-trait, r=GuillaumeGomez

rustdoc: also index impl trait and raw pointers

Revives #92339

2 years agoRollup merge of #97264 - TaKO8Ki:suggest-extern-crate-when-failing-to-resolve-use...
Matthias Krüger [Wed, 1 Jun 2022 15:11:05 +0000 (17:11 +0200)]
Rollup merge of #97264 - TaKO8Ki:suggest-extern-crate-when-failing-to-resolve-use-crate, r=estebank

Suggest `extern crate foo` when failing to resolve `use foo`

closes #97095

r? ``@estebank``

2 years agoRollup merge of #96271 - compiler-errors:suggest-question-mark, r=estebank
Matthias Krüger [Wed, 1 Jun 2022 15:11:04 +0000 (17:11 +0200)]
Rollup merge of #96271 - compiler-errors:suggest-question-mark, r=estebank

suggest `?` when method is missing on `Result<T, _>` but found on `T`

The wording needs help, I think.

Fixes #95729

2 years agoAuto merge of #97622 - JohnTitor:rollup-4qoxrjn, r=JohnTitor
bors [Wed, 1 Jun 2022 14:44:20 +0000 (14:44 +0000)]
Auto merge of #97622 - JohnTitor:rollup-4qoxrjn, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #94647 (Expose `get_many_mut` and `get_many_unchecked_mut` to HashMap)
 - #97216 (Ensure we never consider the null pointer dereferencable)
 - #97399 (simplify code of finding arg index in `opt_const_param_of`)
 - #97470 (rustdoc: add more test coverage)
 - #97498 (Corrected EBNF grammar for from_str)
 - #97562 (Fix comment in `poly_project_and_unify_type`)
 - #97580 (Add regression test for #71546)
 - #97611 (Tweak insert docs)
 - #97616 (Remove an unnecessary `Option`)

Failed merges:

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

2 years agoRollup merge of #97616 - TaKO8Ki:remove-unnecessary-option, r=Dylan-DPC
Yuki Okushi [Wed, 1 Jun 2022 14:36:53 +0000 (23:36 +0900)]
Rollup merge of #97616 - TaKO8Ki:remove-unnecessary-option, r=Dylan-DPC

Remove an unnecessary `Option`

2 years agoRollup merge of #97611 - azdavis:master, r=Dylan-DPC
Yuki Okushi [Wed, 1 Jun 2022 14:36:52 +0000 (23:36 +0900)]
Rollup merge of #97611 - azdavis:master, r=Dylan-DPC

Tweak insert docs

For `{Hash, BTree}Map::insert`, I always have to take a few extra seconds to think about the slight weirdness about the fact that if we "did not" insert (which "sounds" false), we return true, and if we "did" insert, (which "sounds" true), we return false.

This tweaks the doc comments for the `insert` methods of those types (as well as what looks like a rustc internal data structure that I found just by searching the codebase for "If the set did") to first use the "Returns whether _something_" pattern used in e.g. `remove`, where we say that `remove` "returns whether the value was present".

2 years agoRollup merge of #97580 - JohnTitor:issue-71546, r=compiler-errors
Yuki Okushi [Wed, 1 Jun 2022 14:36:51 +0000 (23:36 +0900)]
Rollup merge of #97580 - JohnTitor:issue-71546, r=compiler-errors

Add regression test for #71546

Closes #71546
r? `@compiler-errors`

2 years agoRollup merge of #97562 - compiler-errors:comment-poly_project_and_unify_type, r=lcnr
Yuki Okushi [Wed, 1 Jun 2022 14:36:50 +0000 (23:36 +0900)]
Rollup merge of #97562 - compiler-errors:comment-poly_project_and_unify_type, r=lcnr

Fix comment in `poly_project_and_unify_type`

Renamed some variants to match `ProjectAndUnifyResult`

2 years agoRollup merge of #97498 - ijchen:master, r=Mark-Simulacrum
Yuki Okushi [Wed, 1 Jun 2022 14:36:49 +0000 (23:36 +0900)]
Rollup merge of #97498 - ijchen:master, r=Mark-Simulacrum

Corrected EBNF grammar for from_str

Hello! This is my first time contributing to an open-source project. I'm excited to have the chance to contribute to the rust community 🥳

I noticed an issue with the documentation for `from_str` in `f32` and `f64`. It states that "All strings that adhere to the following [EBNF](https://www.w3.org/TR/REC-xml/#sec-notation) grammar when lowercased will result in an `Ok` being returned. I believe this is incorrect for the string `"."`, which is valid for the given EBNF grammar, but does not result in an `Ok` being returned ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=09f891aa87963a56d3b0d715d8cbc2b4)). I have simplified the grammar in a way which fixes that, but is otherwise identical.

Previously, the `Number` part of the EBNF grammar had an option for `'.' Digit*`, which would include the string `"."`. This is not valid, and does not return an Ok as stated. The corrected version removes this, and still allows for the `'.' Digit+` case with the already existing `Digit* '.' Digit+` case.

2 years agoRollup merge of #97470 - notriddle:notriddle/test-cases, r=GuillaumeGomez
Yuki Okushi [Wed, 1 Jun 2022 14:36:48 +0000 (23:36 +0900)]
Rollup merge of #97470 - notriddle:notriddle/test-cases, r=GuillaumeGomez

rustdoc: add more test coverage

https://github.com/rust-lang/rust/issues/91113

2 years agoRollup merge of #97399 - SparrowLii:arg_index, r=oli-obk
Yuki Okushi [Wed, 1 Jun 2022 14:36:47 +0000 (23:36 +0900)]
Rollup merge of #97399 - SparrowLii:arg_index, r=oli-obk

simplify code of finding arg index in `opt_const_param_of`

From the FIXME in the impl of `opt_const_param_of`. Part of the code is simplified by blending two iterator statements and using `let...else` statement.