]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoDon't try to use wasm intrinsics on vectors
Alex Crichton [Sun, 9 Aug 2020 01:09:40 +0000 (18:09 -0700)]
Don't try to use wasm intrinsics on vectors

This commit fixes an issue with #74695 where the fptosi and fptoui
specializations on wasm were accidentally used on vector types by the
`simd_cast` intrinsic. This issue showed up as broken CI for the stdsimd
crate. Here this commit simply skips the specialization on vector kinds
flowing into `fpto{s,u}i`.

3 years agoAuto merge of #74533 - nikic:issue-74425, r=eddyb
bors [Sat, 8 Aug 2020 13:33:53 +0000 (13:33 +0000)]
Auto merge of #74533 - nikic:issue-74425, r=eddyb

Emit == null instead of <= null for niche check

When the niche maximum is zero, emit a "== zero" check instead of a "<= zero" check. In particular, this avoids the awkward case of "<= null". While LLVM does canonicalize this to "== null", this apparently doesn't happen for constant expressions, leading to the issue in #74425. While that can be addressed on the LLVM side, it still seems prudent to emit sensible IR here, because this will allow null checks to be optimized earlier in the pipeline.

Fixes #74425.

3 years agoAuto merge of #74289 - lzutao:unroll, r=LukasKalbertodt
bors [Sat, 8 Aug 2020 11:34:18 +0000 (11:34 +0000)]
Auto merge of #74289 - lzutao:unroll, r=LukasKalbertodt

Remove some redundant parts from `unrolled_find_u16s`

See each commit message for details.

r? @wesleywiser from old PR #67705 .

3 years agoAuto merge of #75282 - RalfJung:miri-black-box, r=oli-obk
bors [Sat, 8 Aug 2020 09:46:16 +0000 (09:46 +0000)]
Auto merge of #75282 - RalfJung:miri-black-box, r=oli-obk

do not call black_box on Miri

Helps with https://github.com/rust-lang/rust/issues/75274 (but https://github.com/rust-lang/rust/pull/74932 introduced unrelated breakage that will need a separate fix)
Cc @eggyal r? @Mark-Simulacrum

3 years agomake black_box a NOP in Miri
Ralf Jung [Sat, 8 Aug 2020 08:36:16 +0000 (10:36 +0200)]
make black_box a NOP in Miri

3 years agoEmit == null instead of <= null
Nikita Popov [Sun, 19 Jul 2020 18:57:49 +0000 (20:57 +0200)]
Emit == null instead of <= null

When the niche maximum is zero, emit a "== zero" check instead of
a "<= zero" check. In particular, this avoid the awkward case of
"<= null". While LLVM does canonicalize this to "!= null", this
appently doesn't happen for constant expressions, leading to the
issue in #74425. While that can be addressed on the LLVM side, it
still seems prudent to emit sensible IR here, because this will
allow null checks to be optimized earlier in the pipeline.

Fixes #74425.

3 years agoAuto merge of #75257 - ssomers:btree_74762_again, r=Mark-Simulacrum
bors [Sat, 8 Aug 2020 07:46:04 +0000 (07:46 +0000)]
Auto merge of #75257 - ssomers:btree_74762_again, r=Mark-Simulacrum

BTreeMap: better way to postpone root access in DrainFilter

A slightly more elegant (in my opinion) adaptation of #74762. Benchmarks seem irrationally pleased to:
```
benchcmp old new --threshold 5
 name                                           old ns/iter  new ns/iter  diff ns/iter   diff %  speedup
 btree::map::clone_fat_100_and_remove_all       215,182      185,052           -30,130  -14.00%   x 1.16
 btree::map::clone_fat_100_and_remove_half      139,667      127,945           -11,722   -8.39%   x 1.09
 btree::map::clone_fat_val_100_and_remove_all   96,755       81,279            -15,476  -16.00%   x 1.19
 btree::map::clone_fat_val_100_and_remove_half  64,678       56,911             -7,767  -12.01%   x 1.14
 btree::map::find_rand_100                      18           17                     -1   -5.56%   x 1.06
 btree::map::first_and_last_0                   33           35                      2    6.06%   x 0.94
 btree::map::first_and_last_100                 40           54                     14   35.00%   x 0.74
 btree::map::insert_rand_100                    45           42                     -3   -6.67%   x 1.07
 btree::map::insert_rand_10_000                 45           41                     -4   -8.89%   x 1.10
 btree::map::iter_0                             2,010        1,759                -251  -12.49%   x 1.14
 btree::map::iter_100                           3,514        2,764                -750  -21.34%   x 1.27
 btree::map::iter_10k                           4,018        3,768                -250   -6.22%   x 1.07
 btree::map::range_unbounded_unbounded          37,269       28,929             -8,340  -22.38%   x 1.29
 btree::map::range_unbounded_vs_iter            31,518       28,814             -2,704   -8.58%   x 1.09
```

r? @Mark-Simulacrum

3 years agoAuto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkov
bors [Sat, 8 Aug 2020 05:58:57 +0000 (05:58 +0000)]
Auto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkov

Remove `librustc_ast` session globals

By moving the data onto `Session`.

r? @petrochenkov

