]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agolinkcheckr: fix clippy::redundant_static_lifetimes and clippy::single_char_pattern
Matthias Krüger [Sat, 22 Aug 2020 00:09:20 +0000 (02:09 +0200)]
linkcheckr: fix clippy::redundant_static_lifetimes and clippy::single_char_pattern

3 years agoexpand-yaml-anchors: fix clippy::match_ref_pats and clippy::redundant_closure
Matthias Krüger [Sat, 22 Aug 2020 00:01:02 +0000 (02:01 +0200)]
expand-yaml-anchors: fix clippy::match_ref_pats and clippy::redundant_closure

3 years agoAuto merge of #72449 - ecstatic-morse:const-float-bitcast, r=RalfJung
bors [Sun, 23 Aug 2020 19:14:55 +0000 (19:14 +0000)]
Auto merge of #72449 - ecstatic-morse:const-float-bitcast, r=RalfJung

Const floating point bitcasts and classification

Makes the `f32` and `f64` methods described in #72447 and #72505 unstably const.

r? @RalfJung

3 years agoFix `compile-flags` directive
ecstatic-morse [Sun, 23 Aug 2020 17:45:26 +0000 (10:45 -0700)]
Fix `compile-flags` directive

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoAuto merge of #75028 - MrModder:master, r=steveklabnik
bors [Sun, 23 Aug 2020 16:59:10 +0000 (16:59 +0000)]
Auto merge of #75028 - MrModder:master, r=steveklabnik

Document that slice refers to any pointer type to a sequence

I was recently confused about the way slices are represented in memory. The necessary information was not available in the std-docs directly, but was a mix of different material from the reference and book.

This PR should clear up the definition of slices a bit more in the documentation. Especially the fact that the term slice refers to the pointer/reference type, e.g. `&[T]`, and not `[T]`.
It also documents that slice pointers are twice the size of pointers to `Sized` types, as this concept may be unfamiliar to users coming from other languages that do not have the concept of "fat pointers" (especially C/C++).

I've documented why this was important to me and my findings in [this blog post](https://codecrash.me/understanding-rust-slices).

r? @lcnr

3 years agoAuto merge of #74238 - RalfJung:offset_from, r=oli-obk
bors [Sun, 23 Aug 2020 14:50:15 +0000 (14:50 +0000)]
Auto merge of #74238 - RalfJung:offset_from, r=oli-obk

stabilize ptr_offset_from

This stabilizes ptr::offset_from, and closes https://github.com/rust-lang/rust/issues/41079. It also removes the deprecated `wrapping_offset_from`. This function was deprecated 19 days ago and was never stable; given an FCP of 10 days and some waiting time until FCP starts, that leaves at least a month between deprecation and removal which I think is fine for a nightly-only API.

Regarding the open questions in https://github.com/rust-lang/rust/issues/41079:
* Should offset_from abort instead of panic on ZSTs? -- As far as I know, there is no precedent for such aborts. We could, however, declare this UB. Given that the size is always known statically and the check thus rather cheap, UB seems excessive.
* Should there be more methods like this with different restrictions (to allow nuw/nsw, perhaps) or that return usize (like how isize-taking offset is more conveniently done with usize-taking add these days)? -- No reason to block stabilization on that, we can always add such methods later.

Also nominating the lang team because this exposes an intrinsic.

