]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agokeep the same config values in stage0 between invocations
Pietro Albini [Tue, 7 Jun 2022 10:17:11 +0000 (12:17 +0200)]
keep the same config values in stage0 between invocations

This commit allows users to change the contents of the "config" key in
src/stage0.json without having it overridden the next time the
bump-stage0 tool is executed.

2 years agoAuto merge of #97910 - JohnTitor:rollup-gu3k0xl, r=JohnTitor
bors [Thu, 9 Jun 2022 12:58:25 +0000 (12:58 +0000)]
Auto merge of #97910 - JohnTitor:rollup-gu3k0xl, r=JohnTitor

Rollup of 5 pull requests

Successful merges:

 - #95632 (impl Read and Write for VecDeque<u8>)
 - #95860 (Stabilize `$$` in Rust 1.63.0)
 - #97838 (hexagon: adapt test for upstream output changes)
 - #97843 (Relax mipsel-sony-psp's linker script)
 - #97874 (rewrite combine doc comment)

Failed merges:

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

2 years agoRollup merge of #97874 - lcnr:combine-comment, r=davidtwco
Yuki Okushi [Thu, 9 Jun 2022 10:19:57 +0000 (19:19 +0900)]
Rollup merge of #97874 - lcnr:combine-comment, r=davidtwco

rewrite combine doc comment

it was from 2014 and somewhat outdated

2 years agoRollup merge of #97843 - overdrivenpotato:psp-lto, r=michaelwoerister
Yuki Okushi [Thu, 9 Jun 2022 10:19:56 +0000 (19:19 +0900)]
Rollup merge of #97843 - overdrivenpotato:psp-lto, r=michaelwoerister

Relax mipsel-sony-psp's linker script

Previously, the linker script forcefully kept all `.lib.stub` sections, unnecessarily bloating the binary. Now, the script is LTO and `--gc-sections` friendly.

`--nmagic` was also added to the linker, because page alignment is not required on the PSP. This further reduces binary size.

Accompanying changes for the `psp` crate are found in: https://github.com/overdrivenpotato/rust-psp/pull/118

2 years agoRollup merge of #97838 - durin42:llvm-15-hexagon, r=Amanieu
Yuki Okushi [Thu, 9 Jun 2022 10:19:55 +0000 (19:19 +0900)]
Rollup merge of #97838 - durin42:llvm-15-hexagon, r=Amanieu

hexagon: adapt test for upstream output changes

