]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #85334 - r00ster91:patch-8, r=dtolnay
Dylan DPC [Sun, 23 May 2021 01:23:41 +0000 (03:23 +0200)]
Rollup merge of #85334 - r00ster91:patch-8, r=dtolnay

Add doc aliases to `unit`

I think it makes sense for `unit` to have the same doc aliases as `tuple` does.

3 years agoRollup merge of #85288 - Geal:clarify-std-io-read, r=dtolnay
Dylan DPC [Sun, 23 May 2021 01:23:37 +0000 (03:23 +0200)]
Rollup merge of #85288 - Geal:clarify-std-io-read, r=dtolnay

add an example to explain std::io::Read::read returning 0 in some cases

I have always found the explanation about `Read::read` returning 0 to indicate EOF but not indefinitely, so here's more info using Linux as example. I can also add example code if necessary

3 years agoRollup merge of #84758 - ChrisDenton:dllimport, r=dtolnay
Dylan DPC [Sun, 23 May 2021 01:23:34 +0000 (03:23 +0200)]
Rollup merge of #84758 - ChrisDenton:dllimport, r=dtolnay

MSVC: Avoid using jmp stubs for dll function imports

Windows import libraries contain two symbols for every function: `__imp_FunctionName` and `FunctionName` (where `FunctionName` is the name of the function to be imported).

`__imp_FunctionName` contains the address of the imported function. This will be filled in by the Windows executable loader at runtime. `FunctionName` contains a jmp stub that simply jumps to the address given by `__imp_FunctionName`. E.g. it's a function that solely contains a single jmp instruction:

```asm
jmp __imp_FunctionName
```

When using an external DLL function in Rust, by default the linker will link to FunctionName, causing a bit of indirection at runtime. In Microsoft's C++ it's possible to instead tell it to insert calls to the address in `__imp_FunctionName` by using the  `__declspec(dllimport)` attribute. In Rust it's possible to get effectively the same behaviour using the `#[link]` attribute on `extern` blocks.

----

The second commit also merges multiple `extern` blocks into one block. This is because otherwise Rust will currently create duplicate linker arguments for each block. In this case having duplicates shouldn't matter much other than the noise when displaying the linker command.

3 years agoAuto merge of #85578 - RalfJung:alloc-mem-extra, r=oli-obk
bors [Sat, 22 May 2021 20:04:52 +0000 (20:04 +0000)]
Auto merge of #85578 - RalfJung:alloc-mem-extra, r=oli-obk

CTFE get_alloc_extra_mut: also provide ref to MemoryExtra

This would let me use mutable references in more places in Stacked Borrows, avoiding some `RefCell` overhead. :)

r? `@oli-obk`

3 years agoAuto merge of #85078 - RalfJung:const_fn_unsize, r=oli-obk
bors [Sat, 22 May 2021 17:38:15 +0000 (17:38 +0000)]
Auto merge of #85078 - RalfJung:const_fn_unsize, r=oli-obk

stabilize const_fn_unsize

I will post a stabilization report and ask for FCP in https://github.com/rust-lang/rust/issues/64992.
This PR is for the implementation side of stabilization.

r? `@oli-obk`
Fixes https://github.com/rust-lang/rust/issues/64992

3 years agoAuto merge of #85514 - GuillaumeGomez:upgrade-minifer-version, r=Mark-Simulacrum
bors [Sat, 22 May 2021 14:54:45 +0000 (14:54 +0000)]
Auto merge of #85514 - GuillaumeGomez:upgrade-minifer-version, r=Mark-Simulacrum

Upgrade minifier version to 0.0.41

3 years agoCTFE get_alloc_extra_mut: also provide ref to MemoryExtra
Ralf Jung [Sat, 22 May 2021 13:20:20 +0000 (15:20 +0200)]
CTFE get_alloc_extra_mut: also provide ref to MemoryExtra

3 years agoAuto merge of #85557 - hyd-dev:abi, r=RalfJung
bors [Sat, 22 May 2021 11:49:13 +0000 (11:49 +0000)]
Auto merge of #85557 - hyd-dev:abi, r=RalfJung

Add `rustc_mir::interpret::Machine::enforce_abi()`

To specify whether to skip the [ABI](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/abi/enum.Abi.html) check for function calls, so that we could test unwinding out of a `extern "C"` function call in Miri by disabling the check: https://github.com/rust-lang/miri/pull/1776#discussion_r633698382

I have tested that it works in Miri with a `-Zmiri-disable-abi-check` command line flag.

3 years agoAdd default implementation for `enforce_abi()`
hyd-dev [Sat, 22 May 2021 11:04:28 +0000 (19:04 +0800)]
Add default implementation for `enforce_abi()`

3 years agoconst_fn_unsize: check that the cast behaves correctly
Ralf Jung [Sat, 8 May 2021 14:36:39 +0000 (16:36 +0200)]
const_fn_unsize: check that the cast behaves correctly

3 years agostabilize const_fn_unsize
Ralf Jung [Sat, 8 May 2021 14:28:29 +0000 (16:28 +0200)]
stabilize const_fn_unsize

3 years agoAuto merge of #85568 - GuillaumeGomez:search-result-extra-info, r=jsha
bors [Sat, 22 May 2021 07:07:38 +0000 (07:07 +0000)]
Auto merge of #85568 - GuillaumeGomez:search-result-extra-info, r=jsha

Search result extra info

The CSS rule was not updated when we updated the search result, this fixes it:

