Commit graph

159416 commits

Author SHA1 Message Date
Camille GILLOT d9e997d9eb Remove useless variant. 2021-12-11 11:08:46 +01:00
bors 4a66a704b2 Auto merge of #91720 - Aaron1011:skip-llvm-ci-tools, r=Mark-Simulacrum
Don't copy llvm tools to sysroot when using download-ci-llvm

Fixes #91710
2021-12-11 06:58:24 +00:00
bors c185610ebc Auto merge of #91761 - matthiaskrgr:rollup-bjowmvz, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #91668 (Remove the match on `ErrorKind::Other`)
 - #91678 (Add tests fixed by #90023)
 - #91679 (Move core/stream/stream/mod.rs to core/stream/stream.rs)
 - #91681 (fix typo in `intrinsics::raw_eq` docs)
 - #91686 (Fix `Vec::reserve_exact` documentation)
 - #91697 (Delete Utf8Lossy::from_str)
 - #91706 (Add unstable book entries for parts of asm that are not being stabilized)
 - #91709 (Replace iterator-based set construction by *Set::From<[T; N]>)
 - #91716 (Improve x.py logging and defaults a bit more)
 - #91747 (Add pierwill to .mailmap)
 - #91755 (Fix since attribute for const_linked_list_new feature)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-11 03:52:12 +00:00
bors 82575a1d6f Auto merge of #91715 - the8472:bump-rmeta-fromat-version, r=Mark-Simulacrum
Bump rmeta version to fix rustc_serialize ICE

#91407 changed the serialization format which leads to ICEs for nightly users such as #91663 and linked issues. The issue can be solved by running `cargo clean`. But bumping the metadata version should lead to the cached files being discarded, avoiding the issue entirely.
2021-12-11 01:00:14 +00:00
bors f0448f44bc Auto merge of #91760 - matthiaskrgr:rollup-zcemh6j, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #90407 (Document all public items in `rustc_incremental`)
 - #90897 (Fix incorrect stability attributes)
 - #91105 (Fix method name reference in stream documentation)
 - #91325 (adjust const_eval_select documentation)
 - #91470 (code-cov: generate dead functions with private/default linkage)
 - #91482 (Update documentation to use `from()` to initialize `HashMap`s and `BTreeMap`s)
 - #91524 (Fix Vec::extend_from_slice docs)
 - #91575 (Fix ICE on format string of macro with secondary-label)
 - #91625 (Remove redundant [..]s)
 - #91646 (Fix documentation for `core::ready::Ready`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-10 21:59:07 +00:00
Matthias Krüger 637859b26e
Rollup merge of #91755 - not-my-profile:fix-const_linked_list_new-since, r=dtolnay
Fix since attribute for const_linked_list_new feature

https://github.com/rust-lang/rust/pull/63684
was merged for 1.39 not 1.32
2021-12-10 22:41:31 +01:00
Matthias Krüger 6768a0713f
Rollup merge of #91747 - pierwill:patch-1, r=Mark-Simulacrum
Add pierwill to .mailmap
2021-12-10 22:41:30 +01:00
Matthias Krüger ca9d14bcba
Rollup merge of #91716 - jyn514:x.py-defaults, r=Mark-Simulacrum
Improve x.py logging and defaults a bit more

r? ```@Mark-Simulacrum```
2021-12-10 22:41:29 +01:00
Matthias Krüger 3beeb75dde
Rollup merge of #91709 - juniorbassani:use-from-array-in-set-examples, r=jyn514
Replace iterator-based set construction by *Set::From<[T; N]>

This uses the array-based construction for `BtreeSet`s and `HashSet`s instead of first creating an iterator. I could also replace the `let mut a = Set::new(); a.insert(...);` fragments if desired.
2021-12-10 22:41:28 +01:00
Matthias Krüger 698ea96a8f
Rollup merge of #91706 - Amanieu:asm_unstable_book2, r=joshtriplett
Add unstable book entries for parts of asm that are not being stabilized

These are extracted from the existing `asm` documentation in the unstable book that will be removed when `asm` is stabilized.

r? ```@joshtriplett```
2021-12-10 22:41:27 +01:00
Matthias Krüger 2784051c11
Rollup merge of #91697 - dtolnay:lossyfromstr, r=Mark-Simulacrum
Delete Utf8Lossy::from_str

