Commit graph

125838 commits

Author SHA1 Message Date
Aaron Hill
cd24aee8e6
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.
2020-08-22 17:18:26 -04:00
Josh Stone
b450c0c86c Write coverage filenames in Version3 format 2020-08-22 13:44:54 -07:00
Josh Stone
fb05be00df 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.
2020-08-22 13:44:54 -07:00
Josh Stone
5c87749a27 Apply suggestions from code review
Flatten the INC definition to one line.

Co-authored-by: lzutao <taolzu@gmail.com>
2020-08-22 13:44:54 -07:00
Josh Stone
a210a29303 Expand RISCV pseudo-instructions to match LLVM 11 2020-08-22 13:44:54 -07:00
Josh Stone
636ca7a412 Upgrade to LLVM 11 (rc2) 2020-08-22 13:44:54 -07:00
Josh Stone
df4bafc360 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`.
2020-08-22 13:44:53 -07:00
Dylan MacKenzie
b65daa7688 Test new floating point bit casts 2020-08-22 13:35:30 -07:00
LeSeulArtichaut
c3e3b7f119 Use intra-doc link in proc_macro 2020-08-22 22:29:43 +02:00
LeSeulArtichaut
c8a372ecff Use intra-doc-links in core::{raw, ffi, pin} 2020-08-22 22:25:27 +02:00
Dylan MacKenzie
23e08e223b Add #![feature(const_float_classify)] for f64::classify and friends 2020-08-22 12:28:31 -07:00
Dylan MacKenzie
3cd450ec5d Add #![feature(const_float_bits_conv)] for f64::to_bits and friends 2020-08-22 12:28:31 -07:00
bors
663d2f5cd3 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).
2020-08-22 18:46:42 +00:00
Vadim Petrochenkov
6a5e6572cb rustc_metadata: Move some code around to merge impls of CrateMetadataRef 2020-08-22 21:38:56 +03:00
Vadim Petrochenkov
15643d5d90 Do not forget capacity when collecting def path hashes 2020-08-22 21:36:34 +03:00
Aaron Hill
df57e28685 Lazy decoding of DefPathTable from crate metadata (non-incremental case) 2020-08-22 21:19:47 +03:00
bors
5528caf914 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
2020-08-22 15:38:13 +00:00
bors
527a685e40 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.
2020-08-22 13:21:24 +00:00
Ralf Jung
9a12d9a243 fix dead links to wrapping_offset_from 2020-08-22 15:07:34 +02:00
Ralf Jung
4f92f0d31b remove feature gate from tests 2020-08-22 15:07:32 +02:00
Ralf Jung
0e4f335e63 stabilize ptr_offset_from 2020-08-22 14:37:10 +02:00
Ralf Jung
7ad4369ba6 remove deprecated wrapping_offset_from 2020-08-22 14:37:08 +02:00
Ralf Jung
1241f1927e offset_from: also document same-provenance requirement 2020-08-22 14:37:06 +02:00
bors
108e90ca78 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.
2020-08-22 11:07:03 +00:00
Denis Vasilik
2500b6df14 Link to primitive instead of module 2020-08-22 12:16:03 +02:00
Matthias Krüger
a2a387c733 compiletest: fix a couple clippy lint findings 2020-08-22 11:44:30 +02:00
bors
c5a8b7b901 Auto merge of #75790 - LeSeulArtichaut:std-intra-doc, r=jyn514
Use intra-doc-links in `std::sync::*`

Helps with #75080.
r? @jyn514
2020-08-22 08:54:29 +00:00
bors
b1bb8aa3ff 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
2020-08-22 06:51:13 +00:00
bors
ebc03f7c80 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.
2020-08-22 04:39:15 +00:00
Joshua Nelson
da921e97f4 rustdoc: Only resolve traits in scope 2020-08-22 00:25:29 -04:00
Joshua Nelson
9db0b86f4e rustdoc: Cache traits implemented by a type
This avoids taking the slow path several thousand times in a row.

- Fallback to all traits if the traits in scope are unknown
- Use a rustdoc thread_local cache instead of a query

The set of traits implemented by a type is not stable across crates:
there could be new traits added in a new crate.

- Use DocContext instead of a thread-local
2020-08-22 00:25:29 -04:00
Joshua Nelson
42232ba70a rustdoc: Add support for associated items even outside the impl itself
Previously, associated items would only be available for linking
directly on the `impl Trait for Type`. Now they can be used anywhere.

- Make `item` for resolve mandatory
- Refactor resolving associated items into a separate function
- Remove broken trait_item logic
- Don't skip the type namespace for associated items
- Only call `variant_field` for `TypeNS`
- Add test for associated items
- Use exhaustive matches instead of wildcards

Wildcards caused several bugs while implementing this.
2020-08-22 00:25:28 -04:00
Joshua Nelson
a97d65d6e4 rustdoc: Rename misleading function
- `is_associated` -> `is_type_alias`

`is_associated` is not a good name for what this is doing. If you look at
https://github.com/rust-lang/rust/pull/74489/files#diff-6a301d597807ee441a41e7237800563dR296,
is_associated() and as_assoc_kind() do completely different things, but
from the name it sounds like they're similar.
2020-08-22 00:22:43 -04:00
Joshua Nelson
9ed91f363a resolve: Add public entrypoint traits_in_module
- Consider the implicit prelude as well
2020-08-22 00:22:42 -04:00
Joshua Nelson
0647a48dc5 resolve: Split ensure_traits into a separate function 2020-08-22 00:22:42 -04:00
Joshua Nelson
344a42e66e resolve: Move get_traits_in_module_containing_item to Resolver 2020-08-22 00:22:42 -04:00
bors
e3a4b16bd0 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
2020-08-22 02:38:36 +00:00
bors
e674422f86 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
2020-08-22 00:16:02 +00:00
Dylan DPC
2ab6fef19f
Rollup merge of #75788 - nagisa:mir-call-doccomment, r=wesleywiser
MIR call terminator represents diverging calls too

@bors rollup=always
2020-08-22 02:14:59 +02:00
Dylan DPC
13dfa9c874
Rollup merge of #75787 - LeSeulArtichaut:core-intra-doc, r=jyn514
Use intra-doc-links in `core::ops::*`

Helps with #75080.
r? @jyn514
2020-08-22 02:14:57 +02:00
Dylan DPC
2ea63794a4
Rollup merge of #75782 - GuillaumeGomez:more-links, r=jyn514
Convert core/src/str/pattern.rs to Intra-doc links

Part of #75080.
2020-08-22 02:14:56 +02:00
Dylan DPC
cb9ef0988e
Rollup merge of #75781 - Amanieu:asm-fix, r=nagisa
More inline asm register name fixups for LLVM

Fixes #75761

r? @nagisa
2020-08-22 02:14:54 +02:00
Dylan DPC
d8262297ad
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.
2020-08-22 02:14:52 +02:00
Dylan DPC
ad15dc2a6f
Rollup merge of #75769 - matklad:flatten, r=petrochenkov
Minor, remove double nesting of a test module
2020-08-22 02:14:50 +02:00
Dylan DPC
cc1e5c0509
Rollup merge of #75753 - koutheir:patch-1, r=steveklabnik
Another motivation for CFG: return-oriented programming
2020-08-22 02:14:49 +02:00
Dylan DPC
17d60e44b0
Rollup merge of #75745 - jyn514:refactor-resolve, r=Manishearth
Remove duplication in `fold_item`

r? @Manishearth
2020-08-22 02:14:47 +02:00
Dylan DPC
ec629800ec
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
2020-08-22 02:14:45 +02:00
Dylan DPC
441c835278
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
2020-08-22 02:14:44 +02:00
Dylan DPC
6cb98e3114
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
2020-08-22 02:14:41 +02:00
Dylan DPC
8af33add1a
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.
2020-08-22 02:14:36 +02:00