Before:
![Screenshot from 2021-05-21 22-56-17](https://user-images.githubusercontent.com/3050060/119197314-d31a4e80-ba87-11eb-863a-bc0b3de3bfb2.png)

After:
![Screenshot from 2021-05-21 22-54-53](https://user-images.githubusercontent.com/3050060/119197227-b54ce980-ba87-11eb-9f43-c10803ca1b90.png)

r? `@jsha`

3 years agoAuto merge of #85531 - luqmana:flip-gc, r=petrochenkov
bors [Sat, 22 May 2021 04:42:36 +0000 (04:42 +0000)]
Auto merge of #85531 - luqmana:flip-gc, r=petrochenkov

Swap TargetOptions::linker_is_gnu default from false to true and update targets as appropriate.

#85274 gated the `--gc-sections` flag on targets that specified `linker_is_gnu` to stop us from passing it to incompatible linkers. But that had the unintended effect of the flag no longer being passed on targets for which it is valid and hence caused a regression in binary size. Given that most `ld`-style linkers are GNU compatible, this change flips our default for `linker_is_gnu` from false to true. That also means updating the targets that relied on the previous default:
* Apple
* Illumos
* L4Re (not sure about this one)
* MSVC
* NvtPtx
* Solaris

Fixes #85519

3 years agoAuto merge of #85505 - flip1995:clippyup, r=Manishearth
bors [Sat, 22 May 2021 01:59:57 +0000 (01:59 +0000)]
Auto merge of #85505 - flip1995:clippyup, r=Manishearth

Update Clippy

Bi-weekly Clippy update

r? `@Manishearth`

3 years agoAdd test for search result keyword extra info
Guillaume Gomez [Fri, 21 May 2021 20:53:50 +0000 (22:53 +0200)]
Add test for search result keyword extra info

3 years agoFix display for primitive and keyword extra info
Guillaume Gomez [Fri, 21 May 2021 20:53:31 +0000 (22:53 +0200)]
Fix display for primitive and keyword extra info

3 years agoAuto merge of #85560 - GuillaumeGomez:rollup-8k90rc7, r=GuillaumeGomez
bors [Fri, 21 May 2021 19:17:22 +0000 (19:17 +0000)]
Auto merge of #85560 - GuillaumeGomez:rollup-8k90rc7, r=GuillaumeGomez

Rollup of 4 pull requests

Successful merges:

 - #85506 (Reset "focusedByTab" field when doing another search)
 - #85548 (Remove dead toggle JS code)
 - #85550 (facepalm: operator precedence fail on my part.)
 - #85555 (Check for more things in THIR unsafeck)

Failed merges:

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

3 years agoRollup merge of #85555 - LeSeulArtichaut:thir-unsafeck, r=nikomatsakis
Guillaume Gomez [Fri, 21 May 2021 18:06:09 +0000 (20:06 +0200)]
Rollup merge of #85555 - LeSeulArtichaut:thir-unsafeck, r=nikomatsakis

Check for more things in THIR unsafeck

Reunion of #85306, #85381 and #85419 with conflicts resolved.
r? `@nikomatsakis`

3 years agoRollup merge of #85550 - pnkfelix:fix-max-rss-division-on-mac, r=Mark-Simulacrum
Guillaume Gomez [Fri, 21 May 2021 18:06:08 +0000 (20:06 +0200)]
Rollup merge of #85550 - pnkfelix:fix-max-rss-division-on-mac, r=Mark-Simulacrum

facepalm: operator precedence fail on my part.

This bug was only visible on mac. Also, print_step_rusage is a relatively new
internal feature, that is not heavily used, and has no tests. All of these
factors contributed to how this went uncaught this long. Thanks to Josh Triplett
for pointing it out!

3 years agoRollup merge of #85548 - GuillaumeGomez:remove-dead-js, r=jsha
Guillaume Gomez [Fri, 21 May 2021 18:06:07 +0000 (20:06 +0200)]
Rollup merge of #85548 - GuillaumeGomez:remove-dead-js, r=jsha

Remove dead toggle JS code

Explanations on how I got there: I randomly saw `adjustToggle` while browsing through code, checked where it was called, put a `debugger;` instruction in it and checked on all pages while playing with settings and toggles. The breakpoint was never triggered. I then looked at `collapseNonInherent` (its grand-parent). In there, the breakpoint was triggered so I look at what was being done and in fact... nothing. So I simply removed it all, re-ran the tests and play with the UI. Everything is working as expected.

Better double check in case I forgot to check a case though, but if nothing has been left out, then it's a great cleanup once again. :)

r? ``@jsha``

3 years agoRollup merge of #85506 - GuillaumeGomez:reset-focusedByTab, r=jsha
Guillaume Gomez [Fri, 21 May 2021 18:06:06 +0000 (20:06 +0200)]
Rollup merge of #85506 - GuillaumeGomez:reset-focusedByTab, r=jsha

Reset "focusedByTab" field when doing another search

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

The problem was simply that we forget to reset the `focusedByTab` field, which was still referring to removed DOM elements.

r? ``@jsha``

3 years agoCheck for use of mutable/extern statics in THIR unsafeck
LeSeulArtichaut [Sun, 16 May 2021 22:29:54 +0000 (00:29 +0200)]
Check for use of mutable/extern statics in THIR unsafeck

3 years agoAuto merge of #85511 - Mark-Simulacrum:eq-not-sup, r=nikomatsakis
bors [Fri, 21 May 2021 16:36:36 +0000 (16:36 +0000)]
Auto merge of #85511 - Mark-Simulacrum:eq-not-sup, r=nikomatsakis

Adjust self-type check to require equality

When we encounter `SomeType::<X>::foo`, `self_ty` is `SomeType<X>` and the method is defined in an impl on `SomeType<A>`. Previously, we required simply that `self_ty <: impl_ty`, but this is too lax: we should require equality in order to use the method. This was found as part of unrelated work on never type stabilization, but also fixes one of the wf test cases.

3 years agoCheck for ptr-to-int casts in const functions in THIR unsafeck
LeSeulArtichaut [Sat, 15 May 2021 14:29:57 +0000 (16:29 +0200)]
Check for ptr-to-int casts in const functions in THIR unsafeck

3 years agoCheck for initialization of layout-restricted types
LeSeulArtichaut [Sat, 15 May 2021 13:26:28 +0000 (15:26 +0200)]
Check for initialization of layout-restricted types

3 years agofacepalm: operator precedence fail on my part.
Felix S. Klock II [Fri, 21 May 2021 14:48:36 +0000 (10:48 -0400)]
facepalm: operator precedence fail on my part.

This bug was only visible on mac. Also, print_step_rusage is a relatively new
internal feature, that is not heavily used, and has no tests. All of these
factors contributed to how this went uncaught this long. Thanks to Josh Triplett
for pointing it out!

3 years agoAdd `rustc_mir::interpret::Machine::enforce_abi()`
hyd-dev [Fri, 21 May 2021 14:19:37 +0000 (22:19 +0800)]
Add `rustc_mir::interpret::Machine::enforce_abi()`

3 years agoAdjust self-type to require equality
Mark Rousskov [Thu, 20 May 2021 14:15:56 +0000 (10:15 -0400)]
Adjust self-type to require equality

3 years agoRemove dead toggle JS code
Guillaume Gomez [Fri, 21 May 2021 13:50:55 +0000 (15:50 +0200)]
Remove dead toggle JS code

3 years agoAuto merge of #85482 - scottmcm:more-try-bootstrap, r=yaahc
bors [Fri, 21 May 2021 13:46:04 +0000 (13:46 +0000)]
Auto merge of #85482 - scottmcm:more-try-bootstrap, r=yaahc

`#[cfg(bootstrap)]` out `NoneError` and other v1 try_trait stuff

Closes #46871

r? `@yaahc`

3 years agoAuto merge of #85416 - durin42:llvm-catchup-may-2021, r=nagisa
bors [Fri, 21 May 2021 11:21:06 +0000 (11:21 +0000)]
Auto merge of #85416 - durin42:llvm-catchup-may-2021, r=nagisa

PassWrapper: update for LLVM change D102093

In https://reviews.llvm.org/D102093 lots of things stopped taking the
DebugLogging boolean parameter. Mercifully we appear to always set
DebugPassManager to false, so I don't think we're losing anything by not
passing this parameter.

3 years agoAuto merge of #85400 - lnicola:rust-analyzer-2021-05-17, r=jonas-schievink
bors [Fri, 21 May 2021 08:33:36 +0000 (08:33 +0000)]
Auto merge of #85400 - lnicola:rust-analyzer-2021-05-17, r=jonas-schievink

:arrow_up: rust-analyzer

3 years agoRemove linker_is_gnu: true cases as that is now the default.
Luqman Aden [Fri, 21 May 2021 06:36:04 +0000 (23:36 -0700)]
Remove linker_is_gnu: true cases as that is now the default.

3 years agoAuto merge of #85060 - ChrisDenton:win-file-exists, r=yaahc
bors [Fri, 21 May 2021 05:47:24 +0000 (05:47 +0000)]
Auto merge of #85060 - ChrisDenton:win-file-exists, r=yaahc

Windows implementation of feature `path_try_exists`

Draft of a Windows implementation of `try_exists` (#83186).

The first commit reorganizes the code so I would be interested to get some feedback on if this is a good idea or not. It moves the `Path::try_exists` function to `fs::exists`. leaving the former as a wrapper for the latter. This makes it easier to provide platform specific implementations and matches the `fs::metadata` function.

The other commit implements a Windows specific variant of `exists`. I'm still figuring out my approach so this is very much a first draft. Eventually this will need some more eyes from knowledgable Windows people.

3 years agoAuto merge of #85382 - Aaron1011:project-eval, r=nikomatsakis
bors [Fri, 21 May 2021 02:39:39 +0000 (02:39 +0000)]
Auto merge of #85382 - Aaron1011:project-eval, r=nikomatsakis

Always produce sub-obligations when using cached projection result

See https://github.com/rust-lang/rust/issues/85360

When we skip adding the sub-obligations to the `obligation` list, we can affect whether or not the final result is `EvaluatedToOk` or `EvaluatedToOkModuloObligations`. This creates problems for incremental compilation, since the projection cache is untracked shared state.

To solve this issue, we unconditionally process the sub-obligations. Surprisingly, this is a slight performance *win* in many cases.

3 years agoAuto merge of #85524 - RalfJung:miri, r=RalfJung
bors [Thu, 20 May 2021 23:53:36 +0000 (23:53 +0000)]
Auto merge of #85524 - RalfJung:miri, r=RalfJung

update miri

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

3 years agoSwap TargetOptions::linker_is_gnu default from false to true and update targets as...
Luqman Aden [Thu, 20 May 2021 23:38:40 +0000 (16:38 -0700)]
Swap TargetOptions::linker_is_gnu default from false to true and update targets as appropriate.

3 years agoAuto merge of #85521 - alexcrichton:less-tls-inline, r=Mark-Simulacrum
bors [Thu, 20 May 2021 21:11:19 +0000 (21:11 +0000)]
Auto merge of #85521 - alexcrichton:less-tls-inline, r=Mark-Simulacrum

std: Don't inline TLS accessor on MinGW

This is causing [issues] on Cargo's own CI for MinGW and given the
original investigation there's no reason that MinGW should work when
MSVC doesn't, this this tweaks the MSVC exception to being a Windows exception.

[issues]: https://github.com/rust-lang/cargo/runs/2626676503?check_suite_focus=true#step:9:2453

3 years agoupdate miri
Ralf Jung [Thu, 20 May 2021 20:05:08 +0000 (22:05 +0200)]
update miri

3 years agostd: Don't inline TLS accessor on MinGW
Alex Crichton [Thu, 20 May 2021 19:45:05 +0000 (12:45 -0700)]
std: Don't inline TLS accessor on MinGW

This is causing [issues] on Cargo's own CI for MinGW and given the
original investigation there's no reason that MinGW should work when
MSVC doesn't, this this tweaks the MSVC exception to being a Windows exception.

[issues]: https://github.com/rust-lang/cargo/runs/2626676503?check_suite_focus=true#step:9:2453

3 years agoAuto merge of #85518 - GuillaumeGomez:rollup-mq4ohfy, r=GuillaumeGomez
bors [Thu, 20 May 2021 18:30:26 +0000 (18:30 +0000)]
Auto merge of #85518 - GuillaumeGomez:rollup-mq4ohfy, r=GuillaumeGomez

Rollup of 5 pull requests

Successful merges:

 - #85275 (Move `std::memchr` to `sys_common`)
 - #85326 (bootstrap: ensure host std when cross-compiling tools, fixes #85320)
 - #85375 (Fix missing lifetimes diagnostics after #83759)
 - #85507 (Extend escape key check)
 - #85509 (Prevent tab title to "null" if the URL is a search one)

Failed merges:

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

3 years agoRollup merge of #85509 - GuillaumeGomez:search-null-title, r=jsha
Guillaume Gomez [Thu, 20 May 2021 15:56:58 +0000 (17:56 +0200)]
Rollup merge of #85509 - GuillaumeGomez:search-null-title, r=jsha

Prevent tab title to "null" if the URL is a search one

When we arrive on page with a search parameter in the URL, until the results are displayed, the page title is "null". It's because of this code:

```js
if (params.search !== undefined) {
    var search = searchState.outputElement();
    search.innerHTML = "<h3 style=\"text-align: center;\">" +
       searchState.loadingText + "</h3>";
    searchState.showResults(search);
    loadSearch();
}
```

In `searchState.showResults`, we have this:

```js
document.title = searchState.title;
```

But since it's `null`, we set it as title. This PR fixes it.

r? `@jsha`

3 years agoRollup merge of #85507 - GuillaumeGomez:extend-escape-key-check, r=jsha
Guillaume Gomez [Thu, 20 May 2021 15:56:57 +0000 (17:56 +0200)]
Rollup merge of #85507 - GuillaumeGomez:extend-escape-key-check, r=jsha

Extend escape key check

Since #84462 has been merged, we can now extend the `escape-key` test.

r? `@jsha`

3 years agoRollup merge of #85375 - SkiFire13:fix-85347, r=jackh726
Guillaume Gomez [Thu, 20 May 2021 15:56:56 +0000 (17:56 +0200)]
Rollup merge of #85375 - SkiFire13:fix-85347, r=jackh726

Fix missing lifetimes diagnostics after #83759

In #83759 while rebasing I didn't realize there was a new function for suggesting to add lifetime arguments. It relied on some invariants, namely that if a generic type/trait has angle brackets then it must have some generic argument, which is now no longer true. This PR updates that function to handle the new invariants.

This also adds a new regression test but I'm not sure if that's the correct place for it.

Fixes #85347

3 years agoRollup merge of #85326 - infinity0:fix-cross-compile-tools, r=Mark-Simulacrum
Guillaume Gomez [Thu, 20 May 2021 15:56:51 +0000 (17:56 +0200)]
Rollup merge of #85326 - infinity0:fix-cross-compile-tools, r=Mark-Simulacrum

bootstrap: ensure host std when cross-compiling tools, fixes #85320

3 years agoRollup merge of #85275 - CDirkx:memchr, r=m-ou-se
Guillaume Gomez [Thu, 20 May 2021 15:56:46 +0000 (17:56 +0200)]
Rollup merge of #85275 - CDirkx:memchr, r=m-ou-se

Move `std::memchr` to `sys_common`

`std::memchr` is a thin abstraction over the different `memchr` implementations in `sys`, along with documentation and tests. The module is only used internally by `std`, nothing is exported externally. Code like this is exactly what the `sys_common` module is for, so this PR moves it there.

3 years agoAuto merge of #85493 - Amanieu:fix_85446, r=dtolnay
bors [Thu, 20 May 2021 15:49:31 +0000 (15:49 +0000)]
Auto merge of #85493 - Amanieu:fix_85446, r=dtolnay

Update stdarch to fix x86 byte shift intrinsics

Fixes #85446

3 years agoUpgrade minifier version to 0.0.41
Guillaume Gomez [Thu, 20 May 2021 14:51:44 +0000 (16:51 +0200)]
Upgrade minifier version to 0.0.41

3 years agoPrevent tab title to "null" if the URL is a search one
Guillaume Gomez [Thu, 20 May 2021 14:01:08 +0000 (16:01 +0200)]
Prevent tab title to "null" if the URL is a search one

3 years agoAuto merge of #84665 - adamgemmell:aarch64-features, r=Amanieu
bors [Thu, 20 May 2021 13:07:35 +0000 (13:07 +0000)]
Auto merge of #84665 - adamgemmell:aarch64-features, r=Amanieu

Update list of allowed aarch64 features

I recently added these features to std_detect for aarch64 linux, pending [review](https://github.com/rust-lang/stdarch/pull/1146).

I have commented any features not supported by LLVM 9, the current minimum version for Rust. Some (PAuth at least) were renamed between 9 & 12 and I've left them disabled. TME, however, is not in LLVM 9 but I've left it enabled.

See https://github.com/rust-lang/stdarch/issues/993

3 years agoExtend escape key check
Guillaume Gomez [Thu, 20 May 2021 11:37:29 +0000 (13:37 +0200)]
Extend escape key check

3 years agoMerge commit '9e3cd88718cd1912a515d26dbd9c4019fd5a9577' into clippyup
flip1995 [Thu, 20 May 2021 10:30:31 +0000 (12:30 +0200)]
Merge commit '9e3cd88718cd1912a515d26dbd9c4019fd5a9577' into clippyup

3 years agoReset "focusedByTab" field when doing another search
Guillaume Gomez [Thu, 20 May 2021 10:45:25 +0000 (12:45 +0200)]
Reset "focusedByTab" field when doing another search

3 years agoAuto merge of #7252 - flip1995:rustup, r=flip1995
bors [Thu, 20 May 2021 10:07:36 +0000 (10:07 +0000)]
Auto merge of #7252 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

cc `@xFrednet` There was a change to the `rustc_span::FileName` removing the `Display` impl for it. I adapted the metadata collector to compile with that change. I'm not sure if I changed the behavior with this. The path to the string is now printed relative to the `clippy_lints` dir. So for example `src/swap.rs`. I think this should be fine, but probably something to be aware of.

changelog: none

3 years agoBump nightly version -> 2021-05-20
flip1995 [Thu, 20 May 2021 10:06:22 +0000 (12:06 +0200)]
Bump nightly version -> 2021-05-20

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 20 May 2021 09:59:34 +0000 (11:59 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoAuto merge of #85486 - RalfJung:rollup-4ibcxuu, r=RalfJung
bors [Thu, 20 May 2021 07:39:24 +0000 (07:39 +0000)]
Auto merge of #85486 - RalfJung:rollup-4ibcxuu, r=RalfJung

Rollup of 8 pull requests

Successful merges:

 - #84717 (impl FromStr for proc_macro::Literal)
 - #85169 (Add method-toggle to <details> for methods)
 - #85287 (Expose `Concurrent` (private type in public i'face))
 - #85315 (adding time complexity for partition_in_place iter method)
 - #85439 (Add diagnostic item to `CStr`)
 - #85464 (Fix UB in documented example for `ptr::swap`)
 - #85470 (Fix invalid CSS rules for a:hover)
 - #85472 (CTFE Machine: do not expose Allocation)

Failed merges:

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

3 years agoAuto merge of #84697 - CDirkx:util, r=m-ou-se
bors [Thu, 20 May 2021 04:58:13 +0000 (04:58 +0000)]
Auto merge of #84697 - CDirkx:util, r=m-ou-se

Introduce `sys_common::rt::rtprintpanic!` to replace `sys_common::util` functionality

This PR introduces a new macro `rtprintpanic!`, similar to `sys_common::util::dumb_print` and uses that macro to replace all `sys_common::util` functionality.

3 years agoAuto merge of #85391 - Mark-Simulacrum:opt-tostring, r=scottmcm
bors [Thu, 20 May 2021 00:55:27 +0000 (00:55 +0000)]
Auto merge of #85391 - Mark-Simulacrum:opt-tostring, r=scottmcm

Avoid zero-length memcpy in formatting

This has two separate and somewhat orthogonal commits. The first change adjusts the ToString general impl for all types that implement Display; it no longer uses the full format machinery, rather directly falling onto a `std::fmt::Display::fmt` call. The second change directly adjusts the general core::fmt::write function which handles the production of format_args! to avoid zero-length push_str calls.

Both changes target the fact that push_str will still call memmove internally (or a similar function), as it doesn't know the length of the passed string. For zero-length strings in particular, this is quite expensive, and even for very short (several bytes long) strings, this is also expensive. Future work in this area may wish to have us fallback to write_char or similar, which may be cheaper on the (typically) short strings between the interpolated pieces in format_args!.

3 years agoUpdate stdarch to fix x86 byte shift intrinsics
Amanieu d'Antras [Thu, 20 May 2021 00:51:05 +0000 (01:51 +0100)]
Update stdarch to fix x86 byte shift intrinsics

Fixes #85446

3 years agoWindows implementation of `fs::try_exists`
Chris Denton [Tue, 18 May 2021 03:18:46 +0000 (04:18 +0100)]
Windows implementation of `fs::try_exists`

3 years agoMove the implementation of `Path::exists` to `sys_common::fs` so platforms can specia...
Chris Denton [Wed, 17 Mar 2021 03:52:02 +0000 (03:52 +0000)]
Move the implementation of `Path::exists` to `sys_common::fs` so platforms can specialize it

Windows implementation of `fs::try_exists`

3 years agoRollup merge of #85472 - RalfJung:allocation, r=oli-obk
Ralf Jung [Wed, 19 May 2021 22:19:09 +0000 (00:19 +0200)]
Rollup merge of #85472 - RalfJung:allocation, r=oli-obk

CTFE Machine: do not expose Allocation

`Memory` is careful now to not expose direct access to `Allocation`, but this one slipped through.
r? ``@oli-obk``

3 years agoRollup merge of #85470 - GuillaumeGomez:fix-css-rules, r=jsha
Ralf Jung [Wed, 19 May 2021 22:19:08 +0000 (00:19 +0200)]
Rollup merge of #85470 - GuillaumeGomez:fix-css-rules, r=jsha

Fix invalid CSS rules for a:hover

When hovering some links:

![Screenshot from 2021-05-19 15-00-31](https://user-images.githubusercontent.com/3050060/118823585-5f2a4b80-b8b9-11eb-8043-bb7759a178c7.png)
![Screenshot from 2021-05-19 15-00-29](https://user-images.githubusercontent.com/3050060/118823566-5b96c480-b8b9-11eb-8c4e-08e490752fbf.png)

It is a side-effect from #84462.

r? ```@jsha```

3 years agoRollup merge of #85464 - steffahn:fix_ub_in_ptr_swap_docs, r=dtolnay
Ralf Jung [Wed, 19 May 2021 22:19:08 +0000 (00:19 +0200)]
Rollup merge of #85464 - steffahn:fix_ub_in_ptr_swap_docs, r=dtolnay

Fix UB in documented example for `ptr::swap`

Compare [this (short) discussion on zulip](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Pointers.20to.20overlapping.20arrays) (or [in the archive](https://zulip-archive.rust-lang.org/122651general/92017Pointerstooverlappingarrays.html), if you don’t have an account).

``@rustbot`` label T-doc T-libs

3 years agoRollup merge of #85439 - mgacek8:add_diagnostic_item_to_CStr_type, r=davidtwco
Ralf Jung [Wed, 19 May 2021 22:19:07 +0000 (00:19 +0200)]
Rollup merge of #85439 - mgacek8:add_diagnostic_item_to_CStr_type, r=davidtwco

Add diagnostic item to `CStr`

Required for clippy issue: https://github.com/rust-lang/rust-clippy/issues/7145

3 years agoRollup merge of #85315 - satylogin:master, r=yaahc
Ralf Jung [Wed, 19 May 2021 22:19:02 +0000 (00:19 +0200)]
Rollup merge of #85315 - satylogin:master, r=yaahc

adding time complexity for partition_in_place iter method

I feel that one thing missing from rust docs compared to cpp references is existence of time complexity for all methods and functions. While it would be humongous task to include it for everything in single go, it is still doable if we as community keep on adding it in relevant places as and when we find them.

This PR adds the time complexity for partition_in_place method in iter.

3 years agoRollup merge of #85287 - eggyal:expose-test-concurrent, r=m-ou-se
Ralf Jung [Wed, 19 May 2021 22:18:58 +0000 (00:18 +0200)]
Rollup merge of #85287 - eggyal:expose-test-concurrent, r=m-ou-se

Expose `Concurrent` (private type in public i'face)

#53410 introduced experimental support for custom test frameworks.

Such frameworks may wish to build upon `library/test` by calling into its publicly exposed API (which I entirely understand is wholly unstable).  However, any that wish to call `test::run_test` cannot currently do so because `test::options::Concurrent` (the type of its `concurrent` parameter) is not publicly exposed.

3 years agoRollup merge of #85169 - jsha:hoist-classes, r=GuillaumeGomez
Ralf Jung [Wed, 19 May 2021 22:18:57 +0000 (00:18 +0200)]
Rollup merge of #85169 - jsha:hoist-classes, r=GuillaumeGomez

Add method-toggle to <details> for methods

The makes the code for handling "auto-hide" settings more consistent.

Demo at https://hoffman-andrews.com/rust/hoist-classes/std/string/struct.String.html

Fixes #84829

3 years agoRollup merge of #84717 - dtolnay:literalfromstr, r=petrochenkov
Ralf Jung [Wed, 19 May 2021 22:18:56 +0000 (00:18 +0200)]
Rollup merge of #84717 - dtolnay:literalfromstr, r=petrochenkov

impl FromStr for proc_macro::Literal

Note that unlike `impl FromStr for proc_macro::TokenStream`, this impl does not permit whitespace or comments. The input string must consist of nothing but your literal.

- `"1".parse::<Literal>()` ⟶ ok

- `"1.0".parse::<Literal>()` ⟶ ok

- `"'a'".parse::<Literal>()` ⟶ ok

- `"\"\n\"".parse::<Literal>()` ⟶ ok

- `"0 1".parse::<Literal>()` ⟶ LexError

- `" 0".parse::<Literal>()` ⟶ LexError

- `"0 ".parse::<Literal>()` ⟶ LexError

- `"/* comment */0".parse::<Literal>()` ⟶ LexError

- `"0/* comment */".parse::<Literal>()` ⟶ LexError

- `"0// comment".parse::<Literal>()` ⟶ LexError

---

## Use case

```rust
let hex_int: Literal = format!("0x{:x}", int).parse().unwrap();
```

The only way this is expressible in the current API is significantly worse.

```rust
let hex_int = match format!("0x{:x}", int)
    .parse::<TokenStream>()
    .unwrap()
    .into_iter()
    .next()
    .unwrap()
{
    TokenTree::Literal(literal) => literal,
    _ => unreachable!(),
};
```

3 years agoCheck for calls to functions with `#[target_feature]` in THIR unsafeck
LeSeulArtichaut [Fri, 14 May 2021 21:52:34 +0000 (23:52 +0200)]
Check for calls to functions with `#[target_feature]` in THIR unsafeck

3 years agoCheck for raw pointer dereference in THIR unsafeck
LeSeulArtichaut [Fri, 14 May 2021 21:19:59 +0000 (23:19 +0200)]
Check for raw pointer dereference in THIR unsafeck

3 years agoAuto merge of #85340 - the8472:no-inplaceiterable-on-peekable, r=yaahc
bors [Wed, 19 May 2021 21:50:45 +0000 (21:50 +0000)]
Auto merge of #85340 - the8472:no-inplaceiterable-on-peekable, r=yaahc

remove InPlaceIterable marker from Peekable due to unsoundness

The unsoundness is not in Peekable per se, it rather is due to the
interaction between Peekable being able to hold an extra item
and vec::IntoIter's clone implementation shortening the allocation.

An alternative solution would be to change IntoIter's clone implementation
to keep enough spare capacity available.

fixes #85322

3 years ago#[cfg(bootstrap)] out the v1 try_trait stuff
Scott McMurray [Wed, 19 May 2021 19:59:02 +0000 (12:59 -0700)]
#[cfg(bootstrap)] out the v1 try_trait stuff

3 years agoAuto merge of #83842 - LeSeulArtichaut:thir-vec, r=nikomatsakis
bors [Wed, 19 May 2021 18:41:23 +0000 (18:41 +0000)]
Auto merge of #83842 - LeSeulArtichaut:thir-vec, r=nikomatsakis

Store THIR in `IndexVec`s instead of an `Arena`

This is a necessary step to store the THIR in a query: #85273. See [relevant discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/278509-project-thir-unsafeck/topic/THIR-dependent.20queries.20design).

r? `@ghost` cc `@cjgillot` `@nikomatsakis`

3 years agoimpl FromStr for proc_macro::Literal
David Tolnay [Thu, 29 Apr 2021 19:08:35 +0000 (12:08 -0700)]
impl FromStr for proc_macro::Literal

3 years agoAdd proc macro Literal parse test
David Tolnay [Thu, 29 Apr 2021 19:03:35 +0000 (12:03 -0700)]
Add proc macro Literal parse test

3 years agoMake a more meaningful test for Punct eq
David Tolnay [Thu, 29 Apr 2021 18:20:27 +0000 (11:20 -0700)]
Make a more meaningful test for Punct eq

3 years agoMove proc_macro tests to ui test
David Tolnay [Thu, 29 Apr 2021 18:17:44 +0000 (11:17 -0700)]
Move proc_macro tests to ui test

3 years agoMake a ui test to take the role of libproc_macro #[test] tests
David Tolnay [Thu, 29 Apr 2021 18:10:14 +0000 (11:10 -0700)]
Make a ui test to take the role of libproc_macro #[test] tests

3 years agoAuto merge of #84876 - alexcrichton:inline-thread-locals-cross-crate, r=Mark-Simulacrum
bors [Wed, 19 May 2021 15:59:46 +0000 (15:59 +0000)]
Auto merge of #84876 - alexcrichton:inline-thread-locals-cross-crate, r=Mark-Simulacrum

std: Attempt again to inline thread-local-init across crates

Issue #25088 has been part of `thread_local!` for quite some time now.
Historical attempts have been made to add `#[inline]` to `__getit`
in #43931, #50252, and #59720, but these attempts ended up not landing
at the time due to segfaults on Windows.

In the interim though with `const`-initialized thread locals AFAIK this
is the only remaining bug which is why you might want to use
`#[thread_local]` over `thread_local!`. As a result I figured it was
time to resubmit this and see how it fares on CI and if I can help
debugging any issues that crop up.

Closes #25088

3 years agoAuto merge of #7246 - xFrednet:7172-add-lint-level-to-output, r=flip1995
bors [Wed, 19 May 2021 15:23:58 +0000 (15:23 +0000)]
Auto merge of #7246 - xFrednet:7172-add-lint-level-to-output, r=flip1995

Adding the default lint level to the metadata collection

I noticed while working on the website adaption that the lint groups still had the `clippy::` prefix in the JSON output. This PR removes this prefix and adds a `level` field to each lint and with that simplifies the website display and saves performance.

The deprecated lints get are assigned to the level `none`. This is a bit different in comparison to the current lint list, but I believe that this will look better overall. Unless there is any argument against this :).

That's it just a small baby PR in comparison to the original monster ^^

---

See: #7172 for the full metadata collection to-do list or to suggest a new feature in connection to it.

---

changelog: none

r? `@flip1995`

3 years agoFixed a type
Fridtjof Stoldt [Wed, 19 May 2021 15:23:33 +0000 (17:23 +0200)]
Fixed a type

Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agoRemove test for crypto feature ahead of its removal
Adam Gemmell [Wed, 19 May 2021 15:13:52 +0000 (16:13 +0100)]
Remove test for crypto feature ahead of its removal

3 years agoEnsure all crypto components (AES, PMULL, SHA1/2) are available on arm/aarch64
Adam Gemmell [Wed, 19 May 2021 15:13:23 +0000 (16:13 +0100)]
Ensure all crypto components (AES, PMULL, SHA1/2) are available on arm/aarch64

3 years agoRename fptoint to frintts
Adam Gemmell [Wed, 19 May 2021 15:12:30 +0000 (16:12 +0100)]
Rename fptoint to frintts

3 years agoRemove LSE2
Adam Gemmell [Wed, 19 May 2021 15:11:11 +0000 (16:11 +0100)]
Remove LSE2

3 years agoAdding the default lint level to the metadata collection
xFrednet [Wed, 19 May 2021 14:32:09 +0000 (16:32 +0200)]
Adding the default lint level to the metadata collection

And stripping the clippy:: prefix from the group

3 years agoCTFE Machine: do not expose Allocation
Ralf Jung [Wed, 19 May 2021 14:37:17 +0000 (16:37 +0200)]
CTFE Machine: do not expose Allocation

3 years agoAdapt the THIR visitor to the vec-stored THIR
LeSeulArtichaut [Thu, 13 May 2021 20:01:25 +0000 (22:01 +0200)]
Adapt the THIR visitor to the vec-stored THIR

3 years agoStore THIR in `IndexVec`s instead of an `Arena`
LeSeulArtichaut [Sat, 3 Apr 2021 17:58:46 +0000 (19:58 +0200)]
Store THIR in `IndexVec`s instead of an `Arena`

3 years agoRename `rterr` to `rtprintpanic`
Christiaan Dirkx [Thu, 6 May 2021 12:03:50 +0000 (14:03 +0200)]
Rename `rterr` to `rtprintpanic`

3 years agoFix invalid CSS rules for a:hover
Guillaume Gomez [Wed, 19 May 2021 13:37:10 +0000 (15:37 +0200)]
Fix invalid CSS rules for a:hover

3 years agoReplace `sys_common::util::dumb_print` with `rterr!`
Christiaan Dirkx [Thu, 29 Apr 2021 14:10:32 +0000 (16:10 +0200)]
Replace `sys_common::util::dumb_print` with `rterr!`

3 years agoReplace `sys_common::util::report_overflow` with `rterr!`
Christiaan Dirkx [Thu, 29 Apr 2021 14:05:10 +0000 (16:05 +0200)]
Replace `sys_common::util::report_overflow` with `rterr!`

3 years agoRemove `sys_common::util::abort`
Christiaan Dirkx [Thu, 29 Apr 2021 13:59:05 +0000 (15:59 +0200)]
Remove `sys_common::util::abort`

3 years agoIntroduce `sys_common::rt::rterr!`
Christiaan Dirkx [Thu, 29 Apr 2021 13:57:05 +0000 (15:57 +0200)]
Introduce `sys_common::rt::rterr!`

3 years agoFix UB in documented example for `ptr::swap`
Frank Steffahn [Wed, 19 May 2021 10:33:10 +0000 (12:33 +0200)]
Fix UB in documented example for `ptr::swap`

3 years agoAuto merge of #85376 - RalfJung:ptrless-allocs, r=oli-obk
bors [Wed, 19 May 2021 10:11:28 +0000 (10:11 +0000)]
Auto merge of #85376 - RalfJung:ptrless-allocs, r=oli-obk

CTFE core engine allocation & memory API improvemenets

This is a first step towards https://github.com/rust-lang/miri/issues/841.
- make `Allocation` API offset-based (no more making up `Pointer`s just to access an `Allocation`)
- make `Memory` API higher-level (combine checking for access and getting access into one operation)

The Miri-side PR is at https://github.com/rust-lang/miri/pull/1804.
r? `@oli-obk`

3 years agoAuto merge of #85276 - Bobo1239:more_dso_local, r=nagisa
bors [Wed, 19 May 2021 07:25:17 +0000 (07:25 +0000)]
Auto merge of #85276 - Bobo1239:more_dso_local, r=nagisa

Set dso_local for more items

Related to https://github.com/rust-lang/rust/pull/83592. (cc `@nagisa)`

Noticed that on x86_64 with `relocation-model: static` `R_X86_64_GOTPCREL` relocations were still generated in some cases. (related: https://github.com/Rust-for-Linux/linux/issues/135; Rust-for-Linux needs these fixes to successfully build)

First time doing anything with LLVM so not sure whether this is correct but the following are some of the things I've tried to convince myself.

## C equivalent

Example from clang which also sets `dso_local` in these cases:
`clang-12 -fno-PIC -S -emit-llvm test.c`
```C
extern int A;

int* a() {
    return &A;
}

int B;

int* b() {
    return &B;
}
```
```
; ModuleID = 'test.c'
source_filename = "test.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

`@A` = external dso_local global i32, align 4
`@B` = dso_local global i32 0, align 4

; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32* `@a()` #0 {
  ret i32* `@A`
}

; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32* `@b()` #0 {
  ret i32* `@B`
}

attributes #0 = { noinline nounwind optnone uwtable "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }

!llvm.module.flags = !{!0}
!llvm.ident = !{!1}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project/ b978a93635b584db380274d7c8963c73989944a1)"}
```
`clang-12 -fno-PIC -c test.c`
`objdump test.o -r`:
```
test.o:     file format elf64-x86-64

RELOCATION RECORDS FOR [.text]:
OFFSET           TYPE              VALUE
0000000000000006 R_X86_64_64       A
0000000000000016 R_X86_64_64       B

RELOCATION RECORDS FOR [.eh_frame]:
OFFSET           TYPE              VALUE
0000000000000020 R_X86_64_PC32     .text
0000000000000040 R_X86_64_PC32     .text+0x0000000000000010
```

## Comparison to pre-LLVM 12 output

`rustc --emit=obj,llvm-ir --target=x86_64-unknown-none-linuxkernel --crate-type rlib test.rs`
```Rust
#![feature(no_core, lang_items)]
#![no_core]

#[lang="sized"]
trait Sized {}

#[lang="sync"]
trait Sync {}

#[lang = "drop_in_place"]
pub unsafe fn drop_in_place<T: ?Sized>(_: *mut T) {}

impl Sync for i32 {}

pub static STATIC: i32 = 32;

extern {
    pub static EXT_STATIC: i32;
}

pub fn a() -> &'static i32 {
    &STATIC
}
pub fn b() -> &'static i32 {
    unsafe {&EXT_STATIC}
}
```
`objdump test.o -r`
nightly-2021-02-20 (rustc target is `x86_64-linux-kernel`):
```
RELOCATION RECORDS FOR [.text._ZN4test1a17h1024ba65f3424175E]:
OFFSET           TYPE              VALUE
0000000000000007 R_X86_64_32S      _ZN4test6STATIC17h3adc41a83746c9ffE

RELOCATION RECORDS FOR [.text._ZN4test1b17h86a6a80c1190ac8dE]:
OFFSET           TYPE              VALUE
0000000000000007 R_X86_64_32S      EXT_STATIC
```
nightly-2021-05-10:
```
RELOCATION RECORDS FOR [.text._ZN4test1a17he846f03bf37b2d20E]:
OFFSET           TYPE              VALUE
0000000000000007 R_X86_64_GOTPCREL  _ZN4test6STATIC17h5a059515bf3d4968E-0x0000000000000004

RELOCATION RECORDS FOR [.text._ZN4test1b17h7e0f7f80fbd91125E]:
OFFSET           TYPE              VALUE
0000000000000007 R_X86_64_GOTPCREL  EXT_STATIC-0x0000000000000004
```
This PR:
```
RELOCATION RECORDS FOR [.text._ZN4test1a17he846f03bf37b2d20E]:
OFFSET           TYPE              VALUE
0000000000000007 R_X86_64_32S      _ZN4test6STATIC17h5a059515bf3d4968E

RELOCATION RECORDS FOR [.text._ZN4test1b17h7e0f7f80fbd91125E]:
OFFSET           TYPE              VALUE
0000000000000007 R_X86_64_32S      EXT_STATIC
```