This whole type is marked as being for str internals only, but this constructor is never used by str internals. If you had a &amp;str already and wanted to lossy display it or iterate its lossy utf8 chunks, you would simply not use Utf8Lossy because the whole &amp;str is known to be one contiguous valid utf8 chunk.

If code really does need to obtain a value of type &amp;Utf8Lossy somewhere, and has only a &amp;str, `Utf8Lossy::from_bytes(s.as_bytes())` remains available. As currently implemented, there is no performance penalty relative to `from_str` i.e. the Utf8Lossy does not "remember" that it was constructed using `from_str` to bypass later utf8 decoding.
2021-12-10 22:41:26 +01:00
Matthias Krüger 1d36c6ac2e
Rollup merge of #91686 - dalcde:patch-1, r=dtolnay
Fix `Vec::reserve_exact` documentation

The documentation previously said the new capacity cannot overflow `usize`, but in fact it cannot exceed `isize::MAX`.
2021-12-10 22:41:25 +01:00
Matthias Krüger 4286ade8c9
Rollup merge of #91681 - WaffleLapkin:patch-3, r=scottmcm
fix typo in `intrinsics::raw_eq` docs
2021-12-10 22:41:24 +01:00
Matthias Krüger 6451de0a5d
Rollup merge of #91679 - ibraheemdev:stream-mod, r=Mark-Simulacrum
Move core/stream/stream/mod.rs to core/stream/stream.rs

Removes an unnecessary nested module.
2021-12-10 22:41:23 +01:00
Matthias Krüger d6e941778a
Rollup merge of #91678 - b-naber:tests-for-postpone-const-eval, r=jackh726
Add tests fixed by #90023

The following issues were fixed by https://github.com/rust-lang/rust/pull/90023

Fixes https://github.com/rust-lang/rust/issues/79674
Fixes https://github.com/rust-lang/rust/issues/83765
Fixes https://github.com/rust-lang/rust/issues/86033
Fixes https://github.com/rust-lang/rust/issues/90318
Fixes https://github.com/rust-lang/rust/issues/88468

The following issues were duplicates of https://github.com/rust-lang/rust/issues/90654

Fixes https://github.com/rust-lang/rust/issues/86850
Fixes https://github.com/rust-lang/rust/issues/89022

r? ````@jackh726````
2021-12-10 22:41:22 +01:00
Matthias Krüger 0aa41bea97
Rollup merge of #91668 - ChrisDenton:bootstrap-clean-error, r=Mark-Simulacrum
Remove the match on `ErrorKind::Other`

It's a) superfluous and b) doesn't work any more.
2021-12-10 22:41:22 +01:00
Matthias Krüger 1fca934898
Rollup merge of #91646 - ibraheemdev:patch-9, r=dtolnay
Fix documentation for `core::ready::Ready`
2021-12-10 22:40:37 +01:00
Matthias Krüger 40988591ec
Rollup merge of #91625 - est31:remove_indexes, r=oli-obk
Remove redundant [..]s
2021-12-10 22:40:36 +01:00
Matthias Krüger 6cfe9af6a0
Rollup merge of #91575 - compiler-errors:issue-91556, r=cjgillot
Fix ICE on format string of macro with secondary-label

This generalizes the fix #86104 to also correctly skip `Span::from_inner` for the `secondary_label` of a format macro parsing error as well.

We can alternatively skip the `span_label` diagnostic call for the secondary label as well, since that label probably only makes sense when the _proper_ span is computed.

Fixes #91556
2021-12-10 22:40:35 +01:00
Matthias Krüger ca352c4522
Rollup merge of #91524 - rukai:fix_extend_from_slice_docs, r=dtolnay
Fix Vec::extend_from_slice docs

`other` is a slice not a vector.
2021-12-10 22:40:34 +01:00
Matthias Krüger 5510803fe9
Rollup merge of #91482 - JosephTLyons:update-HashMap-and-BTreeMap-documentation, r=yaahc
Update documentation to use `from()` to initialize `HashMap`s and `BTreeMap`s

