]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAdd padding to mobile layout and fix width issue on both
Stefan Schindler [Sat, 22 May 2021 09:01:33 +0000 (09:01 +0000)]
Add padding to mobile layout and fix width issue on both

3 years agoPrepar to remove deep nesting
Stefan Schindler [Fri, 21 May 2021 21:54:49 +0000 (23:54 +0200)]
Prepar to remove deep nesting

3 years agoImplement staggered mobile layout
Stefan Schindler [Fri, 21 May 2021 21:11:06 +0000 (23:11 +0200)]
Implement staggered mobile layout

3 years agoFix search results display
Guillaume Gomez [Fri, 21 May 2021 14:39:03 +0000 (16:39 +0200)]
Fix search results display

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 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 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 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 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 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 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 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 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
```

3 years agoAuto merge of #85458 - jackh726:rollup-zvvybmt, r=jackh726
bors [Wed, 19 May 2021 04:44:09 +0000 (04:44 +0000)]
Auto merge of #85458 - jackh726:rollup-zvvybmt, r=jackh726

Rollup of 8 pull requests

Successful merges:

 - #83366 (Stabilize extended_key_value_attributes)
 - #83767 (Fix v0 symbol mangling bug)
 - #84883 (compiletest: "fix" FileCheck with --allow-unused-prefixes)
 - #85274 (Only pass --[no-]gc-sections if linker is GNU ld.)
 - #85297 (bootstrap: build cargo only if requested in tools)
 - #85396 (rustdoc: restore header sizes)
 - #85425 (Fix must_use on `Option::is_none`)
 - #85438 (Fix escape handling)

Failed merges:

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

3 years agoRollup merge of #85438 - GuillaumeGomez:fix-escape-handling, r=jsha
Jack Huey [Wed, 19 May 2021 02:36:19 +0000 (22:36 -0400)]
Rollup merge of #85438 - GuillaumeGomez:fix-escape-handling, r=jsha

Fix escape handling

Currently, when we press Escape while on the search results, nothing is happening, this PR fixes it.

More information: it's because in case the element doesn't exist, `hasClass` will return `null`, which coerces into `false` with the `!` comparison operator. But even if it returned `false`, it would still be an issue because if the element doesn't exist, it means it's hidden so in this case it's just as good, hence the additional check I added.

r? ``@jsha``

3 years agoRollup merge of #85425 - mbartlett21:patch-1, r=scottmcm
Jack Huey [Wed, 19 May 2021 02:36:18 +0000 (22:36 -0400)]
Rollup merge of #85425 - mbartlett21:patch-1, r=scottmcm

Fix must_use on `Option::is_none`

This fixes the `#[must_use = ...]` on `Option::is_none` to have a working suggestion.

3 years agoRollup merge of #85396 - jsha:top-doc-font-sizes, r=GuillaumeGomez
Jack Huey [Wed, 19 May 2021 02:36:13 +0000 (22:36 -0400)]
Rollup merge of #85396 - jsha:top-doc-font-sizes, r=GuillaumeGomez

rustdoc: restore header sizes

The `<details>` toggle work changed the relationship from #main to the top-doc docblock so it was no longer a parent relationship but a great-grandparent relationship. This updates the CSS rules that set the heading sizes so they still apply.

Fixes #85389

r? ``@camelid``

3 years agoRollup merge of #85297 - infinity0:master, r=Mark-Simulacrum
Jack Huey [Wed, 19 May 2021 02:36:08 +0000 (22:36 -0400)]
Rollup merge of #85297 - infinity0:master, r=Mark-Simulacrum

bootstrap: build cargo only if requested in tools

In Debian we'd like to build rustfmt and clippy alongside rustc, but we're still excluding cargo from the rustc build and doing that separately. This patch makes that possible.

3 years agoRollup merge of #85274 - luqmana:linker-is-gnu-gc-sections, r=petrochenkov
Jack Huey [Wed, 19 May 2021 02:36:04 +0000 (22:36 -0400)]
Rollup merge of #85274 - luqmana:linker-is-gnu-gc-sections, r=petrochenkov

Only pass --[no-]gc-sections if linker is GNU ld.

Fixes a regression from #84468 where linking now fails with solaris linkers. LinkerFlavor::Gcc does not always mean GNU ld specifically. And in the case of at least the solaris ld in illumos, that flag is unrecognized and will cause the linking step to fail.