The output of IR formatting changed slightly in upstream rev
a0bc67e555f404d0e7ddb2e78cb891d96eaf913d
(https://reviews.llvm.org/D123096). I'm not actually sure what any of
that means, as I don't even know what hexagon is in this context, but
this change allows the test to pass on both old and new LLVMs.

r? ``@nikic``

2 years agoRollup merge of #95860 - c410-f3r:stabilize-meta, r=joshtriplett
Yuki Okushi [Thu, 9 Jun 2022 10:19:55 +0000 (19:19 +0900)]
Rollup merge of #95860 - c410-f3r:stabilize-meta, r=joshtriplett

Stabilize `$$` in Rust 1.63.0

# Stabilization proposal

This PR proposes the stabilization of a subset of `#![feature(macro_metavar_expr)]` or more specifically, the stabilization of dollar-dollar (`$$`).

Tracking issue: #83527
Version: 1.63 (2022-06-28 => beta, 2022-08-11 => stable).

## What is stabilized

```rust
macro_rules! foo {
    () => {
        macro_rules! bar {
            ( $$( $$any:tt )* ) => { $$( $$any )* };
        }
    };
}

fn main() {
    foo!();
}
```

## Motivation

For more examples, see the [RFC](https://github.com/markbt/rfcs/blob/macro_metavar_expr/text/0000-macro-metavar-expr.md).

Users must currently resort to a tricky and not so well-known hack to declare nested macros with repetitions.

```rust
macro_rules! foo {
    ($dollar:tt) => {
        macro_rules! bar {
            ( $dollar ( $any:tt )* ) => { $dollar ( $any )* };
        }
    };
}
fn main() {
    foo!($);
}
```

As seen above, such hack is fragile and makes work with declarative macros much more unpleasant. Dollar-dollar (`$$`), on the other hand, makes nested macros more intuitive.

## What isn't stabilized

`count`, `ignore`, `index` and `length` are not being stabilized due to the lack of consensus.

## History

* 2021-02-22, [RFC: Declarative macro metavariable expressions](https://github.com/rust-lang/rfcs/pull/3086)
* 2021-03-26, [Tracking Issue for RFC 3086: macro metavariable expressions](https://github.com/rust-lang/rust/issues/83527)
* 2022-02-01, [Implement macro meta-variable expressions](https://github.com/rust-lang/rust/pull/93545)
* 2022-02-25, [[1/2] Implement macro meta-variable expressions](https://github.com/rust-lang/rust/pull/94368)
* 2022-03-11, [[2/2] Implement macro meta-variable expressions](https://github.com/rust-lang/rust/pull/94833)
* 2022-03-12, [Fix remaining meta-variable expression TODOs](https://github.com/rust-lang/rust/pull/94884)
* 2019-03-21, [[macro-metavar-expr] Fix generated tokens hygiene](https://github.com/rust-lang/rust/pull/95188)
* 2022-04-07, [Kickstart the inner usage of macro_metavar_expr](https://github.com/rust-lang/rust/pull/95761)
* 2022-04-07, [[macro_metavar_expr] Add tests to ensure the feature requirement](https://github.com/rust-lang/rust/pull/95764)

## Non-stabilized expressions

https://github.com/rust-lang/rust/issues/83527 lists several concerns about some characteristics of `count`, `index` and `length` that effectively make their stabilization unfeasible. `$$` and `ignore`, however, are not part of any discussion and thus are suitable for stabilization.

It is not in the scope of this PR to detail each concern or suggest any possible converging solution. Such thing should be restrained in this tracking issue.

## Tests

This list is a subset of https://github.com/rust-lang/rust/tree/master/src/test/ui/macros/rfc-3086-metavar-expr

* [Ensures that nested macros have correct behavior](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/dollar-dollar-has-correct-behavior.rs)

* [Compares produced tokens to assert expected outputs](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/feature-gate-macro_metavar_expr.rs)

* [Checks the declarations of the feature](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/required-feature.rs)

* [Verifies all possible errors that can occur due to incorrect user input](https://github.com/rust-lang/rust/blob/master/src/test/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs)

## Possible future work

Once consensus is achieved, other nightly expressions can be stabilized.

Thanks ``@markbt`` for creating the RFC and thanks to ``@petrochenkov`` and ``@mark-i-m`` for reviewing the implementations.

2 years agoRollup merge of #95632 - evanrichter:master, r=joshtriplett
Yuki Okushi [Thu, 9 Jun 2022 10:19:54 +0000 (19:19 +0900)]
Rollup merge of #95632 - evanrichter:master, r=joshtriplett

impl Read and Write for VecDeque<u8>

Implementing `Read` and `Write` for `VecDeque<u8>` fills in the VecDeque api surface where `Vec<u8>` and `Cursor<Vec<u8>>` already impl Read and Write. Not only for completeness, but VecDeque in particular is a very handy mock interface for a TCP echo service, if only it supported Read/Write.

Since this PR is just an impl trait, I don't think there is a way to limit it behind a feature flag, so it's "insta-stable". Please correct me if I'm wrong here, not trying to rush stability.

2 years agoAuto merge of #97868 - ssomers:btree_from_sorted_iter, r=the8472
bors [Thu, 9 Jun 2022 10:17:04 +0000 (10:17 +0000)]
Auto merge of #97868 - ssomers:btree_from_sorted_iter, r=the8472

BTreeSet: avoid intermediate sorting when collecting sorted iterators

As [pointed out by droundy](https://users.rust-lang.org/t/question-about-btreeset-implementation/76427), an obvious optimization is to skip the first step introduced by #88448 (creation of a vector and sorting) and it's easy to do so for btree's own iterators. Also, exploit `from` in the examples.

2 years agorewrite combine doc comment
lcnr [Wed, 8 Jun 2022 11:58:28 +0000 (13:58 +0200)]
rewrite combine doc comment

2 years agoAuto merge of #97862 - SparrowLii:superset, r=lcnr
bors [Thu, 9 Jun 2022 07:13:46 +0000 (07:13 +0000)]
Auto merge of #97862 - SparrowLii:superset, r=lcnr

optimize `superset` method of `IntervalSet`

Given that intervals in the `IntervalSet` are sorted and strictly separated( it means the `end` of the previous interval will not be equal to the `start` of the next interval), we can reduce the complexity of the `superset` method from O(NMlogN) to O(2N) (N is the number of intervals and M is the length of each interval)

2 years agoAuto merge of #97772 - GuillaumeGomez:minifier-update, r=notriddle
bors [Thu, 9 Jun 2022 04:33:01 +0000 (04:33 +0000)]
Auto merge of #97772 - GuillaumeGomez:minifier-update, r=notriddle

Update minifier version to 0.2.1

This change and these changes come from an idea of `@camelid:` instead of creating a string, we just `write` the type into the file directly.

I don't think it'll have a big impact on perf but it's still a potential small improvement.

r? `@notriddle`

2 years agoAuto merge of #97740 - RalfJung:ctfe-cycle-spans, r=lcnr
bors [Thu, 9 Jun 2022 01:52:15 +0000 (01:52 +0000)]
Auto merge of #97740 - RalfJung:ctfe-cycle-spans, r=lcnr

use precise spans for recursive const evaluation

This fixes https://github.com/rust-lang/rust/issues/73283 by using a `TyCtxtAt` with a more precise span when the interpreter recursively calls itself. Hopefully such calls are sufficiently rare that this does not cost us too much performance.

(In theory, cycles can also arise through layout computation, as layout can depend on consts -- but layout computation happens all the time so we'd have to do something to not make this terrible for performance.)

2 years agoAuto merge of #97896 - compiler-errors:rollup-mrl7ng0, r=compiler-errors
bors [Wed, 8 Jun 2022 23:07:22 +0000 (23:07 +0000)]
Auto merge of #97896 - compiler-errors:rollup-mrl7ng0, r=compiler-errors

Rollup of 9 pull requests

Successful merges:

 - #97557 (Fix indices and remove some unwraps in arg mismatch algorithm)
 - #97830 (Add std::alloc::set_alloc_error_hook example)
 - #97856 (Don't suggest adding `let` in certain `if` conditions)
 - #97857 (Suggest escaping `box` as identifier)
 - #97871 (Suggest using `iter()` or `into_iter()` for `Vec`)
 - #97882 (Add regresion test for #67498)
 - #97883 (Remove `ignore-compare-mode-nll` annotations from tests)
 - #97891 (Update books)
 - #97894 (Fix polonius compare mode.)

Failed merges:

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

2 years agoRollup merge of #97894 - ehuss:fix-polonius-compare-mode, r=jackh726
Michael Goulet [Wed, 8 Jun 2022 20:32:26 +0000 (13:32 -0700)]
Rollup merge of #97894 - ehuss:fix-polonius-compare-mode, r=jackh726

Fix polonius compare mode.

This fixes running compiler tests in `--compare-mode=polonius`. The `-Zborrowck=mir` option was removed in #95565.

r? `@jackh726`

2 years agoRollup merge of #97891 - ehuss:update-books, r=ehuss
Michael Goulet [Wed, 8 Jun 2022 20:32:25 +0000 (13:32 -0700)]
Rollup merge of #97891 - ehuss:update-books, r=ehuss

Update books

## nomicon

5 commits in 10d40c59a581c66d8ecd29ad18d410bf97ed524d..3a43983b76174342b7dbd3e12ea2c49f762e52be
2022-05-07 10:45:07 +0900 to 2022-05-30 17:01:30 +0900
- Changes for `c_unwind` (rust-lang/nomicon#365)
- Upgrade actions/checkout to v3 (rust-lang/nomicon#367)
- Clarification of borrowck (rust-lang/nomicon#354)
- Update the now stale warning about `PhantomData&lt;T&gt;` and dropck (rust-lang/nomicon#363)
- Minor language fixes (rust-lang/nomicon#364)

## reference

1 commits in b74825d8f88b685e239ade00f00de68ba4cd63d4..683bfe5cd64d589c6a1645312ab5f93b6385ccbb
2022-05-20 14:30:30 -0700 to 2022-05-27 11:54:20 -0700
- Reflect changes about unsizing casts in const context (rust-lang/reference#1221)

## book

58 commits in b4dd5f00b87190ad5ef42cbc2a88a783c6ae57ef..396fdb69de7fb18f24b15c7ad13491b1c1fa7231
2022-05-24 21:37:06 -0400 to 2022-06-08 10:02:35 -0400
- Make not-equals operator example consistent. Fixes rust-lang/book#3189.
- Propagate nostarch appendix edits to src
- Edits to edits to appendices
- Edits from nostarch for the appendices
- Propagate edits to chapter 20 to src
- Edits to edits of chapter 20
- Update reference to chapter 12 code that was changed
- Edits from nostarch to chapter 20
- Fix spelling mistake
- Propagate ch17 tech review changes to src
- Responses to tech review for ch17
- Chapter 17 tech review comments
- Update dependencies via `cargo update`
- Propagate changes from ch16 tech review to src
- Tech review comments and responses for chapter 16
- Println captures in chapter 15
- Propagate chapter 15 tech review edits to src
- Responses to tech review for chapter 15
- Tech review comments for chapter 15
- Merge branch 'ch14-tr'
- Upgrade to Rust 1.61
- Upgrade to Rust 1.60
- More little improvements to chapter 12
- Update references to ch12 to be Config::build instead of new
- Propagate ch12 tech review edits to src
- Responses to tech review of chapter 12
- Tech review comments of chapter 12
- Show directory layouts including integration test files
- Clarify that integration/doc tests aren't run if unit tests fail
- Propagate ch11 tech review edits to src
- Edits in response to tech review of chapter 11
- Comments from tech review in chapter 11
- Propagate other edits to nostarch
- Adjust listing so error output line numbers match
- Merge remote-tracking branch 'origin/pr/3153' into ch10-tr
- Reword a rewording about lifetimes of values vs references
- Merge remote-tracking branch 'origin/pr/3107' into ch10-tr
- Merge remote-tracking branch 'origin/pr/3104' into ch10-tr
- Propagate ch10 edits to src
- Edits in response to tech review
- Comments from tech review for chapter 10
- New dictionary entries
- Demonstrate a better expect message. Fixes rust-lang/book#2918.
- Propagate tech review ch9 edits to src
- Termination has stabilized! Fixes rust-lang/book#3116.
- Respond to tech review comments to chapter 9
- Comments from tech review on chapter 9
- Propagate changes for ch8 to src
- Clarify that split_whitespace returns an iterator
- Add type annotation in nostarch snapshot too
- Extra-clarity qualification
- Edits to chapter 8 in response to tech review
- Comments from tech review for chapter 8
- Propagate tech review edits to ch06 src
- Responses to tech review comments on chapter 6
- Chapter 6 after tech review
- Snapshot of chapter 1 for nostarch
- src: use TLSv1.3 if we're going to specify at all

## rust-by-example

4 commits in 2ed26865e8c29ef939dc913a97bd321cadd72a9a..dbb7e5e2345ee26199ffba218156b6009016a20c
2022-05-18 17:23:47 -0300 to 2022-06-02 16:30:51 -0300
- Fix typo in Traits → "impl Trait" (rust-lang/rust-by-example#1544)
- doc_testing.md: clarify tests vs doc-tests (rust-lang/rust-by-example#1547)
- unsafe::asm.md: add some explicit declarations (rust-lang/rust-by-example#1548)
- Update dsl.md to remove unnecessary braces (rust-lang/rust-by-example#1543)

## rustc-dev-guide

6 commits in 554c00e4805df7f7bffac7db408437d62d6dfb9a..6e4d6435db89bcc027b1bba9742e4f59666f5412
2022-05-24 17:15:35 -0700 to 2022-06-08 08:06:32 +0900
- Make build scripts and proc macros work with the suggested rust-analyzer config (rust-lang/rustc-dev-guide#1365)
- improve rustc_interface examples a little (rust-lang/rustc-dev-guide#1362)
- Bump regex from 1.4.3 to 1.5.5 in /ci/date-check (rust-lang/rustc-dev-guide#1364)
- Clarify cargo fallback behavior for rustup link (rust-lang/rustc-dev-guide#1273)
- Update rustc-driver related examples
- Triage some date references related to traits

## embedded-book

1 commits in f7cefbb995eec8c6148f213235e9e2e03268e775..cbb494f96da3268c2925bdadc65ca83d42f2d4ef
2022-04-20 10:38:51 +0000 to 2022-05-26 06:58:43 +0000
- Add Chinese translation repository  (rust-embedded/book#318)

2 years agoRollup merge of #97883 - JohnTitor:no-more-compare-mode-nll, r=jackh726
Michael Goulet [Wed, 8 Jun 2022 20:32:24 +0000 (13:32 -0700)]
Rollup merge of #97883 - JohnTitor:no-more-compare-mode-nll, r=jackh726

Remove `ignore-compare-mode-nll` annotations from tests

Since #95565 these do nothing as compare-mode-nll has been removed.
r? `@jackh726`

2 years agoRollup merge of #97882 - JohnTitor:issue-67498, r=compiler-errors
Michael Goulet [Wed, 8 Jun 2022 20:32:23 +0000 (13:32 -0700)]
Rollup merge of #97882 - JohnTitor:issue-67498, r=compiler-errors

Add regresion test for #67498

Closes #67498
r? `@compiler-errors`

2 years agoRollup merge of #97871 - ChayimFriedman2:vec-iterator-unimplemented, r=compiler-errors
Michael Goulet [Wed, 8 Jun 2022 20:32:22 +0000 (13:32 -0700)]
Rollup merge of #97871 - ChayimFriedman2:vec-iterator-unimplemented, r=compiler-errors

Suggest using `iter()` or `into_iter()` for `Vec`

We cannot do that for `&Vec` because `#[rustc_on_unimplemented]` is limited (it does not clean generic instantiation for references, only for ADTs).

`@rustbot` label +A-diagnostics

2 years agoRollup merge of #97857 - ChayimFriedman2:box-identifier-help, r=compiler-errors
Michael Goulet [Wed, 8 Jun 2022 20:32:21 +0000 (13:32 -0700)]
Rollup merge of #97857 - ChayimFriedman2:box-identifier-help, r=compiler-errors

Suggest escaping `box` as identifier

Fixes #97810.

2 years agoRollup merge of #97856 - compiler-errors:bad-let-suggestions, r=estebank
Michael Goulet [Wed, 8 Jun 2022 20:32:20 +0000 (13:32 -0700)]
Rollup merge of #97856 - compiler-errors:bad-let-suggestions, r=estebank

Don't suggest adding `let` in certain `if` conditions

Avoid being too eager to suggest `let` in an `if` condition with an `=`, namely when the LHS of the `=` isn't even valid as a pattern (to a first degree approximation).

This heustic I came up with kinda sucks. Let me know if it needs to be refined.

2 years agoRollup merge of #97830 - LucasDumont:add-example-alloc, r=yaahc
Michael Goulet [Wed, 8 Jun 2022 20:32:19 +0000 (13:32 -0700)]
Rollup merge of #97830 - LucasDumont:add-example-alloc, r=yaahc

Add std::alloc::set_alloc_error_hook example

2 years agoRollup merge of #97557 - compiler-errors:arg-mismatch-mini, r=jackh726
Michael Goulet [Wed, 8 Jun 2022 20:32:18 +0000 (13:32 -0700)]
Rollup merge of #97557 - compiler-errors:arg-mismatch-mini, r=jackh726

Fix indices and remove some unwraps in arg mismatch algorithm

This is a more conservative fix than #97542, addressing some indices which were used incorectly and unwraps which are bound to panic (e.g. when the provided and expected arg counts differ). Beta nominating this as it's quite easy to cause ICEs -- I wrote a fuzzer and found hundreds of examples of ICEs.

cc `@jackh726` as author of #92364, and `@estebank` as reviewer of that PR.
fixes #97484
r? `@jackh726` this should be _much_ easier to review than the other PR :sweat_smile:

2 years agoAuto merge of #97893 - ehuss:update-cargo, r=ehuss
bors [Wed, 8 Jun 2022 20:26:34 +0000 (20:26 +0000)]
Auto merge of #97893 - ehuss:update-cargo, r=ehuss

Update cargo

7 commits in 38472bc19f2f76e245eba54a6e97ee6821b3c1db..85e457e158db216a2938d51bc3b617a5a7fe6015
2022-05-31 02:03:24 +0000 to 2022-06-07 21:57:52 +0000
- Make -Z http-registry use index.crates.io when accessing crates-io (rust-lang/cargo#10725)
- Respect submodule update=none strategy in .gitmodules (rust-lang/cargo#10717)
- Expose rust-version through env var (rust-lang/cargo#10713)
- add validation for string "true"/"false" in lto profile (rust-lang/cargo#10676)
- Enhance documentation of testing (rust-lang/cargo#10726)
- Clear disk space on CI. (rust-lang/cargo#10724)
- Enforce to use tar v0.4.38 (rust-lang/cargo#10720)

2 years agoFix polonius compare mode.
Eric Huss [Wed, 8 Jun 2022 18:53:16 +0000 (11:53 -0700)]
Fix polonius compare mode.

2 years agoUpdate cargo
Eric Huss [Wed, 8 Jun 2022 18:48:31 +0000 (11:48 -0700)]
Update cargo

2 years agoUpdate books
Eric Huss [Wed, 8 Jun 2022 18:19:53 +0000 (11:19 -0700)]
Update books

2 years agoAuto merge of #97887 - matthiaskrgr:rollup-ym5k7kb, r=matthiaskrgr
bors [Wed, 8 Jun 2022 17:57:59 +0000 (17:57 +0000)]
Auto merge of #97887 - matthiaskrgr:rollup-ym5k7kb, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #97507 (Move rustfmt downloads from bootstrap.py to rustbuild)
 - #97813 (Sync rustc_codegen_gcc)
 - #97878 (Add regression test for anonymous lifetimes)
 - #97879 (remove unneeded code)
 - #97880 (Fix typo: fo->for)

Failed merges:

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

2 years agoRollup merge of #97880 - ChayimFriedman2:patch-2, r=lcnr
Matthias Krüger [Wed, 8 Jun 2022 16:15:06 +0000 (18:15 +0200)]
Rollup merge of #97880 - ChayimFriedman2:patch-2, r=lcnr

Fix typo: fo->for

2 years agoRollup merge of #97879 - hermitcore:condvar, r=Dylan-DPC
Matthias Krüger [Wed, 8 Jun 2022 16:15:05 +0000 (18:15 +0200)]
Rollup merge of #97879 - hermitcore:condvar, r=Dylan-DPC

remove unneeded code

The init function isn't longer part of `Condvar`. Consequently, we removed the implementation for the target os `hermit`.

2 years agoRollup merge of #97878 - GuillaumeGomez:regression-test-84634, r=notriddle
Matthias Krüger [Wed, 8 Jun 2022 16:15:04 +0000 (18:15 +0200)]
Rollup merge of #97878 - GuillaumeGomez:regression-test-84634, r=notriddle

Add regression test for anonymous lifetimes

Fixes #84634.

Seems like this issue was already solved. I added a regression test just in case so we can close it with peace in mind.

r? `@notriddle`

2 years agoRollup merge of #97813 - antoyo:sync_from_cg_gcc, r=petrochenkov
Matthias Krüger [Wed, 8 Jun 2022 16:15:02 +0000 (18:15 +0200)]
Rollup merge of #97813 - antoyo:sync_from_cg_gcc, r=petrochenkov

Sync rustc_codegen_gcc

2 years agoRollup merge of #97507 - jyn514:download-rustfmt, r=Mark-Simulacrum
Matthias Krüger [Wed, 8 Jun 2022 16:15:01 +0000 (18:15 +0200)]
Rollup merge of #97507 - jyn514:download-rustfmt, r=Mark-Simulacrum

Move rustfmt downloads from bootstrap.py to rustbuild

- Allow verifying CI downloads using src/stage0.json
- Change download functions not to hard-code `ci-artifacts.rust-lang.org`
- Change `format::format` to take a `Builder` so it has access to `download_component`. I think we may want to reconsider the distinction between Build and Builder at some point; I don't think it's particularly useful.
- Move rustfmt downloads out of bootstrap.py

Fixes https://github.com/rust-lang/rust/issues/95136. Helps with https://github.com/rust-lang/rust/issues/94829. This is based on https://github.com/rust-lang/rust/pull/96687 for simplicity.

2 years agoRemove `ignore-compare-mode-nll` annotations from tests
Yuki Okushi [Wed, 8 Jun 2022 15:13:57 +0000 (00:13 +0900)]
Remove `ignore-compare-mode-nll` annotations from tests

2 years agoAdd regresion test for #67498
Yuki Okushi [Wed, 8 Jun 2022 15:09:28 +0000 (00:09 +0900)]
Add regresion test for #67498

2 years agocorrect the test if IntervalSet
SparrowLii [Wed, 8 Jun 2022 14:44:26 +0000 (22:44 +0800)]
correct the test if IntervalSet

2 years agofix the impl error in `insert_all`
SparrowLii [Wed, 8 Jun 2022 14:09:26 +0000 (22:09 +0800)]
fix the impl error in `insert_all`

2 years agoFix typo: fo->for
Chayim Refael Friedman [Wed, 8 Jun 2022 13:40:02 +0000 (16:40 +0300)]
Fix typo: fo->for

2 years agoadd `check_invariants` method
SparrowLii [Wed, 8 Jun 2022 13:39:04 +0000 (21:39 +0800)]
add `check_invariants` method

2 years agoremove unneeded code
Stefan Lankes [Wed, 8 Jun 2022 08:34:42 +0000 (10:34 +0200)]
remove unneeded code

2 years agoAuto merge of #97873 - Dylan-DPC:rollup-g6ptsdq, r=Dylan-DPC
bors [Wed, 8 Jun 2022 13:20:45 +0000 (13:20 +0000)]
Auto merge of #97873 - Dylan-DPC:rollup-g6ptsdq, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #97276 (Stabilize `const_intrinsic_copy`)
 - #97763 (Allow ptr_from_addr_cast to fail)
 - #97846 (Specify DWARF alignment in bits, not bytes.)
 - #97848 (Impl Traits lowering minor refactors)
 - #97865 (remove `BorrowckMode`)

Failed merges:

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

2 years agoAdd regression test for #84634
Guillaume Gomez [Wed, 8 Jun 2022 12:26:37 +0000 (14:26 +0200)]
Add regression test for #84634

2 years agoRollup merge of #97865 - lcnr:bb-BorrowckMode, r=Dylan-DPC
Dylan DPC [Wed, 8 Jun 2022 11:43:21 +0000 (13:43 +0200)]
Rollup merge of #97865 - lcnr:bb-BorrowckMode, r=Dylan-DPC

remove `BorrowckMode`

dead code after #95565

2 years agoRollup merge of #97848 - spastorino:universal-lowering-refactor-1, r=cjgillot
Dylan DPC [Wed, 8 Jun 2022 11:43:20 +0000 (13:43 +0200)]
Rollup merge of #97848 - spastorino:universal-lowering-refactor-1, r=cjgillot

Impl Traits lowering minor refactors

This are unrelated changes on my RPIT refactor that may be better to merge before opening the main PR.

r? `@cjgillot`

cc `@nikomatsakis`

2 years agoRollup merge of #97846 - pcwalton:align-bits, r=michaelwoerister
Dylan DPC [Wed, 8 Jun 2022 11:43:19 +0000 (13:43 +0200)]
Rollup merge of #97846 - pcwalton:align-bits, r=michaelwoerister

Specify DWARF alignment in bits, not bytes.

In DWARF, alignment of types is specified in bits, as is made clear by the
parameter name `AlignInBits`. However, `rustc` was incorrectly passing a byte
alignment. This commit fixes that.

This was noticed in upstream LLVM when I tried to check in a test consisting of
LLVM IR generated from `rustc` and it triggered assertions [1].

[1]: https://reviews.llvm.org/D126835

2 years agoRollup merge of #97763 - RalfJung:fallible-cast, r=lcnr
Dylan DPC [Wed, 8 Jun 2022 11:43:18 +0000 (13:43 +0200)]
Rollup merge of #97763 - RalfJung:fallible-cast, r=lcnr

Allow ptr_from_addr_cast to fail

This is needed for https://github.com/rust-lang/miri/issues/2133: I would like to have an option in Miri to error when a int2ptr cast is executed.

2 years agoRollup merge of #97276 - JohnTitor:stabilize-const-intrinsic-copy, r=dtolnay
Dylan DPC [Wed, 8 Jun 2022 11:43:18 +0000 (13:43 +0200)]
Rollup merge of #97276 - JohnTitor:stabilize-const-intrinsic-copy, r=dtolnay

Stabilize `const_intrinsic_copy`

FCP has been completed: https://github.com/rust-lang/rust/issues/80697#issuecomment-1059825428
Closes #80697

2 years agoStabilize `const_intrinsic_copy`
Yuki Okushi [Sun, 22 May 2022 12:29:54 +0000 (21:29 +0900)]
Stabilize `const_intrinsic_copy`

2 years agoSuggest using `iter()` or `into_iter()` for `Vec`
Chayim Refael Friedman [Wed, 8 Jun 2022 11:09:08 +0000 (11:09 +0000)]
Suggest using `iter()` or `into_iter()` for `Vec`

We cannot do that for `&Vec` because `#[rustc_on_unimplemented]` is limited (it does not clean generic instantiation for references, only for ADTs).

2 years agoBTreeSet: avoid intermediate sorting when collecting sorted iterators
Stein Somers [Fri, 3 Jun 2022 13:19:12 +0000 (15:19 +0200)]
BTreeSet: avoid intermediate sorting when collecting sorted iterators

2 years agoAuto merge of #94732 - nnethercote:infallible-encoder, r=bjorn3
bors [Wed, 8 Jun 2022 10:24:12 +0000 (10:24 +0000)]
Auto merge of #94732 - nnethercote:infallible-encoder, r=bjorn3

Make `Encodable` and `Encoder` infallible.

A follow-up to #93066.

r? `@ghost`

2 years agobye `BorrowckMode`
lcnr [Wed, 8 Jun 2022 08:46:52 +0000 (10:46 +0200)]
bye `BorrowckMode`

2 years agoAuto merge of #97860 - Dylan-DPC:rollup-t3vxos8, r=Dylan-DPC
bors [Wed, 8 Jun 2022 08:05:47 +0000 (08:05 +0000)]
Auto merge of #97860 - Dylan-DPC:rollup-t3vxos8, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #97595 (Remove unwrap from get_vtable)
 - #97597 (Preserve unused pointer to address casts)
 - #97819 (Recover `import` instead of `use` in item)
 - #97823 (Recover missing comma after match arm)
 - #97851 (Use repr(C) when depending on struct layout in ptr tests)

Failed merges:

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

2 years agooptimize `superset` method of `IntervalSet`
SparrowLii [Wed, 8 Jun 2022 07:23:11 +0000 (15:23 +0800)]
optimize `superset` method of `IntervalSet`

2 years agoSuggest escaping `box` as identifier
Chayim Refael Friedman [Wed, 8 Jun 2022 04:40:55 +0000 (04:40 +0000)]
Suggest escaping `box` as identifier

2 years agoRollup merge of #97851 - saethlin:use-repr-c, r=thomcc
Dylan DPC [Wed, 8 Jun 2022 05:37:33 +0000 (07:37 +0200)]
Rollup merge of #97851 - saethlin:use-repr-c, r=thomcc

Use repr(C) when depending on struct layout in ptr tests

The test depends on the layout of this struct `Pair`, so it should use `repr(C)` instead of the default `repr(Rust)`.

2 years agoRollup merge of #97823 - compiler-errors:missing-comma-match-arm, r=estebank
Dylan DPC [Wed, 8 Jun 2022 05:37:32 +0000 (07:37 +0200)]
Rollup merge of #97823 - compiler-errors:missing-comma-match-arm, r=estebank

Recover missing comma after match arm

If we're missing a comma after a match arm expression, try parsing another pattern and a following `=>`. If we find both of those, then recover by suggesting to insert a `,`.

Fixes #80112

2 years agoRollup merge of #97819 - compiler-errors:use-import, r=wesleywiser
Dylan DPC [Wed, 8 Jun 2022 05:37:31 +0000 (07:37 +0200)]
Rollup merge of #97819 - compiler-errors:use-import, r=wesleywiser

Recover `import` instead of `use` in item

When we definitely don't have a macro invocation (i.e. when we don't have `import ::`), then it's more productive to parse `import` as if it was incorrectly mistaken for `use`.

Not sure if this needs to be a verbose suggestion, but it renders strangely when it's not verbose:
```
error: expected item, found `import`
 --> /home/michael/test.rs:1:1
  |
1 | import std::{io::{self, Write}, rc::Rc};
  | ^^^^^^ help: items are imported using the `use` keyword: `use`
```

Happy to change it to `span_suggestion` instead of `span_suggestion_verbose` though.

Fixes #97788

2 years agoRollup merge of #97597 - tmiasko:simplify-locals-side-effects, r=RalfJung,JakobDegen
Dylan DPC [Wed, 8 Jun 2022 05:37:30 +0000 (07:37 +0200)]
Rollup merge of #97597 - tmiasko:simplify-locals-side-effects, r=RalfJung,JakobDegen

Preserve unused pointer to address casts

Fixes #97421.

cc `@RalfJung`

2 years agoRollup merge of #97595 - ouz-a:issue-97381, r=compiler-errors
Dylan DPC [Wed, 8 Jun 2022 05:37:29 +0000 (07:37 +0200)]
Rollup merge of #97595 - ouz-a:issue-97381, r=compiler-errors

Remove unwrap from get_vtable

This avoids ICE on issue #97381 I think the bug is a bit deeper though, it compiles fine when `v` is `&v` which makes me think `Deref` is causing some issue with borrowck but it's fine I guess since this thing crashes since `nightly-2020-09-17` 😅

2 years agoAuto merge of #97447 - nnethercote:improve-folding, r=jackh726
bors [Wed, 8 Jun 2022 05:36:40 +0000 (05:36 +0000)]
Auto merge of #97447 - nnethercote:improve-folding, r=jackh726

Folding revamp

r? `@ghost`

2 years agoDon't suggest adding let in certain if conditions
Michael Goulet [Wed, 8 Jun 2022 03:53:02 +0000 (20:53 -0700)]
Don't suggest adding let in certain if conditions

2 years agorecover `import` instead of `use` in item
Michael Goulet [Tue, 7 Jun 2022 07:13:50 +0000 (00:13 -0700)]
recover `import` instead of `use` in item

2 years agoStabilize $$ in Rust 1.63.0
Caio [Wed, 8 Jun 2022 00:50:45 +0000 (21:50 -0300)]
Stabilize $$ in Rust 1.63.0

2 years agoAuto merge of #97849 - matthiaskrgr:rollup-1yodhvw, r=matthiaskrgr
bors [Wed, 8 Jun 2022 00:26:37 +0000 (00:26 +0000)]
Auto merge of #97849 - matthiaskrgr:rollup-1yodhvw, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #97829 (Add regresion test for #95307)
 - #97831 (Remove `AlwaysLiveLocals` wrapper struct)
 - #97832 (Change `Direction::{is_forward,is_backward}` functions into constants)
 - #97840 (RustWrapper: adapt to APInt API changes in LLVM 15)
 - #97845 (Use more targeted suggestion when confusing i8 with std::i8)

Failed merges:

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

2 years agoRename `rustc_serialize::opaque::Encoder` as `MemEncoder`.
Nicholas Nethercote [Tue, 7 Jun 2022 23:17:49 +0000 (09:17 +1000)]
Rename `rustc_serialize::opaque::Encoder` as `MemEncoder`.

This avoids the name clash with `rustc_serialize::Encoder` (a trait),
and allows lots qualifiers to be removed and imports to be simplified
(e.g. fewer `as` imports).

2 years agoUse repr(C) when depending on struct layout in ptr tests
Ben Kimock [Tue, 7 Jun 2022 23:24:09 +0000 (19:24 -0400)]
Use repr(C) when depending on struct layout in ptr tests

2 years agoFolding revamp.
Nicholas Nethercote [Thu, 2 Jun 2022 01:38:15 +0000 (11:38 +1000)]
Folding revamp.

This commit makes type folding more like the way chalk does it.

Currently, `TypeFoldable` has `fold_with` and `super_fold_with` methods.
- `fold_with` is the standard entry point, and defaults to calling
  `super_fold_with`.
- `super_fold_with` does the actual work of traversing a type.
- For a few types of interest (`Ty`, `Region`, etc.) `fold_with` instead
  calls into a `TypeFolder`, which can then call back into
  `super_fold_with`.

With the new approach, `TypeFoldable` has `fold_with` and
`TypeSuperFoldable` has `super_fold_with`.
- `fold_with` is still the standard entry point, *and* it does the
  actual work of traversing a type, for all types except types of
  interest.
- `super_fold_with` is only implemented for the types of interest.

Benefits of the new model.
- I find it easier to understand. The distinction between types of
  interest and other types is clearer, and `super_fold_with` doesn't
  exist for most types.
- With the current model is easy to get confused and implement a
  `super_fold_with` method that should be left defaulted. (Some of the
  precursor commits fixed such cases.)
- With the current model it's easy to call `super_fold_with` within
  `TypeFolder` impls where `fold_with` should be called. The new
  approach makes this mistake impossible, and this commit fixes a number
  of such cases.
- It's potentially faster, because it avoids the `fold_with` ->
  `super_fold_with` call in all cases except types of interest. A lot of
  the time the compile would inline those away, but not necessarily
  always.

2 years agoAvoid some unnecessary `return`s.
Nicholas Nethercote [Thu, 2 Jun 2022 01:31:23 +0000 (11:31 +1000)]
Avoid some unnecessary `return`s.

2 years agoAdd `try_fold_uenevaluted`.
Nicholas Nethercote [Wed, 1 Jun 2022 07:20:56 +0000 (17:20 +1000)]
Add `try_fold_uenevaluted`.

We already have `visit_unevaluated`, so this improves consistency.

Also, define `TypeFoldable for Unevaluated<'tcx, ()>` in terms of
`TypeFoldable for Unevaluated<'tcx>`, which is neater.

2 years agoAdd `TypeVisitor::visit_mir_const`.
Nicholas Nethercote [Wed, 1 Jun 2022 00:48:34 +0000 (10:48 +1000)]
Add `TypeVisitor::visit_mir_const`.

Because `TypeFoldable::try_fold_mir_const` exists, and even though
`visit_mir_const` isn't needed right now, the consistency makes the code
easier to understand.

2 years agoRemove `EarlyBinder::{try_fold_with,visit_with}`.
Nicholas Nethercote [Wed, 1 Jun 2022 00:25:56 +0000 (10:25 +1000)]
Remove `EarlyBinder::{try_fold_with,visit_with}`.

For most types the default impls of these methods are good enough, and
`EarlyBinder` is one such type.

2 years agoUse `super_visit_with` in a couple of `visit_binder` methods.
Nicholas Nethercote [Tue, 31 May 2022 23:38:07 +0000 (09:38 +1000)]
Use `super_visit_with` in a couple of `visit_binder` methods.

Because it's equivalent but simpler to what's currently there.

2 years agoRename `TypeVisitor::visit_unevaluated_const`.
Nicholas Nethercote [Tue, 31 May 2022 05:07:28 +0000 (15:07 +1000)]
Rename `TypeVisitor::visit_unevaluated_const`.

To match the corresponding type name.

2 years agoMove `finish` out of the `Encoder` trait.
Nicholas Nethercote [Tue, 7 Jun 2022 21:26:35 +0000 (07:26 +1000)]
Move `finish` out of the `Encoder` trait.

This simplifies things, but requires making `CacheEncoder` non-generic.

2 years agoRollup merge of #97845 - estebank:spancito, r=compiler-errors
Matthias Krüger [Tue, 7 Jun 2022 21:55:29 +0000 (23:55 +0200)]
Rollup merge of #97845 - estebank:spancito, r=compiler-errors

Use more targeted suggestion when confusing i8 with std::i8

r? `@compiler-errors`

2 years agoRollup merge of #97840 - durin42:llvm-15-apint, r=nikic
Matthias Krüger [Tue, 7 Jun 2022 21:55:28 +0000 (23:55 +0200)]
Rollup merge of #97840 - durin42:llvm-15-apint, r=nikic

RustWrapper: adapt to APInt API changes in LLVM 15

In https://reviews.llvm.org/D125556 upstream changed sext() and zext()
to allow some no-op cases, which previously required use of the *OrSelf()
methods, which I assume is what was going on here. The *OrSelf() methods
got removed in https://reviews.llvm.org/D125559 after two weeks of
deprecation because they came with some bonus (probably-undesired)
behavior. Since the behavior of sext() and zext() changed slightly, I
kept the old *OrSelf() calls in LLVM 14 and earlier, and only use the
new version in LLVM 15.

r? `@nikic`

2 years agoRollup merge of #97832 - tmiasko:const-direction, r=cjgillot
Matthias Krüger [Tue, 7 Jun 2022 21:55:27 +0000 (23:55 +0200)]
Rollup merge of #97832 - tmiasko:const-direction, r=cjgillot

Change `Direction::{is_forward,is_backward}` functions into constants

Make it explicit that the analysis direction is constant.

This also makes the value immediately available for optimizations.
Previously those functions were neither inline nor generic and so their
definition was unavailable when using data flow framework from other
crates.

2 years agoRollup merge of #97831 - tmiasko:rm-always-live-locals-struct, r=davidtwco
Matthias Krüger [Tue, 7 Jun 2022 21:55:26 +0000 (23:55 +0200)]
Rollup merge of #97831 - tmiasko:rm-always-live-locals-struct, r=davidtwco

Remove `AlwaysLiveLocals` wrapper struct

It is just a wrapper around a `BitSet` and
doesn't have any functionality of its own.

2 years agoRollup merge of #97829 - JohnTitor:issue-95307, r=compiler-errors
Matthias Krüger [Tue, 7 Jun 2022 21:55:25 +0000 (23:55 +0200)]
Rollup merge of #97829 - JohnTitor:issue-95307, r=compiler-errors

Add regresion test for #95307

Closes #95307
r? `@compiler-errors`

2 years agoAuto merge of #97081 - oli-obk:outlives_query_fast_path, r=jackh726
bors [Tue, 7 Jun 2022 21:44:40 +0000 (21:44 +0000)]
Auto merge of #97081 - oli-obk:outlives_query_fast_path, r=jackh726

Re-use the type op instead of calling the implied_outlives_bounds query directly

r? `@ghost`

2 years agoExtract lower_generic_and_bounds function
Santiago Pastorino [Tue, 7 Jun 2022 21:17:41 +0000 (18:17 -0300)]
Extract lower_generic_and_bounds function

2 years agoPass origin down to impl_trait_ty_to_ty
Santiago Pastorino [Fri, 20 May 2022 18:29:45 +0000 (15:29 -0300)]
Pass origin down to impl_trait_ty_to_ty

2 years agoExtract lower_generic_param_kind
Santiago Pastorino [Fri, 20 May 2022 20:32:48 +0000 (17:32 -0300)]
Extract lower_generic_param_kind

2 years agoInstrument important fns in AST lowering
Santiago Pastorino [Fri, 20 May 2022 18:52:56 +0000 (15:52 -0300)]
Instrument important fns in AST lowering

2 years agoUse delayed error handling for `Encodable` and `Encoder` infallible.
Nicholas Nethercote [Tue, 7 Jun 2022 03:30:45 +0000 (13:30 +1000)]
Use delayed error handling for `Encodable` and `Encoder` infallible.

There are two impls of the `Encoder` trait: `opaque::Encoder` and
`opaque::FileEncoder`. The former encodes into memory and is infallible, the
latter writes to file and is fallible.

Currently, standard `Result`/`?`/`unwrap` error handling is used, but this is a
bit verbose and has non-trivial cost, which is annoying given how rare failures
are (especially in the infallible `opaque::Encoder` case).

This commit changes how `Encoder` fallibility is handled. All the `emit_*`
methods are now infallible. `opaque::Encoder` requires no great changes for
this. `opaque::FileEncoder` now implements a delayed error handling strategy.
If a failure occurs, it records this via the `res` field, and all subsequent
encoding operations are skipped if `res` indicates an error has occurred. Once
encoding is complete, the new `finish` method is called, which returns a
`Result`. In other words, there is now a single `Result`-producing method
instead of many of them.

This has very little effect on how any file errors are reported if
`opaque::FileEncoder` has any failures.

Much of this commit is boring mechanical changes, removing `Result` return
values and `?` or `unwrap` from expressions. The more interesting parts are as
follows.
- serialize.rs: The `Encoder` trait gains an `Ok` associated type. The
  `into_inner` method is changed into `finish`, which returns
  `Result<Vec<u8>, !>`.
- opaque.rs: The `FileEncoder` adopts the delayed error handling
  strategy. Its `Ok` type is a `usize`, returning the number of bytes
  written, replacing previous uses of `FileEncoder::position`.
- Various methods that take an encoder now consume it, rather than being
  passed a mutable reference, e.g. `serialize_query_result_cache`.

2 years agoDon't pass in a vector to `Encoder::new`.
Nicholas Nethercote [Tue, 7 Jun 2022 03:30:08 +0000 (13:30 +1000)]
Don't pass in a vector to `Encoder::new`.

It's not necessary.

2 years agoRemove an unnecessary encoder operation.
Nicholas Nethercote [Tue, 7 Jun 2022 01:08:10 +0000 (11:08 +1000)]
Remove an unnecessary encoder operation.

2 years agoUse more targeted suggestion when confusing i8 with std::i8
Esteban Küber [Tue, 7 Jun 2022 20:39:21 +0000 (13:39 -0700)]
Use more targeted suggestion when confusing i8 with std::i8

2 years agoSpecify DWARF alignment in bits, not bytes.
Patrick Walton [Tue, 7 Jun 2022 20:38:35 +0000 (13:38 -0700)]
Specify DWARF alignment in bits, not bytes.

In DWARF, alignment of types is specified in bits, as is made clear by the
parameter name `AlignInBits`. However, `rustc` was incorrectly passing a byte
alignment. This commit fixes that.

This was noticed in upstream LLVM when I tried to check in a test consisting of
LLVM IR generated from `rustc` and it triggered assertions [1].

[1]: https://reviews.llvm.org/D126835

2 years agoFormatting fix
Marko Mijalkovic [Tue, 7 Jun 2022 20:02:11 +0000 (16:02 -0400)]
Formatting fix

2 years agoAuto merge of #97835 - Dylan-DPC:rollup-0ae3pwp, r=Dylan-DPC
bors [Tue, 7 Jun 2022 19:00:02 +0000 (19:00 +0000)]
Auto merge of #97835 - Dylan-DPC:rollup-0ae3pwp, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #95948 (Improve the safety docs for `CStr`)
 - #97325 (Fix precise field capture of univariant enums)
 - #97817 (:arrow_up: rust-analyzer)
 - #97821 (Remove confusing sentence from `Mutex` docs)
 - #97826 (Add more information for rustdoc-gui tests)

Failed merges:

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

2 years agoRustWrapper: adapt to APInt API changes in LLVM 15
Augie Fackler [Tue, 7 Jun 2022 18:28:20 +0000 (14:28 -0400)]
RustWrapper: adapt to APInt API changes in LLVM 15

In https://reviews.llvm.org/D125556 upstream changed sext() and zext()
to allow some no-op cases, which previously required use of the *OrSelf()
methods, which I assume is what was going on here. The *OrSelf() methods
got removed in https://reviews.llvm.org/D125559 after two weeks of
deprecation because they came with some bonus (probably-undesired)
behavior. Since the behavior of sext() and zext() changed slightly, I
kept the old *OrSelf() calls in LLVM 14 and earlier, and only use the
new version in LLVM 15.

r? @nikic

2 years agohexagon: adapt test for upstream output changes
Augie Fackler [Tue, 7 Jun 2022 17:21:34 +0000 (13:21 -0400)]
hexagon: adapt test for upstream output changes

The output of IR formatting changed slightly in upstream rev
a0bc67e555f404d0e7ddb2e78cb891d96eaf913d
(https://reviews.llvm.org/D123096). I'm not actually sure what any of
that means, as I don't even know what hexagon is in this context, but
this change allows the test to pass on both old and new LLVMs.

r? @nikic

2 years agoPreserve unused pointer to address casts
Tomasz Miąsko [Wed, 1 Jun 2022 00:00:00 +0000 (00:00 +0000)]
Preserve unused pointer to address casts

2 years agoRollup merge of #97826 - GuillaumeGomez:rustdoc-gui-tests-info, r=Dylan-DPC
Dylan DPC [Tue, 7 Jun 2022 15:25:45 +0000 (17:25 +0200)]
Rollup merge of #97826 - GuillaumeGomez:rustdoc-gui-tests-info, r=Dylan-DPC

Add more information for rustdoc-gui tests

It was missing `--no-sandbox` in the `--help` message and the README was a bit outdated.

cc `@jsha` (I recall you asking some questions about passing arguments to the rustdoc gui tester so here it).

r? `@notriddle`

2 years agoRollup merge of #97821 - Nilstrieb:mutex-docs, r=Dylan-DPC
Dylan DPC [Tue, 7 Jun 2022 15:25:44 +0000 (17:25 +0200)]
Rollup merge of #97821 - Nilstrieb:mutex-docs, r=Dylan-DPC

Remove confusing sentence from `Mutex` docs

The docs were saying something about "statically initializing" the
mutex, and it's not clear what this means. Remove that part to avoid
confusion.

2 years agoRollup merge of #97817 - lnicola:rust-analyzer-2022-06-07, r=lnicola
Dylan DPC [Tue, 7 Jun 2022 15:25:43 +0000 (17:25 +0200)]
Rollup merge of #97817 - lnicola:rust-analyzer-2022-06-07, r=lnicola

:arrow_up: rust-analyzer

r? ``@ghost``

2 years agoRollup merge of #97325 - tmiasko:capture-enum-field, r=arora-aman
Dylan DPC [Tue, 7 Jun 2022 15:25:43 +0000 (17:25 +0200)]
Rollup merge of #97325 - tmiasko:capture-enum-field, r=arora-aman

Fix precise field capture of univariant enums

When constructing a MIR from a THIR field expression, introduce an
additional downcast projection before accessing a field of an enum.

When rebasing a place builder on top of a captured place, account for
the fact that a single HIR enum field projection corresponds to two MIR
projection elements: a downcast element and a field element.

Fixes #95271.
Fixes #96299.
Fixes #96512.
Fixes #97378.

r? ``@nikomatsakis`` ``@arora-aman``

2 years agoRollup merge of #95948 - Nilstrieb:improve-cstr-safety-docs, r=RalfJung
Dylan DPC [Tue, 7 Jun 2022 15:25:42 +0000 (17:25 +0200)]
Rollup merge of #95948 - Nilstrieb:improve-cstr-safety-docs, r=RalfJung

Improve the safety docs for `CStr`

Namely, the two functions `from_ptr` and `from_bytes_with_nul_unchecked`.
Before, these functions didn't state the requirements clearly enough,
and I was not immediately able to find them like for other functions.

This doesn't change the content of the docs, but simply rewords them for
clarity.

note: I'm not entirely sure about the '`ptr` must be valid for reads of `u8`.', there might be room for improvement for this (and maybe for the other docs as well 😄)

2 years agoAdd a `DownloadSource` enum
Joshua Nelson [Sun, 29 May 2022 04:55:42 +0000 (23:55 -0500)]
Add a `DownloadSource` enum

This simplifies the arguments to `download_component` in config.rs.

It also moves stage0.json metadata handling to `Build::new`, making it easier to download the stage0
compiler in rustbuild later if necessary.