]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoignore the doctest for map
Yoshiki Matsuda [Tue, 3 May 2022 15:53:46 +0000 (00:53 +0900)]
ignore the doctest for map

2 years agoignore a doctest for the non-exported macro
Yoshiki Matsuda [Tue, 3 May 2022 09:33:56 +0000 (18:33 +0900)]
ignore a doctest for the non-exported macro

2 years agoremove the special case for nonexported macro_rules! macros
Yoshiki Matsuda [Mon, 2 May 2022 09:50:54 +0000 (18:50 +0900)]
remove the special case for nonexported macro_rules! macros

2 years agoAuto merge of #96600 - c410-f3r:z-errors, r=petrochenkov
bors [Mon, 2 May 2022 05:52:01 +0000 (05:52 +0000)]
Auto merge of #96600 - c410-f3r:z-errors, r=petrochenkov

Move some tests to more reasonable places

cc https://github.com/rust-lang/rust/issues/73494
r? `@petrochenkov`

16602 -> `codegen` because of https://github.com/rust-lang/rust/issues/16602#issuecomment-53806665

2 years agoAuto merge of #96622 - JohnTitor:rollup-8hckgaj, r=JohnTitor
bors [Mon, 2 May 2022 03:28:14 +0000 (03:28 +0000)]
Auto merge of #96622 - JohnTitor:rollup-8hckgaj, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #94126 (Classify BinaryHeap & LinkedList unit tests as such)
 - #96222 (Clarify docs for `from_raw_parts` on `Vec` and `String`)
 - #96499 (Make it possible to write doctests for bootstrap)
 - #96567 (Fix docs for u32 and i32 logs func)
 - #96568 (std::fmt: Various fixes and improvements to documentation)
 - #96571 (Add a bathroom stall to weird expressions test)
 - #96610 (Update browser-ui-test version to 0.9.0)

Failed merges:

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

2 years agoRollup merge of #96610 - GuillaumeGomez:update-browser-ui-test, r=notriddle
Yuki Okushi [Mon, 2 May 2022 01:41:59 +0000 (10:41 +0900)]
Rollup merge of #96610 - GuillaumeGomez:update-browser-ui-test, r=notriddle

Update browser-ui-test version to 0.9.0

It adds the command `screenshot` and disables the screenshot comparison by default.

r? `@notriddle`

2 years agoRollup merge of #96571 - thomcc:bathroom-stall, r=Mark-Simulacrum
Yuki Okushi [Mon, 2 May 2022 01:41:59 +0000 (10:41 +0900)]
Rollup merge of #96571 - thomcc:bathroom-stall, r=Mark-Simulacrum

Add a bathroom stall to weird expressions test

2 years agoRollup merge of #96568 - EliasHolzmann:fmt_doc_fixes, r=joshtriplett
Yuki Okushi [Mon, 2 May 2022 01:41:58 +0000 (10:41 +0900)]
Rollup merge of #96568 - EliasHolzmann:fmt_doc_fixes, r=joshtriplett

std::fmt: Various fixes and improvements to documentation

This PR contains the following changes:

- **Added argument index comments to examples for specifying precision**

  The examples for specifying the precision have comments explaining which
  argument the specifier is referring to. However, for implicit positional
  arguments, the examples simply refer to "next arg". To simplify following the
  comments, "next arg" was supplemented with the actual resulting argument index.

- **Fixed documentation for specifying precision via `.*`**

  The documentation stated that in case of the syntax `{<arg>:<spec>.*}`, "the
  `<arg>` part refers to the value to print, and the precision must come in the
  input preceding `<arg>`". This is not correct: the <arg> part does indeed refer
  to the value to print, but the precision does not come in the input preciding
  arg, but in the next implicit input (as if specified with {}).

  Fixes #96413.

- **Fix the grammar documentation**

  According to the grammar documented, the format specifier `{: }` should not be
  legal because of the whitespace it contains. However, in reality, this is
  perfectly fine because the actual implementation allows spaces before the
  closing brace. Fixes #71088.

  Also, the exact meaning of most of the terminal symbols was not specified, for
  example the meaning of `identifier`.

- **Removed reference to Formatter::buf and other private fields**

  Formatter::buf is not a public field and therefore isn't very helpful in user-
  facing documentation. Also, the other public fields of Formatter were removed
  during stabilization of std::fmt (4af3494bb0) and can only be accessed via
  getters.

- **Improved list of formatting macros**

  Two improvements:
  1. write! can not only receive a `io::Write`, but also a `fmt::Write` as first argument.
  2. The description texts now contain links to the actual macros for easier
     navigation.

2 years agoRollup merge of #96567 - alex-semenyuk:fix_docs_for_logs_func, r=Mark-Simulacrum
Yuki Okushi [Mon, 2 May 2022 01:41:57 +0000 (10:41 +0900)]
Rollup merge of #96567 - alex-semenyuk:fix_docs_for_logs_func, r=Mark-Simulacrum

Fix docs for u32 and i32 logs func

Closes #96545

2 years agoRollup merge of #96499 - jyn514:bootstrap-doctests, r=Mark-Simulacrum
Yuki Okushi [Mon, 2 May 2022 01:41:56 +0000 (10:41 +0900)]
Rollup merge of #96499 - jyn514:bootstrap-doctests, r=Mark-Simulacrum

Make it possible to write doctests for bootstrap