As of Rust 1.56, `HashMap` and `BTreeMap` both have associated `from()` functions.  I think using these in the documentation cleans things up a bit.  It allows us to remove some of the `mut`s and avoids the Initialize-Then-Modify anti-pattern.
2021-12-10 22:40:33 +01:00
Matthias Krüger b7b4d7742e
Rollup merge of #91470 - wesleywiser:code_coverage_link_error, r=tmandry
code-cov: generate dead functions with private/default linkage

As discovered in #85461, the MSVC linker treats weak symbols slightly
differently than unix-y linkers do. This causes link.exe to fail with
LNK1227 "conflicting weak extern definition" where as other targets are
able to link successfully.

This changes the dead functions from being generated as weak/hidden to
private/default which, as the LLVM reference says:

> Global values with “private” linkage are only directly accessible by
objects in the current module. In particular, linking code into a module
with a private global value may cause the private to be renamed as
necessary to avoid collisions. Because the symbol is private to the
module, all references can be updated. This doesn’t show up in any
symbol table in the object file.

This fixes the conflicting weak symbols but doesn't address the reason
*why* we have conflicting symbols for these dead functions. The test
cases added in this commit contain a minimal repro of the fundamental
issue which is that the logic used to decide what dead code functions
should be codegen'd in the current CGU doesn't take into account that
functions can be duplicated across multiple CGUs (for instance, in the
case of `#[inline(always)]` functions).

