]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoSpeed up path searching with `find_library_crate`.
Nicholas Nethercote [Mon, 6 Apr 2020 07:44:30 +0000 (17:44 +1000)]
Speed up path searching with `find_library_crate`.

By doing prefix and suffix checking on a `String` copy of each relevant
`PathBuf`, rather than the `PathBuf` itself.

4 years agoAuto merge of #70826 - Centril:rollup-yn0hc1h, r=Centril
bors [Sun, 5 Apr 2020 23:08:44 +0000 (23:08 +0000)]
Auto merge of #70826 - Centril:rollup-yn0hc1h, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #70553 (move OS constants to platform crate)
 - #70665 (Do not lose or reorder user-provided linker arguments)
 - #70750 (Match options directly in the Fuse implementation)
 - #70782 (Stop importing the float modules in documentation)
 - #70798 ("cannot resolve" → "cannot satisfy")
 - #70808 (Simplify dtor registration for HermitCore by using a list of destructors)
 - #70824 (Remove marker comments in libstd/lib.rs macro imports)

Failed merges:

r? @ghost

4 years agoRollup merge of #70824 - yoshuawuyts:fix-labels-in-std-macro-imports, r=Mark-Simulacrum
Mazdak Farrokhzad [Sun, 5 Apr 2020 22:53:51 +0000 (00:53 +0200)]
Rollup merge of #70824 - yoshuawuyts:fix-labels-in-std-macro-imports, r=Mark-Simulacrum

Remove marker comments in libstd/lib.rs macro imports

These comments were probably moved around when rustfmt was introduced. They don't correctly denote what they were intended for, so I propose we remove them instead. Thanks!

4 years agoRollup merge of #70808 - hermitcore:tls, r=dtolnay
Mazdak Farrokhzad [Sun, 5 Apr 2020 22:53:50 +0000 (00:53 +0200)]
Rollup merge of #70808 - hermitcore:tls, r=dtolnay

Simplify dtor registration for HermitCore by using a list of destructors

The implementation is similar to the macOS version and doesn't depend on additional OS support

4 years agoRollup merge of #70798 - estebank:satisfy, r=Centril
Mazdak Farrokhzad [Sun, 5 Apr 2020 22:53:48 +0000 (00:53 +0200)]
Rollup merge of #70798 - estebank:satisfy, r=Centril

"cannot resolve" → "cannot satisfy"

CC #66523

r? @Centril

4 years agoRollup merge of #70782 - faern:use-assoc-float-consts, r=dtolnay
Mazdak Farrokhzad [Sun, 5 Apr 2020 22:53:47 +0000 (00:53 +0200)]
Rollup merge of #70782 - faern:use-assoc-float-consts, r=dtolnay

Stop importing the float modules in documentation

Follow up to #69860. I realized I had not searched for and fixed this for the float values. So with this PR they also use the associated constants instead of the module level constants.

For the documentation where it also was using the `consts` submodule I opted to change it to import that directly. This becomes more in line with how other docs that use the `consts` submodule looks. And it also makes it so there are not two `f32` or `f64` things in the current namespace (both the module and the primitive type) and then hopefully confusing documentation readers less.

r? @dtolnay

4 years agoRollup merge of #70750 - cuviper:direct-fuse, r=scottmcm
Mazdak Farrokhzad [Sun, 5 Apr 2020 22:53:45 +0000 (00:53 +0200)]
Rollup merge of #70750 - cuviper:direct-fuse, r=scottmcm

Match options directly in the Fuse implementation

Rather than using `as_ref()`, `as_mut()`, and `?`, we can use `match` directly to save a lot of generated code. This was mentioned as a possibility in https://github.com/rust-lang/rust/pull/70366#issuecomment-603462546, and I found that it had a very large impact on #70332 using `Fuse` within `Chain`. Let's evaluate this change on its own first.

4 years agoRollup merge of #70665 - petrochenkov:linkargs, r=nagisa
Mazdak Farrokhzad [Sun, 5 Apr 2020 22:53:43 +0000 (00:53 +0200)]
Rollup merge of #70665 - petrochenkov:linkargs, r=nagisa

Do not lose or reorder user-provided linker arguments

Linker arguments are potentially order-dependent, so the order in which `-C link-arg` and `-C link-args` options are passed to `rustc` should be preserved when they are passed further to the linker.

Also, multiple `-C link-args` options are now appended to each other rather than overwrite each other.

In other words, `-C link-arg=a -C link-args="b c" -C link-args="d e" -C link-arg=f` is now passed as `"a" "b" "c" "d" "e" "f"` and not as `"d" "e" "a" "f"`.

Addresses https://github.com/rust-lang/rust/pull/70505#issuecomment-606780163.

4 years agoRollup merge of #70553 - hermitcore:abi, r=dtolnay
Mazdak Farrokhzad [Sun, 5 Apr 2020 22:53:42 +0000 (00:53 +0200)]
Rollup merge of #70553 - hermitcore:abi, r=dtolnay

move OS constants to platform crate

to reduce platform specific constants move O_RDONLY etc. and the definition of thread priorities to hermit-abi

4 years agoRemove labels in libstd/lib.rs macro imports
Yoshua Wuyts [Sun, 5 Apr 2020 18:59:10 +0000 (20:59 +0200)]
Remove labels in libstd/lib.rs macro imports