Even though removing the `is_like_solaris` branch from `gc_sections` in #84468 made sense as `-z ignore/record` are more analogous to the `--[no-]-as-needed` flags, it inadvertently caused solaris linkers to be passed the `--gc-sections` flag. So let's just change it to be more explicit about when we pass those flags.

3 years agoRollup merge of #84883 - durin42:allow-unused-prefixes, r=nikic
Jack Huey [Wed, 19 May 2021 02:35:59 +0000 (22:35 -0400)]
Rollup merge of #84883 - durin42:allow-unused-prefixes, r=nikic

compiletest: "fix" FileCheck with --allow-unused-prefixes

The default of --allow-unused-prefixes used to be false, but in LLVM
change 87dbdd2e3b (https://reviews.llvm.org/D95849) the default became
true. I'm not quite sure how we could do better here (specifically not
providing the CHECK prefix when it's not needed), but this seems to work
for now.

This reduces codegen test failures against LLVM HEAD from 31 cases to 5.

3 years agoRollup merge of #83767 - camelid:mangle-v0-fix, r=nikomatsakis
Jack Huey [Wed, 19 May 2021 02:35:55 +0000 (22:35 -0400)]
Rollup merge of #83767 - camelid:mangle-v0-fix, r=nikomatsakis

Fix v0 symbol mangling bug

Fixes #83611.

r? ``@jackh726``

3 years agoRollup merge of #83366 - jyn514:stabilize-key-value-attrs, r=petrochenkov
Jack Huey [Wed, 19 May 2021 02:35:54 +0000 (22:35 -0400)]
Rollup merge of #83366 - jyn514:stabilize-key-value-attrs, r=petrochenkov

Stabilize extended_key_value_attributes

Closes https://github.com/rust-lang/rust/issues/44732. Closes https://github.com/rust-lang/rust/issues/78835. Closes https://github.com/rust-lang/rust/issues/82768 (by making it irrelevant).

 # Stabilization report

 ## Summary

This stabilizes using macro expansion in key-value attributes, like so:

 ```rust
 #[doc = include_str!("my_doc.md")]
 struct S;

 #[path = concat!(env!("OUT_DIR"), "/generated.rs")]
 mod m;
 ```

See Petrochenkov's excellent blog post [on internals](https://internals.rust-lang.org/t/macro-expansion-points-in-attributes/11455)
for alternatives that were considered and rejected ("why accept no more and no less?")

This has been available on nightly since 1.50 with no major issues.

## Notes

### Accepted syntax

The parser accepts arbitrary Rust expressions in this position, but any expression other than a macro invocation will ultimately lead to an error because it is not expected by the built-in expression forms (e.g., `#[doc]`).  Note that decorators and the like may be able to observe other expression forms.

### Expansion ordering

Expansion of macro expressions in "inert" attributes occurs after decorators have executed, analogously to macro expressions appearing in the function body or other parts of decorator input.

There is currently no way for decorators to accept macros in key-value position if macro expansion must be performed before the decorator executes (if the macro can simply be copied into the output for later expansion, that can work).

## Test cases

 - https://github.com/rust-lang/rust/blob/master/src/test/ui/attributes/key-value-expansion-on-mac.rs
 - https://github.com/rust-lang/rust/blob/master/src/test/rustdoc/external-doc.rs

The feature has also been dogfooded extensively in the compiler and
standard library:

- https://github.com/rust-lang/rust/pull/83329
- https://github.com/rust-lang/rust/pull/83230
- https://github.com/rust-lang/rust/pull/82641
- https://github.com/rust-lang/rust/pull/80534

## Implementation history

- Initial proposal: https://github.com/rust-lang/rust/issues/55414#issuecomment-554005412
- Experiment to see how much code it would break: https://github.com/rust-lang/rust/pull/67121
- Preliminary work to restrict expansion that would conflict with this
feature: https://github.com/rust-lang/rust/pull/77271
- Initial implementation: https://github.com/rust-lang/rust/pull/78837
- Fix for an ICE: https://github.com/rust-lang/rust/pull/80563

## Unresolved Questions

~~https://github.com/rust-lang/rust/pull/83366#issuecomment-805180738 listed some concerns, but they have been resolved as of this final report.~~

 ## Additional Information

 There are two workarounds that have a similar effect for `#[doc]`
attributes on nightly. One is to emulate this behavior by using a limited version of this feature that was stabilized for historical reasons:

```rust
macro_rules! forward_inner_docs {
    ($e:expr => $i:item) => {
        #[doc = $e]
        $i
    };
}

forward_inner_docs!(include_str!("lib.rs") => struct S {});
```

This also works for other attributes (like `#[path = concat!(...)]`).
The other is to use `doc(include)`:

```rust
 #![feature(external_doc)]
 #[doc(include = "lib.rs")]
 struct S {}
```

The first works, but is non-trivial for people to discover, and
difficult to read and maintain. The second is a strange special-case for
a particular use of the macro. This generalizes it to work for any use
case, not just including files.

I plan to remove `doc(include)` when this is stabilized
(https://github.com/rust-lang/rust/pull/82539). The `forward_inner_docs`
workaround will still compile without warnings, but I expect it to be
used less once it's no longer necessary.

3 years agoAdd method-toggle to <details> for methods.
Jacob Hoffman-Andrews [Mon, 10 May 2021 23:41:41 +0000 (16:41 -0700)]
Add method-toggle to <details> for methods.

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

3 years agoAuto merge of #85176 - a1phyr:impl_clone_from, r=yaahc
bors [Wed, 19 May 2021 02:17:41 +0000 (02:17 +0000)]
Auto merge of #85176 - a1phyr:impl_clone_from, r=yaahc

Override `clone_from` for some types

Override `clone_from` method of the `Clone` trait for:
- `cell::RefCell`
- `cmp::Reverse`
- `io::Cursor`
- `mem::ManuallyDrop`

This can bring performance improvements.

3 years agofrom review: more robust test
the8472 [Sun, 16 May 2021 13:35:05 +0000 (15:35 +0200)]
from review: more robust test

This also checks the contents and not only the capacity in case IntoIter's clone implementation is changed to add capacity at the end. Extra capacity at the beginning would be needed to make InPlaceIterable work.

Co-authored-by: Giacomo Stevanato <giaco.stevanato@gmail.com>
3 years agoadd regression test
The8472 [Sat, 15 May 2021 18:41:15 +0000 (20:41 +0200)]
add regression test

3 years agoremove InPlaceIterable marker from Peekable due to unsoundness
The8472 [Sat, 15 May 2021 18:08:09 +0000 (20:08 +0200)]
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.

3 years agoAuto merge of #84767 - scottmcm:try_trait_actual, r=lcnr
bors [Tue, 18 May 2021 20:50:01 +0000 (20:50 +0000)]
Auto merge of #84767 - scottmcm:try_trait_actual, r=lcnr

Implement the new desugaring from `try_trait_v2`

~~Currently blocked on https://github.com/rust-lang/rust/issues/84782, which has a PR in https://github.com/rust-lang/rust/pull/84811~~ Rebased atop that fix.

`try_trait_v2` tracking issue: https://github.com/rust-lang/rust/issues/84277

Unfortunately this is already touching a ton of things, so if you have suggestions for good ways to split it up, I'd be happy to hear them.  (The combination between the use in the library, the compiler changes, the corresponding diagnostic differences, even MIR tests mean that I don't really have a great plan for it other than trying to have decently-readable commits.

r? `@ghost`

~~(This probably shouldn't go in during the last week before the fork anyway.)~~ Fork happened.

3 years agoNo matter how trivial the change, tidy always finds a way to complain...
Scott McMurray [Tue, 18 May 2021 18:48:00 +0000 (11:48 -0700)]
No matter how trivial the change, tidy always finds a way to complain...

3 years agoMention the issue number for the new mir-opt in the FIXMEs
scottmcm [Tue, 18 May 2021 18:29:34 +0000 (18:29 +0000)]
Mention the issue number for the new mir-opt in the FIXMEs

Thanks for the suggestions, lcnr!

Co-authored-by: lcnr <rust@lcnr.de>
3 years agostd: Attempt again to inline thread-local-init across crates
Alex Crichton [Mon, 3 May 2021 18:39:10 +0000 (11:39 -0700)]
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 agoSet dso_local for more items
Boris-Chengbiao Zhou [Fri, 14 May 2021 01:47:41 +0000 (03:47 +0200)]
Set dso_local for more items

3 years agoFix assembly test from #83592
Boris-Chengbiao Zhou [Thu, 13 May 2021 23:56:00 +0000 (01:56 +0200)]
Fix assembly test from #83592

The test case wasn't actually checked for x64 due to a small difference in the name.

3 years agoAuto merge of #85443 - RalfJung:rollup-d9gd64t, r=RalfJung
bors [Tue, 18 May 2021 18:04:47 +0000 (18:04 +0000)]
Auto merge of #85443 - RalfJung:rollup-d9gd64t, r=RalfJung

Rollup of 7 pull requests

Successful merges:

 - #84462 (rustdoc: use focus for search navigation)
 - #85251 (Make `const_generics_defaults` not an incomplete feature)
 - #85404 (Backport 1.52.1 release notes)
 - #85407 (Improve display for "copy-path" button, making it more discreet)
 - #85423 (Don't require cmake on Windows when LLVM isn't being built)
 - #85428 (Add x.py pre-setup instructions)
 - #85442 (fix typo)

Failed merges:

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

3 years agoRollup merge of #85442 - imjorge:patch-1, r=jonas-schievink
Ralf Jung [Tue, 18 May 2021 17:35:48 +0000 (19:35 +0200)]
Rollup merge of #85442 - imjorge:patch-1, r=jonas-schievink

fix typo

3 years agoRollup merge of #85428 - leebradley:add-xpy-presetup-instructions, r=Mark-Simulacrum
Ralf Jung [Tue, 18 May 2021 17:35:47 +0000 (19:35 +0200)]
Rollup merge of #85428 - leebradley:add-xpy-presetup-instructions, r=Mark-Simulacrum

Add x.py pre-setup instructions

This change adds pre-setup instructions that outline how x.py requires
python to be setup and how to work around the problem of x.py failing to
locate python, especially now that Ubuntu 20.04's dropped default python
command is causing people to encounter this issue regularly.

See also: #71818

3 years agoRollup merge of #85423 - jyn514:cmake, r=Mark-Simulacrum
Ralf Jung [Tue, 18 May 2021 17:35:46 +0000 (19:35 +0200)]
Rollup merge of #85423 - jyn514:cmake, r=Mark-Simulacrum

Don't require cmake on Windows when LLVM isn't being built

Previously, setting `download-ci-llvm = true` when cmake wasn't
installed would give the following error:

```
failed to execute command: "cmake" "--help"
error: The system cannot find the file specified. (os error 2)
```

3 years agoRollup merge of #85407 - GuillaumeGomez:copy-path-display-improvement, r=jsha
Ralf Jung [Tue, 18 May 2021 17:35:45 +0000 (19:35 +0200)]
Rollup merge of #85407 - GuillaumeGomez:copy-path-display-improvement, r=jsha

Improve display for "copy-path" button, making it more discreet

As suggested by `@Nemo157` [here](https://github.com/rust-lang/rust/pull/85118#issuecomment-838887670):

![Screenshot from 2021-05-18 11-18-49](https://user-images.githubusercontent.com/3050060/118626882-899ddb00-b7cb-11eb-84c5-ef68dee5e351.png)
![Screenshot from 2021-05-18 11-15-06](https://user-images.githubusercontent.com/3050060/118626880-899ddb00-b7cb-11eb-95c1-2f3bacd22374.png)
![Screenshot from 2021-05-18 11-18-54](https://user-images.githubusercontent.com/3050060/118626885-8a367180-b7cb-11eb-870c-7acdf4259bef.png)
![Screenshot from 2021-05-18 11-15-00](https://user-images.githubusercontent.com/3050060/118626877-89054480-b7cb-11eb-9efc-9a0f153964ce.png)
![Screenshot from 2021-05-18 11-18-58](https://user-images.githubusercontent.com/3050060/118626888-8a367180-b7cb-11eb-91bb-47867cd0f2cc.png)
![Screenshot from 2021-05-18 11-19-00](https://user-images.githubusercontent.com/3050060/118626891-8acf0800-b7cb-11eb-9e3d-d2937b361524.png)

r? `@jsha`

3 years agoRollup merge of #85404 - pietroalbini:relnotes-1.52.1, r=Mark-Simulacrum
Ralf Jung [Tue, 18 May 2021 17:35:44 +0000 (19:35 +0200)]
Rollup merge of #85404 - pietroalbini:relnotes-1.52.1, r=Mark-Simulacrum

Backport 1.52.1 release notes

This PR backports the 1.52.1 release notes to master, fixing https://github.com/rust-lang/rust/issues/85235.

r? `@Mark-Simulacrum`
`@rustbot` modify-labels: beta-accepted beta-nominated T-release

3 years agoRollup merge of #85251 - BoxyUwU:constparamdefaultsany%, r=lcnr
Ralf Jung [Tue, 18 May 2021 17:35:40 +0000 (19:35 +0200)]
Rollup merge of #85251 - BoxyUwU:constparamdefaultsany%, r=lcnr

Make `const_generics_defaults` not an incomplete feature

r? `@lcnr`

3 years agoRollup merge of #84462 - jsha:focus-search-results2, r=GuillaumeGomez
Ralf Jung [Tue, 18 May 2021 17:35:35 +0000 (19:35 +0200)]
Rollup merge of #84462 - jsha:focus-search-results2, r=GuillaumeGomez

rustdoc: use focus for search navigation

Rather than keeping track of highlighted element inside the JS, take advantage of `.focus()` and the :focus CSS pseudo-class.

This required wrapping each row of results in one big `<a>` tag (because anchors can be focused, but table rows cannot). That in turn required moving from a table layout to a div layout with float.

This makes it so Ctrl+Enter opens links in new tabs, and using the arrow keys to navigate off the bottom of the page scrolls the rest of the page into view. It also simplifies the keyboard event handling. It eliminates the need for click handlers on the search results, and for tracking mouse movements.

This changes the UI treatment of mouse hovering. A hovered element now gets a light grey background, but does not change the focus. It's possible to have two highlighted search results: one that is focused (via keyboard) and one that is hovered (via mouse). Pressing enter will activate the focused link; clicking will activate the hovered link. This matches up with how Firefox and Chrome handle suggestions in their URL bar, and avoids stray mouse movements changing the focus.

Selecting tabs is now done with left/right arrows while any search result is focused. The visibility of results on each search tab is
controlled with the "active" class, rather than by setting display: none directly. Note that the old code kept track of highlighted search element when tabbing back and forth. The new code doesn't.

Demo at https://hoffman-andrews.com/rust/focus-search-results2/std/?search=fn

Fixes #84384
Fixes #79962
Fixes #79872

3 years agofix mplace_access_checked with forced alignment
Ralf Jung [Mon, 17 May 2021 11:38:15 +0000 (13:38 +0200)]
fix mplace_access_checked with forced alignment

3 years agoadd Align::ONE; add methods to access alloc.extra
Ralf Jung [Mon, 17 May 2021 11:08:12 +0000 (13:08 +0200)]
add Align::ONE; add methods to access alloc.extra

3 years agoreduce number of allocation lookups during copy
Ralf Jung [Mon, 17 May 2021 09:29:49 +0000 (11:29 +0200)]
reduce number of allocation lookups during copy

3 years agoCTFE core engine allocation & memory API improvemenets
Ralf Jung [Sun, 16 May 2021 16:53:20 +0000 (18:53 +0200)]
CTFE core engine allocation & memory API improvemenets

- make Allocation API offset-based (no more Pointer)
- make Memory API higher-level (combine checking for access and getting access into one operation)

3 years agofix typo
Jorge Ferreira [Tue, 18 May 2021 16:05:40 +0000 (17:05 +0100)]
fix typo

3 years agoAuto merge of #85437 - GuillaumeGomez:rollup-3jcirty, r=GuillaumeGomez
bors [Tue, 18 May 2021 14:48:53 +0000 (14:48 +0000)]
Auto merge of #85437 - GuillaumeGomez:rollup-3jcirty, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #84587 (rustdoc: Make "rust code block is empty" and "could not parse code block" warnings a lint (`INVALID_RUST_CODEBLOCKS`))
 - #85280 (Toggle-wrap items differently than top-doc.)
 - #85338 (Implement more Iterator methods on core::iter::Repeat)
 - #85339 (Report an error if a lang item has the wrong number of generic arguments)
 - #85369 (Suggest borrowing if a trait implementation is found for &/&mut <type>)
 - #85393 (Suppress spurious errors inside `async fn`)
 - #85415 (Clean up remnants of BorrowOfPackedField)

Failed merges:

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

3 years agoAdd diagnostic item to `CStr`
Mateusz Gacek [Tue, 18 May 2021 13:33:38 +0000 (15:33 +0200)]
Add diagnostic item to `CStr`

3 years agoAdd GUI tests for escape handling
Guillaume Gomez [Tue, 18 May 2021 12:51:54 +0000 (14:51 +0200)]
Add GUI tests for escape handling

3 years agoFix escape handling on search results
Guillaume Gomez [Tue, 18 May 2021 12:32:20 +0000 (14:32 +0200)]
Fix escape handling on search results

3 years agoRollup merge of #85415 - LeSeulArtichaut:no-packed-borrow-unsafeck, r=RalfJung
Guillaume Gomez [Tue, 18 May 2021 12:08:57 +0000 (14:08 +0200)]
Rollup merge of #85415 - LeSeulArtichaut:no-packed-borrow-unsafeck, r=RalfJung

Clean up remnants of BorrowOfPackedField

cc #82525 which removed `BorrowOfPackedField` from unsafety-checking
r? `@RalfJung`

3 years agoRollup merge of #85393 - Aaron1011:async-type-err, r=varkor
Guillaume Gomez [Tue, 18 May 2021 12:08:56 +0000 (14:08 +0200)]
Rollup merge of #85393 - Aaron1011:async-type-err, r=varkor

Suppress spurious errors inside `async fn`

Fixes #73741

3 years agoRollup merge of #85369 - FabianWolff:issue-84973, r=jackh726
Guillaume Gomez [Tue, 18 May 2021 12:08:55 +0000 (14:08 +0200)]
Rollup merge of #85369 - FabianWolff:issue-84973, r=jackh726

Suggest borrowing if a trait implementation is found for &/&mut <type>

This pull request fixes #84973 by suggesting to borrow if a trait is not implemented for some type `T`, but it is for `&T` or `&mut T`. For instance:
```rust
trait Ti {}
impl<T> Ti for &T {}
fn foo<T: Ti>(_: T) {}

trait Tm {}
impl<T> Tm for &mut T {}
fn bar<T: Tm>(_: T) {}

fn main() {
    let a: i32 = 5;
    foo(a);

    let b: Box<i32> = Box::new(42);
    bar(b);
}
```
gives, on current nightly:
```
error[E0277]: the trait bound `i32: Ti` is not satisfied
  --> t2.rs:11:9
   |
3  | fn foo<T: Ti>(_: T) {}
   |           -- required by this bound in `foo`
...
11 |     foo(a);
   |         ^ the trait `Ti` is not implemented for `i32`

error[E0277]: the trait bound `Box<i32>: Tm` is not satisfied
  --> t2.rs:14:9
   |
7  | fn bar<T: Tm>(_: T) {}
   |           -- required by this bound in `bar`
...
14 |     bar(b);
   |         ^ the trait `Tm` is not implemented for `Box<i32>`

error: aborting due to 2 previous errors
```
whereas with my changes, I get:
```
error[E0277]: the trait bound `i32: Ti` is not satisfied
  --> t2.rs:11:9
   |
3  | fn foo<T: Ti>(_: T) {}
   |           -- required by this bound in `foo`
...
11 |     foo(a);
   |         ^
   |         |
   |         expected an implementor of trait `Ti`
   |         help: consider borrowing here: `&a`

error[E0277]: the trait bound `Box<i32>: Tm` is not satisfied
  --> t2.rs:14:9
   |
7  | fn bar<T: Tm>(_: T) {}
   |           -- required by this bound in `bar`
...
14 |     bar(b);
   |         ^
   |         |
   |         expected an implementor of trait `Tm`
   |         help: consider borrowing mutably here: `&mut b`

error: aborting due to 2 previous errors
```
In my implementation, I have added a "blacklist" to make these suggestions flexible. In particular, suggesting to borrow can interfere with other suggestions, such as to add another trait bound to a generic argument. I have tried to configure this blacklist to cause the least amount of test case failures, i.e. to model the current behavior as closely as possible (I only had to change one existing test case, and this change was quite clearly an improvement).