]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRemove duplicated SimplifyCfg pass
Tomasz Miąsko [Thu, 24 Sep 2020 00:00:00 +0000 (00:00 +0000)]
Remove duplicated SimplifyCfg pass

3 years agoAuto merge of #76820 - jyn514:query-comments, r=davidtwco
bors [Thu, 24 Sep 2020 13:01:46 +0000 (13:01 +0000)]
Auto merge of #76820 - jyn514:query-comments, r=davidtwco

Preserve doc-comments when generating queries

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

3 years agoAuto merge of #77049 - lcnr:const-eval-function-signature, r=oli-obk
bors [Thu, 24 Sep 2020 10:29:14 +0000 (10:29 +0000)]
Auto merge of #77049 - lcnr:const-eval-function-signature, r=oli-obk

const_evaluatable_checked: extend predicate collection

We now walk the hir instead of using `ty` so that we get better spans here, While I am still not completely sure if that's
what we want in the end, it does seem a lot closer to the final goal than the previous version.

We also look into type aliases (and use a `TypeVisitor` here), about which I am not completely sure, but we will see how well this works.

We also look into fn decls, so the following should work now.
```rust
fn test<T>() -> [u8; std::mem::size_of::<T>()] {
    [0; std::mem::size_of::<T>()]
}
```
Additionally, we visit the optional trait and self type of impls.

r? `@oli-obk`

3 years agoAuto merge of #77028 - andjo403:mini, r=matthewjasper
bors [Thu, 24 Sep 2020 08:14:30 +0000 (08:14 +0000)]
Auto merge of #77028 - andjo403:mini, r=matthewjasper

Move MiniSet to data_structures

remove the need for T to be copy from MiniSet as was done for MiniMap

MiniMap and MiniSet was added by https://github.com/rust-lang/rust/pull/72412

think that this can be used in https://github.com/rust-lang/rust/pull/68828

3 years agoupdate tests
Bastian Kauschke [Tue, 22 Sep 2020 16:00:32 +0000 (18:00 +0200)]
update tests

3 years agovisit impl self ty + trait
Bastian Kauschke [Tue, 22 Sep 2020 09:55:03 +0000 (11:55 +0200)]
visit impl self ty + trait

3 years agoassign the correct `DefId` in `nominal_obligations`
Bastian Kauschke [Tue, 22 Sep 2020 09:36:54 +0000 (11:36 +0200)]
assign the correct `DefId` in `nominal_obligations`

3 years agowalk hir to get const evaluatable predicates
Bastian Kauschke [Tue, 22 Sep 2020 08:54:09 +0000 (10:54 +0200)]
walk hir to get const evaluatable predicates

3 years agofmt, use IndexSet directly instead of UniquePredicates
Bastian Kauschke [Tue, 22 Sep 2020 07:48:20 +0000 (09:48 +0200)]
fmt, use IndexSet directly instead of UniquePredicates

3 years agoconst_evaluatable_checked: collect predicates from fn_sig
Bastian Kauschke [Tue, 22 Sep 2020 07:42:29 +0000 (09:42 +0200)]
const_evaluatable_checked: collect predicates from fn_sig

3 years agoAuto merge of #76748 - tmiasko:no-op-jumps, r=matthewjasper
bors [Thu, 24 Sep 2020 05:57:06 +0000 (05:57 +0000)]
Auto merge of #76748 - tmiasko:no-op-jumps, r=matthewjasper

Fix underflow when calculating the number of no-op jumps folded

When removing unwinds to no-op blocks and folding jumps to no-op blocks,
remove the unwind target first. Otherwise we cannot determine if target
has been already folded or not.

Previous implementation incorrectly assumed that all resume targets had
been folded already, occasionally resulting in an underflow:

```
remove_noop_landing_pads: removed 18446744073709551613 jumps and 3 landing pads
```

3 years agoAuto merge of #74430 - Manishearth:stabilize-intra-doc, r=Manishearth
bors [Thu, 24 Sep 2020 03:42:53 +0000 (03:42 +0000)]
Auto merge of #74430 - Manishearth:stabilize-intra-doc, r=Manishearth

Stabilize intra-doc links

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