This probably isn't super useful in practice, but it was easy to fix
and avoids confusing errors about mismatched versions between beta and the default toolchain.

2 years agoRollup merge of #96222 - jmaargh:john-mark/clarify-from-raw-parts-docs, r=JohnTitor
Yuki Okushi [Mon, 2 May 2022 01:41:55 +0000 (10:41 +0900)]
Rollup merge of #96222 - jmaargh:john-mark/clarify-from-raw-parts-docs, r=JohnTitor

Clarify docs for `from_raw_parts` on `Vec` and `String`

Closes #95427

Original safety explanation for `from_raw_parts` was unclear on safety for consuming a C string. This clarifies when doing so is safe.

2 years agoRollup merge of #94126 - ssomers:alloc_prep_1, r=Mark-Simulacrum
Yuki Okushi [Mon, 2 May 2022 01:41:54 +0000 (10:41 +0900)]
Rollup merge of #94126 - ssomers:alloc_prep_1, r=Mark-Simulacrum

Classify BinaryHeap & LinkedList unit tests as such

All but one of these so-called integration test case are unit tests, just like btree's were (#75531). In addition, reunite the unit tests of linked_list that were split off during #23104 because they needed to remain unit tests (they were later moved to the separate file they are in during #63207). The two sets could remain separate files, but I opted to merge them back together, more or less in the order they used to be, apart from one duplicate name `test_split_off` and one duplicate tiny function `list_from`.

2 years agoAuto merge of #96517 - ferrocene:pa-files-related-to-test, r=Mark-Simulacrum
bors [Sun, 1 May 2022 22:56:11 +0000 (22:56 +0000)]
Auto merge of #96517 - ferrocene:pa-files-related-to-test, r=Mark-Simulacrum

[compiletest] Extract code to detect files related to a test into a different function

In the code that checks whether a test needs to be re-executed, compiletest checks the modification date of all the files related to the test. I need the list of files related to the test for other purposes inside compiletest, and while I could copy/paste the code `is_up_to_date` runs, that would produce incomplete results if more related files are added in the future.

This PR extracts the code to detect related files into a separate function, allowing the rest of compiletest to access the same data.

r? `@Mark-Simulacrum`

2 years agoAuto merge of #96521 - petrochenkov:docrules, r=notriddle,GuillaumeGomez
bors [Sun, 1 May 2022 20:28:10 +0000 (20:28 +0000)]
Auto merge of #96521 - petrochenkov:docrules, r=notriddle,GuillaumeGomez

rustdoc: Resolve doc links referring to `macro_rules` items

cc https://github.com/rust-lang/rust/issues/81633

UPD: the fallback to considering *all* `macro_rules` in the crate for unresolved names is not removed in this PR, it will be removed separately and will be run through crater.

2 years agoUpdate browser-ui-test version to 0.9.0
Guillaume Gomez [Sun, 1 May 2022 19:36:19 +0000 (21:36 +0200)]
Update browser-ui-test version to 0.9.0

2 years agoAuto merge of #96582 - petrochenkov:finalize, r=cjgillot
bors [Sun, 1 May 2022 18:05:57 +0000 (18:05 +0000)]
Auto merge of #96582 - petrochenkov:finalize, r=cjgillot

resolve: Cleanup path resolution finalization

Some cleanup after https://github.com/rust-lang/rust/pull/95255 and https://github.com/rust-lang/rust/pull/95405.
r? `@cjgillot`

2 years agoAuto merge of #96549 - ouz-a:mir-opt, r=oli-obk
bors [Sun, 1 May 2022 15:25:16 +0000 (15:25 +0000)]
Auto merge of #96549 - ouz-a:mir-opt, r=oli-obk

Move Derefer before Retag

_Follow up work to #96116 #95857 #95649_

This moves `Derefer` before `Retag` and creates a new `LocalInfo` called `Temp` to avoid retagging created temp values.

Zulip discussion [link](https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/deref.20as.20first.20and.20only.20projection)

r? `@oli-obk`

2 years agoresolve: Rename `unusable_binding` to `ignore_binding`
Vadim Petrochenkov [Sat, 30 Apr 2022 15:01:01 +0000 (18:01 +0300)]
resolve: Rename `unusable_binding` to `ignore_binding`

2 years agoresolve: Merge `last_import_segment` into `Finalize`
Vadim Petrochenkov [Sat, 30 Apr 2022 14:31:44 +0000 (17:31 +0300)]
resolve: Merge `last_import_segment` into `Finalize`

2 years agoresolve: Pass full `Finalize` in nearly all cases
Vadim Petrochenkov [Sat, 30 Apr 2022 13:57:18 +0000 (16:57 +0300)]
resolve: Pass full `Finalize` in nearly all cases

2 years agoresolve: Turn `enum Finalize` into an optional struct
Vadim Petrochenkov [Sat, 30 Apr 2022 13:26:36 +0000 (16:26 +0300)]
resolve: Turn `enum Finalize` into an optional struct

2 years agostd::fmt: Improved list of formatting macros
Elias Holzmann [Sat, 30 Apr 2022 00:41:32 +0000 (02:41 +0200)]
std::fmt: Improved list of formatting macros

Two improvements:
1. write! can not only receive a `io::Write`, but also a `fmt::Write` as first argument.
2. The description texts now contain links to the actual macros for easier
   navigation.