These labels were probably moved around when rustfmt was introduced.

4 years agoAuto merge of #70816 - Dylan-DPC:rollup-kzcs8px, r=Dylan-DPC
bors [Sun, 5 Apr 2020 19:31:14 +0000 (19:31 +0000)]
Auto merge of #70816 - Dylan-DPC:rollup-kzcs8px, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #67797 (Query-ify Instance::resolve)
 - #70777 (Don't import integer and float modules, use assoc consts)
 - #70795 (Keep track of position when deleting from a BTreeMap)
 - #70812 (Do not use "nil" to refer to `()`)
 - #70815 (Enable layout debugging for `impl Trait` type aliases)

Failed merges:

r? @ghost

4 years ago"cannot resolve" → "cannot satisfy"
Esteban Küber [Sun, 5 Apr 2020 02:47:50 +0000 (19:47 -0700)]
"cannot resolve" → "cannot satisfy"

4 years agoRollup merge of #70815 - RalfJung:layout-debug, r=jonas-schievink
Dylan DPC [Sun, 5 Apr 2020 16:47:50 +0000 (18:47 +0200)]
Rollup merge of #70815 - RalfJung:layout-debug, r=jonas-schievink

Enable layout debugging for `impl Trait` type aliases

I also made it print the actual type name that the alias picks under the hood.

4 years agoRollup merge of #70812 - rossmacarthur:fix/unit-called-nil, r=LukasKalbertodt
Dylan DPC [Sun, 5 Apr 2020 16:47:48 +0000 (18:47 +0200)]
Rollup merge of #70812 - rossmacarthur:fix/unit-called-nil, r=LukasKalbertodt

Do not use "nil" to refer to `()`