3 years agoAuto merge of #75276 - JohnTitor:rollup-rz4hs0w, r=JohnTitor
bors [Sat, 8 Aug 2020 03:54:33 +0000 (03:54 +0000)]
Auto merge of #75276 - JohnTitor:rollup-rz4hs0w, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #75224 (Don't call a function in function-arguments-naked.rs)
 - #75237 (Display elided lifetime for non-reference type in doc)
 - #75250 (make MaybeUninit::as_(mut_)ptr const)
 - #75253 (clean up const-hacks in int endianess conversion functions)
 - #75259 (Add missing backtick)
 - #75267 (Small cleanup)
 - #75270 (fix a couple of clippy findings)

Failed merges:

r? @ghost

3 years agoRollup merge of #75270 - matthiaskrgr:clippy_aug_1, r=Dylan-DPC
Yuki Okushi [Sat, 8 Aug 2020 02:36:12 +0000 (11:36 +0900)]
Rollup merge of #75270 - matthiaskrgr:clippy_aug_1, r=Dylan-DPC

fix a couple of clippy findings

3 years agoRollup merge of #75267 - estebank:cleanup, r=Dylan-DPC
Yuki Okushi [Sat, 8 Aug 2020 02:36:10 +0000 (11:36 +0900)]
Rollup merge of #75267 - estebank:cleanup, r=Dylan-DPC

Small cleanup

* Add docstring to `Parser` field
* Remove unnecessary `unwrap`
* Remove unnecessary borrow
* Fix indentation of some `teach`text output

3 years agoRollup merge of #75259 - giraffate:add_missing_backtick, r=lcnr
Yuki Okushi [Sat, 8 Aug 2020 02:36:09 +0000 (11:36 +0900)]
Rollup merge of #75259 - giraffate:add_missing_backtick, r=lcnr

Add missing backtick

3 years agoRollup merge of #75253 - RalfJung:cleanup-const-hack, r=oli-obk
Yuki Okushi [Sat, 8 Aug 2020 02:36:07 +0000 (11:36 +0900)]
Rollup merge of #75253 - RalfJung:cleanup-const-hack, r=oli-obk

clean up const-hacks in int endianess conversion functions

Cleans up the const hacks added in https://github.com/rust-lang/rust/pull/69373.

r? @oli-obk

3 years agoRollup merge of #75250 - RalfJung:uninit-const-ptr, r=oli-obk
Yuki Okushi [Sat, 8 Aug 2020 02:36:05 +0000 (11:36 +0900)]
Rollup merge of #75250 - RalfJung:uninit-const-ptr, r=oli-obk

make MaybeUninit::as_(mut_)ptr const

I think it was just an oversight that they are not const yet.

I also changed their implementation as the old one created references to uninitialized memory.^^

3 years agoRollup merge of #75237 - nbdd0121:rustdoc, r=jyn514
Yuki Okushi [Sat, 8 Aug 2020 02:36:03 +0000 (11:36 +0900)]
Rollup merge of #75237 - nbdd0121:rustdoc, r=jyn514

Display elided lifetime for non-reference type in doc

In edition 2018 we encourage writing `<'_>` explicitly, so rustdoc should display like such as well.

Fixes #75225

~~Somehow when I run the compiled rustdoc using `cargo +stage2 doc` on other crates, it correctly produces `<'_>`, but I couldn't get the std doc to do the same with `./x.py doc --stage 2`. Might this be related to the recent change to x.py about how the doc is built?~~

3 years agoRollup merge of #75224 - Aaron1011:fix/function-arguments-naked, r=Amanieu
Yuki Okushi [Sat, 8 Aug 2020 02:36:02 +0000 (11:36 +0900)]
Rollup merge of #75224 - Aaron1011:fix/function-arguments-naked, r=Amanieu

Don't call a function in function-arguments-naked.rs

Fixes #75096

It's U.B. to use anything other than inline assmebling in a naked
function. Fortunately, the `#break` directive works fine without
anything in the function body.

3 years agoIncrease `recursion_limit` in `librustc_plugin_impl`.
Nicholas Nethercote [Sat, 8 Aug 2020 02:05:10 +0000 (12:05 +1000)]
Increase `recursion_limit` in `librustc_plugin_impl`.

To avoid rustdoc problems.

3 years agoEliminate `librustc_hir`'s dependency on `librustc_session`.
Nicholas Nethercote [Fri, 7 Aug 2020 01:11:44 +0000 (11:11 +1000)]
Eliminate `librustc_hir`'s dependency on `librustc_session`.

3 years agoEliminate the `SessionGlobals` from `librustc_ast`.
Nicholas Nethercote [Thu, 30 Jul 2020 01:27:50 +0000 (11:27 +1000)]
Eliminate the `SessionGlobals` from `librustc_ast`.

By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This
means they are accessed via the `Session`, rather than via TLS. A few
`Attr` methods and `librustc_ast` functions are now methods of
`Session`.

All of this required passing a `Session` to lots of functions that didn't
already have one. Some of these functions also had arguments removed, because
those arguments could be accessed directly via the `Session` argument.

`contains_feature_attr()` was dead, and is removed.