2 years agostd::fmt: Removed reference to Formatter::buf and other private fields
Elias Holzmann [Sat, 30 Apr 2022 00:40:39 +0000 (02:40 +0200)]
std::fmt: Removed reference to Formatter::buf and other private fields

Formatter::buf is not a public field and therefore isn't very helpful in user-
facing documentation. Also, the other public fields of Formatter were made
private during stabilization of std::fmt (4af3494bb0) and can now only be read
via accessor methods.

2 years agostd::fmt: Fix the grammar documentation
Elias Holzmann [Sat, 30 Apr 2022 00:39:59 +0000 (02:39 +0200)]
std::fmt: Fix the grammar documentation

According to the grammar documented, the format specifier `{: }` should not be
legal because of the whitespace it contains. However, in reality, this is
perfectly fine because the actual implementation allows spaces before the
closing brace. Fixes #71088.

Also, the exact meaning of most of the terminal symbols was not specified, for
example the meaning of `identifier`.

2 years agostd::fmt: Added argument index comments to examples for specifying precision
Elias Holzmann [Sat, 30 Apr 2022 00:39:27 +0000 (02:39 +0200)]
std::fmt: Added argument index comments to examples for specifying precision

The examples for specifying the precision have comments explaining which
argument the specifier is referring to. However, for implicit positional
arguments, the examples simply talk about "next arg". To make it easier for
readers to follow the comments, "next arg" was supplemented with the actual
resulting argument index.

2 years agostd::fmt: Fixed documentation for specifying precision via `.*`
Elias Holzmann [Sat, 30 Apr 2022 00:38:22 +0000 (02:38 +0200)]
std::fmt: Fixed documentation for specifying precision via `.*`

The documentation stated that in case of the syntax `{<arg>:<spec>.*}`, "the
`<arg>` part refers to the value to print, and the precision must come in the
input preceding `<arg>`". This is not correct: the <arg> part does indeed refer
to the value to print, but the precision does not come in the input preciding
arg, but in the next implicit input (as if specified with {}).

Fixes #96413.

2 years agoAuto merge of #96376 - scottmcm:do-yeet, r=oli-obk
bors [Sun, 1 May 2022 13:10:21 +0000 (13:10 +0000)]
Auto merge of #96376 - scottmcm:do-yeet, r=oli-obk

Add `do yeet` expressions to allow experimentation in nightly

Two main goals for this:
- Ensure that trait restructuring in https://github.com/rust-lang/rust/issues/84277#issuecomment-1066120333 doesn't accidentally close us off from the possibility of doing this in future, as sketched in https://rust-lang.github.io/rfcs/3058-try-trait-v2.html#possibilities-for-yeet
- Experiment with the *existence* of syntax for this, to be able to weight the syntax-vs-library tradeoffs better than we can right now.  Notably the syntax (with `do`) and name in this PR are not intended as candidates for stabilization, but they make a good v0 PR for adding this with minimal impact to compiler maintenance or priming one possible name choice over another.

r? `@oli-obk`
The lang `second` for doing this: https://github.com/rust-lang/lang-team/issues/160#issuecomment-1107896716

Tracking issues
- Lang, https://github.com/rust-lang/rust/issues/96373
- Libs-api, https://github.com/rust-lang/rust/issues/96374

2 years agore-name stuff
ouz-a [Sun, 1 May 2022 12:38:22 +0000 (15:38 +0300)]
re-name stuff

2 years agoMove some tests to more reasonable places
Caio [Sun, 1 May 2022 11:47:38 +0000 (08:47 -0300)]
Move some tests to more reasonable places

2 years agoAuto merge of #96576 - oli-obk:post_monomorphization_error_backtrace, r=lqd
bors [Sun, 1 May 2022 10:29:39 +0000 (10:29 +0000)]
Auto merge of #96576 - oli-obk:post_monomorphization_error_backtrace, r=lqd

Also report the call site of PME errors locally.

Note this does not produce a full stack all the way to the first call that specifies all monomorphic parameters, it's just shallowly mentioning the last call site.

previous work: https://github.com/rust-lang/rust/pull/85633
tracking issue: https://github.com/rust-lang/rust/issues/85155

r? `@lqd`

I figured we could get some improvement for traces in local crates without going into the backtrace hell you landed in last time

2 years agoAuto merge of #96078 - udoprog:refcounted-str-to-u8, r=dtolnay
bors [Sun, 1 May 2022 06:41:59 +0000 (06:41 +0000)]
Auto merge of #96078 - udoprog:refcounted-str-to-u8, r=dtolnay

Implement str to [u8] conversion for refcounted containers

This seems motivated to complete the APIs for shared containers since we already have similar allocation-free conversions for strings like `From<Box<[u8]>> for Box<str>`.

Insta-stable since it's a new trait impl?

2 years agoBump shared_from_str to Rust 1.62.0
David Tolnay [Sun, 1 May 2022 06:40:35 +0000 (23:40 -0700)]
Bump shared_from_str to Rust 1.62.0

2 years agoAuto merge of #96490 - dtolnay:writetmpbackport, r=Mark-Simulacrum
bors [Sun, 1 May 2022 03:18:53 +0000 (03:18 +0000)]
Auto merge of #96490 - dtolnay:writetmpbackport, r=Mark-Simulacrum

Make [e]println macros eagerly drop temporaries (for backport)