Fixing that is likely to be a more complex change (see
https://github.com/rust-lang/rust/issues/85461#issuecomment-985005805).

Fixes #85461
2021-12-10 22:40:32 +01:00
Matthias Krüger d317da48b1
Rollup merge of #91325 - RalfJung:const_eval_select, r=dtolnay
adjust const_eval_select documentation

"The Rust compiler assumes" indicates that this is language UB, but [I don't think that is a good idea](https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/const_eval_select.20assumptions). This UB would be very hard to test for and looks like a way-too-big footgun. ``@oli-obk`` suggested this is meant to be more like "library UB", so I tried to adjust the docs accordingly.

I also removed all references to "referential transparency". That is a rather vague concept used to mean many different things, and I honestly have no idea what exactly is meant by it in this specific instance. But I assume ``@fee1-dead`` had in their mind a property that all `const fn` code upholds, so by demanding that the runtime code and the const-time code are *observably equivalent*, whatever that property is would also be enforced here.

Cc ``@rust-lang/wg-const-eval``
2021-12-10 22:40:32 +01:00
Matthias Krüger 60aa03aa71
Rollup merge of #91105 - jplatte:stream-docs, r=dtolnay
Fix method name reference in stream documentation
2021-12-10 22:40:31 +01:00
Matthias Krüger 616f9efebb
Rollup merge of #90897 - jhpratt:fix-incorrect-feature-flags, r=dtolnay
Fix incorrect stability attributes

These two instances were caught in #90356, but that PR isn't going to be merged. I've extracted these to ensure it's still correct.

``@rustbot`` label: +A-stability +C-cleanup +S-waiting-on-review
2021-12-10 22:40:29 +01:00
Matthias Krüger 71c1d562ce
Rollup merge of #90407 - pierwill:edit-rustc-incremental-docs, r=cjgillot
Document all public items in `rustc_incremental`

Also:

- Review and edit current docs
- Enforce documentation for the module.
2021-12-10 22:40:28 +01:00
Martin Fischer 305dd6908c Fix since attribute for const_linked_list_new feature
https://github.com/rust-lang/rust/pull/63684
was merged for 1.39 not 1.32
2021-12-10 20:22:19 +01:00
pierwill 777c041c10 Add pierwill to .mailmap 2021-12-10 10:52:07 -06:00
Aaron Hill faf407d5dc
Don't copy llvm tools to sysroot when using download-ci-llvm
Fixes #91710
2021-12-09 13:41:39 -06:00
Joshua Nelson 6840030283 Default to doc-stage = 2 for the tools profile
This already enables `download-rustc`, so it's quick to build rustdoc,
and this makes it less confusing when changes to rustdoc aren't reflected in the docs.

Note that this uses 2 and not 1 because `download-rustc` only affects stage 2 runs.
2021-12-09 11:30:38 -06:00
Joshua Nelson dfcaac53ce Don't print bootstrap caching/ensure info unless -vv is passed
Previously, passing `-v` would emit an overwhelming amount of logging:

```
> Std { stage: 1, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
  > Assemble { target_compiler: Compiler { stage: 1, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
    > Assemble { target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
    < Assemble { target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
    > Rustc { target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None }, compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
      > Std { target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None }, compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        > StartupObjects { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
        < StartupObjects { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
        c Assemble { target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        > Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
          > Sysroot { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
          < Sysroot { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        < Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
        c Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
        c Sysroot { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        c Assemble { target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        > StdLink { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
          c Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
          c Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
        < StdLink { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
      < Std { target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None }, compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
... continues for another 150 lines ...
```

This info is occasionally useful when debugging bootstrap itself, but not very useful for figuring
out why a config option was ignored or command wasn't run.  Demote it to `-vv` logging so that `-v`
is more useful.
2021-12-09 11:30:38 -06:00
Joshua Nelson ae6f5fbc3f If --verbose is passed, print a warning in bootstrap.py when download-rustc is ignored 2021-12-09 11:30:38 -06:00
Joshua Nelson 8a6f54fc3a Use more accurate wording in bootstrap.py logging 2021-12-09 11:30:38 -06:00
Michael Goulet 99bd24e9a3 Fix span calculation on secondary_label as well 2021-12-09 09:09:39 -08:00
The 8472 0696e79f27 Bump rmeta version to fix rustc_serialize ICE
#91407 changed the serialization format which leads to ICEs for nightly users such as #91663 and linked issue.
Bumping the metadata version should lead to the cached files being discarded instead.
2021-12-09 18:00:36 +01:00
bors 0b42deaccc Auto merge of #85157 - the8472:drain-drop-in-place, r=Mark-Simulacrum
replace vec::Drain drop loops with drop_in_place

The `Drain::drop` implementation came up in https://github.com/rust-lang/rust/pull/82185#issuecomment-789584796 as potentially interfering with other optimization work due its widespread use somewhere in `println!`

`@rustbot` label T-libs-impl
2021-12-09 15:01:42 +00:00
Júnior Bassani cebd9494bd
Replace iterator-based set construction by *Set::From<[T; N]> 2021-12-09 11:56:19 -03:00
Chris Denton caed83d400
Add reminder to match the error kind once DirectoryNotEmpty is stabilized 2021-12-09 14:39:30 +00:00
Amanieu d'Antras e18518b648 Add unstable book entries for parts of asm that are not being stabilized 2021-12-09 14:09:47 +00:00
bors 3b263ceb5c Auto merge of #81156 - DrMeepster:read_buf, r=joshtriplett
Implement most of RFC 2930, providing the ReadBuf abstraction

This replaces the `Initializer` abstraction for permitting reading into uninitialized buffers, closing #42788.

This leaves several APIs described in the RFC out of scope for the initial implementation:

* read_buf_vectored
* `ReadBufs`

Closes #42788, by removing the relevant APIs.
2021-12-09 10:11:55 +00:00
bors 600820da45 Auto merge of #91692 - matthiaskrgr:rollup-u7dvh0n, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #87599 (Implement concat_bytes!)
 - #89999 (Update std::env::temp_dir to use GetTempPath2 on Windows when available.)
 - #90796 (Remove the reg_thumb register class for asm! on ARM)
 - #91042 (Use Vec extend instead of repeated pushes on several places)
 - #91634 (Do not attempt to suggest help for overly malformed struct/function call)
 - #91685 (Install llvm tools to sysroot when assembling local toolchain)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-09 07:08:32 +00:00
David Tolnay 4b0a9c9bc3
Delete Utf8Lossy::from_str 2021-12-08 22:54:51 -08:00
Matthias Krüger ab92eca612
Rollup merge of #91685 - Aaron1011:install-llvm-tools, r=Mark-Simulacrum
Install llvm tools to sysroot when assembling local toolchain

Some projects (e.g. the `bootimage` crate) may require the
user to install the `llvm-tools-preview` rustup component.
However, this cannot be easily done with a locally built toolchain.

To allow a local toolchain to be used a drop-in replacement for
a normal rustup toolchain in more cases, this PR copies the built
LLVM tools to the sysoot. From the perspective a tool looking
at the sysroot, this is equivalent to installing `llvm-tools-preview`.
2021-12-09 05:08:34 +01:00
Matthias Krüger 8c94b2c375
Rollup merge of #91634 - terrarier2111:fix-recover-from-variant-ice, r=nagisa
Do not attempt to suggest help for overly malformed struct/function call

This fixes: https://github.com/rust-lang/rust/issues/91461
2021-12-09 05:08:33 +01:00
Matthias Krüger 876f9ffde6
Rollup merge of #91042 - Kobzol:vec-extend-cleanup, r=nagisa
Use Vec extend instead of repeated pushes on several places

Inspired by https://github.com/rust-lang/rust/pull/90813, I tried to use a simple regex (`for .*in.*\{\n.*push\(.*\);\n\s+}`) to search for more places that would use `Vec::push` in a loop and replace them with `Vec::extend`.

These probably won't have as much perf. impact as the original PR (if any), but it would probably be better to do a perf run to see if there are not any regressions.
2021-12-09 05:08:33 +01:00
Matthias Krüger 22a1331112
Rollup merge of #90796 - Amanieu:remove_reg_thumb, r=joshtriplett
Remove the reg_thumb register class for asm! on ARM

Also restricts r8-r14 from being used on Thumb1 targets as per #90736.

cc ``@Lokathor``

r? ``@joshtriplett``
2021-12-09 05:08:32 +01:00
Matthias Krüger 856eefece9
Rollup merge of #89999 - talagrand:GetTempPath2, r=m-ou-se
Update std::env::temp_dir to use GetTempPath2 on Windows when available.

As a security measure, Windows 11 introduces a new temporary directory API, GetTempPath2.
When the calling process is running as SYSTEM, a separate temporary directory
will be returned inaccessible to non-SYSTEM processes. For non-SYSTEM processes
the behavior will be the same as before.

This can help mitigate against attacks such as this one:
https://medium.com/csis-techblog/cve-2020-1088-yet-another-arbitrary-delete-eop-a00b97d8c3e2

Compatibility risk: Software which relies on temporary files to communicate between SYSTEM and non-SYSTEM
processes may be affected by this change. In many cases, such patterns may be vulnerable to the very
attacks the new API was introduced to harden against.
I'm unclear on the Rust project's tolerance for such change-of-behavior in the standard library. If anything,
this PR is meant to raise awareness of the issue and hopefully start the conversation.

How tested: Taking the example code from the documentation and running it through psexec (from SysInternals) on
Win10 and Win11.
On Win10:
C:\test>psexec -s C:\test\main.exe
<...>
Temporary directory: C:\WINDOWS\TEMP\

On Win11:
C:\test>psexec -s C:\test\main.exe
<...>
Temporary directory: C:\Windows\SystemTemp\
2021-12-09 05:08:31 +01:00
Matthias Krüger 3fc5bd7abc
Rollup merge of #87599 - Smittyvb:concat_bytes, r=Mark-Simulacrum
Implement concat_bytes!

This implements the unstable `concat_bytes!` macro, which has tracking issue #87555. It can be used like:
```rust
#![feature(concat_bytes)]

fn main() {
    assert_eq!(concat_bytes!(), &[]);
    assert_eq!(concat_bytes!(b'A', b"BC", [68, b'E', 70]), b"ABCDEF");
}
```
If strings or characters are used where byte strings or byte characters are required, it suggests adding a `b` prefix. If a number is used outside of an array it suggests arrayifying it. If a boolean is used it suggests replacing it with the numeric value of that number. Doubly nested arrays of bytes are disallowed.
2021-12-09 05:08:30 +01:00
bors e250777041 Auto merge of #91691 - matthiaskrgr:rollup-wfommdr, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #91042 (Use Vec extend instead of repeated pushes on several places)
 - #91476 (Improve 'cannot contain emoji' error.)
 - #91568 (Pretty print break and continue without redundant space)
 - #91645 (Implement `core::future::join!`)
 - #91666 (update Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-09 04:04:01 +00:00
Matthias Krüger 229aa1b106
Rollup merge of #91666 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/91649
r? `@ghost`
2021-12-09 05:02:23 +01:00