Some functions were moved from `librustc_ast` elsewhere because they now need
to access `Session`, which isn't available in that crate.
- `entry_point_type()` --> `librustc_builtin_macros`
- `global_allocator_spans()` --> `librustc_metadata`
- `is_proc_macro_attr()` --> `Session`

3 years agoRemove some unnecessary uses of `Option`.
Nicholas Nethercote [Thu, 30 Jul 2020 01:15:51 +0000 (11:15 +1000)]
Remove some unnecessary uses of `Option`.

These arguments are never `None`.

3 years agoAuto merge of #74877 - lcnr:min_const_generics, r=oli-obk
bors [Sat, 8 Aug 2020 01:48:35 +0000 (01:48 +0000)]
Auto merge of #74877 - lcnr:min_const_generics, r=oli-obk

Implement the `min_const_generics` feature gate

Implements both https://github.com/rust-lang/lang-team/issues/37 and https://github.com/rust-lang/compiler-team/issues/332.

Adds the new feature gate `#![feature(min_const_generics)]`.
This feature gate adds the following limitations to using const generics:
- generic parameters must only be used in types if they are trivial. (either `N` or `{ N }`)
- generic parameters must be either integers, `bool` or `char`.

We do allow arbitrary expressions in associated consts though, meaning that the following is allowed,
even if `<[u8; 0] as Foo>::ASSOC` is not const evaluatable.
```rust
trait Foo {
    const ASSOC: usize;
}

impl<const N: usize> Foo for [u8; N] {
    const ASSOC: usize = 64 / N;
}
```

r? @varkor cc @eddyb @withoutboats

3 years agoCross-crate doc inlining test case for elided lifetime
Gary Guo [Sat, 8 Aug 2020 00:07:43 +0000 (01:07 +0100)]
Cross-crate doc inlining test case for elided lifetime

3 years agoAuto merge of #75048 - eggyal:force-no-tco-start-backtrace-frame, r=Mark-Simulacrum
bors [Sat, 8 Aug 2020 00:00:52 +0000 (00:00 +0000)]
Auto merge of #75048 - eggyal:force-no-tco-start-backtrace-frame, r=Mark-Simulacrum

Prevent `__rust_begin_short_backtrace` frames from being tail-call optimised away

I've stumbled across some situations where there (unexpectedly) was no `__rust_begin_short_backtrace` frame on the stack during unwinding.

On closer examination, it appeared that the calls to that function had been tail-call optimised away.