This PR extracts the subset of #96455 which is only the parts necessary for fixing the 1.61-beta regressions in #96434.

My larger PR #96455 contains a few other changes relative to the pre-#94868 behavior; those are not necessary to backport into 1.61.

argument position | before #94868 | after #94868 | after this PR
--- |:---:|:---:|:---:
`write!($tmp, "…", …)` | :rage: | :rage: | :rage:
`write!(…, "…", $tmp)` | :rage: | :rage: | :rage:
`writeln!($tmp, "…", …)` | :rage: | :rage: | :rage:
`writeln!(…, "…", $tmp)` | :rage: | :rage: | :rage:
`print!("…", $tmp)` | :rage: | :rage: | :rage:
`println!("…", $tmp)` | :smiley_cat: | :rage: | :smiley_cat:
`eprint!("…", $tmp)` | :rage: | :rage: | :rage:
`eprintln!("…", $tmp)` | :smiley_cat: | :rage: | :smiley_cat:
`panic!("…", $tmp)` | :smiley_cat: | :smiley_cat: | :smiley_cat:

2 years agoRevert "Bless coverage-reports after core macro blocks change"
David Tolnay [Sun, 1 May 2022 01:25:17 +0000 (18:25 -0700)]
Revert "Bless coverage-reports after core macro blocks change"

This reverts commit ac5c657a0801db84b29ea9b3ae322107756575b0.

2 years agoFeature-gate `do yeet` inside `cfg`s too
Scott McMurray [Wed, 27 Apr 2022 02:49:00 +0000 (19:49 -0700)]
Feature-gate `do yeet` inside `cfg`s too

2 years agoBless the UI tests
Scott McMurray [Mon, 25 Apr 2022 02:59:23 +0000 (19:59 -0700)]
Bless the UI tests

2 years agoAuto merge of #95362 - scottmcm:calloc-arrays, r=Mark-Simulacrum
bors [Sun, 1 May 2022 00:50:46 +0000 (00:50 +0000)]
Auto merge of #95362 - scottmcm:calloc-arrays, r=Mark-Simulacrum

Support arrays of zeros in Vec's __rust_alloc_zeroed optimization

I happened to notice in https://users.rust-lang.org/t/any-advantage-of-box-u64-16-16-16-over-vec-u64/73500/3?u=scottmcm that the calloc optimization wasn't applying to vectors-of-arrays, so here's the easy fix for that.

2 years agoFix the rustfmt build
Scott McMurray [Mon, 25 Apr 2022 02:25:30 +0000 (19:25 -0700)]
Fix the rustfmt build

2 years agoFix the clippy build
Scott McMurray [Mon, 25 Apr 2022 02:08:23 +0000 (19:08 -0700)]
Fix the clippy build

2 years agoAdd `do yeet` expressions to allow experimentation in nightly
Scott McMurray [Sat, 26 Mar 2022 06:43:54 +0000 (23:43 -0700)]
Add `do yeet` expressions to allow experimentation in nightly

Using an obviously-placeholder syntax.  An RFC would still be needed before this could have any chance at stabilization, and it might be removed at any point.

But I'd really like to have it in nightly at least to ensure it works well with try_trait_v2, especially as we refactor the traits.

2 years agoAuto merge of #93815 - camsteffen:intravisit-docs, r=cjgillot
bors [Sat, 30 Apr 2022 21:24:53 +0000 (21:24 +0000)]
Auto merge of #93815 - camsteffen:intravisit-docs, r=cjgillot

Update intravisit docs

Follow-up to #90986.

r? `@cjgillot`

2 years agoFix some links in the standard library
Vadim Petrochenkov [Sat, 30 Apr 2022 21:02:34 +0000 (00:02 +0300)]
Fix some links in the standard library

2 years agorustdoc: Track `macro_rules` scopes during early doc link resolution
Vadim Petrochenkov [Thu, 28 Apr 2022 12:52:54 +0000 (15:52 +0300)]
rustdoc: Track `macro_rules` scopes during early doc link resolution

This way links referring to `macro_rules` items are resolved correctly

2 years agorustdoc: Keep full `ParentScope` during early doc link resolution
Vadim Petrochenkov [Wed, 27 Apr 2022 19:51:44 +0000 (22:51 +0300)]
rustdoc: Keep full `ParentScope` during early doc link resolution

2 years agorustdoc: Early-resolve doc links in all requested namespaces
Vadim Petrochenkov [Wed, 27 Apr 2022 19:01:07 +0000 (22:01 +0300)]
rustdoc: Early-resolve doc links in all requested namespaces

2 years agoAuto merge of #96347 - estebank:issue-96292, r=compiler-errors
bors [Sat, 30 Apr 2022 18:44:01 +0000 (18:44 +0000)]
Auto merge of #96347 - estebank:issue-96292, r=compiler-errors

Erase type params when suggesting fully qualified path

When suggesting the use of a fully qualified path for a method call that
is ambiguous because it has multiple candidates, erase type params in
the resulting code, as they would result in an error when applied. We
replace them with `_` in the output to rely on inference. There might be
cases where this still produces slighlty incomplete suggestions, but it
otherwise produces many more errors in relatively common cases.

Fix #96292

2 years agoUpdate intravisit docs
Cameron Steffen [Sat, 30 Apr 2022 17:27:01 +0000 (12:27 -0500)]
Update intravisit docs