Thanks to the great work of `@jyn514` in getting the [cross-crate reexport issue](https://github.com/rust-lang/rust/issues/65983) in intra-rustdoc links fixed, I think we're now in a position to stabilize this feature.

The tracking issue currently has two unresolved issues:

 - <s>behavior around doc(hidden): This is fixed in https://github.com/rust-lang/rust/pull/73365, which is just waiting for CI and should land tomorrow. It's also a pretty niche bug so while I expect it to land soon I don't think we need to block stabilization on it anyway.</s>
 - Non-identifier primitive types like slices: This was not a part of the original RFC anyway, and is a pretty niche use case

The feature itself, sans https://github.com/rust-lang/rust/issues/65983, has been shipped on nightly for three years now, with people using it on docs.rs. https://github.com/rust-lang/rust/issues/65983 itself is not an overwhelmingly central bit of functionality; the reason we elected to block stabilization on it was that back in 2017 it was not possible to fix the issue without some major refactorings of resolve, and we did not want to stabilize something that had such a potentially unfixable bug.

Given that we've fixed it, I see no reason to delay stabilization on this long awaited feature. It's possible that the latest patches have problems, however we _have_ done crater runs of some of the crucial parts. Furthermore, that's what the release trains are for, we will have a solid three months to let it ride the trains before it actually hits the stable compiler.

r? `@rust-lang/rustdoc`

3 years agoAuto merge of #77083 - KodrAus:revert/const-type-id, r=RalfJung
bors [Thu, 24 Sep 2020 00:43:09 +0000 (00:43 +0000)]
Auto merge of #77083 - KodrAus:revert/const-type-id, r=RalfJung

revert const_type_id stabilization

This reverts #72488, which is currently on beta and scheduled to stabilize in `1.47.0`, based on https://github.com/rust-lang/rust/pull/75923#issuecomment-696676511

It turns out we might not be quite ready to stabilize `TypeId` in const contexts before having a chance to rework its internals. Since `TypeId` is a bit of an oddity we want to be careful about how those internals are currently being relied on while making changes. That will be easier to do without having to also consider compile-time contexts.

r? `@eddyb`

3 years agoupdate tracking issue for const_type_id
Ashley Mannix [Wed, 23 Sep 2020 23:00:04 +0000 (09:00 +1000)]
update tracking issue for const_type_id

3 years agoAuto merge of #77102 - Dylan-DPC:rollup-2jfrg3u, r=Dylan-DPC
bors [Wed, 23 Sep 2020 22:34:44 +0000 (22:34 +0000)]
Auto merge of #77102 - Dylan-DPC:rollup-2jfrg3u, r=Dylan-DPC

Rollup of 9 pull requests

Successful merges:

 - #76898 (Record `tcx.def_span` instead of `item.span` in crate metadata)
 - #76939 (emit errors during AbstractConst building)
 - #76965 (Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut.)
 - #76993 (Changing the alloc() to accept &self instead of &mut self)
 - #76994 (fix small typo in docs and comments)
 - #77017 (Add missing examples on Vec iter types)
 - #77042 (Improve documentation for ToSocketAddrs)
 - #77047 (Miri: more informative deallocation error messages)
 - #77055 (Add #[track_caller] to more panicking Cell functions)

Failed merges:

r? `@ghost`

3 years agoAuto merge of #76673 - simonvandel:remove-unneeded-drops, r=oli-obk
bors [Wed, 23 Sep 2020 20:13:47 +0000 (20:13 +0000)]
Auto merge of #76673 - simonvandel:remove-unneeded-drops, r=oli-obk

MIR pass to remove unneeded drops on types not needing drop

This is heavily dependent on MIR inlining running to actually see the drop statement.

Do we want to special case replacing a call to std::mem::drop with a goto aswell?

3 years agoIgnore test on wasm as it does not unwind
Simon Vandel Sillesen [Wed, 23 Sep 2020 16:25:55 +0000 (18:25 +0200)]
Ignore test on wasm as it does not unwind

3 years agoAuto merge of #77090 - rust-lang:revert-76110-convert-openoptions-cint, r=dtolnay
bors [Wed, 23 Sep 2020 13:19:18 +0000 (13:19 +0000)]
Auto merge of #77090 - rust-lang:revert-76110-convert-openoptions-cint, r=dtolnay

Revert "Function to convert OpenOptions to c_int"

Reverts rust-lang/rust#76110. This broke Rust's stability guarantees.

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

r? `@joshtriplett`

3 years agoRollup merge of #77055 - est31:more_track_caller, r=Mark-Simulacrum
Dylan DPC [Wed, 23 Sep 2020 12:54:15 +0000 (14:54 +0200)]
Rollup merge of #77055 - est31:more_track_caller, r=Mark-Simulacrum

Add #[track_caller] to more panicking Cell functions

Continuation of #74526

Adds the #[track_caller] attribute to almost all panicking Cell
functions. The ones that borrow two Cells in their function
body are spared, because the panic location helps pinpoint
which of the two borrows failed. You'd need to have
full debuginfo and backtraces enabled together with column
info in order to be able to discern the cases.
Column info in debuginfo is only available on non-Windows platforms.

3 years agoRollup merge of #77047 - RalfJung:miri-dealloc, r=oli-obk
Dylan DPC [Wed, 23 Sep 2020 12:54:13 +0000 (14:54 +0200)]
Rollup merge of #77047 - RalfJung:miri-dealloc, r=oli-obk

Miri: more informative deallocation error messages

Make sure we show the affected AllocId.

r? @oli-obk

3 years agoRollup merge of #77042 - imbolc:patch-2, r=kennytm
Dylan DPC [Wed, 23 Sep 2020 12:54:11 +0000 (14:54 +0200)]
Rollup merge of #77042 - imbolc:patch-2, r=kennytm

Improve documentation for ToSocketAddrs

I little clarification

3 years agoRollup merge of #77017 - GuillaumeGomez:vec-missing-examples-iter, r=Dylan-DPC
Dylan DPC [Wed, 23 Sep 2020 12:54:10 +0000 (14:54 +0200)]
Rollup merge of #77017 - GuillaumeGomez:vec-missing-examples-iter, r=Dylan-DPC

Add missing examples on Vec iter types

r? @Dylan-DPC

3 years agoRollup merge of #76994 - yuk1ty:fix-small-typo, r=estebank
Dylan DPC [Wed, 23 Sep 2020 12:54:07 +0000 (14:54 +0200)]
Rollup merge of #76994 - yuk1ty:fix-small-typo, r=estebank

fix small typo in docs and comments

Fixed `the the` to `the`, as far as I found.

3 years agoRollup merge of #76993 - blitzerr:alloc-ref, r=Amanieu
Dylan DPC [Wed, 23 Sep 2020 12:54:06 +0000 (14:54 +0200)]
Rollup merge of #76993 - blitzerr:alloc-ref, r=Amanieu

Changing the alloc() to accept &self instead of &mut self

Fixes: [#55](https://github.com/rust-lang/wg-allocators/issues/55)
This is the first cut. It only makes the change for `alloc` method.

3 years agoRollup merge of #76965 - fusion-engineering-forks:fix-atomic-from-mut, r=Amanieu
Dylan DPC [Wed, 23 Sep 2020 12:54:04 +0000 (14:54 +0200)]
Rollup merge of #76965 - fusion-engineering-forks:fix-atomic-from-mut, r=Amanieu

Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut.

Fixes some platform-specific problems with #74532 by using the actual alignment of the types instead of hardcoding a few `target_arch`s.

r? @RalfJung

3 years agoRollup merge of #76939 - lcnr:const-evaluatable-cont, r=oli-obk
Dylan DPC [Wed, 23 Sep 2020 12:54:02 +0000 (14:54 +0200)]
Rollup merge of #76939 - lcnr:const-evaluatable-cont, r=oli-obk

emit errors during AbstractConst building

There changes are currently still untested, so I don't expect this to pass CI :laughing:

It seems to me like this is the direction we want to go in, though we didn't have too much of a discussion about this.

r? @oli-obk

3 years agoRollup merge of #76898 - Aaron1011:fix/item-def-span, r=oli-obk
Dylan DPC [Wed, 23 Sep 2020 12:54:00 +0000 (14:54 +0200)]
Rollup merge of #76898 - Aaron1011:fix/item-def-span, r=oli-obk

Record `tcx.def_span` instead of `item.span` in crate metadata

This was missed in PR #75465. As a result, a few places have been using
the full body span of functions, instead of just the header span.

3 years agoAuto merge of #76864 - est31:downloaded_llvm_no_clone_sources, r=Mark-Simulacrum
bors [Wed, 23 Sep 2020 10:38:18 +0000 (10:38 +0000)]
Auto merge of #76864 - est31:downloaded_llvm_no_clone_sources, r=Mark-Simulacrum

Don't download/sync llvm-project submodule if download-ci-llvm is set

llvm-project takes > 1GB storage space and a long time to download.
It's better to not download it unless needed.

3 years agoAuto merge of #76659 - simonvandel:76432, r=oli-obk
bors [Wed, 23 Sep 2020 08:23:00 +0000 (08:23 +0000)]
Auto merge of #76659 - simonvandel:76432, r=oli-obk

SimplifyComparisonIntegral: fix miscompilation

Fixes #76432
Only insert StorageDeads if we actually removed one.
Fixes an issue where we added StorageDead to a place with no StorageLive

r? `@oli-obk`

3 years agoMove MiniSet to data_structures
Andreas Jonson [Wed, 23 Sep 2020 06:09:16 +0000 (08:09 +0200)]
Move MiniSet to data_structures

remove the need for T to be copy from MiniSet as was done for MiniMap

3 years agoAuto merge of #76850 - ecstatic-morse:const-checking-refactor, r=oli-obk
bors [Wed, 23 Sep 2020 05:40:35 +0000 (05:40 +0000)]
Auto merge of #76850 - ecstatic-morse:const-checking-refactor, r=oli-obk

Remove `qualify_min_const_fn`

~~Blocked on #76807 (the first six commits).~~

With this PR, all checks in `qualify_min_const_fn` are replicated in `check_consts`, and the former is no longer invoked. My goal was to have as few changes to test output as possible, since making sweeping changes to the code *while* doing big batches of diagnostics updates turned out to be a headache. To this end, there's a few `HACK`s in `check_consts` to achieve parity with `qualify_min_const_fn`.

The new system that replaces `is_min_const_fn` is referred to as "const-stability"  My end goal for the const-stability rules is this:
* Const-stability is only applicable to functions defined in `staged_api` crates.
* All functions not marked `rustc_const_unstable` are considered "const-stable".
    - NB. This is currently not implemented. `#[unstable]` functions are also const-unstable. This causes problems when searching for feature gates.
    - All "const-unstable" functions have an associated feature gate
* const-stable functions can only call other const-stable functions
     - `allow_internal_unstable` can be used to circumvent this.
* All const-stable functions are subject to some additional checks (the ones that were unique to `qualify_min_const_fn`)

The plan is to remove each `HACK` individually in subsequent PRs. That way, changes to error message output can be reviewed in isolation.

3 years agoa few more &mut self -> self changes
blitzerr [Wed, 23 Sep 2020 04:04:31 +0000 (21:04 -0700)]
a few more &mut self -> self changes

3 years agofixing the test failure
blitzerr [Wed, 23 Sep 2020 03:16:13 +0000 (20:16 -0700)]
fixing the test failure

3 years agoRevert "Function to convert OpenOptions to c_int"
Joshua Nelson [Wed, 23 Sep 2020 03:07:30 +0000 (23:07 -0400)]
Revert "Function to convert OpenOptions to c_int"

3 years agoAuto merge of #77063 - cuviper:llvm-11.0.0-rc3, r=nikic
bors [Wed, 23 Sep 2020 02:15:38 +0000 (02:15 +0000)]
Auto merge of #77063 - cuviper:llvm-11.0.0-rc3, r=nikic

Rebase LLVM onto 11.0.0-rc3

r? `@nikic`

3 years agorevert const_type_id stabilization
Ashley Mannix [Tue, 22 Sep 2020 22:39:19 +0000 (08:39 +1000)]
revert const_type_id stabilization

This reverts commit e3856616ee2a894c7811a7017d98fafa7ba84dd8.

3 years agoAuto merge of #76928 - lcnr:opaque-types-cache, r=tmandry
bors [Tue, 22 Sep 2020 22:52:07 +0000 (22:52 +0000)]
Auto merge of #76928 - lcnr:opaque-types-cache, r=tmandry

cache types during normalization

partially fixes #75992

reduces the following test from 14 to 3 seconds locally.

cc `@Mark-Simulacrum` would it make sense to add that test to `perf`?
```rust
#![recursion_limit="2048"]
#![type_length_limit="112457564"]

pub async fn h0(v: &String, x: &u64) { println!("{} {}", v, x) }
pub async fn h1(v: &String, x: &u64) { h0(v, x).await }
pub async fn h2(v: &String, x: &u64) { h1(v, x).await }
pub async fn h3(v: &String, x: &u64) { h2(v, x).await }
pub async fn h4(v: &String, x: &u64) { h3(v, x).await }
pub async fn h5(v: &String, x: &u64) { h4(v, x).await }
pub async fn h6(v: &String, x: &u64) { h5(v, x).await }
pub async fn h7(v: &String, x: &u64) { h6(v, x).await }
pub async fn h8(v: &String, x: &u64) { h7(v, x).await }
pub async fn h9(v: &String, x: &u64) { h8(v, x).await }

pub async fn h10(v: &String, x: &u64) { h9(v, x).await }
pub async fn h11(v: &String, x: &u64) { h10(v, x).await }
pub async fn h12(v: &String, x: &u64) { h11(v, x).await }
pub async fn h13(v: &String, x: &u64) { h12(v, x).await }
pub async fn h14(v: &String, x: &u64) { h13(v, x).await }
pub async fn h15(v: &String, x: &u64) { h14(v, x).await }
pub async fn h16(v: &String, x: &u64) { h15(v, x).await }
pub async fn h17(v: &String, x: &u64) { h16(v, x).await }
pub async fn h18(v: &String, x: &u64) { h17(v, x).await }
pub async fn h19(v: &String, x: &u64) { h18(v, x).await }

macro_rules! async_recursive {
    (29, $inner:expr) => { async { async_recursive!(28, $inner) }.await };
    (28, $inner:expr) => { async { async_recursive!(27, $inner) }.await };
    (27, $inner:expr) => { async { async_recursive!(26, $inner) }.await };
    (26, $inner:expr) => { async { async_recursive!(25, $inner) }.await };
    (25, $inner:expr) => { async { async_recursive!(24, $inner) }.await };
    (24, $inner:expr) => { async { async_recursive!(23, $inner) }.await };
    (23, $inner:expr) => { async { async_recursive!(22, $inner) }.await };
    (22, $inner:expr) => { async { async_recursive!(21, $inner) }.await };
    (21, $inner:expr) => { async { async_recursive!(20, $inner) }.await };
    (20, $inner:expr) => { async { async_recursive!(19, $inner) }.await };

    (19, $inner:expr) => { async { async_recursive!(18, $inner) }.await };
    (18, $inner:expr) => { async { async_recursive!(17, $inner) }.await };
    (17, $inner:expr) => { async { async_recursive!(16, $inner) }.await };
    (16, $inner:expr) => { async { async_recursive!(15, $inner) }.await };
    (15, $inner:expr) => { async { async_recursive!(14, $inner) }.await };
    (14, $inner:expr) => { async { async_recursive!(13, $inner) }.await };
    (13, $inner:expr) => { async { async_recursive!(12, $inner) }.await };
    (12, $inner:expr) => { async { async_recursive!(11, $inner) }.await };
    (11, $inner:expr) => { async { async_recursive!(10, $inner) }.await };
    (10, $inner:expr) => { async { async_recursive!(9, $inner) }.await };

    (9, $inner:expr) => { async { async_recursive!(8, $inner) }.await };
    (8, $inner:expr) => { async { async_recursive!(7, $inner) }.await };
    (7, $inner:expr) => { async { async_recursive!(6, $inner) }.await };
    (6, $inner:expr) => { async { async_recursive!(5, $inner) }.await };
    (5, $inner:expr) => { async { async_recursive!(4, $inner) }.await };
    (4, $inner:expr) => { async { async_recursive!(3, $inner) }.await };
    (3, $inner:expr) => { async { async_recursive!(2, $inner) }.await };
    (2, $inner:expr) => { async { async_recursive!(1, $inner) }.await };
    (1, $inner:expr) => { async { async_recursive!(0, $inner) }.await };
    (0, $inner:expr) => { async { h19(&String::from("owo"), &0).await; $inner }.await };
}

async fn f() {
    async_recursive!(14, println!("hello"));
}

fn main() {
    let _ = f();
}
```
r? `@eddyb` requires a perf run.

3 years agorebless after rebase
Simon Vandel Sillesen [Mon, 21 Sep 2020 20:06:54 +0000 (22:06 +0200)]
rebless after rebase

3 years agocleanup cfg after optimization
Simon Vandel Sillesen [Sat, 19 Sep 2020 13:21:39 +0000 (15:21 +0200)]
cleanup cfg after optimization

3 years agoThe optimization should also apply for DropAndReplace
Simon Vandel Sillesen [Sat, 19 Sep 2020 12:25:53 +0000 (14:25 +0200)]
The optimization should also apply for DropAndReplace

3 years agoGet LocalDefId from source instead of passing in
Simon Vandel Sillesen [Sat, 19 Sep 2020 11:52:55 +0000 (13:52 +0200)]
Get LocalDefId from source instead of passing in

3 years agoSuggestion from review
Simon Vandel Sillesen [Mon, 14 Sep 2020 20:56:39 +0000 (22:56 +0200)]
Suggestion from review

Co-authored-by: Andreas Jonson <andjo403@users.noreply.github.com>
3 years agoMIR pass to remove unneeded drops on types not needing drop
Simon Vandel Sillesen [Sun, 13 Sep 2020 14:04:45 +0000 (16:04 +0200)]
MIR pass to remove unneeded drops on types not needing drop

This is heavily dependent on MIR inlining running to actually see the drop statement

3 years agoAuto merge of #76810 - Mark-Simulacrum:fix-lld-macos, r=alexcrichton
bors [Tue, 22 Sep 2020 20:35:45 +0000 (20:35 +0000)]
Auto merge of #76810 - Mark-Simulacrum:fix-lld-macos, r=alexcrichton

Don't dynamically link LLVM tools unless rustc is too

This PR initially tried to support link-shared on all of our target platforms (other than Windows), but ran into a number of difficulties:
 * LLVM doesn't really support a shared link on macOS (llvm-config runs into problems with the version suffix)
 * LLVM doesn't seem to support a shared link when cross-compiling (the libLLVM.so ends up empty and symbols are not found)

So, this PR has now been revised such that we don't attempt to dynamically link LLVM tools (even if that would, otherwise, be supported) on targets where LLVM is statically linked to rustc. Currently that's basically everything except for x86_64-unknown-linux-gnu (where we dynamically link to avoid rerunning ThinLTO in each stage).

Follow-up to #76708.
Fixes #76698.

3 years agoUse correct feature gate for unsizing casts
Dylan MacKenzie [Tue, 22 Sep 2020 17:21:58 +0000 (10:21 -0700)]
Use correct feature gate for unsizing casts

3 years agoAdd `#![feature(const_fn_transmute)]` to `rustc_ast`
Dylan MacKenzie [Tue, 22 Sep 2020 17:21:45 +0000 (10:21 -0700)]
Add `#![feature(const_fn_transmute)]` to `rustc_ast`

3 years agoRebase LLVM onto 11.0.0-rc3
Josh Stone [Tue, 22 Sep 2020 17:16:03 +0000 (10:16 -0700)]
Rebase LLVM onto 11.0.0-rc3

3 years agoReplace missing comment
Dylan MacKenzie [Fri, 18 Sep 2020 16:19:36 +0000 (09:19 -0700)]
Replace missing comment

3 years agoUse the same name everywhere for `is_const_stable_const_fn`
Dylan MacKenzie [Fri, 18 Sep 2020 16:17:13 +0000 (09:17 -0700)]
Use the same name everywhere for `is_const_stable_const_fn`

3 years agoBless compile-fail
Dylan MacKenzie [Thu, 17 Sep 2020 19:48:09 +0000 (12:48 -0700)]
Bless compile-fail

3 years agoBless tests
Dylan MacKenzie [Thu, 17 Sep 2020 17:32:07 +0000 (10:32 -0700)]
Bless tests

3 years agoUpdate const-checker to replicate `qualify_min_const_fn`
Dylan MacKenzie [Thu, 17 Sep 2020 18:14:11 +0000 (11:14 -0700)]
Update const-checker to replicate `qualify_min_const_fn`

3 years agoAdd structured errors for `qualify_min_const_fn` checks
Dylan MacKenzie [Thu, 17 Sep 2020 18:12:13 +0000 (11:12 -0700)]
Add structured errors for `qualify_min_const_fn` checks

3 years agoAllow errors to abort const checking when emitted
Dylan MacKenzie [Thu, 17 Sep 2020 18:09:52 +0000 (11:09 -0700)]
Allow errors to abort const checking when emitted

This is a hack for parity with `qualify_min_const_fn`, which only
emitted a single error.

3 years agoReturn `true` if `check_const` emits an error
Dylan MacKenzie [Thu, 17 Sep 2020 18:08:43 +0000 (11:08 -0700)]
Return `true` if `check_const` emits an error

3 years agoAdd const-stability helpers
Dylan MacKenzie [Thu, 17 Sep 2020 18:05:51 +0000 (11:05 -0700)]
Add const-stability helpers

3 years agoUpdate library functions with stability attributes
Dylan MacKenzie [Thu, 17 Sep 2020 18:02:56 +0000 (11:02 -0700)]
Update library functions with stability attributes

This may not be strictly minimal, but all unstable functions also need a
`rustc_const_unstable` attribute.

3 years agoUseful derives on `ops::Status`
Dylan MacKenzie [Thu, 17 Sep 2020 18:10:36 +0000 (11:10 -0700)]
Useful derives on `ops::Status`

3 years agoUpdate library/std/src/net/addr.rs
Imbolc [Tue, 22 Sep 2020 16:09:35 +0000 (19:09 +0300)]
Update library/std/src/net/addr.rs

Co-authored-by: Ivan Tham <pickfire@riseup.net>
3 years agoUpdate library/std/src/net/addr.rs
Imbolc [Tue, 22 Sep 2020 16:09:27 +0000 (19:09 +0300)]
Update library/std/src/net/addr.rs

Co-authored-by: Ivan Tham <pickfire@riseup.net>
3 years agofixing the custom.rs
blitzerr [Tue, 22 Sep 2020 15:51:20 +0000 (08:51 -0700)]
fixing the custom.rs

3 years agoAdd #[track_caller] to more panicking Cell functions
est31 [Tue, 22 Sep 2020 13:30:09 +0000 (15:30 +0200)]
Add #[track_caller] to more panicking Cell functions

Continuation of #74526

Adds the #[track_caller] attribute to almost all panicking Cell
functions. The ones that borrow two Cells in their function
body are spared, because the panic location helps pinpoint
which of the two borrows failed. You'd need to have
full debuginfo and backtraces enabled together with column
info in order to be able to discern the cases.
Column info is only available on non-Windows platforms.

3 years agoremoving &mut self for other methods of AllocRef
blitzerr [Tue, 22 Sep 2020 13:22:02 +0000 (06:22 -0700)]
removing &mut self for other methods of AllocRef

3 years agoAuto merge of #76110 - FedericoPonzi:convert-openoptions-cint, r=JoshTriplett
bors [Tue, 22 Sep 2020 13:02:02 +0000 (13:02 +0000)]
Auto merge of #76110 - FedericoPonzi:convert-openoptions-cint, r=JoshTriplett

Function to convert OpenOptions to c_int

Fixes: #74943
The creation_mode and access_mode function were already available in the OpenOptions struct, but currently private. I've added a new free functions to unix/fs.rs which takes the OpenOptions, and returns the c_int to be used as parameter for the `open` call.

3 years agoAdd missing examples on Vec iter types
Guillaume Gomez [Mon, 21 Sep 2020 15:32:53 +0000 (17:32 +0200)]
Add missing examples on Vec iter types

3 years agoAuto merge of #76626 - jyn514:x.py-changelog, r=Mark-Simulacrum
bors [Tue, 22 Sep 2020 10:36:41 +0000 (10:36 +0000)]
Auto merge of #76626 - jyn514:x.py-changelog, r=Mark-Simulacrum

Add a changelog for x.py and nag contributors until they read it

Add a changelog for x.py

- Add a changelog and instructions for updating it
- Use `changelog-seen` in `config.toml` and `VERSION` in bootstrap to determine whether the changelog has been read.  There's no way to tie reading the changelog to updating the version, so unfortunately they still have to update `config.toml` manually. Actually reading the changelog is optional, anyone can set `changelog-seen = N` without reading (although it's not recommended).
- Nag people if they haven't read the x.py changelog
  + Print message twice to make sure it's seen
- Give different error messages depending on whether the version needs to be updated or added

Closes https://github.com/rust-lang/rust/issues/76617
r? `@Mark-Simulacrum`

3 years agoenable unstable open_options_ext_as_flags feature in doc comments
Federico Ponzi [Tue, 22 Sep 2020 08:54:36 +0000 (09:54 +0100)]
enable unstable open_options_ext_as_flags feature in doc comments

3 years agoAuto merge of #76906 - Nicholas-Baron:shorten_typeck_check, r=oli-obk
bors [Tue, 22 Sep 2020 08:11:07 +0000 (08:11 +0000)]
Auto merge of #76906 - Nicholas-Baron:shorten_typeck_check, r=oli-obk

Split rustc_typeck::check into separate files

Contributing to #60302.

3 years agoMiri: more informative deallocation error messages
Ralf Jung [Tue, 22 Sep 2020 07:04:30 +0000 (09:04 +0200)]
Miri: more informative deallocation error messages

3 years agoUpdate addr.rs
Imbolc [Tue, 22 Sep 2020 06:15:53 +0000 (09:15 +0300)]
Update addr.rs

I little clarification

3 years agoAuto merge of #76799 - Mark-Simulacrum:fix-cross-compile-dist, r=alexcrichton
bors [Tue, 22 Sep 2020 06:02:21 +0000 (06:02 +0000)]
Auto merge of #76799 - Mark-Simulacrum:fix-cross-compile-dist, r=alexcrichton

Fix cross compiling dist/build invocations

I am uncertain why the first commit is not affecting CI. I suspect it's because we pass --disable-docs on most of our cross-compilation builders. The second commit doesn't affect CI because CI runs x.py dist, not x.py build.

Both commits are standalone; together they should resolve #76733. The first commit doesn't really fix that issue but rather just fixes cross-compiled x.py dist, resolving a bug introduced in #76549.

3 years agoAuto merge of #77039 - ecstatic-morse:rollup-qv3jj4a, r=ecstatic-morse
bors [Tue, 22 Sep 2020 03:45:30 +0000 (03:45 +0000)]
Auto merge of #77039 - ecstatic-morse:rollup-qv3jj4a, r=ecstatic-morse

Rollup of 13 pull requests

Successful merges:

 - #72734 (Reduce duplicate in liballoc reserve error handling)
 - #76131 (Don't use `zip` to compare iterators during pretty-print hack)
 - #76150 (Don't recommend ManuallyDrop to customize drop order)
 - #76275 (Implementation of Write for some immutable ref structs)
 - #76489 (Add explanation for E0756)
 - #76581 (do not ICE on bound variables, return `TooGeneric` instead)
 - #76655 (Make some methods of `Pin` unstable const)
 - #76783 (Only get ImplKind::Impl once)
 - #76807 (Use const-checking to forbid use of unstable features in const-stable functions)
 - #76888 (use if let instead of single match arm expressions)
 - #76914 (extend `Ty` and `TyCtxt` lints to self types)
 - #77022 (Reduce boilerplate for BytePos and CharPos)
 - #77032 (lint missing docs for extern items)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #77032 - lcnr:visit-all-the-item-likes, r=davidtwco
ecstatic-morse [Tue, 22 Sep 2020 03:41:01 +0000 (20:41 -0700)]
Rollup merge of #77032 - lcnr:visit-all-the-item-likes, r=davidtwco

lint missing docs for extern items

fixes #76991

3 years agoRollup merge of #77022 - Juici:master, r=lcnr
ecstatic-morse [Tue, 22 Sep 2020 03:40:59 +0000 (20:40 -0700)]
Rollup merge of #77022 - Juici:master, r=lcnr

Reduce boilerplate for BytePos and CharPos

Reduces boilerplate code for BytePos and CharPos by using a macro to implement shared traits.

3 years agoRollup merge of #76914 - lcnr:path-no-more, r=ecstatic-morse
ecstatic-morse [Tue, 22 Sep 2020 03:40:57 +0000 (20:40 -0700)]
Rollup merge of #76914 - lcnr:path-no-more, r=ecstatic-morse

extend `Ty` and `TyCtxt` lints to self types

blocked on #76891

r? @ecstatic-morse cc @Aaron1011

3 years agoRollup merge of #76888 - matthiaskrgr:clippy_single_match_2, r=Dylan-DPC
ecstatic-morse [Tue, 22 Sep 2020 03:40:55 +0000 (20:40 -0700)]
Rollup merge of #76888 - matthiaskrgr:clippy_single_match_2, r=Dylan-DPC

use if let instead of single match arm expressions

use if let instead of single match arm expressions to compact code and reduce nesting (clippy::single_match)

3 years agoRollup merge of #76807 - ecstatic-morse:const-checking-staged-api, r=oli-obk
ecstatic-morse [Tue, 22 Sep 2020 03:40:53 +0000 (20:40 -0700)]
Rollup merge of #76807 - ecstatic-morse:const-checking-staged-api, r=oli-obk

Use const-checking to forbid use of unstable features in const-stable functions

First step towards #76618.

Currently this code isn't ever hit because `qualify_min_const_fn` runs first and catches pretty much everything. One exception is `const_precise_live_drops`, which does not use the newly added code since it runs as part of a separate pass.

Also contains some unrelated refactoring, which is split into separate commits.

r? @oli-obk

3 years agoRollup merge of #76783 - lzutao:rd_impl_kind, r=GuillaumeGomez
ecstatic-morse [Tue, 22 Sep 2020 03:40:51 +0000 (20:40 -0700)]
Rollup merge of #76783 - lzutao:rd_impl_kind, r=GuillaumeGomez

Only get ImplKind::Impl once

With this, the code panics in one place instead of two.

3 years agoRollup merge of #76655 - CDirkx:const-pin, r=ecstatic-morse
ecstatic-morse [Tue, 22 Sep 2020 03:40:49 +0000 (20:40 -0700)]
Rollup merge of #76655 - CDirkx:const-pin, r=ecstatic-morse

Make some methods of `Pin` unstable const

Make the following methods unstable const under the `const_pin` feature:
- `new`
- `new_unchecked`
- `into_inner`
- `into_inner_unchecked`
- `get_ref`
- `into_ref`
- `get_mut`
- `get_unchecked_mut`

Of these, `into_inner` and `into_inner_unchecked` require the unstable `const_precise_live_drops`.

Also adds tests for these methods in a const context.

Tracking issue: #76654

r? @ecstatic-morse

3 years agoRollup merge of #76581 - lcnr:bound-too-generic, r=eddyb
ecstatic-morse [Tue, 22 Sep 2020 03:40:47 +0000 (20:40 -0700)]
Rollup merge of #76581 - lcnr:bound-too-generic, r=eddyb

do not ICE on bound variables, return `TooGeneric` instead

fixes #73260, fixes #74634, fixes #76595

r? @nikomatsakis

3 years agoRollup merge of #76489 - GuillaumeGomez:add-explanation-e0756, r=jyn514
ecstatic-morse [Tue, 22 Sep 2020 03:40:46 +0000 (20:40 -0700)]
Rollup merge of #76489 - GuillaumeGomez:add-explanation-e0756, r=jyn514

Add explanation for E0756

r? @pickfire

3 years agoRollup merge of #76275 - FedericoPonzi:immutable-write-impl-73836, r=dtolnay
ecstatic-morse [Tue, 22 Sep 2020 03:40:44 +0000 (20:40 -0700)]
Rollup merge of #76275 - FedericoPonzi:immutable-write-impl-73836, r=dtolnay

Implementation of Write for some immutable ref structs

Fixes  #73836

3 years agoRollup merge of #76150 - matklad:droporder, r=withoutboats
ecstatic-morse [Tue, 22 Sep 2020 03:40:41 +0000 (20:40 -0700)]
Rollup merge of #76150 - matklad:droporder, r=withoutboats

Don't recommend ManuallyDrop to customize drop order

See
https://internals.rust-lang.org/t/need-for-controlling-drop-order-of-fields/12914/21
for the discussion.

TL;DR: ManuallyDrop is unsafe and footguny, but you can just ask the compiler to do all the work for you by re-ordering declarations.

Specifically, the original example from the docs is much better written as

```rust
struct Peach;
struct Banana;
struct Melon;
struct FruitBox {
    melon: Melon,
    // XXX: mind the relative drop order of the fields below
    peach: Peach,
    banana: Banana,
}
```

3 years agoRollup merge of #76131 - Aaron1011:fix/pretty-print-zip, r=lcnr
ecstatic-morse [Tue, 22 Sep 2020 03:40:39 +0000 (20:40 -0700)]
Rollup merge of #76131 - Aaron1011:fix/pretty-print-zip, r=lcnr

Don't use `zip` to compare iterators during pretty-print hack

If the right-hand iterator has exactly one more element than the
left-hand iterator, then both iterators will be fully consumed, but
the extra element will never be compared.

Split out from https://github.com/rust-lang/rust/pull/76130

3 years agoRollup merge of #72734 - pickfire:liballoc, r=KodrAus
ecstatic-morse [Tue, 22 Sep 2020 03:40:37 +0000 (20:40 -0700)]
Rollup merge of #72734 - pickfire:liballoc, r=KodrAus

Reduce duplicate in liballoc reserve error handling

Not sure if it affects compilation time.

3 years agoAuto merge of #76913 - vandenheuvel:performance_debug, r=lcnr
bors [Tue, 22 Sep 2020 00:22:24 +0000 (00:22 +0000)]
Auto merge of #76913 - vandenheuvel:performance_debug, r=lcnr

Fixing the performance regression of #76244

Issue https://github.com/rust-lang/rust/issues/74865 suggested that removing the `def_id` field from `ParamEnv` would improve performance. PR https://github.com/rust-lang/rust/pull/76244 implemented this change.

Generally, [results](https://perf.rust-lang.org/compare.html?start=80fc9b0ecb29050d45b17c64af004200afd3cfc2&end=5ef250dd2ad618ee339f165e9b711a1b4746887d) were as expected: an instruction count decrease of about a percent. The instruction count for the unicode crates increased by about 3%, which `@nnethercote` speculated to be caused by a quirk of inlining or codegen. As the results were generally positive, and for chalk integration, this was also a step in the right direction, the PR was r+'d regardless.

However, [wall-time performance results](https://perf.rust-lang.org/compare.html?start=a055c5a1bd95e029e9b31891db63b6dc8258b472&end=7402a394471a6738a40fea7d4f1891666e5a80c5&stat=task-clock) show a much larger performance degradation: 25%, as [mentioned](https://github.com/rust-lang/rust/pull/76244#issuecomment-694459840) by `@Mark-Simulacrum.`

This PR, for now, reverts #76244 and attempts to find out, which change caused the regression.

3 years agoreplaced cell::update with cell::[g|s]et
blitzerr [Mon, 21 Sep 2020 23:55:07 +0000 (16:55 -0700)]
replaced cell::update with cell::[g|s]et

3 years agoAdded feature flag to use cell_update
blitzerr [Mon, 21 Sep 2020 22:52:35 +0000 (15:52 -0700)]
Added feature flag to use cell_update

3 years agoChanging the alloc() to accept &self instead of &mut self
blitzerr [Mon, 21 Sep 2020 03:14:44 +0000 (20:14 -0700)]
Changing the alloc() to accept &self instead of &mut self

3 years agoAuto merge of #76683 - simonvandel:inst-combine-deref, r=oli-obk
bors [Mon, 21 Sep 2020 22:04:16 +0000 (22:04 +0000)]
Auto merge of #76683 - simonvandel:inst-combine-deref, r=oli-obk

Add optimization to avoid load of address

Look for the sequence
```rust
_2 = &_1;
...
_5 = (*_2)
```

in which we can replace the last statement with `_5 = _1` to avoid the load of _2

3 years agolint missing docs for extern items
Bastian Kauschke [Mon, 21 Sep 2020 21:48:39 +0000 (23:48 +0200)]
lint missing docs for extern items

3 years agoreview
Bastian Kauschke [Mon, 21 Sep 2020 21:25:52 +0000 (23:25 +0200)]
review

3 years agoRun the test with explicit -O such that Add is generated instead of CheckedAdd
Simon Vandel Sillesen [Mon, 21 Sep 2020 20:15:30 +0000 (22:15 +0200)]
Run the test with explicit -O such that Add is generated instead of CheckedAdd

This makes the test run deterministic regardless of noopt testruns

3 years agoAdd optimization to avoid load of address
Simon Vandel Sillesen [Sun, 13 Sep 2020 20:38:36 +0000 (22:38 +0200)]
Add optimization to avoid load of address

3 years agoadd test for closures in abstract consts
Bastian Kauschke [Mon, 21 Sep 2020 20:01:18 +0000 (22:01 +0200)]
add test for closures in abstract consts

3 years agoAuto merge of #77003 - joshtriplett:remove-duplicate-link-libraries, r=Mark-Simulacrum
bors [Mon, 21 Sep 2020 19:52:13 +0000 (19:52 +0000)]
Auto merge of #77003 - joshtriplett:remove-duplicate-link-libraries, r=Mark-Simulacrum

Remove duplicated library links between std and libc

The libc crate is already responsible for linking in the appropriate
libraries, and std doing the same thing results in duplicated library
names on the linker command line. Removing this duplication slightly
reduces linker time, and makes it simpler to adjust the set or order of
linked libraries in one place (such as to add static linking support).

3 years agobless tests
Bastian Kauschke [Mon, 21 Sep 2020 19:50:00 +0000 (21:50 +0200)]
bless tests

3 years agoTest that AtomicU64::from_mut is not available on x86 linux.
Mara Bos [Mon, 21 Sep 2020 19:12:20 +0000 (21:12 +0200)]
Test that AtomicU64::from_mut is not available on x86 linux.

3 years agoDon't use `zip` to compare iterators during pretty-print hack
Aaron Hill [Sun, 30 Aug 2020 22:08:16 +0000 (18:08 -0400)]
Don't use `zip` to compare iterators during pretty-print hack

If the right-hand iterator has exactly one more element than the
left-hand iterator, then both iterators will be fully consumed, but
the extra element will never be compared.

3 years agoRecord `tcx.def_span` instead of `item.span` in crate metadata
Aaron Hill [Sat, 19 Sep 2020 01:49:11 +0000 (21:49 -0400)]
Record `tcx.def_span` instead of `item.span` in crate metadata

This was missed in PR #75465. As a result, a few places have been using
the full body span of functions, instead of just the header span.