This PR follows [@bjorn3's suggestion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Disabling.20tail.20call.20optimisation.3F/near/205699133), by adding calls to `black_box` that hint to rustc not to perform TCO.

Fixes #47429

3 years agofix clippy::needless_return: remove unneeded return statements
Matthias Krüger [Fri, 7 Aug 2020 22:39:38 +0000 (00:39 +0200)]
fix clippy::needless_return: remove unneeded return statements

3 years agofix clippy::clone_on_copy: don't clone types that are copy
Matthias Krüger [Fri, 7 Aug 2020 22:27:46 +0000 (00:27 +0200)]
fix clippy::clone_on_copy: don't clone types that are copy

3 years agofix clippy::map_clone: use .cloned() instead of .map(|x| x.clone())
Matthias Krüger [Fri, 7 Aug 2020 22:14:28 +0000 (00:14 +0200)]
fix clippy::map_clone: use .cloned() instead of .map(|x| x.clone())

3 years agofix clippy::into_iter_on_ref: use .iter() instead of into_iter() on references.
Matthias Krüger [Fri, 7 Aug 2020 22:07:01 +0000 (00:07 +0200)]
fix clippy::into_iter_on_ref: use .iter() instead of into_iter() on references.

3 years agofix clippy::while_let_loop: use while let{} instead of loop { if ... break; }
Matthias Krüger [Fri, 7 Aug 2020 21:59:59 +0000 (23:59 +0200)]
fix clippy::while_let_loop: use while let{} instead of loop { if ... break; }

3 years agofix clippy::redundant_closure: remove redundant closures and call functions directly
Matthias Krüger [Fri, 7 Aug 2020 21:45:19 +0000 (23:45 +0200)]
fix clippy::redundant_closure: remove redundant closures and call functions directly

3 years agoDisplay elided lifetime for external paths
Gary Guo [Fri, 7 Aug 2020 22:34:44 +0000 (23:34 +0100)]
Display elided lifetime for external paths

3 years agoDisplay elided lifetime for non-reference type in doc
Gary Guo [Thu, 6 Aug 2020 23:48:24 +0000 (00:48 +0100)]
Display elided lifetime for non-reference type in doc

3 years agoAuto merge of #75071 - ssomers:btree_cleanup_5, r=Mark-Simulacrum
bors [Fri, 7 Aug 2020 21:48:32 +0000 (21:48 +0000)]
Auto merge of #75071 - ssomers:btree_cleanup_5, r=Mark-Simulacrum

BTreeMap: enforce the panic rule imposed by `replace`

Also, reveal the unsafe parts in the closures fed to it.

r? @Mark-Simulacrum

3 years agofix clippy::len_zero: use is_empty() instead of comparing .len() to zero
Matthias Krüger [Sat, 1 Aug 2020 17:20:44 +0000 (19:20 +0200)]
fix clippy::len_zero: use is_empty() instead of comparing .len() to zero

3 years agofix clippy::unneeded_wildcard_pattern: remove redundant wildcard pattern
Matthias Krüger [Sat, 1 Aug 2020 16:20:39 +0000 (18:20 +0200)]
fix clippy::unneeded_wildcard_pattern: remove redundant wildcard pattern

3 years agofix clippy::unnecessary_mut_passed: function arg is not required to be mutable
Matthias Krüger [Sat, 1 Aug 2020 16:01:19 +0000 (18:01 +0200)]
fix clippy::unnecessary_mut_passed: function arg is not required to be mutable

3 years agofix clippy::unit_arg: make it explicit that Ok(()) is being returned
Matthias Krüger [Sat, 1 Aug 2020 15:57:51 +0000 (17:57 +0200)]
fix clippy::unit_arg: make it explicit that Ok(()) is being returned

3 years agofix clippy::single_char_pattern: use char instead of string single-char pattern
Matthias Krüger [Sat, 1 Aug 2020 15:53:16 +0000 (17:53 +0200)]
fix clippy::single_char_pattern: use char instead of string single-char pattern

3 years agofix clippy::redundant_pattern_matching: use .is_some() instead of if let Some(_)...
Matthias Krüger [Sat, 1 Aug 2020 15:52:20 +0000 (17:52 +0200)]
fix clippy::redundant_pattern_matching: use .is_some() instead of if let Some(_) = ..

3 years agofix clippy::redundant_clone: remove redundant clones
Matthias Krüger [Sat, 1 Aug 2020 15:50:31 +0000 (17:50 +0200)]
fix clippy::redundant_clone: remove redundant clones

3 years agofix clippy::map_identity: remove redundant .map(|x| x) call
Matthias Krüger [Sat, 1 Aug 2020 15:46:59 +0000 (17:46 +0200)]
fix clippy::map_identity: remove redundant .map(|x| x) call

3 years agofix clippy::iter_next_slice: use .get(0) instead of .iter().next()
Matthias Krüger [Sat, 1 Aug 2020 15:45:08 +0000 (17:45 +0200)]
fix clippy::iter_next_slice: use .get(0) instead of .iter().next()

3 years agofix clippy::filter_next: use .find(..) instead of .filter(..).next()
Matthias Krüger [Sat, 1 Aug 2020 15:40:26 +0000 (17:40 +0200)]
fix clippy::filter_next: use .find(..) instead of .filter(..).next()

3 years agofix clippy::expect_fun_call: use unwrap_or_else to prevent panic message from always...
Matthias Krüger [Sat, 1 Aug 2020 15:38:20 +0000 (17:38 +0200)]
fix clippy::expect_fun_call: use unwrap_or_else to prevent panic message from always being evaluated

3 years agoSmall cleanup
Esteban Küber [Fri, 7 Aug 2020 18:52:02 +0000 (11:52 -0700)]
Small cleanup

* Add docstring to `Parser` field
* Remove unnecessary `unwrap`
* Remove unnecessary borrow
* Fix indentation of some `teach`text output

3 years agoPrevent `__rust_begin_short_backtrace` frames from being tail-call optimised away
Alan Egerton [Tue, 4 Aug 2020 21:18:20 +0000 (22:18 +0100)]
Prevent `__rust_begin_short_backtrace` frames from being tail-call optimised away

3 years agoAuto merge of #75255 - davidtwco:polymorphisation-symbol-mangling-v0-upvar-closures...
bors [Fri, 7 Aug 2020 17:57:30 +0000 (17:57 +0000)]
Auto merge of #75255 - davidtwco:polymorphisation-symbol-mangling-v0-upvar-closures, r=lcnr

instance: polymorphize upvar closures/generators

This PR modifies how instances are polymorphized so that closures and generators have any closures or generators captured within their upvars also polymorphized.

With the new symbol mangling, a fully polymorphised closure will produce the same symbol regardless of what it was instantiated with. However, when that polymorphised closure captures another closure as an upvar, then the type of that other closure in the upvar substitution wouldn't have been polymorphised. The other closure will still refer to the initial substitutions. Therefore, the polymorphised closure will end up hashing differently but producing the same symbol - triggering `assert_symbols_are_distinct` in MIR partitioning. The old mangling scheme had a hash at the end that meant this didn't happen (this would still have been an issue, we just didn't have a way to notice).

See [this Zulip discussion for further elaboration](https://rust-lang.zulipchat.com/#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/symbol.20mangling.20v0.20.E2.9C.95.20polymorphisation/near/206152008).

r? @eddyb
cc @lcnr

3 years agoBTreeMap: enforce the panic rule imposed by `replace`
Stein Somers [Wed, 22 Jul 2020 20:37:08 +0000 (22:37 +0200)]
BTreeMap: enforce the panic rule imposed by `replace`

3 years agoinstance: polymorphize `FnDef` substs
David Wood [Fri, 7 Aug 2020 16:57:21 +0000 (17:57 +0100)]
instance: polymorphize `FnDef` substs

This commit extends previous polymorphization of substs to polymorphize
`FnDef`.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoinstance: avoid unnecessary `mk_` calls
David Wood [Fri, 7 Aug 2020 16:51:40 +0000 (17:51 +0100)]
instance: avoid unnecessary `mk_` calls

This commit avoids unnecessary calls to `mk_closure` and `mk_generator`
by checking if the polymorphized substs match the original substs.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoty: add `MAY_POLYMORPHIZE` flag
David Wood [Fri, 7 Aug 2020 16:50:45 +0000 (17:50 +0100)]
ty: add `MAY_POLYMORPHIZE` flag

This commit adds a `MAY_POLYMORPHIZE` which checks for closures and
generators so that polymorphization of substs does not need to traverse
every substs.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoinstance: always polymorphize substs
David Wood [Fri, 7 Aug 2020 16:11:16 +0000 (17:11 +0100)]
instance: always polymorphize substs

By always polymorphizing substitutions, functions which take closures as
arguments (e.g. `impl Fn()`) can have fewer mono items when some of the
argument closures can be polymorphized.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoinstance: polymorphize upvar closures/generators
David Wood [Fri, 7 Aug 2020 11:28:52 +0000 (12:28 +0100)]
instance: polymorphize upvar closures/generators

This commit modifies how instances are polymorphized so that closures
and generators have any closures or generators captured within their
upvars also polymorphized - this avoids symbol clashes with the new
symbol mangling scheme.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoAuto merge of #74821 - oli-obk:const_eval_read_uninit_fast_path, r=wesleywiser
bors [Fri, 7 Aug 2020 15:28:07 +0000 (15:28 +0000)]
Auto merge of #74821 - oli-obk:const_eval_read_uninit_fast_path, r=wesleywiser

Check whether locals are too large instead of whether accesses into them are too large

Essentially this stops const prop from attempting to optimize

```rust
let mut x = [0_u8; 5000];
x[42] = 3;
```

I don't expect this to be a perf improvement without #73656 (which is also where the lack of this PR will be a perf regression).

r? @wesleywiser

3 years agoAdd missing backtick
Takayuki Nakata [Wed, 5 Aug 2020 14:44:28 +0000 (23:44 +0900)]
Add missing backtick

3 years agoApply `extern "C"` calling convention
Aaron Hill [Fri, 7 Aug 2020 13:51:50 +0000 (09:51 -0400)]
Apply `extern "C"` calling convention

Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
3 years agoOnly test function-arguments-naked.rs on x86_64
Aaron Hill [Fri, 7 Aug 2020 13:46:47 +0000 (09:46 -0400)]
Only test function-arguments-naked.rs on x86_64

We need to use inline assembly, which is inherently platform-specific.

3 years agoAuto merge of #74627 - petrochenkov:docbeauty2, r=Aaron1011
bors [Fri, 7 Aug 2020 13:29:25 +0000 (13:29 +0000)]
Auto merge of #74627 - petrochenkov:docbeauty2, r=Aaron1011

rustc_ast: Stop using "string typing" for doc comment tokens

Explicitly store their kind and style retrieved during lexing in the `token::DocComment`.

Also don't "beautify" doc comments before converting them to `#[doc]` attributes when passing them to macros (both declarative and procedural).
The trimming of empty lines, lines containing only `*`s, etc is purely a rustdoc's job as a part of its presentation of doc strings to users, rustc must not do this and must pass tokens as precisely as possible internally.

3 years agoBTreeMap: better way to postpone root access in DrainFilter
Stein Somers [Wed, 5 Aug 2020 08:36:12 +0000 (10:36 +0200)]
BTreeMap: better way to postpone root access in DrainFilter

3 years agoclean up const-hacks in int endianess conversion functions
Ralf Jung [Fri, 7 Aug 2020 11:44:02 +0000 (13:44 +0200)]
clean up const-hacks in int endianess conversion functions

3 years agoAuto merge of #73842 - euclio:doctest-expn, r=GuillaumeGomez
bors [Fri, 7 Aug 2020 11:38:17 +0000 (11:38 +0000)]
Auto merge of #73842 - euclio:doctest-expn, r=GuillaumeGomez

Use outermost invocation span for doctest names

Fixes #70090.

This PR also allows using aux-build files in rustdoc-ui tests.

3 years agofix feature gate and tracking issue
Ralf Jung [Fri, 7 Aug 2020 10:27:53 +0000 (12:27 +0200)]
fix feature gate and tracking issue

3 years agomake MaybeUninit::as_(mut_)ptr const
Ralf Jung [Fri, 7 Aug 2020 10:24:28 +0000 (12:24 +0200)]
make MaybeUninit::as_(mut_)ptr const

3 years agoAuto merge of #70052 - Amanieu:hashbrown7, r=Mark-Simulacrum
bors [Fri, 7 Aug 2020 08:36:15 +0000 (08:36 +0000)]
Auto merge of #70052 - Amanieu:hashbrown7, r=Mark-Simulacrum

Update hashbrown to 0.8.1

This update includes:
- https://github.com/rust-lang/hashbrown/pull/146, which improves the performance of `Clone` and implements `clone_from`.
- https://github.com/rust-lang/hashbrown/pull/159, which reduces the size of `HashMap` by 8 bytes.
- https://github.com/rust-lang/hashbrown/pull/162, which avoids creating small 1-element tables.

Fixes #28481

3 years agoAuto merge of #75244 - Manishearth:rollup-dzfyjva, r=Manishearth
bors [Fri, 7 Aug 2020 06:40:53 +0000 (06:40 +0000)]
Auto merge of #75244 - Manishearth:rollup-dzfyjva, r=Manishearth

Rollup of 4 pull requests

Successful merges:

 - #74774 (adds [*mut|*const] ptr::set_ptr_value)
 - #75079 (Disallow linking to items with a mismatched disambiguator)
 - #75203 (Make `IntoIterator` lifetime bounds of `&BTreeMap` match with `&HashMap` )
 - #75227 (Fix ICE when using asm! on an unsupported architecture)

Failed merges:

r? @ghost

3 years agoFix natvis tests
Amanieu d'Antras [Fri, 7 Aug 2020 06:19:13 +0000 (07:19 +0100)]
Fix natvis tests

3 years agoRollup merge of #75227 - Amanieu:fix_asm_arch, r=Mark-Simulacrum
Manish Goregaokar [Fri, 7 Aug 2020 06:04:07 +0000 (23:04 -0700)]
Rollup merge of #75227 - Amanieu:fix_asm_arch, r=Mark-Simulacrum

Fix ICE when using asm! on an unsupported architecture

Fixes #75220

3 years agoRollup merge of #75203 - canova:btreemap-into-iter, r=dtolnay
Manish Goregaokar [Fri, 7 Aug 2020 06:04:05 +0000 (23:04 -0700)]
Rollup merge of #75203 - canova:btreemap-into-iter, r=dtolnay

Make `IntoIterator` lifetime bounds of `&BTreeMap` match with `&HashMap`

This is a pretty small change on the lifetime bounds of `IntoIterator` implementations of both `&BTreeMap` and `&mut BTreeMap`. This is loosening the lifetime bounds, so more code should be accepted with this PR. This is lifetime bounds will still be implicit since we have `type Item = (&'a K, &'a V);` in the implementation. This change will make the HashMap and BTreeMap share the same signature, so we can share the same function/trait with both HashMap and BTreeMap in the code.

Fixes #74034.
r? @dtolnay hey, I was touching this file on my previous PR and wanted to fix this on the way. Would you mind taking a look at this, or redirecting it if you are busy?

3 years agoRollup merge of #75079 - jyn514:disambiguator, r=Manishearth
Manish Goregaokar [Fri, 7 Aug 2020 06:04:03 +0000 (23:04 -0700)]
Rollup merge of #75079 - jyn514:disambiguator, r=Manishearth

Disallow linking to items with a mismatched disambiguator

Closes https://github.com/rust-lang/rust/issues/74851

r? @Manishearth

3 years agoRollup merge of #74774 - oliver-giersch:set_data_ptr, r=dtolnay
Manish Goregaokar [Fri, 7 Aug 2020 06:04:02 +0000 (23:04 -0700)]
Rollup merge of #74774 - oliver-giersch:set_data_ptr, r=dtolnay

adds [*mut|*const] ptr::set_ptr_value

I propose the addition of these two functions to `*mut T` and `*const T`, respectively. The motivation for this is primarily byte-wise pointer arithmetic on (potentially) fat pointers, i.e. for types with a `T: ?Sized` bound. A concrete use-case has been discussed in [this](https://internals.rust-lang.org/t/byte-wise-fat-pointer-arithmetic/12739) thread.
TL;DR: Currently, byte-wise pointer arithmetic with potentially fat pointers in not possible in either stable or nightly Rust without making assumptions about the layout of fat pointers, which is currently still an implementation detail and not formally stabilized. This PR adds one function to `*mut T` and `*const T` each, allowing to circumvent this restriction without exposing any internal implementation details.
One possible alternative would be to add specific byte-wise pointer arithmetic functions to the two pointer types in addition to the already existing count-wise functions. However, I feel this fairly niche use case does not warrant adding a whole set of new functions like `add_bytes`, `offset_bytes`, `wrapping_offset_bytes`, etc. (times two, one for each pointer type) to `libcore`.

3 years agoHandle new HashMap layout in CDB, MSVC, WinDbg, etc.
MaulingMonkey [Sun, 12 Jul 2020 15:13:36 +0000 (08:13 -0700)]
Handle new HashMap layout in CDB, MSVC, WinDbg, etc.

3 years agoHandle new HashMap layout in GDB and LLDB
Amanieu d'Antras [Mon, 22 Jun 2020 11:13:34 +0000 (12:13 +0100)]
Handle new HashMap layout in GDB and LLDB

3 years agoUpdate hashbrown to 0.8.1
Amanieu d'Antras [Mon, 16 Mar 2020 18:37:15 +0000 (18:37 +0000)]
Update hashbrown to 0.8.1

3 years agotest min_const_generics using revisions
Bastian Kauschke [Thu, 6 Aug 2020 20:57:09 +0000 (22:57 +0200)]
test min_const_generics using revisions

3 years agoAuto merge of #75121 - tmiasko:str-slicing, r=Mark-Simulacrum
bors [Fri, 7 Aug 2020 04:51:04 +0000 (04:51 +0000)]
Auto merge of #75121 - tmiasko:str-slicing, r=Mark-Simulacrum

Avoid `unwrap_or_else` in str indexing

This provides a small reduction of generated LLVM IR, and leads to a
simpler assembly code.

Closes #68874.

3 years agoAdd doc-comment for `kind_side_channel`
Joshua Nelson [Fri, 7 Aug 2020 03:17:15 +0000 (23:17 -0400)]
Add doc-comment for `kind_side_channel`

3 years agoAuto merge of #75233 - RalfJung:miri, r=RalfJung
bors [Fri, 7 Aug 2020 03:04:38 +0000 (03:04 +0000)]
Auto merge of #75233 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/74999
Cc @rust-lang/miri r? @ghost

3 years agoAuto merge of #75238 - JohnTitor:rollup-llbk0sq, r=JohnTitor
bors [Fri, 7 Aug 2020 01:16:47 +0000 (01:16 +0000)]
Auto merge of #75238 - JohnTitor:rollup-llbk0sq, r=JohnTitor

Rollup of 12 pull requests

Successful merges:

 - #74888 (compiletest: ignore-endian-big, fixes #74829, fixes #74885)
 - #75175 (Make doctests of Ipv4Addr::from(u32) easier to read)
 - #75179 (Remove unused FromInner impl for Ipv4Addr)
 - #75181 (Fix typo in  `librustc_feature/active.rs`)
 - #75183 (Label rustfmt toolstate issues with A-rustfmt)
 - #75188 (Handle fieldless tuple structs in diagnostic code)
 - #75190 (Clean up E0746 explanation)
 - #75210 (Change the type of `AssertModuleSource::available_cgus`.)
 - #75211 (Note about endianness of returned value of {integer}::from_be_bytes and friends)
 - #75217 (Clean up E0747 explanation)
 - #75232 (Fix typo "TraitObligatiom" -> "TraitObligation")
 - #75236 (Fix typo "biset" -> "bitset")

Failed merges:

r? @ghost

3 years agoRollup merge of #75236 - syntacticsugarglider:patch-1, r=jonas-schievink
Yuki Okushi [Fri, 7 Aug 2020 00:35:31 +0000 (09:35 +0900)]
Rollup merge of #75236 - syntacticsugarglider:patch-1, r=jonas-schievink

Fix typo "biset" -> "bitset"

3 years agoRollup merge of #75232 - leijurv:patch-1, r=jonas-schievink
Yuki Okushi [Fri, 7 Aug 2020 00:35:29 +0000 (09:35 +0900)]
Rollup merge of #75232 - leijurv:patch-1, r=jonas-schievink

Fix typo "TraitObligatiom" -> "TraitObligation"

3 years agoRollup merge of #75217 - GuillaumeGomez:cleanup-e0747, r=Dylan-DPC
Yuki Okushi [Fri, 7 Aug 2020 00:35:28 +0000 (09:35 +0900)]
Rollup merge of #75217 - GuillaumeGomez:cleanup-e0747, r=Dylan-DPC

Clean up E0747 explanation

r? @Dylan-DPC

3 years agoRollup merge of #75211 - lzutao:native-endian-notes, r=lcnr
Yuki Okushi [Fri, 7 Aug 2020 00:35:26 +0000 (09:35 +0900)]
Rollup merge of #75211 - lzutao:native-endian-notes, r=lcnr

Note about endianness of returned value of {integer}::from_be_bytes and friends

[`u32::from_be`](https://doc.rust-lang.org/nightly/src/core/num/mod.rs.html#2883-2892) documents about endianness of returned value.

I was confused by endianness of `from_be_bytes` in #75086 .

3 years agoRollup merge of #75210 - nnethercote:change-type-of-available_cgus, r=ecstatic-morse
Yuki Okushi [Fri, 7 Aug 2020 00:35:24 +0000 (09:35 +0900)]
Rollup merge of #75210 - nnethercote:change-type-of-available_cgus, r=ecstatic-morse

Change the type of `AssertModuleSource::available_cgus`.

It's currently a `BTreeSet<Symbol>`, which is a strange type. The
`BTreeSet` suggests that element order is important, but `Symbol` is a
type whose ordering isn't useful to humans. The ordering of the
collection only manifests in an obscure error message ("no module named
`...`") that doesn't appear in any tests.

This commit changes the `Symbol` to a `String`, which is more
typical.

3 years agoRollup merge of #75190 - GuillaumeGomez:cleanup-e0746, r=Dylan-DPC
Yuki Okushi [Fri, 7 Aug 2020 00:35:23 +0000 (09:35 +0900)]
Rollup merge of #75190 - GuillaumeGomez:cleanup-e0746, r=Dylan-DPC

Clean up E0746 explanation

r? @Dylan-DPC

3 years agoRollup merge of #75188 - Aaron1011:fix/fieldless-tuple-error, r=varkor
Yuki Okushi [Fri, 7 Aug 2020 00:35:21 +0000 (09:35 +0900)]
Rollup merge of #75188 - Aaron1011:fix/fieldless-tuple-error, r=varkor

Handle fieldless tuple structs in diagnostic code

Fixes #75062

3 years agoRollup merge of #75183 - Aaron1011:toolstate/a-rustfmt, r=nikomatsakis
Yuki Okushi [Fri, 7 Aug 2020 00:35:19 +0000 (09:35 +0900)]
Rollup merge of #75183 - Aaron1011:toolstate/a-rustfmt, r=nikomatsakis

Label rustfmt toolstate issues with A-rustfmt

This makes it easier to filter toolstate issues by the tool involved.

3 years agoRollup merge of #75181 - WaffleLapkin:patch-2, r=ecstaticmorse
Yuki Okushi [Fri, 7 Aug 2020 00:35:18 +0000 (09:35 +0900)]
Rollup merge of #75181 - WaffleLapkin:patch-2, r=ecstaticmorse

Fix typo in  `librustc_feature/active.rs`

3 years agoRollup merge of #75179 - lzutao:unsed-ipv4-frominner, r=alexcrichton
Yuki Okushi [Fri, 7 Aug 2020 00:35:16 +0000 (09:35 +0900)]
Rollup merge of #75179 - lzutao:unsed-ipv4-frominner, r=alexcrichton

Remove unused FromInner impl for Ipv4Addr

The removed is a unused unstable implementation.

3 years agoRollup merge of #75175 - lzutao:doctest-ipv4-fromu32, r=cuviper
Yuki Okushi [Fri, 7 Aug 2020 00:35:14 +0000 (09:35 +0900)]
Rollup merge of #75175 - lzutao:doctest-ipv4-fromu32, r=cuviper

Make doctests of Ipv4Addr::from(u32) easier to read

There are many zeroes in `0x0d0c0b0au32` which makes it hard to read.

3 years agoRollup merge of #74888 - infinity0:ignore-endian-big, r=nikomatsakis
Yuki Okushi [Fri, 7 Aug 2020 00:35:13 +0000 (09:35 +0900)]
Rollup merge of #74888 - infinity0:ignore-endian-big, r=nikomatsakis

compiletest: ignore-endian-big, fixes #74829, fixes #74885

See discussion on #74829

I tested it on a Debian s390x machine, works well.

3 years agoFix typo "biset" -> "bitset"
Izzy Swart [Thu, 6 Aug 2020 23:13:29 +0000 (16:13 -0700)]
Fix typo "biset" -> "bitset"

3 years agoRemove dead code
Joshua Nelson [Thu, 6 Aug 2020 22:57:56 +0000 (18:57 -0400)]
Remove dead code

3 years agoFix outdated code
Joshua Nelson [Thu, 6 Aug 2020 22:50:23 +0000 (18:50 -0400)]
Fix outdated code

3 years agoImprove tests
Joshua Nelson [Thu, 6 Aug 2020 22:33:29 +0000 (18:33 -0400)]
Improve tests

3 years agoUse the proper kind for associated items
Joshua Nelson [Thu, 6 Aug 2020 22:11:47 +0000 (18:11 -0400)]
Use the proper kind for associated items

See comments in the diff; this is such a hack.

The reason this can't be done properly in `register_res` is because
there's no way to get back the parent type: calling
`tcx.parent(assoc_item)` gets you the _impl_, not the type.
You can call `tcx.impl_trait_ref(impl_).self_ty()`, but there's no way
to go from that to a DefId without unwrapping.

3 years agoupdate Miri
Ralf Jung [Thu, 6 Aug 2020 21:55:30 +0000 (23:55 +0200)]
update Miri

3 years agoFix typo "TraitObligatiom" -> "TraitObligation"
Leijurv [Thu, 6 Aug 2020 21:37:32 +0000 (14:37 -0700)]
Fix typo "TraitObligatiom" -> "TraitObligation"

3 years agoStill print help even if there's no span
Joshua Nelson [Thu, 6 Aug 2020 21:10:52 +0000 (17:10 -0400)]
Still print help even if there's no span

3 years agoChange the type of `AssertModuleSource::available_cgus`.
Nicholas Nethercote [Thu, 6 Aug 2020 05:58:23 +0000 (15:58 +1000)]
Change the type of `AssertModuleSource::available_cgus`.

It's currently a `BTreeSet<Symbol>`, which is a strange type. The
`BTreeSet` suggests that element order is important, but `Symbol` is a
type whose ordering isn't useful to humans. The ordering of the
collection only manifests in an obscure error message ("no module named
`...`") that doesn't appear in any tests.

This commit changes the `Symbol` to a `String`, which is more
typical.

3 years agoallow complex expressions in assoc consts
Bastian Kauschke [Wed, 5 Aug 2020 16:59:53 +0000 (18:59 +0200)]
allow complex expressions in assoc consts

3 years agoAuto merge of #75228 - tmiasko:keep-stdout-open, r=ecstatic-morse
bors [Thu, 6 Aug 2020 20:22:20 +0000 (20:22 +0000)]
Auto merge of #75228 - tmiasko:keep-stdout-open, r=ecstatic-morse

Keep stdout open in limit_vector_count test