2 years agoAuto merge of #96348 - overdrivenpotato:inline-location, r=the8472
bors [Sat, 30 Apr 2022 16:33:12 +0000 (16:33 +0000)]
Auto merge of #96348 - overdrivenpotato:inline-location, r=the8472

Inline core::panic::Location methods

This avoids the overhead of a function call when used.

2 years agoAuto merge of #93803 - cjgillot:unify-bounds, r=oli-obk
bors [Sat, 30 Apr 2022 13:52:29 +0000 (13:52 +0000)]
Auto merge of #93803 - cjgillot:unify-bounds, r=oli-obk

Handle generic bounds in a uniform way in HIR

Generic bounds in HIR used to be split between bounds in the parameter definition and bounds in a where clause. This PR attempts to store all of those as where predicates.

This effectively desugars
```rust
fn foo<T: Default, U>(x: impl Copy) where U: Clone
```
into
```rust
fn foo<T, U, _V>(x: _V) where T: Default, U: Clone, _V: Copy
```
(where _V is actually hidden and called "impl Copy").

I managed to make compiler warnings more uniform.
About rustdoc: is making this desugaring user-visible acceptable?
About clippy: I don't understand the subtle logic in the `needless-lifetimes` lint.

r? `@estebank`

2 years agoBless nll tests.
Camille GILLOT [Sat, 30 Apr 2022 08:33:37 +0000 (10:33 +0200)]
Bless nll tests.

2 years agoCorrect comment.
Camille GILLOT [Fri, 29 Apr 2022 16:54:04 +0000 (18:54 +0200)]
Correct comment.

2 years agoSave colon span to suggest bounds.
Camille GILLOT [Thu, 28 Apr 2022 19:59:41 +0000 (21:59 +0200)]
Save colon span to suggest bounds.

2 years agoBless tests.
Camille GILLOT [Mon, 14 Mar 2022 14:56:37 +0000 (15:56 +0100)]
Bless tests.

2 years agoStore all generic bounds as where predicates.
Camille GILLOT [Mon, 7 Feb 2022 21:58:30 +0000 (22:58 +0100)]
Store all generic bounds as where predicates.

2 years agoInline WhereClause into Generics.
Camille GILLOT [Sat, 5 Feb 2022 14:48:02 +0000 (15:48 +0100)]
Inline WhereClause into Generics.

2 years agoBox HIR Generics and Impl.
Camille GILLOT [Sat, 5 Feb 2022 14:26:49 +0000 (15:26 +0100)]
Box HIR Generics and Impl.

2 years agoAlso report the call site of PME errors locally.
Oli Scherer [Sat, 30 Apr 2022 09:04:15 +0000 (09:04 +0000)]
Also report the call site of PME errors locally.

Note this does not produce a full stack all the way to the first call that specifies all monomorphic parameters, it's just shallowly mentioning the last call site.

2 years agoAuto merge of #95776 - cjgillot:ast-lifetimes-static, r=petrochenkov
bors [Sat, 30 Apr 2022 07:52:18 +0000 (07:52 +0000)]
Auto merge of #95776 - cjgillot:ast-lifetimes-static, r=petrochenkov

Enforce static lifetimes in consts during late resolution

This PR moves the handling of implicitly and explicitly static lifetimes in constants from HIR to the AST.

2 years agoAuto merge of #96500 - SparrowLii:rpo, r=tmiasko
bors [Sat, 30 Apr 2022 05:06:47 +0000 (05:06 +0000)]
Auto merge of #96500 - SparrowLii:rpo, r=tmiasko

Reduce duplication of RPO calculation of mir

Computing the RPO of mir is not a low-cost thing, but it is duplicate in many places. In particular the `iterate_to_fixpoint` method which is called multiple times when computing the data flow.
This PR reduces the number of times the RPO is recalculated as much as possible, which should save some compile time.

2 years agoAdd a bathroom stall to weird expressions test
Thom Chiovoloni [Sat, 30 Apr 2022 03:25:02 +0000 (20:25 -0700)]
Add a bathroom stall to weird expressions test

2 years agoAuto merge of #90988 - estebank:binding-supposed-to-be-const, r=davidtwco
bors [Sat, 30 Apr 2022 02:41:34 +0000 (02:41 +0000)]
Auto merge of #90988 - estebank:binding-supposed-to-be-const, r=davidtwco

When encountering a binding that could be a const or unit variant, suggest the right path

2 years agoUse newtype `enum`s instead of `bool`
Esteban Kuber [Sat, 30 Apr 2022 02:40:36 +0000 (02:40 +0000)]
Use newtype `enum`s instead of `bool`

2 years agoWhen encountering a binding that could be a const or unit variant, suggest the right...
Esteban Kuber [Wed, 17 Nov 2021 19:37:46 +0000 (19:37 +0000)]
When encountering a binding that could be a const or unit variant, suggest the right path

2 years agoFix documentation for log functions int
alexey semenyuk [Fri, 29 Apr 2022 23:21:50 +0000 (23:21 +0000)]
Fix documentation for log functions int

2 years agoFix documentation for log functions unsigned int
alexey semenyuk [Fri, 29 Apr 2022 23:16:53 +0000 (23:16 +0000)]
Fix documentation for log functions unsigned int