The stabilized method is best described [by its doc-comment](https://github.com/RalfJung/rust/blob/56d4b2d69abb93e4f0ca79471deca7aaaaeca214/src/libcore/ptr/const_ptr.rs#L227). The documentation forgot to mention the requirement that both pointers must "have the same provenance", aka "be derived from pointers to the same allocation", which I am adding in this PR. This is a precondition that [Miri already implements](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=a3b9d0a07a01321f5202cd99e9613480) and that, should LLVM ever obtain a `psub` operation to subtract pointers, will likely be required for that operation (following the semantics in [this paper](https://people.mpi-sws.org/~jung/twinsem/twinsem.pdf)).

3 years agobump stable version
Ralf Jung [Sun, 23 Aug 2020 14:09:30 +0000 (16:09 +0200)]
bump stable version

Co-authored-by: Josh Stone <cuviper@gmail.com>
3 years agoremove an unused feature flag
Ralf Jung [Sat, 22 Aug 2020 18:57:45 +0000 (20:57 +0200)]
remove an unused feature flag

3 years agoRevert changed paragraph about slice definition.
Leon Matthes [Sun, 23 Aug 2020 14:02:22 +0000 (16:02 +0200)]
Revert changed paragraph about slice definition.

This reverts part of commit e6c83dd57b920d2069797736ae0a1c9fe14a97cb.
As requested by @steveklabnik .

3 years agoAuto merge of #75816 - LeSeulArtichaut:core-intra-docs, r=jyn514
bors [Sun, 23 Aug 2020 12:40:01 +0000 (12:40 +0000)]
Auto merge of #75816 - LeSeulArtichaut:core-intra-docs, r=jyn514

Use intra-doc-links in `core::{raw, ffi, pin}`

Helps with #75080.
r? @jyn514

3 years agoAuto merge of #75789 - matthiaskrgr:clippy_compiletest, r=Dylan-DPC
bors [Sun, 23 Aug 2020 10:25:53 +0000 (10:25 +0000)]
Auto merge of #75789 - matthiaskrgr:clippy_compiletest, r=Dylan-DPC

compiletest: fix a couple clippy lint findings

3 years agoAuto merge of #75465 - Aaron1011:feature/short-fn-def-span, r=estebank
bors [Sun, 23 Aug 2020 08:14:17 +0000 (08:14 +0000)]
Auto merge of #75465 - Aaron1011:feature/short-fn-def-span, r=estebank

Use smaller def span for functions

Currently, the def span of a function encompasses the entire function
signature and body. However, this is usually unnecessarily verbose - when we are
pointing at an entire function in a diagnostic, we almost always want to
point at the signature. The actual contents of the body tends to be
irrelevant to the diagnostic we are emitting, and just takes up
additional screen space.

This commit changes the `def_span` of all function items (freestanding
functions, `impl`-block methods, and `trait`-block methods) to be the
span of the signature. For example, the function

```rust
pub fn foo<T>(val: T) -> T { val }
```

now has a `def_span` corresponding to `pub fn foo<T>(val: T) -> T`
(everything before the opening curly brace).

Trait methods without a body have a `def_span` which includes the
trailing semicolon. For example:

```rust
trait Foo {
    fn bar();
}
```

the function definition `Foo::bar` has a `def_span` of `fn bar();`

This makes our diagnostic output much shorter, and emphasizes
information that is relevant to whatever diagnostic we are reporting.

We continue to use the full span (including the body) in a few of
places:

* MIR building uses the full span when building source scopes.
* 'Outlives suggestions' use the full span to sort the diagnostics being
  emitted.
* The `#[rustc_on_unimplemented(enclosing_scope="in this scope")]`
attribute points the entire scope body.

All of these cases work only with local items, so we don't need to
add anything extra to crate metadata.

3 years agoAuto merge of #75813 - petrochenkov:feature/incr-def-path-table, r=Aaron1011
bors [Sun, 23 Aug 2020 05:56:47 +0000 (05:56 +0000)]
Auto merge of #75813 - petrochenkov:feature/incr-def-path-table, r=Aaron1011

Lazy decoding of DefPathTable from crate metadata (non-incremental case)

The is the half of https://github.com/rust-lang/rust/pull/74967 that doesn't touch incremental-related structures.
We are still decoding def path hashes eagerly if we are in incremental mode.

The incremental part of https://github.com/rust-lang/rust/pull/74967 feels hacky, but I'm not qualified enough to suggest improvements. I'll reassign it so someone else once this PR lands.
@Aaron1011, I wasn't asking you to do this split because I wasn't sure that it's feasible (or simple to do).

r? @Aaron1011

3 years agoAuto merge of #73526 - cuviper:rust-llvm11, r=nikic
bors [Sun, 23 Aug 2020 04:02:41 +0000 (04:02 +0000)]
Auto merge of #73526 - cuviper:rust-llvm11, r=nikic

Upgrade to LLVM 11 (rc2)

This builds on #73525 to try actually moving rust-lang/llvm-project to LLVM 11.

3 years agoAuto merge of #73084 - Aaron1011:feature/new-recursive-expand, r=petrochenkov
bors [Sun, 23 Aug 2020 01:44:36 +0000 (01:44 +0000)]
Auto merge of #73084 - Aaron1011:feature/new-recursive-expand, r=petrochenkov

Re-land PR #72388:  Recursively expand `TokenKind::Interpolated` in `probably_equal_for_proc_macro`

PR #72388 allowed us to preserve the original `TokenStream` in more cases during proc-macro expansion, but had to be reverted due to a large number of regressions (See #72545 and #72622). These regressions fell into two categories

1. Missing handling for `Group`s with `Delimiter::None`, which are inserted during `macro_rules!` expansion (but are lost during stringification and re-parsing). A large number of these regressions were due to `syn` and `proc-macro-hack`, but several crates needed changes to their own proc-macro code.
2. Legitimate hygiene issues that were previously being masked by stringification. Some of these were relatively benign (e.g. [a compiliation error](https://github.com/paritytech/parity-scale-codec/pull/210) caused by misusing `quote_spanned!`). However, two crates had intentionally written unhygenic `macro_rules!` macros, which were able to access identifiers that were not passed as arguments (see https://github.com/rust-lang/rust/issues/72622#issuecomment-636402573).

All but one of the Crater regressions have now been fixed upstream (see https://hackmd.io/ItrXWRaSSquVwoJATPx3PQ?both). The remaining crate (which has a PR pending at https://github.com/sammhicks/face-generator/pull/1) is not on `crates.io`, and is a Yew application that seems unlikely to have any reverse dependencies.

As @petrochenkov mentioned in https://github.com/rust-lang/rust/issues/72545#issuecomment-638632434, not re-landing PR #72388 allows more crates to write unhygenic `macro_rules!` macros, which will eventually stop compiling. Since there is only one Crater regression remaining, since additional crates could write unhygenic `macro_rules!` macros in the time it takes that PR to be merged.

3 years agoUse smaller def span for functions
Aaron Hill [Wed, 12 Aug 2020 21:02:14 +0000 (17:02 -0400)]
Use smaller def span for functions

Currently, the def span of a funtion encompasses the entire function
signature and body. However, this is usually unnecessarily verbose - when we are
pointing at an entire function in a diagnostic, we almost always want to
point at the signature. The actual contents of the body tends to be
irrelevant to the diagnostic we are emitting, and just takes up
additional screen space.

This commit changes the `def_span` of all function items (freestanding
functions, `impl`-block methods, and `trait`-block methods) to be the
span of the signature. For example, the function

```rust
pub fn foo<T>(val: T) -> T { val }
```

now has a `def_span` corresponding to `pub fn foo<T>(val: T) -> T`
(everything before the opening curly brace).

Trait methods without a body have a `def_span` which includes the
trailing semicolon. For example:

```rust
trait Foo {
    fn bar();
}```

the function definition `Foo::bar` has a `def_span` of `fn bar();`

This makes our diagnostic output much shorter, and emphasizes
information that is relevant to whatever diagnostic we are reporting.

We continue to use the full span (including the body) in a few of
places:

* MIR building uses the full span when building source scopes.
* 'Outlives suggestions' use the full span to sort the diagnostics being
  emitted.
* The `#[rustc_on_unimplemented(enclosing_scope="in this scope")]`
attribute points the entire scope body.
* The 'unconditional recursion' lint uses the full span to show
  additional context for the recursive call.

All of these cases work only with local items, so we don't need to
add anything extra to crate metadata.

3 years agoAdd backwards-compat hack for certain '$name' tokens
Aaron Hill [Sat, 25 Jul 2020 09:30:32 +0000 (05:30 -0400)]
Add backwards-compat hack for certain '$name' tokens

See issue #74616

3 years agoRecursively expand `TokenKind::Interpolated` (take 2)
Aaron Hill [Wed, 24 Jun 2020 05:52:48 +0000 (01:52 -0400)]
Recursively expand `TokenKind::Interpolated` (take 2)

Fixes #68430

This is a re-attempt of PR #72388, which was previously reverted due to
a large number of breakages. All of the known breakages should now be
patched upstream.

3 years agoWrite coverage filenames in Version3 format
Josh Stone [Fri, 21 Aug 2020 19:07:52 +0000 (12:07 -0700)]
Write coverage filenames in Version3 format

3 years agoMatch scalar-pair-bool more flexibly for LLVM 11
Josh Stone [Tue, 18 Aug 2020 22:11:02 +0000 (15:11 -0700)]
Match scalar-pair-bool more flexibly for LLVM 11

LLVM 11 started using `phi` and `select` for `fn pair_i32_bool`, which
is still valid, but harder to match than the simple instructions we were
getting before. We'll just check that the unpacked args are directly
referenced in any way, and call it good.

3 years agoApply suggestions from code review
Josh Stone [Thu, 6 Aug 2020 17:52:23 +0000 (10:52 -0700)]
Apply suggestions from code review

Flatten the INC definition to one line.

Co-authored-by: lzutao <taolzu@gmail.com>
3 years agoExpand RISCV pseudo-instructions to match LLVM 11
Josh Stone [Wed, 5 Aug 2020 18:34:58 +0000 (11:34 -0700)]
Expand RISCV pseudo-instructions to match LLVM 11

3 years agoUpgrade to LLVM 11 (rc2)
Josh Stone [Tue, 28 Jul 2020 19:16:41 +0000 (12:16 -0700)]
Upgrade to LLVM 11 (rc2)

3 years agoDon't make clang use gcc's include-fixed
Josh Stone [Mon, 20 Jul 2020 23:55:56 +0000 (16:55 -0700)]
Don't make clang use gcc's include-fixed

This was breaking `#include_next <limits.h>`, such that we weren't
getting definitions of `PATH_MAX` and `_POSIX_ARG_MAX`.

3 years agoTest new floating point bit casts
Dylan MacKenzie [Fri, 22 May 2020 01:51:47 +0000 (18:51 -0700)]
Test new floating point bit casts

3 years agoUse intra-doc-links in `core::{raw, ffi, pin}`
LeSeulArtichaut [Sat, 22 Aug 2020 20:15:17 +0000 (22:15 +0200)]
Use intra-doc-links in `core::{raw, ffi, pin}`

3 years agoAdd `#![feature(const_float_classify)]` for `f64::classify` and friends
Dylan MacKenzie [Sat, 22 Aug 2020 19:25:39 +0000 (12:25 -0700)]
Add `#![feature(const_float_classify)]` for `f64::classify` and friends

3 years agoAdd `#![feature(const_float_bits_conv)]` for `f64::to_bits` and friends
Dylan MacKenzie [Sat, 22 Aug 2020 19:24:35 +0000 (12:24 -0700)]
Add `#![feature(const_float_bits_conv)]` for `f64::to_bits` and friends

3 years agoAuto merge of #75171 - amosonn:new_zeroed_slice, r=Amanieu
bors [Sat, 22 Aug 2020 18:46:42 +0000 (18:46 +0000)]
Auto merge of #75171 - amosonn:new_zeroed_slice, r=Amanieu

New zeroed slice

Add to #63291 the methods

```rust
impl<T> Box<[T]> { pub fn new_zeroed_slice(len: usize) -> Box<[MaybeUninit<T>]> {…} }
impl<T> Rc<[T]> { pub fn new_zeroed_slice(len: usize) -> Rc<[MaybeUninit<T>]> {…} }
impl<T> Arc<[T]> { pub fn new_zeroed_slice(len: usize) -> Arc<[MaybeUninit<T>]> {…} }
```

as suggested in https://github.com/rust-lang/rust/issues/63291#issuecomment-605511675 .

Also optimize `{Rc, Arc}::new_zeroed` to use `alloc_zeroed`, otherwise they are no more efficient than using `new_uninit` and zeroing the memory manually (which was the original implementation).

3 years agorustc_metadata: Move some code around to merge impls of `CrateMetadataRef`
Vadim Petrochenkov [Sat, 22 Aug 2020 18:38:56 +0000 (21:38 +0300)]
rustc_metadata: Move some code around to merge impls of `CrateMetadataRef`

3 years agoDo not forget capacity when collecting def path hashes
Vadim Petrochenkov [Sat, 22 Aug 2020 18:36:34 +0000 (21:36 +0300)]
Do not forget capacity when collecting def path hashes

3 years agoLazy decoding of DefPathTable from crate metadata (non-incremental case)
Aaron Hill [Wed, 29 Jul 2020 16:26:15 +0000 (12:26 -0400)]
Lazy decoding of DefPathTable from crate metadata (non-incremental case)

3 years agoAuto merge of #74566 - lzutao:guard, r=petrochenkov
bors [Sat, 22 Aug 2020 15:38:13 +0000 (15:38 +0000)]
Auto merge of #74566 - lzutao:guard, r=petrochenkov

Gate if-let guard feature

Enhanced on #74315. That PR is in crater queue so I don't want to push to it.

Close  #74232
cc #51114

3 years agoAuto merge of #75783 - denisvasilik:intra-doc-links-core-alloc, r=jyn514
bors [Sat, 22 Aug 2020 13:21:24 +0000 (13:21 +0000)]
Auto merge of #75783 - denisvasilik:intra-doc-links-core-alloc, r=jyn514

Move to intra-doc links for library/core/src/alloc/{layout, global, mod}.rs

Helps with #75080. The files already contained intra-doc links, so there are only minor changes.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

Known issues:

* [`handle_alloc_error`]: Link from `core` to `alloc` could not be resolved.
* [`slice`]: slice is a primitive type, but could not be resolved; had to use [`crate::slice`] instead.

3 years agofix dead links to wrapping_offset_from
Ralf Jung [Sat, 11 Jul 2020 14:35:48 +0000 (16:35 +0200)]
fix dead links to wrapping_offset_from

3 years agoremove feature gate from tests
Ralf Jung [Sat, 11 Jul 2020 12:19:07 +0000 (14:19 +0200)]
remove feature gate from tests

3 years agostabilize ptr_offset_from
Ralf Jung [Sat, 11 Jul 2020 11:07:39 +0000 (13:07 +0200)]
stabilize ptr_offset_from

3 years agoremove deprecated wrapping_offset_from
Ralf Jung [Sat, 11 Jul 2020 10:57:33 +0000 (12:57 +0200)]
remove deprecated wrapping_offset_from

3 years agooffset_from: also document same-provenance requirement
Ralf Jung [Sat, 11 Jul 2020 10:56:32 +0000 (12:56 +0200)]
offset_from: also document same-provenance requirement

3 years agoAuto merge of #75795 - matthiaskrgr:cargotest_clippy, r=Dylan-DPC
bors [Sat, 22 Aug 2020 11:07:03 +0000 (11:07 +0000)]
Auto merge of #75795 - matthiaskrgr:cargotest_clippy, r=Dylan-DPC

cargotest: fix clippy warnings

Fixes clippy::redundant_static_lifetimes and clippy::toplevel_ref_arg
I also replaced some .expect("") calls with .unwrap()s since there was no message passed by the .expect() anyway.

3 years agoLink to primitive instead of module
Denis Vasilik [Sat, 22 Aug 2020 10:16:03 +0000 (12:16 +0200)]
Link to primitive instead of module

3 years agocompiletest: fix a couple clippy lint findings
Matthias Krüger [Fri, 21 Aug 2020 20:02:42 +0000 (22:02 +0200)]
compiletest: fix a couple clippy lint findings

3 years agoAuto merge of #75790 - LeSeulArtichaut:std-intra-doc, r=jyn514
bors [Sat, 22 Aug 2020 08:54:29 +0000 (08:54 +0000)]
Auto merge of #75790 - LeSeulArtichaut:std-intra-doc, r=jyn514

Use intra-doc-links in `std::sync::*`

Helps with #75080.
r? @jyn514

3 years agoAuto merge of #75776 - GuillaumeGomez:missing-doc-examples-lint-improvements, r=jyn514
bors [Sat, 22 Aug 2020 06:51:13 +0000 (06:51 +0000)]
Auto merge of #75776 - GuillaumeGomez:missing-doc-examples-lint-improvements, r=jyn514

Missing doc examples lint improvements

Fixes #75719.

To be merged after #75718 (only the two last commits are from this PR).

Since you already reviewed #75718, I'll set you as reviewer here as well. :)

r? @jyn514

3 years agoAuto merge of #75772 - tmiasko:io-maybe-no, r=dtolnay
bors [Sat, 22 Aug 2020 04:39:15 +0000 (04:39 +0000)]
Auto merge of #75772 - tmiasko:io-maybe-no, r=dtolnay

Remove unused `Maybe` wrapper around raw standard streams

* Remove result type from raw standard streams constructors
* Make raw standard stream constructors const
* Remove wrapper type handling absent raw standard streams

cargo checked with:

```shell
env CC=true ./x.py check library/std/ \
  --target i686-unknown-linux-gnu \
  --target wasm32-unknown-emscripten \
  --target wasm32-wasi \
  --target x86_64-fortanix-unknown-sgx \
  --target x86_64-pc-windows-gnu \
  --target x86_64-unknown-cloudabi \
  --target x86_64-unknown-hermit \
  --target x86_64-unknown-linux-gnu \
  --target x86_64-uwp-windows-gnu \
  --target x86_64-wrs-vxworks
```

Note: Last target doesn't compile currently.

3 years agoAuto merge of #75792 - matthiaskrgr:bootstrap_clippy, r=Dylan-DPC
bors [Sat, 22 Aug 2020 02:38:36 +0000 (02:38 +0000)]
Auto merge of #75792 - matthiaskrgr:bootstrap_clippy, r=Dylan-DPC

bootstrap: fix a couple of clippy lint warnings

clippy::print_literal
clippy::clone_on_copy
clippy::single_char_pattern
clippy::into_iter_on_ref
clippy::match_like_matches_macro

3 years agoAuto merge of #75797 - Dylan-DPC:rollup-lfeytr7, r=Dylan-DPC
bors [Sat, 22 Aug 2020 00:16:02 +0000 (00:16 +0000)]
Auto merge of #75797 - Dylan-DPC:rollup-lfeytr7, r=Dylan-DPC

Rollup of 12 pull requests

Successful merges:

 - #75705 (Move to intra-doc links for /library/core/src/intrinsics.rs)
 - #75711 (Split `astconv.rs` into its own submodule)
 - #75718 (Don't count variants/fields/consts/associated types in doc-coverage doc examples)
 - #75725 (Use intra-doc-links in `alloc`)
 - #75745 (Remove duplication in `fold_item`)
 - #75753 (Another motivation for CFG: return-oriented programming)
 - #75769 (Minor, remove double nesting of a test module)
 - #75771 (Extend normalization in const-eval-query-stack test)
 - #75781 (More inline asm register name fixups for LLVM)
 - #75782 (Convert core/src/str/pattern.rs to Intra-doc links)
 - #75787 (Use intra-doc-links in `core::ops::*`)
 - #75788 (MIR call terminator represents diverging calls too)

Failed merges:

 - #75773 (Introduce expect snapshot testing library into rustc)

r? @ghost

3 years agoRollup merge of #75788 - nagisa:mir-call-doccomment, r=wesleywiser
Dylan DPC [Sat, 22 Aug 2020 00:14:59 +0000 (02:14 +0200)]
Rollup merge of #75788 - nagisa:mir-call-doccomment, r=wesleywiser

MIR call terminator represents diverging calls too

@bors rollup=always

3 years agoRollup merge of #75787 - LeSeulArtichaut:core-intra-doc, r=jyn514
Dylan DPC [Sat, 22 Aug 2020 00:14:57 +0000 (02:14 +0200)]
Rollup merge of #75787 - LeSeulArtichaut:core-intra-doc, r=jyn514

Use intra-doc-links in `core::ops::*`

Helps with #75080.
r? @jyn514

3 years agoRollup merge of #75782 - GuillaumeGomez:more-links, r=jyn514
Dylan DPC [Sat, 22 Aug 2020 00:14:56 +0000 (02:14 +0200)]
Rollup merge of #75782 - GuillaumeGomez:more-links, r=jyn514

Convert core/src/str/pattern.rs to Intra-doc links

Part of #75080.

3 years agoRollup merge of #75781 - Amanieu:asm-fix, r=nagisa
Dylan DPC [Sat, 22 Aug 2020 00:14:54 +0000 (02:14 +0200)]
Rollup merge of #75781 - Amanieu:asm-fix, r=nagisa

More inline asm register name fixups for LLVM

Fixes #75761

r? @nagisa

3 years agoRollup merge of #75771 - tmiasko:const-eval-query-stack-normalize, r=jonas-schievink
Dylan DPC [Sat, 22 Aug 2020 00:14:52 +0000 (02:14 +0200)]
Rollup merge of #75771 - tmiasko:const-eval-query-stack-normalize, r=jonas-schievink

Extend normalization in const-eval-query-stack test

Builds with debuginfo have additional information in backtrace.

3 years agoRollup merge of #75769 - matklad:flatten, r=petrochenkov
Dylan DPC [Sat, 22 Aug 2020 00:14:50 +0000 (02:14 +0200)]
Rollup merge of #75769 - matklad:flatten, r=petrochenkov

Minor, remove double nesting of a test module

3 years agoRollup merge of #75753 - koutheir:patch-1, r=steveklabnik
Dylan DPC [Sat, 22 Aug 2020 00:14:49 +0000 (02:14 +0200)]
Rollup merge of #75753 - koutheir:patch-1, r=steveklabnik

Another motivation for CFG: return-oriented programming

3 years agoRollup merge of #75745 - jyn514:refactor-resolve, r=Manishearth
Dylan DPC [Sat, 22 Aug 2020 00:14:47 +0000 (02:14 +0200)]
Rollup merge of #75745 - jyn514:refactor-resolve, r=Manishearth

Remove duplication in `fold_item`

r? @Manishearth

3 years agoRollup merge of #75725 - LeSeulArtichaut:alloc-intra-doc, r=jyn514
Dylan DPC [Sat, 22 Aug 2020 00:14:45 +0000 (02:14 +0200)]
Rollup merge of #75725 - LeSeulArtichaut:alloc-intra-doc, r=jyn514

Use intra-doc-links in `alloc`

I didn't have time to test this, so I will let the CI do it for me.

r? @jyn514 cc #75080

3 years agoRollup merge of #75718 - GuillaumeGomez:coverage-ui-doc-examples-count, r=jyn514
Dylan DPC [Sat, 22 Aug 2020 00:14:44 +0000 (02:14 +0200)]
Rollup merge of #75718 - GuillaumeGomez:coverage-ui-doc-examples-count, r=jyn514

Don't count variants/fields/consts/associated types in doc-coverage doc examples

Fixes #75714.

I think I'll need to update the equivalent lint too. Creating an issue for that!

r? @jyn514

3 years agoRollup merge of #75711 - CohenArthur:split-up-astconv, r=oli-obk
Dylan DPC [Sat, 22 Aug 2020 00:14:41 +0000 (02:14 +0200)]
Rollup merge of #75711 - CohenArthur:split-up-astconv, r=oli-obk

Split `astconv.rs` into its own submodule

Fixes #67418

This changed induced a few changes across the Type checker, but only there. Mostly, it was just renaming `Self::` into something else to call specific methods from a subtrait instead of having a 2500+ lines one.

I split up the `astconv.rs` file into its own module. This way, directives such as
```rust
use crate::astconv::AstConv;
```
are still valid, and doing
```rust
use crate::astconv::{AstConv, AstConvGeneric};
```
is possible

(instead of having two modules, one named `astconv_generic.rs` for example and `astconv.rs`)

I'm not entirely sure that the name `AstConvGeneric` is a good one. However, only methods related to lifetimes or generics have been moved over to this module. Sorry about the large diff.

I'd be very happy to make any correction you deem necessary.

r? @oli-obk

3 years agoRollup merge of #75705 - denisvasilik:intra-doc-links-intrinsics, r=jyn514
Dylan DPC [Sat, 22 Aug 2020 00:14:36 +0000 (02:14 +0200)]
Rollup merge of #75705 - denisvasilik:intra-doc-links-intrinsics, r=jyn514

Move to intra-doc links for /library/core/src/intrinsics.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

Known issues:

* The following f32 and f64 primitive methods cannot be resolved:

    f32/f64::powi
    f32/f64::sqrt
    f32/f64::sin
    f32/f64::cos
    f32/f64::powf
    f32/f64::exp
    f32/f64::exp2
    f32/f64::ln
    f32/f64::log2
    f32/f64::log10
    f32/f64::mul_add
    f32/f64::abs
    f32/f64::copysign
    f32/f64::floor
    f32/f64::ceil
    f32/f64::trunc
    f32/f64::round

* Links from core to std:

    [`std::pointer::*`]
    [`std::process::abort`]
    [`from_raw_parts`]
    [`Vec::append`]

* Links with anchors?

I provided a separate commit that replaced links with anchors by intra-doc links.
Here the anchor location information gets lost, so its questionable whether to
actually replace those links.

3 years agocargotest: fix clippy warnings
Matthias Krüger [Fri, 21 Aug 2020 23:49:36 +0000 (01:49 +0200)]
cargotest: fix clippy warnings

Fixes clippy::redundant_static_lifetimes and clippy::toplevel_ref_arg
I also replaced some .expect("") calls with .unwrap()s since there was no message passed by the .expect() anyway.

3 years agoUse intra-doc-links in `std::sync::*`
LeSeulArtichaut [Fri, 21 Aug 2020 22:26:28 +0000 (00:26 +0200)]
Use intra-doc-links in `std::sync::*`

3 years agobootstrap: fix a couple of clippy lint warnings
Matthias Krüger [Fri, 21 Aug 2020 23:08:04 +0000 (01:08 +0200)]
bootstrap: fix a couple of clippy lint warnings

clippy::print_literal
clippy::clone_on_copy
clippy::single_char_pattern
clippy::into_iter_on_ref
clippy::match_like_matches_macro

3 years agoAdd more links
Guillaume Gomez [Fri, 21 Aug 2020 18:43:36 +0000 (20:43 +0200)]
Add more links

3 years agoRemove links that get imported from the prelude
LeSeulArtichaut [Fri, 21 Aug 2020 21:25:07 +0000 (23:25 +0200)]
Remove links that get imported from the prelude

3 years agoUse intra-doc-links in `core::ops::*`
LeSeulArtichaut [Fri, 21 Aug 2020 20:34:21 +0000 (22:34 +0200)]
Use intra-doc-links in `core::ops::*`

3 years agoMIR call terminator represents diverging calls too
Simonas Kazlauskas [Fri, 21 Aug 2020 21:11:52 +0000 (00:11 +0300)]
MIR call terminator represents diverging calls too

3 years agoUpdate rc.rs
amosonn [Fri, 21 Aug 2020 20:25:09 +0000 (22:25 +0200)]
Update rc.rs

3 years agoUse intra-doc links
Denis Vasilik [Fri, 21 Aug 2020 19:41:43 +0000 (21:41 +0200)]
Use intra-doc links

3 years agoUse intra-doc links
Denis Vasilik [Fri, 21 Aug 2020 19:35:52 +0000 (21:35 +0200)]
Use intra-doc links

3 years agoAdd regression test
Amanieu d'Antras [Fri, 21 Aug 2020 18:52:48 +0000 (19:52 +0100)]
Add regression test

3 years agoAdded link to Microsoft's documentation of CFG
Dr. Koutheir Attouchi [Fri, 21 Aug 2020 18:52:30 +0000 (14:52 -0400)]
Added link to Microsoft's documentation of CFG

3 years agoFixed a typo
Dr. Koutheir Attouchi [Fri, 21 Aug 2020 18:47:18 +0000 (14:47 -0400)]
Fixed a typo

3 years agoConvert links to intra-doc links format
Guillaume Gomez [Fri, 21 Aug 2020 18:28:57 +0000 (20:28 +0200)]
Convert links to intra-doc links format

3 years agoAuto merge of #75708 - JohnTitor:stay-cool-full-bootstrap-builder, r=pietroalbini
bors [Fri, 21 Aug 2020 17:43:27 +0000 (17:43 +0000)]
Auto merge of #75708 - JohnTitor:stay-cool-full-bootstrap-builder, r=pietroalbini

Remove the full-bootstrap builder from CI

Fixes #75198

3 years agoMore inline asm register name fixups for LLVM
Amanieu d'Antras [Fri, 21 Aug 2020 17:42:06 +0000 (18:42 +0100)]
More inline asm register name fixups for LLVM

Fixes #75761

3 years agoApply suggestions from code review
LeSeulArtichaut [Fri, 21 Aug 2020 11:09:32 +0000 (13:09 +0200)]
Apply suggestions from code review

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoRework imports used solely for docs
Denis Vasilik [Fri, 21 Aug 2020 17:19:58 +0000 (19:19 +0200)]
Rework imports used solely for docs

3 years agoApply auto-formatter
Denis Vasilik [Fri, 21 Aug 2020 16:50:09 +0000 (18:50 +0200)]
Apply auto-formatter

3 years agoIncorporate suggestions from review
Denis Vasilik [Fri, 21 Aug 2020 16:35:17 +0000 (18:35 +0200)]
Incorporate suggestions from review

3 years agoStrenghten tests for missing_doc_code_examples lint
Guillaume Gomez [Fri, 21 Aug 2020 16:05:51 +0000 (18:05 +0200)]
Strenghten tests for missing_doc_code_examples lint

3 years agoUnify checks for lint missing_doc_code_examples and --show-coverage
Guillaume Gomez [Fri, 21 Aug 2020 13:33:34 +0000 (15:33 +0200)]
Unify checks for lint missing_doc_code_examples and --show-coverage

3 years agoAuto merge of #75694 - RalfJung:miri-align-to, r=nagisa
bors [Fri, 21 Aug 2020 15:40:48 +0000 (15:40 +0000)]
Auto merge of #75694 - RalfJung:miri-align-to, r=nagisa

enable align_to tests in Miri

With https://github.com/rust-lang/miri/issues/1074 resolved, we can enable these tests in Miri.

I also tweaked the test sized to get reasonable execution times with decent test coverage.

3 years agoShow line even if there is no code examples
Guillaume Gomez [Fri, 21 Aug 2020 14:43:04 +0000 (16:43 +0200)]
Show line even if there is no code examples

3 years agoIgnore more kind of items for doc examples
Guillaume Gomez [Fri, 21 Aug 2020 11:51:03 +0000 (13:51 +0200)]
Ignore more kind of items for doc examples

3 years agoMinor, remove double nesting of a test module
Aleksey Kladov [Fri, 21 Aug 2020 11:30:39 +0000 (13:30 +0200)]
Minor, remove double nesting of a test module

3 years agoRemove wrapper type handling absent raw standard streams
Tomasz Miąsko [Fri, 21 Aug 2020 00:00:00 +0000 (00:00 +0000)]
Remove wrapper type handling absent raw standard streams

Raw standard streams are always available.  Remove unused wrapper type
that was supposed to be responsible for handling their absence.

3 years agoMake raw standard stream constructors const
Tomasz Miąsko [Thu, 20 Aug 2020 00:00:00 +0000 (00:00 +0000)]
Make raw standard stream constructors const

3 years agoRemove result type from raw standard streams constructors
Tomasz Miąsko [Thu, 20 Aug 2020 00:00:00 +0000 (00:00 +0000)]
Remove result type from raw standard streams constructors

Raw standard streams constructors are infallible. Remove unnecessary
result type.

3 years agoAuto merge of #75697 - lzutao:mir-dumb-const-prefix, r=oli-obk
bors [Fri, 21 Aug 2020 11:08:31 +0000 (11:08 +0000)]
Auto merge of #75697 - lzutao:mir-dumb-const-prefix, r=oli-obk

Suppress "const" prefix of FnDef constants in MIR dump

I [was asked][1] to suppress the `const` infront of `FnDef`.
I tried to suppress comments for other types, but turned out that `const ()` and `()` is different: https://github.com/rust-lang/rust/pull/75697#discussion_r473892806

[1]: https://github.com/rust-lang/rust/pull/75670#issuecomment-675574333

3 years agoastconv: Split astconv.rs into its own module with submodules
CohenArthur [Wed, 19 Aug 2020 17:07:03 +0000 (19:07 +0200)]
astconv: Split astconv.rs into its own module with submodules

To separate the astconv.rs file, I split it into its own module with a
subtrait called GenericAstConv. This subtrait handles methods related to
generics, be it types or lifetimes.

typeck: Add bounds module and Bounds struct

bounds: Run fmt, add documentation

generic_astconv: Add subtrait GenericAstConv

Some methods of AstConv deal exclusively with Generics. Therefore, it
makes sense to have them in their own trait. Some other methods from
AstConv might be added to it later

generic_astconv: Add more methods from AstConv

Add check_generic_arg_count_for_call() and check_generic_arg_count()

astconv: Add module for clarity

generic: Rename GenericAstConv -> AstConvGeneric

generic: add more methods to AstConvGeneric

astconv: Remove AstConvGeneric trait, add impl dyn AstConv in other
module

astconv: Add errors module to handle AstConv complaints

fmt: format code in astconv/

astconv: Remove old file

astconv: Fix visibility on GenericArgPosition

astconv: Fix visibility on GenericArgPosition

astconv: Fix function visibility on other originally private functions

3 years agoAuto merge of #75765 - JohnTitor:rollup-lexaoa9, r=JohnTitor
bors [Fri, 21 Aug 2020 09:00:49 +0000 (09:00 +0000)]
Auto merge of #75765 - JohnTitor:rollup-lexaoa9, r=JohnTitor

Rollup of 5 pull requests

Successful merges:

 - #75324 (clarify documentation of remove_dir errors)
 - #75532 (Fix RFC-1014 test)
 - #75664 (Update mailmap for mati865)
 - #75727 (Switch to intra-doc links in `core::result`)
 - #75750 (Move to intra doc links for std::thread documentation)

Failed merges:

r? @ghost

3 years agoRollup merge of #75750 - poliorcetics:intra-links-std-thread, r=jyn514
Yuki Okushi [Fri, 21 Aug 2020 08:55:15 +0000 (17:55 +0900)]
Rollup merge of #75750 - poliorcetics:intra-links-std-thread, r=jyn514

Move to intra doc links for std::thread documentation

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

r? @jyn514

3 years agoRollup merge of #75727 - camelid:intra-doc-links-for-core-result, r=jyn514
Yuki Okushi [Fri, 21 Aug 2020 08:55:14 +0000 (17:55 +0900)]
Rollup merge of #75727 - camelid:intra-doc-links-for-core-result, r=jyn514

Switch to intra-doc links in `core::result`

Part of #75080.

@rustbot modify labels: A-intra-doc-links T-doc T-rustdoc

3 years agoRollup merge of #75664 - mati865:mailmap, r=Dylan-DPC
Yuki Okushi [Fri, 21 Aug 2020 08:55:12 +0000 (17:55 +0900)]
Rollup merge of #75664 - mati865:mailmap, r=Dylan-DPC

Update mailmap for mati865

3 years agoRollup merge of #75532 - tmiasko:rfc-1014, r=nikomatsakis
Yuki Okushi [Fri, 21 Aug 2020 08:55:10 +0000 (17:55 +0900)]
Rollup merge of #75532 - tmiasko:rfc-1014, r=nikomatsakis

Fix RFC-1014 test

Use two printlns when testing that writing to a closed stdout does not
panic. Otherwise the test is ineffective, since the current implementation
silently ignores the error during first println regardless.

3 years agoRollup merge of #75324 - ericseppanen:master, r=JohnTitor
Yuki Okushi [Fri, 21 Aug 2020 08:55:08 +0000 (17:55 +0900)]
Rollup merge of #75324 - ericseppanen:master, r=JohnTitor

clarify documentation of remove_dir errors

remove_dir will error if the path doesn't exist or isn't a directory.

It's useful to clarify that this is "remove dir or fail" not "remove dir
if it exists".

I don't think this belongs in the title. "Removes an existing, empty
directory" is strangely worded-- there's no such thing as a non-existing
directory.  Better to just say explicitly it will return an error.

3 years agoImprove wording
Guillaume Gomez [Fri, 21 Aug 2020 07:49:26 +0000 (09:49 +0200)]
Improve wording

3 years agoSwitched ROP link to Desktop layout instead of mobile layout
Dr. Koutheir Attouchi [Fri, 21 Aug 2020 07:34:25 +0000 (03:34 -0400)]
Switched ROP link to Desktop layout instead of mobile layout

3 years agoAuto merge of #75642 - matklad:lexer-comments, r=petrochenkov
bors [Fri, 21 Aug 2020 06:05:39 +0000 (06:05 +0000)]
Auto merge of #75642 - matklad:lexer-comments, r=petrochenkov

Move doc comment parsing to rustc_lexer

Plain comments are trivia, while doc comments are not, so it feels
like this belongs to the rustc_lexer.

The specific reason to do this is the desire to use rustc_lexer in
rustdoc for syntax highlighting, without duplicating "is this a doc
comment?" logic there.

r? @ghost

3 years agoAuto merge of #74846 - Aaron1011:fix/pat-token-capture, r=petrochenkov
bors [Fri, 21 Aug 2020 02:16:35 +0000 (02:16 +0000)]
Auto merge of #74846 - Aaron1011:fix/pat-token-capture, r=petrochenkov

Capture tokens for Pat used in macro_rules! argument

This extends PR #73293 to handle patterns (Pat). Unlike expressions,
patterns do not support custom attributes, so we only need to capture
tokens during macro_rules! argument parsing.