"nil" is not used in the [book](https://doc.rust-lang.org/book) or in the [standard library](https://doc.rust-lang.org/std) anywhere else. Because "nil" is often used in programming languages to refer to "None" or "null" I think it could be a little confusing for newcomers to see this type referred to as "nil".

4 years agoRollup merge of #70795 - Amanieu:btree_remove_tracking, r=Mark-Simulacrum
Dylan DPC [Sun, 5 Apr 2020 16:47:47 +0000 (18:47 +0200)]
Rollup merge of #70795 - Amanieu:btree_remove_tracking, r=Mark-Simulacrum

Keep track of position when deleting from a BTreeMap

This improves the performance of drain_filter and is needed for future Cursor support for BTreeMap.

cc @ssomers
r? @Mark-Simulacrum

4 years agoRollup merge of #70777 - faern:use-assoc-int-consts2, r=dtolnay
Dylan DPC [Sun, 5 Apr 2020 16:47:45 +0000 (18:47 +0200)]
Rollup merge of #70777 - faern:use-assoc-int-consts2, r=dtolnay

Don't import integer and float modules, use assoc consts

Stop importing the standard library integer and float modules to reach the `MIN`, `MAX` and other constants. They are available directly on the primitive types now.

This PR is a follow up of #69860 which made sure we use the new constants in documentation.

This type of change touches a lot of files, and previously all my assoc int consts PRs had collisions and were accepted only after a long delay. So I'd prefer to do it in smaller steps now. Just removing these imports seem like a good next step.

r? @dtolnay

4 years agoRollup merge of #67797 - Aaron1011:feature/instance-query, r=nikomatsakis
Dylan DPC [Sun, 5 Apr 2020 16:47:44 +0000 (18:47 +0200)]
Rollup merge of #67797 - Aaron1011:feature/instance-query, r=nikomatsakis

Query-ify Instance::resolve

Split off from #65989

Instance::resolve is now a wrapper for a new `resolve_instance` query.
This greatly improves performance on several benchmarks

4 years agoAuto merge of #70809 - matthiaskrgr:submodule_upd, r=Mark-Simulacrum
bors [Sun, 5 Apr 2020 16:13:44 +0000 (16:13 +0000)]
Auto merge of #70809 - matthiaskrgr:submodule_upd, r=Mark-Simulacrum

submodules: update clippy from 326b2204 to 7907abea

Changes:
````
Rustup to rust-lang/rust#70634
Update clippy_lints/src/types.rs
Update types.rs
Update types.rs
Improve docs for option_option
useless Rc<Rc<T>>, Rc<Box<T>>, Rc<&T>, Box<&T>
Allow let_underscore
Update option_option ui test
Test for ignoring let_underscore_must_use
Downgrade option_option to pedantic
````

Fixes #70709

4 years agoalso print type type
Ralf Jung [Sun, 5 Apr 2020 15:13:30 +0000 (17:13 +0200)]
also print type type

4 years agoalso print rustc_layout on impl trait type aliases
Ralf Jung [Sun, 5 Apr 2020 15:07:06 +0000 (17:07 +0200)]
also print rustc_layout on impl trait type aliases

4 years agoApply review feedback
Amanieu d'Antras [Sun, 5 Apr 2020 13:27:18 +0000 (14:27 +0100)]
Apply review feedback

4 years agoAuto merge of #70807 - Dylan-DPC:rollup-qd1kgl2, r=Dylan-DPC
bors [Sun, 5 Apr 2020 13:00:36 +0000 (13:00 +0000)]
Auto merge of #70807 - Dylan-DPC:rollup-qd1kgl2, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #70558 (Fix some aliasing issues in Vec)
 - #70760 (docs: make the description of Result::map_or more clear)
 - #70769 (Miri: remove an outdated FIXME)
 - #70776 (clarify comment in RawVec::into_box)
 - #70806 (fix Miri assignment sanity check)

Failed merges:

r? @ghost

4 years agoDo not use "nil" to refer to `()`
Ross MacArthur [Sun, 5 Apr 2020 12:30:13 +0000 (14:30 +0200)]
Do not use "nil" to refer to `()`

4 years agosubmodules: update clippy from 326b2204 to 7907abea
Matthias Krüger [Sun, 5 Apr 2020 11:46:28 +0000 (13:46 +0200)]
submodules: update clippy from 326b2204 to 7907abea

Changes:
````
Rustup to rust-lang/rust#70634
Update clippy_lints/src/types.rs
Update types.rs
Update types.rs
Improve docs for option_option
useless Rc<Rc<T>>, Rc<Box<T>>, Rc<&T>, Box<&T>
Allow let_underscore
Update option_option ui test
Test for ignoring let_underscore_must_use
Downgrade option_option to pedantic
````

Fixes #70709

4 years agoSimplify dtor registration for HermitCore by using a list of destructors
Stefan Lankes [Sun, 5 Apr 2020 11:37:04 +0000 (13:37 +0200)]
Simplify dtor registration for HermitCore by using a list of destructors

The implementation is similiar to macOS solution doesn't
depend on additional OS support

4 years agoKeep track of position when deleting from a BTreeMap
Amanieu d'Antras [Sun, 5 Apr 2020 00:58:25 +0000 (01:58 +0100)]
Keep track of position when deleting from a BTreeMap

This improves the performance of drain_filter and is needed for
future Cursor support for BTreeMap.

4 years agoRollup merge of #70806 - RalfJung:miri-assignment-check, r=eddyb
Dylan DPC [Sun, 5 Apr 2020 11:13:14 +0000 (13:13 +0200)]
Rollup merge of #70806 - RalfJung:miri-assignment-check, r=eddyb

fix Miri assignment sanity check

Thanks @eddyb for pointing me to the right APIs!

r? @eddyb
Fixes https://github.com/rust-lang/rust/issues/70804

4 years agoRollup merge of #70776 - RalfJung:raw-vec, r=Dylan-DPC,TimDiekmann
Dylan DPC [Sun, 5 Apr 2020 11:13:13 +0000 (13:13 +0200)]
Rollup merge of #70776 - RalfJung:raw-vec, r=Dylan-DPC,TimDiekmann

clarify comment in RawVec::into_box

On first reading I almost thought "len <= cap" would be all that there is to check here. Expand the comment to clarify that that is not the case.

4 years agoRollup merge of #70769 - RalfJung:fixed, r=Dylan-DPC
Dylan DPC [Sun, 5 Apr 2020 11:13:11 +0000 (13:13 +0200)]
Rollup merge of #70769 - RalfJung:fixed, r=Dylan-DPC

Miri: remove an outdated FIXME

We even [have a test ](https://github.com/rust-lang/rust/blob/49dc2f9f091748beb1a8a9d5b3eb3bbe7362c3bd/src/test/ui/consts/miri_unleashed/drop.rs) making sure that we detect dropping with a non-const implementation.

r? @oli-obk

4 years agoRollup merge of #70760 - PonasKovas:docs, r=Dylan-DPC
Dylan DPC [Sun, 5 Apr 2020 11:13:10 +0000 (13:13 +0200)]
Rollup merge of #70760 - PonasKovas:docs, r=Dylan-DPC

docs: make the description of Result::map_or more clear

The documentation of [`Result::map_or`](https://doc.rust-lang.org/std/result/enum.Result.html#method.map_or) is very unclear and confusing, probably because it was copied straight from [`Option::map_or`](https://doc.rust-lang.org/std/option/enum.Option.html#method.map_or) and someone forgot to adapt it for Result.

4 years agoRollup merge of #70558 - RalfJung:vec-extend-aliasing, r=Amanieu
Dylan DPC [Sun, 5 Apr 2020 11:13:08 +0000 (13:13 +0200)]
Rollup merge of #70558 - RalfJung:vec-extend-aliasing, r=Amanieu

Fix some aliasing issues in Vec

`Vec::extend` and `Vec::truncate` invalidated references into the vector even without reallocation, because they (implicitly) created a mutable reference covering the *entire* initialized part of the vector.

Fixes https://github.com/rust-lang/rust/issues/70301
I verified the fix by adding some new tests here that I ran in Miri.

4 years agoMake libcore float constant examples similar to libstd
Linus Färnstrand [Sun, 5 Apr 2020 09:44:25 +0000 (11:44 +0200)]
Make libcore float constant examples similar to libstd

4 years agoRemove more std::f32 imports in libstd
Linus Färnstrand [Sun, 5 Apr 2020 09:36:44 +0000 (11:36 +0200)]
Remove more std::f32 imports in libstd

4 years agofix comment
Ralf Jung [Sun, 5 Apr 2020 10:11:33 +0000 (12:11 +0200)]
fix comment

4 years agoclarify safety in RawVec::into_box
Ralf Jung [Sat, 4 Apr 2020 17:32:21 +0000 (19:32 +0200)]
clarify safety in RawVec::into_box

4 years agoadd test
Ralf Jung [Sun, 5 Apr 2020 09:56:02 +0000 (11:56 +0200)]
add test

4 years agomiri assignment check: compare types after normalizing all late-bound regions away
Ralf Jung [Sun, 5 Apr 2020 09:55:52 +0000 (11:55 +0200)]
miri assignment check: compare types after normalizing all late-bound regions away

4 years agoAuto merge of #70803 - arlosi:hash-regression, r=eddyb
bors [Sun, 5 Apr 2020 09:50:30 +0000 (09:50 +0000)]
Auto merge of #70803 - arlosi:hash-regression, r=eddyb

Fix performance regression in debuginfo file_metadata.

Fixes performance regression caused by #69718.

Finding the `SourceFile` associated with a `FileName` called `get_source_file` on the `SourceMap`, which does a linear search through all files in the `SourceMap`.

This resolves the issue by passing the `SourceFile` in from the caller (which already had it available) instead of the `FileName`

Fixes #70785.

4 years agoStop importing the float modules. Use assoc consts
Linus Färnstrand [Sun, 5 Apr 2020 09:30:25 +0000 (11:30 +0200)]
Stop importing the float modules. Use assoc consts

4 years agoStop importing integer modules in libstd
Linus Färnstrand [Sat, 4 Apr 2020 16:03:03 +0000 (18:03 +0200)]
Stop importing integer modules in libstd

4 years agoStop importing int module in float parse test
Linus Färnstrand [Sat, 4 Apr 2020 15:27:28 +0000 (17:27 +0200)]
Stop importing int module in float parse test

4 years agoStop importing int modules in librustdoc
Linus Färnstrand [Sat, 4 Apr 2020 15:26:59 +0000 (17:26 +0200)]
Stop importing int modules in librustdoc

4 years agoStop importing int/float modules in libserialize
Linus Färnstrand [Sat, 4 Apr 2020 15:26:35 +0000 (17:26 +0200)]
Stop importing int/float modules in libserialize

4 years agoStop importing int/float modules in librustc_*
Linus Färnstrand [Sat, 4 Apr 2020 15:25:45 +0000 (17:25 +0200)]
Stop importing int/float modules in librustc_*

4 years agoStop importing int/float modules in libcore
Linus Färnstrand [Sat, 4 Apr 2020 15:24:36 +0000 (17:24 +0200)]
Stop importing int/float modules in libcore

4 years agoStop importing integer modules in liballoc
Linus Färnstrand [Sat, 4 Apr 2020 15:24:03 +0000 (17:24 +0200)]
Stop importing integer modules in liballoc

4 years agoFix performance regression in debuginfo file_metadata.
Arlo Siemsen [Sun, 5 Apr 2020 08:43:44 +0000 (01:43 -0700)]
Fix performance regression in debuginfo file_metadata.

Finding the `SourceFile` associated with a `FileName` called `get_source_file` on
the `SourceMap`, which does a linear search through all files in the `SourceMap`.

This resolves the issue by passing the SourceFile in from the caller (which already
had it available).

4 years agotweak swap_remove
Ralf Jung [Sun, 5 Apr 2020 06:40:40 +0000 (08:40 +0200)]
tweak swap_remove

4 years agoAuto merge of #70800 - Dylan-DPC:rollup-9jjoptp, r=Dylan-DPC
bors [Sun, 5 Apr 2020 06:22:35 +0000 (06:22 +0000)]
Auto merge of #70800 - Dylan-DPC:rollup-9jjoptp, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #70635 (rustc_target: Some cleanup to `no_default_libraries`)
 - #70748 (Do not disable field reordering on enums with big discriminant)
 - #70752 (Add slice::fill)
 - #70766 (use ManuallyDrop instead of forget inside collections)
 - #70768 (macro_rules: `NtLifetime` cannot start with an identifier)
 - #70783 (comment refers to removed type)

Failed merges:

r? @ghost

4 years agoQuery-ify Instance::resolve
Aaron Hill [Sun, 5 Apr 2020 05:21:36 +0000 (01:21 -0400)]
Query-ify Instance::resolve

4 years agoRollup merge of #70783 - tshepang:deleted-types, r=Xanewok
Dylan DPC [Sun, 5 Apr 2020 04:44:50 +0000 (06:44 +0200)]
Rollup merge of #70783 - tshepang:deleted-types, r=Xanewok

comment refers to removed type

Was removed in 51938c61f6f1b26e463f9071716f543543486e72

4 years agoRollup merge of #70768 - petrochenkov:macambig, r=Centril,mark-i-m
Dylan DPC [Sun, 5 Apr 2020 04:44:48 +0000 (06:44 +0200)]
Rollup merge of #70768 - petrochenkov:macambig, r=Centril,mark-i-m

macro_rules: `NtLifetime` cannot start with an identifier

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

4 years agoRollup merge of #70766 - tspiteri:forget-to-ManuallyDrop, r=Mark-Simulacrum,RalfJung
Dylan DPC [Sun, 5 Apr 2020 04:44:47 +0000 (06:44 +0200)]
Rollup merge of #70766 - tspiteri:forget-to-ManuallyDrop, r=Mark-Simulacrum,RalfJung

use ManuallyDrop instead of forget inside collections

This PR changes some usage of `mem::forget` into `mem::ManuallyDrop` in some `Vec`, `VecDeque`, `BTreeMap` and `Box` methods.

Before the commit, the generated IR for some of the methods was longer, and even after optimization, some unwinding artifacts were still present.

4 years agoRollup merge of #70752 - yoshuawuyts:slice_fill, r=dtolnay
Dylan DPC [Sun, 5 Apr 2020 04:44:45 +0000 (06:44 +0200)]
Rollup merge of #70752 - yoshuawuyts:slice_fill, r=dtolnay

Add slice::fill

Adds the `slice::fill` method to fill a slice with an item. This replaces manual for loops where items are copied one-by-one. This is a counterpart to C++20's [`std::fill`](https://en.cppreference.com/w/cpp/algorithm/fill) function.

## Usage

```rust
let mut buf = vec![0; 10];
buf.fill(1);
assert_eq!(buf, vec![1; 10]);
```

## Performance

When compiling in release mode, for `[u8]` and `[u16]` this method will optimize to a `memset(3)` call ([godbolt](https://godbolt.org/z/85El_c)). The initial implementation relies on LLVM's optimizer to make it as fast as possible for any given input. But as @jonas-schievink [pointed out](https://twitter.com/sheevink/status/1245756597453885442) this can later be optimized through specialization to guarantee it has a specific performance profile.

## Why now?

Conversations about adding `slice::fill` are not new. In fact, https://github.com/rust-lang/rfcs/issues/2067 was opened 3 years ago about this exact topic. However discussion stranded while discussing implementation details, and it's not seen much forward motion since.

In ["The Hunt for the Fastest Zero"](https://travisdowns.github.io/blog/2020/01/20/zero.html) Travis Downs provides disects C++'s `std::fill` performance profile on gcc, comparing it among others to `memset(3)`. Even though `memset(3)` outperforms `std::fill` in their tests, the author notes the following:

>  That the optimization fails, perhaps unexpectedly, in some cases is unfortunate but it’s nice that you can fix it yourself. [...] Do we throw out modern C++ idioms, at least where performance matters, for example by replacing std::fill with memset? I don’t think so.

Much of the article focuses on how how to fix the performance of `std::fill` by providing specializations for specific input. In Rust we don't have any dedicated methods to fill slices with values, so it either needs to be optimized at the MIR layer, or more likely rely on LLVM's optimizer.

By adding a dedicated method for filling slices with values it opens up the ability for us to in the future guarantee that e.g. `Vec<u8>` will always optimize to `memset` even in debug mode. Or perhaps provide stronger guarantees about memory when zeroing values when a certain flag is passed. But regardless of that, it improves general ergonomics of working with slices by providing a dedicated method with documentation and examples.

## References
- [slice-fill prototype on docs.rs](https://docs.rs/slice-fill/1.0.1/slice_fill/)
- [The Hunt For The Fastest Zero](https://travisdowns.github.io/blog/2020/01/20/zero.html)
- [Safe memset for slices](https://github.com/rust-lang/rfcs/issues/2067)
- [C++20 std::fill](https://en.cppreference.com/w/cpp/algorithm/fill)
- [ASM output on Godbolt](https://godbolt.org/z/5-XU66)

4 years agoRollup merge of #70748 - ogoffart:enum-layout-optim2, r=eddyb
Dylan DPC [Sun, 5 Apr 2020 04:44:44 +0000 (06:44 +0200)]
Rollup merge of #70748 - ogoffart:enum-layout-optim2, r=eddyb

Do not disable field reordering on enums with big discriminant

The field are always re-ordered to minimize padding, regardless of the
alignment of the discriminant

(spinoff from #70477)

4 years agoRollup merge of #70635 - petrochenkov:nodefault, r=nagisa
Dylan DPC [Sun, 5 Apr 2020 04:44:42 +0000 (06:44 +0200)]
Rollup merge of #70635 - petrochenkov:nodefault, r=nagisa

rustc_target: Some cleanup to `no_default_libraries`

4 years agoAdd slice::fill
Yoshua Wuyts [Fri, 3 Apr 2020 20:53:55 +0000 (22:53 +0200)]
Add slice::fill

4 years agoAuto merge of #70149 - Xanewok:update-rls, r=Xanewok
bors [Sat, 4 Apr 2020 22:48:51 +0000 (22:48 +0000)]
Auto merge of #70149 - Xanewok:update-rls, r=Xanewok

submodules: Update RLS and Rustfmt

Fixes #70129.
Fixes #70280.

Regression fixed specifically with https://github.com/rust-lang/rls/commit/4a587b5fda6c2c9302562ece8c2795cd9848c553.

r? @ghost

4 years agorustc-workspace-hack: Account for upgraded crossbeam-utils 0.7
Igor Matuszewski [Wed, 1 Apr 2020 20:39:11 +0000 (22:39 +0200)]
rustc-workspace-hack: Account for upgraded crossbeam-utils 0.7

4 years agotidy: Update rustc-ap-syntax to -rustc_ast
Igor Matuszewski [Tue, 31 Mar 2020 12:47:40 +0000 (14:47 +0200)]
tidy: Update rustc-ap-syntax to -rustc_ast

4 years agosubmodules: Update RLS and Rustfmt to 1.4.13
Igor Matuszewski [Tue, 31 Mar 2020 12:31:52 +0000 (14:31 +0200)]
submodules: Update RLS and Rustfmt to 1.4.13

4 years agoDo not lose or reorder user-provided linker arguments
Vadim Petrochenkov [Wed, 1 Apr 2020 16:17:08 +0000 (19:17 +0300)]
Do not lose or reorder user-provided linker arguments

4 years agocomment refers to removed type
Tshepang Lekhonkhobe [Sat, 4 Apr 2020 18:30:09 +0000 (20:30 +0200)]
comment refers to removed type

Was removed in 51938c61f6f1b26e463f9071716f543543486e72

4 years agoAuto merge of #69898 - spastorino:rename-rustc-guide2, r=Xanewok
bors [Sat, 4 Apr 2020 18:17:14 +0000 (18:17 +0000)]
Auto merge of #69898 - spastorino:rename-rustc-guide2, r=Xanewok

Move rustc-guide submodule to rustc-dev-guide

r? @pietroalbini

4 years agoUpdate src/tools/publish_toolstate.py
Igor Matuszewski [Sat, 4 Apr 2020 18:11:01 +0000 (20:11 +0200)]
Update src/tools/publish_toolstate.py

Co-Authored-By: Mateusz Mikuła <mati865@users.noreply.github.com>
4 years agoMerge branch 'master' into abi
Stefan Lankes [Sat, 4 Apr 2020 14:19:40 +0000 (16:19 +0200)]
Merge branch 'master' into abi

4 years agoMiri: remove an outdated FIXME
Ralf Jung [Sat, 4 Apr 2020 13:55:32 +0000 (15:55 +0200)]
Miri: remove an outdated FIXME

4 years agoAuto merge of #70683 - jclulow:illumos-openssl-gmake, r=Mark-Simulacrum
bors [Sat, 4 Apr 2020 13:40:49 +0000 (13:40 +0000)]
Auto merge of #70683 - jclulow:illumos-openssl-gmake, r=Mark-Simulacrum

update openssl-src to 111.8.1+1.1.1f

This update includes a fix for alexcrichton/openssl-src-rs#52 which allows Cargo to build correctly on Solaris/illumos.

4 years agomacro_rules: `NtLifetime` cannot start with an identifier
Vadim Petrochenkov [Sat, 4 Apr 2020 13:23:43 +0000 (16:23 +0300)]
macro_rules: `NtLifetime` cannot start with an identifier

4 years agorustc_target: Rely on default value of `no_default_libraries` more
Vadim Petrochenkov [Tue, 31 Mar 2020 20:39:38 +0000 (23:39 +0300)]
rustc_target: Rely on default value of `no_default_libraries` more

4 years agouse ManuallyDrop instead of forget inside collections
Trevor Spiteri [Sat, 4 Apr 2020 12:24:26 +0000 (14:24 +0200)]
use ManuallyDrop instead of forget inside collections

This commit changes some usage of mem::forget into mem::ManuallyDrop
in some Vec, VecDeque, BTreeMap and Box methods.

Before the commit, the generated IR for some of the methods was
longer, and even after optimization, some unwinding artifacts were
still present.

4 years agodocs: make the description of Result::map_or more clear
Ponas [Sat, 4 Apr 2020 11:18:02 +0000 (14:18 +0300)]
docs: make the description of Result::map_or more clear

4 years agoAuto merge of #70272 - eddyb:type-of-impl-trait, r=nikomatsakis
bors [Sat, 4 Apr 2020 09:16:19 +0000 (09:16 +0000)]
Auto merge of #70272 - eddyb:type-of-impl-trait, r=nikomatsakis

typeck/type_of: let wfcheck handle generics in opaque types' substs.

I was working on #70164, and `type_of`'s handling of opaque types seemed to be, by far, the trickiest use of `Ty::walk`, but I believe it wasn't doing anything (see https://github.com/rust-lang/rust/pull/57896#discussion_r396064431 - I suspect, based on glancing at the PR discussion, that an early attempt was kept in, despite becoming just an overcomplicated way to do exactly the same as the previous simple type equality check).

I would've loved to remove `ResolvedOpaqueTy` (keep the `Ty` and lose the `Substs`), but it looks like the MIR borrowck part of the process needs that now, so it would've been added anyway since #57896, even if that PR hadn't happened.

<hr/>

In the process, I've moved the remaining substitution validation to `wfcheck`, which was already handling lifetimes, and kept only `delay_span_bug`s in `type_of`, as an insurance policy.

I've added tests for lifetime and const cases, they seem to be checked correctly now.
(and more uniform than they were in https://github.com/rust-lang/rust/issues/63063#issuecomment-602162804)

However, the quality of the errors is maybe a bit worse, and they don't trigger when there are other errors (not sure if this is due to compilation stop points or something more specific to one opaque type).

r? @nikomatsakis cc @matthewjasper @oli-obk @Aaron1011

4 years agoAuto merge of #70136 - hermitcore:network_tcp, r=dtolnay
bors [Sat, 4 Apr 2020 06:04:32 +0000 (06:04 +0000)]
Auto merge of #70136 - hermitcore:network_tcp, r=dtolnay

add basic IP support in HermitCore

- add initial version to support sockets
- use TcpStream as test case
- HermitCore uses smoltcp as IP stack for pure Rust applications
- further functionalities (e.g. UDP support) will be added step by step
- in principle, the current PR is a revision of #69404

4 years agoMerge branch 'master' into abi
Stefan Lankes [Sat, 4 Apr 2020 05:41:05 +0000 (07:41 +0200)]
Merge branch 'master' into abi

4 years agotypeck/type_of: only early-bound and (free) late-bound lifetimes are parameters.
Eduard-Mihai Burtescu [Sun, 22 Mar 2020 12:45:32 +0000 (14:45 +0200)]
typeck/type_of: only early-bound and (free) late-bound lifetimes are parameters.

4 years agotests: add tests for lifetime and const params of opaque types.
Eduard-Mihai Burtescu [Sun, 22 Mar 2020 12:15:02 +0000 (14:15 +0200)]
tests: add tests for lifetime and const params of opaque types.

4 years agotypeck/type_of: let wfcheck handle duplicate generics in opaque types' substs.
Eduard-Mihai Burtescu [Sun, 22 Mar 2020 10:30:24 +0000 (12:30 +0200)]
typeck/type_of: let wfcheck handle duplicate generics in opaque types' substs.

4 years agotypeck/type_of: let wfcheck handle concrete types in opaque types' substs.
Eduard-Mihai Burtescu [Sun, 22 Mar 2020 10:16:51 +0000 (12:16 +0200)]
typeck/type_of: let wfcheck handle concrete types in opaque types' substs.

4 years agotypeck/type_of: don't ignore incorrect defining uses of opaque types.
Eduard-Mihai Burtescu [Sun, 22 Mar 2020 09:15:56 +0000 (11:15 +0200)]
typeck/type_of: don't ignore incorrect defining uses of opaque types.

4 years agotypeck/type_of: simplify checking of opaque types with multipler defining uses.
Eduard-Mihai Burtescu [Sun, 22 Mar 2020 09:01:46 +0000 (11:01 +0200)]
typeck/type_of: simplify checking of opaque types with multipler defining uses.

4 years agoAuto merge of #69718 - arlosi:debughash, r=eddyb
bors [Sat, 4 Apr 2020 03:00:47 +0000 (03:00 +0000)]
Auto merge of #69718 - arlosi:debughash, r=eddyb

Add hash of source files in debug info

LLVM supports placing the hash of source files inside the debug info.
This information can be used by a debugger to verify that the source code matches
the executable.

This change adds support for both hash algorithms supported by LLVM, MD5 and SHA1, controlled by a target option.

* DWARF only supports MD5
* LLVM IR supports MD5 and SHA1 (and SHA256 in LLVM 11).
* CodeView (.PDB) supports MD5, SHA1, and SHA256.

Fixes #68980.

Tracking issue: #70401

rustc dev guide PR with further details: https://github.com/rust-lang/rustc-dev-guide/pull/623

4 years agoAuto merge of #70156 - michaelwoerister:incr-cgus, r=nikomatsakis
bors [Fri, 3 Apr 2020 23:50:01 +0000 (23:50 +0000)]
Auto merge of #70156 - michaelwoerister:incr-cgus, r=nikomatsakis

Make the rustc respect the `-C codegen-units` flag in incremental mode.

This PR implements (the as of yet unapproved) major change proposal at https://github.com/rust-lang/compiler-team/issues/245. See the description there for background and rationale.

The changes are pretty straightforward and should be easy to rebase if the proposal gets accepted at some point.

r? @nikomatsakis cc @pnkfelix

4 years agoDo not disable field reordering on enums with big discriminant
Olivier Goffart [Fri, 3 Apr 2020 21:00:47 +0000 (23:00 +0200)]
Do not disable field reordering on enums with big discriminant

The field are always re-ordered to minimize padding, regardless of the
alignment of the discriminant

4 years agoAuto merge of #70747 - Centril:rollup-2vx9bve, r=Centril
bors [Fri, 3 Apr 2020 20:56:05 +0000 (20:56 +0000)]
Auto merge of #70747 - Centril:rollup-2vx9bve, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #69860 (Use associated numeric consts in documentation)
 - #70576 (Update the description of the ticket to point at RFC 1721)
 - #70597 (Fix double-free and undefined behaviour in libstd::syn::unix::Thread::new)
 - #70640 (Hide `task_context` when lowering body)
 - #70641 (Remove duplicated code in trait selection)
 - #70707 (Remove unused graphviz emitter)
 - #70720 (Place TLS initializers with relocations in .tdata)
 - #70735 (Clean up E0502 explanation)
 - #70741 (Add test for #59023)

Failed merges:

r? @ghost

4 years agoRollup merge of #70741 - DutchGhost:test-59023, r=Centril
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:16 +0000 (22:55 +0200)]
Rollup merge of #70741 - DutchGhost:test-59023, r=Centril

Add test for #59023

Adds a test for https://github.com/rust-lang/rust/issues/59023

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

4 years agoRollup merge of #70735 - GuillaumeGomez:cleanup-e0502, r=Dylan-DPC
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:14 +0000 (22:55 +0200)]
Rollup merge of #70735 - GuillaumeGomez:cleanup-e0502, r=Dylan-DPC

Clean up E0502 explanation

r? @Dylan-DPC

4 years agoRollup merge of #70720 - ecstatic-morse:issue-70637, r=oli-obk
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:12 +0000 (22:55 +0200)]
Rollup merge of #70720 - ecstatic-morse:issue-70637, r=oli-obk

Place TLS initializers with relocations in .tdata

Should fix #70673, although I'm not sure how to test this. Perhaps @joshlf could find a MCVE?

Also adds more context to the FIXME.

r? @oli-obk

4 years agoRollup merge of #70707 - ecstatic-morse:dataflow-graphviz-cleanup, r=nikomatsakis
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:10 +0000 (22:55 +0200)]
Rollup merge of #70707 - ecstatic-morse:dataflow-graphviz-cleanup, r=nikomatsakis

Remove unused graphviz emitter

This was only used by the old dataflow framework that was removed in #69644.

4 years agoRollup merge of #70641 - estebank:dedup-code, r=nikomatsakis
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:08 +0000 (22:55 +0200)]
Rollup merge of #70641 - estebank:dedup-code, r=nikomatsakis

Remove duplicated code in trait selection

4 years agoRollup merge of #70640 - jonas-schievink:async-ice, r=cramertj
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:07 +0000 (22:55 +0200)]
Rollup merge of #70640 - jonas-schievink:async-ice, r=cramertj

Hide `task_context` when lowering body

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

4 years agoRollup merge of #70597 - vakaras:thread_new_double_free_bug_fix, r=Amanieu
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:05 +0000 (22:55 +0200)]
Rollup merge of #70597 - vakaras:thread_new_double_free_bug_fix, r=Amanieu

Fix double-free and undefined behaviour in libstd::syn::unix::Thread::new

While working on concurrency support for Miri, I found that the `libstd::syn::unix::Thread::new` method has two potential problems: double-free and undefined behaviour.

**Double-free** could occur if the following events happened (credit for pointing this out goes to @RalfJung):

1.  The call to `pthread_create` successfully launched a new thread that executed to completion and deallocated `p`.
2.  The call to `pthread_attr_destroy` returned a non-zero value causing the `assert_eq!` to panic.
3.  Since `mem::forget(p)` was not yet executed, the destructor of `p` would be executed and cause a double-free.

As far as I understand, this code also violates the stacked-borrows aliasing rules and thus would result in **undefined behaviour** if these rules were adopted.  The problem is that the ownership of `p` is passed to the newly created thread before the call to `mem::forget`. Since the call to `mem::forget` is still a call, it counts as a use of `p` and triggers UB.

This pull request changes the code to use `mem::ManuallyDrop` instead of `mem::forget`. As a consequence, in case of a panic, `p` would be potentially leaked, which while undesirable is probably better than double-free or undefined behaviour.

4 years agoRollup merge of #70576 - Rustin-Liu:rustin-patch-link-cfg, r=varkor
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:03 +0000 (22:55 +0200)]
Rollup merge of #70576 - Rustin-Liu:rustin-patch-link-cfg, r=varkor

Update the description of the ticket to point at RFC 1721

Fixes #70538.

My first PR to rust. So please let me know if I'm doing something wrong.

4 years agoRollup merge of #69860 - faern:use-assoc-int-consts, r=dtolnay
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:02 +0000 (22:55 +0200)]
Rollup merge of #69860 - faern:use-assoc-int-consts, r=dtolnay

Use associated numeric consts in documentation

Now when the associated constants on int/float types are stabilized and the recommended way of accessing said constants (#68952). We can start using it in this repository, and recommend it via documentation example code.

This PR is the reincarnation of #67913 minus the actual adding + stabilization of said constants. (EDIT: Now it's only changing the documentation. So users will see the new consts, but we don't yet update the internal code)

Because of how fast bit rot happens to PRs that touch this many files, it does not try to replace 100% of the old usage of the constants in the entire repo, but a good chunk of them.

4 years agoUse a macro to expand the specialized Fuse
Josh Stone [Fri, 3 Apr 2020 20:30:21 +0000 (13:30 -0700)]
Use a macro to expand the specialized Fuse

4 years agoOpen-code Fuse's Option matches
Josh Stone [Fri, 3 Apr 2020 20:21:12 +0000 (13:21 -0700)]
Open-code Fuse's Option matches

4 years agoAdd regression test for #70673
Oliver Scherer [Fri, 3 Apr 2020 17:50:06 +0000 (10:50 -0700)]
Add regression test for #70673

4 years agoUpdate the description of link_cfg unstable
Rustin-Liu [Mon, 30 Mar 2020 17:04:03 +0000 (01:04 +0800)]
Update the description of link_cfg unstable

Fmt code

Update tests

Modify msg

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
4 years agoDelete unnecessary stub stack overflow handler for cloudabi.
Vytautas Astrauskas [Fri, 3 Apr 2020 17:13:49 +0000 (10:13 -0700)]
Delete unnecessary stub stack overflow handler for cloudabi.

4 years agoDelete unnecessary stub stack overflow handler for hermit.
Vytautas Astrauskas [Fri, 3 Apr 2020 17:07:40 +0000 (10:07 -0700)]
Delete unnecessary stub stack overflow handler for hermit.