2 years agoBless tests.
Camille GILLOT [Thu, 31 Mar 2022 18:11:22 +0000 (20:11 +0200)]
Bless tests.

2 years agoBan non-static lifetimes from AnonConst on AST.
Camille GILLOT [Thu, 31 Mar 2022 18:10:37 +0000 (20:10 +0200)]
Ban non-static lifetimes from AnonConst on AST.

The extra diagnostics come from the compiler no longer aborting before
typeck.

2 years agoAuto merge of #96566 - Dylan-DPC:rollup-fo7rd98, r=Dylan-DPC
bors [Fri, 29 Apr 2022 22:27:10 +0000 (22:27 +0000)]
Auto merge of #96566 - Dylan-DPC:rollup-fo7rd98, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #96390 (Switch JS code to ES6 - part 2)
 - #96527 (RustWrapper: explicitly don't handle DXILPointerTyID)
 - #96536 (rustdoc: fix missing method list for primitive deref target)
 - #96559 (Use the correct lifetime binder for elided lifetimes in path.)
 - #96560 (Remove unnecessary environment variable in cf-protection documentation)
 - #96562 (Fix duplicate directory separator in --remap-path-prefix.)

Failed merges:

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

2 years agoRollup merge of #96562 - michaelwoerister:path-remapping-fixes, r=oli-obk
Dylan DPC [Fri, 29 Apr 2022 21:54:43 +0000 (23:54 +0200)]
Rollup merge of #96562 - michaelwoerister:path-remapping-fixes, r=oli-obk

Fix duplicate directory separator in --remap-path-prefix.

The compiler will currently emit duplicate directory separators when `--remap-path-prefix` has an exact match of the working directory and it is invoked with a relative path to the main source file. For example

```bash
rustc src/main.rs -Cdebuginfo=2 --remap-path-prefix="$(pwd)=abc"
```

will produce the path `abc//src/main.rs` in debuginfo. This is because `some_path.join("")` will append a directory separator to `some_path` and then LLVM does not check if the working directory already ends a directory separator before concatenating it with the relative path.

2 years agoRollup merge of #96560 - abrown:update-docs, r=Dylan-DPC
Dylan DPC [Fri, 29 Apr 2022 21:54:42 +0000 (23:54 +0200)]
Rollup merge of #96560 - abrown:update-docs, r=Dylan-DPC

Remove unnecessary environment variable in cf-protection documentation

Before merging the `cf-protection` flag, it was necessary to use a
locally-compiled version of `rustc`. This is no longer the case and the
documentation should reflect this.

2 years agoRollup merge of #96559 - cjgillot:elided-path-fn, r=petrochenkov
Dylan DPC [Fri, 29 Apr 2022 21:54:41 +0000 (23:54 +0200)]
Rollup merge of #96559 - cjgillot:elided-path-fn, r=petrochenkov

Use the correct lifetime binder for elided lifetimes in path.

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

2 years agoRollup merge of #96536 - rust-lang:notriddle/deref-slice-core, r=GuillaumeGomez
Dylan DPC [Fri, 29 Apr 2022 21:54:40 +0000 (23:54 +0200)]
Rollup merge of #96536 - rust-lang:notriddle/deref-slice-core, r=GuillaumeGomez

rustdoc: fix missing method list for primitive deref target

This change makes it so that local impls count when listing primitives that need retained.

Fixes #95325

2 years agoRollup merge of #96527 - durin42:llvm-15-werror-wswitch, r=nikic
Dylan DPC [Fri, 29 Apr 2022 21:54:38 +0000 (23:54 +0200)]
Rollup merge of #96527 - durin42:llvm-15-werror-wswitch, r=nikic

RustWrapper: explicitly don't handle DXILPointerTyID

This new enum entry was introduced in https://reviews.llvm.org/D122268,
and if I'm reading correctly there's no case where we'd ever encounter
it in our uses of LLVM. To preserve the ability to compile this file
with -Werror -Wswitch we add an explicit case for this entry.

r? nikic

2 years agoRollup merge of #96390 - GuillaumeGomez:es6-part2, r=notriddle
Dylan DPC [Fri, 29 Apr 2022 21:54:37 +0000 (23:54 +0200)]
Rollup merge of #96390 - GuillaumeGomez:es6-part2, r=notriddle

Switch JS code to ES6 - part 2

Part of #93058.

It's based on https://github.com/rust-lang/rust/pull/96361 so it needs to wait for it to be merged first.

r? `@notriddle`

2 years agoRemove `error` variable.
Camille GILLOT [Fri, 29 Apr 2022 20:26:22 +0000 (22:26 +0200)]
Remove `error` variable.

2 years agoAuto merge of #95819 - oli-obk:mir_can't_hold_all_these_lifetimes, r=estebank
bors [Fri, 29 Apr 2022 20:00:47 +0000 (20:00 +0000)]
Auto merge of #95819 - oli-obk:mir_can't_hold_all_these_lifetimes, r=estebank

Enforce Copy bounds for repeat elements while considering lifetimes

fixes https://github.com/rust-lang/rust/issues/95477

this is a breaking change in order to fix a soundness bug.

Before this PR we only checked whether the repeat element type had an `impl Copy`, but not whether that impl also had the appropriate lifetimes. E.g. if the impl was for `YourType<'static>` and not a general `'a`, then copying any type other than a `'static` one should have been rejected, but wasn't.

r? `@lcnr`

2 years agoEliminate duplication of RPO calculation for mir
SparrowLii [Thu, 28 Apr 2022 03:31:08 +0000 (11:31 +0800)]
Eliminate duplication of RPO calculation for mir

add `postorder_cache` to mir Body

add `ReversePostorderCache` struct

correct struct name and comments

2 years agoFix duplicate directory separator in --remap-path-prefix.
Michael Woerister [Fri, 29 Apr 2022 17:36:02 +0000 (19:36 +0200)]
Fix duplicate directory separator in --remap-path-prefix.

2 years agoRefactor and document the repeat length check
Oli Scherer [Fri, 29 Apr 2022 18:56:57 +0000 (18:56 +0000)]
Refactor and document the repeat length check

2 years agoExtract copy bound check into a function
Oli Scherer [Fri, 29 Apr 2022 18:49:02 +0000 (18:49 +0000)]
Extract copy bound check into a function

2 years agoRemove unnecessary environment variable in cf-protection documentation
Andrew Brown [Fri, 29 Apr 2022 17:32:34 +0000 (10:32 -0700)]
Remove unnecessary environment variable in cf-protection documentation

Before merging the `cf-protection` flag, it was necessary to use a
locally-compiled version of `rustc`. This is no longer the case and the
documentation should reflect this.

2 years agoAuto merge of #96474 - SparrowLii:langcall, r=lcnr
bors [Fri, 29 Apr 2022 17:20:00 +0000 (17:20 +0000)]
Auto merge of #96474 - SparrowLii:langcall, r=lcnr

Eliminate duplication code of building panic langcall during codegen

From the FIXME in the `codegen_panic_intrinsic` func.

2 years agoUse the correct lifetime binder for elided lifetimes in path.
Camille GILLOT [Fri, 29 Apr 2022 16:48:48 +0000 (18:48 +0200)]
Use the correct lifetime binder for elided lifetimes in path.

2 years agorustdoc: prevent B -> C -> B -> C loops from stack overflowing
Michael Howell [Fri, 29 Apr 2022 15:49:14 +0000 (08:49 -0700)]
rustdoc: prevent B -> C -> B -> C loops from stack overflowing

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

2 years agoremove and bless
ouz-a [Fri, 29 Apr 2022 15:29:38 +0000 (18:29 +0300)]
remove and bless

2 years agoAuto merge of #96489 - shepmaster:revert-vec-from-array-ref, r=yaahc
bors [Fri, 29 Apr 2022 14:39:14 +0000 (14:39 +0000)]
Auto merge of #96489 - shepmaster:revert-vec-from-array-ref, r=yaahc

Revert "impl From<&[T; N]> and From<&mut [T; N]> for Vec<T>"

This reverts commit 5dd702763ae0e112332a4447171adbed51aeee3d.

2 years agoAuto merge of #96468 - davidtwco:diagnostic-translation-subdiagnostic, r=oli-obk
bors [Fri, 29 Apr 2022 11:58:24 +0000 (11:58 +0000)]
Auto merge of #96468 - davidtwco:diagnostic-translation-subdiagnostic, r=oli-obk

macros: subdiagnostic derive

Add a new macro, `#[derive(SessionSubdiagnostic)]`, which can be applied to structs that represent subdiagnostics, such as labels, notes, helps or suggestions.

`#[derive(SessionSubdiagnostic)]` can be used with the existing `#[derive(SessionDiagnostic)]`. All diagnostics implemented using either derive are translatable, and this new derive should make it easier to port existing diagnostics to using these derives.

For example, consider the following subdiagnostic types...

```rust
#[derive(SessionSubdiagnostic)]
pub enum ExpectedIdentifierLabel<'tcx> {
    #[label(slug = "parser-expected-identifier")]
    WithoutFound {
        #[primary_span]
        span: Span,
    }
    #[label(slug = "parser-expected-identifier-found")]
    WithFound {
        #[primary_span]
        span: Span,
        found: String,
    }
}

#[derive(SessionSubdiagnostic)]
#[suggestion_verbose(slug = "parser-raw-identifier")]
pub struct RawIdentifierSuggestion<'tcx> {
    #[primary_span]
    span: Span,
    #[applicability]
    applicability: Applicability,
    ident: Ident,
}
```

...and the corresponding Fluent messages:

```fluent
parser-expected-identifier = expected identifier

parser-expected-identifier-found = expected identifier, found {$found}

parser-raw-identifier = escape `{$ident}` to use it as an identifier
```

These can be emitted using the new `subdiagnostic` function on `Diagnostic`...

```rust
diag.subdiagnostic(ExpectedIdentifierLabel::WithoutFound { span });
diag.subdiagnostic(RawIdentifierSuggestion { span, applicability, ident });
```

...or as part of a larger `#[derive(SessionDiagnostic)]`:

```rust
#[derive(SessionDiagnostic)]
#[error(slug = "parser-expected-identifier")]
pub struct ExpectedIdentifier {
    #[primary_span]
    span: Span,
    token_descr: String,
    #[subdiagnostic]
    label: ExpectedIdentifierLabel,
    #[subdiagnostic]
    raw_identifier_suggestion: Option<RawIdentifierSuggestion>,
}
```

```rust
sess.emit_err(ExpectedIdentifier { ... });
```

r? `@oli-obk`
cc `@pvdrz`

2 years agoexp-stuff-dirty
ouz-a [Wed, 27 Apr 2022 22:03:07 +0000 (01:03 +0300)]
exp-stuff-dirty

2 years agoAuto merge of #96548 - Dylan-DPC:rollup-m3xkqxg, r=Dylan-DPC
bors [Fri, 29 Apr 2022 09:33:29 +0000 (09:33 +0000)]
Auto merge of #96548 - Dylan-DPC:rollup-m3xkqxg, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #96477 (Update data layout string for wasm64-unknown-unknown)
 - #96481 (HashMap doc: Don't use monospace font for 'Entry Api')
 - #96492 (Revert "Re-export core::ffi types from std::ffi")
 - #96516 (Revert diagnostic duplication and accidental stabilization)
 - #96523 (Add ``@feat.00`` symbol to symbols.o for COFF)

Failed merges:

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

2 years agoRollup merge of #96523 - nbdd0121:windows, r=petrochenkov
Dylan DPC [Fri, 29 Apr 2022 09:23:16 +0000 (11:23 +0200)]
Rollup merge of #96523 - nbdd0121:windows, r=petrochenkov

Add `@feat.00` symbol to symbols.o for COFF

Fix #96498

This is based on top of #96444.

r? ``@petrochenkov``

2 years agoRollup merge of #96516 - oli-obk:impl_trait_inference_accidental_permitted, r=jackh726
Dylan DPC [Fri, 29 Apr 2022 09:23:15 +0000 (11:23 +0200)]
Rollup merge of #96516 - oli-obk:impl_trait_inference_accidental_permitted, r=jackh726

Revert diagnostic duplication and accidental stabilization

fixes #96460

this is an accidental stabilization that we should put into the beta. I believe it is low-risk, because it was literally what we had before #94081

The effect on tests is massive, but mostly deduplication of diagnostics and some minor span changes.

2 years agoRollup merge of #96492 - joshtriplett:revert-std-ffi-re-export, r=yaahc
Dylan DPC [Fri, 29 Apr 2022 09:23:14 +0000 (11:23 +0200)]
Rollup merge of #96492 - joshtriplett:revert-std-ffi-re-export, r=yaahc

Revert "Re-export core::ffi types from std::ffi"

This reverts commit 9aed829fe6cdf5eaf278c6c3972f7acd0830887d.

Fixes https://github.com/rust-lang/rust/issues/96435 , a regression
in crates doing `use std::ffi::*;` and `use std::os::raw::*;`.

We can re-add this re-export once the `core::ffi` types
are stable, and thus the `std::os::raw` types can become re-exports as
well, which will avoid the conflict. (Type aliases to the same type
still conflict, but re-exports of the same type don't.)

2 years agoRollup merge of #96481 - aDotInTheVoid:hashmap-docs-monospace, r=joshtriplett
Dylan DPC [Fri, 29 Apr 2022 09:23:13 +0000 (11:23 +0200)]
Rollup merge of #96481 - aDotInTheVoid:hashmap-docs-monospace, r=joshtriplett

HashMap doc: Don't use monospace font for 'Entry Api'

2 years agoRollup merge of #96477 - alexcrichton:update-wasm64-data-layout, r=wesleywiser
Dylan DPC [Fri, 29 Apr 2022 09:23:12 +0000 (11:23 +0200)]
Rollup merge of #96477 - alexcrichton:update-wasm64-data-layout, r=wesleywiser

Update data layout string for wasm64-unknown-unknown

Looks like this changed in a recent LLVM update but wasm64 isn't built
on CI so it wasn't caught until now.

Closes #96463

2 years agoAuto merge of #96444 - nbdd0121:used2, r=petrochenkov
bors [Fri, 29 Apr 2022 05:34:29 +0000 (05:34 +0000)]
Auto merge of #96444 - nbdd0121:used2, r=petrochenkov

Use decorated names for linked_symbols on Windows

Fix #96423

r? `@petrochenkov`

2 years agoAuto merge of #96441 - ChrisDenton:sync-pipes, r=m-ou-se
bors [Fri, 29 Apr 2022 03:06:45 +0000 (03:06 +0000)]
Auto merge of #96441 - ChrisDenton:sync-pipes, r=m-ou-se

Windows: Make stdin pipes synchronous

Stdin pipes do not need to be used asynchronously within the standard library. This is a first step in making pipes mostly synchronous.

r? `@m-ou-se`

2 years agomacros: add interop between diagnostic derives
David Wood [Wed, 27 Apr 2022 04:59:48 +0000 (05:59 +0100)]
macros: add interop between diagnostic derives

Add `#[subdiagnostic]` field attribute to the diagnostic derive which
is applied to fields that have types which use the subdiagnostic derive.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agomacros: allow setting applicability in attribute
David Wood [Wed, 27 Apr 2022 04:43:36 +0000 (05:43 +0100)]
macros: allow setting applicability in attribute

In the initial implementation of the `SessionSubdiagnostic`, the
`Applicability` of a suggestion can be set both as a field and as part
of the attribute, this commit adds the same support to the original
`SessionDiagnostic` derive.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agomacros: add more documentation comments
David Wood [Wed, 27 Apr 2022 04:24:31 +0000 (05:24 +0100)]
macros: add more documentation comments

Documentation comments are always good.

Signed-off-by: David Wood <david.wood@huawei.com>