]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #79529 - Dylan-DPC:rollup-6k20msr, r=Dylan-DPC
bors [Sun, 29 Nov 2020 02:45:48 +0000 (02:45 +0000)]
Auto merge of #79529 - Dylan-DPC:rollup-6k20msr, r=Dylan-DPC

Rollup of 11 pull requests

Successful merges:

 - #79327 (Require allocator to be static for boxed `Pin`-API)
 - #79340 (Rename "stability" CSS class to "item-info" and combine `document_stability` with `document_short`)
 - #79363 (BTreeMap: try to enhance various comments)
 - #79395 (Move ui if tests from top-level into `expr/if`)
 - #79443 (Improve rustdoc JS tests error output)
 - #79464 (Extend doc keyword feature by allowing any ident)
 - #79484 (add enable-full-tools to freebsd builds to prevent occasional link er…)
 - #79505 (Cleanup: shorter and faster code)
 - #79514 (Add test for issue #54121: order dependent trait bounds)
 - #79516 (Remove unnecessary `mut` binding)
 - #79528 (Fix a bootstrap comment)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #79528 - nooberfsh:fix_doc, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Nov 2020 02:14:29 +0000 (03:14 +0100)]
Rollup merge of #79528 - nooberfsh:fix_doc, r=Mark-Simulacrum

Fix a bootstrap comment

3 years agoRollup merge of #79516 - jyn514:cleanup-trait-solver, r=Aaron1011
Dylan DPC [Sun, 29 Nov 2020 02:14:27 +0000 (03:14 +0100)]
Rollup merge of #79516 - jyn514:cleanup-trait-solver, r=Aaron1011

Remove unnecessary `mut` binding

Found while fiddling around with https://github.com/rust-lang/rust/issues/77459.

3 years agoRollup merge of #79514 - Julian-Wollersberger:order-dependent-bounds, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Nov 2020 02:14:26 +0000 (03:14 +0100)]
Rollup merge of #79514 - Julian-Wollersberger:order-dependent-bounds, r=Mark-Simulacrum

Add test for issue #54121: order dependent trait bounds

This adds a test for #54121, which has already been fixed by #73905. Now that issue can be closed.

I tested the test [on the playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6cb061d3b81518f268649551eb67769f) where it indeed fails on stable 1.48, but compiles successfully on beta and nightly.

fixes #54121

3 years agoRollup merge of #79505 - matklad:cleanup, r=jonas-schievink
Dylan DPC [Sun, 29 Nov 2020 02:14:24 +0000 (03:14 +0100)]
Rollup merge of #79505 - matklad:cleanup, r=jonas-schievink

Cleanup: shorter and faster code

3 years agoRollup merge of #79484 - sreehax:master, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Nov 2020 02:14:22 +0000 (03:14 +0100)]
Rollup merge of #79484 - sreehax:master, r=Mark-Simulacrum

add enable-full-tools to freebsd builds to prevent occasional link er…

On FreeBSD, there is sometimes an issue where linking a rust program will fail due to rust not finding a linker, even though lld is included in the base system. This seems to mostly affect bare metal/cross compilation things, such as wasm builds and arm/riscv bare metal work (eg. when trying to compile [this](https://github.com/quantumscraps/scraps)). On Linux and other operating systems, full tools are enabled for builds of rust, so there are no linking issues. This pr should enable fully functional builds on FreeBSD, assuming rust builds correctly with these options.

3 years agoRollup merge of #79464 - GuillaumeGomez:doc-keyword-ident, r=jyn514
Dylan DPC [Sun, 29 Nov 2020 02:14:21 +0000 (03:14 +0100)]
Rollup merge of #79464 - GuillaumeGomez:doc-keyword-ident, r=jyn514

Extend doc keyword feature by allowing any ident

Part of #51315.

As suggested by ``@danielhenrymantilla`` in [this comment](https://github.com/rust-lang/rust/issues/51315#issuecomment-733879934), this PR extends `#[doc(keyword = "...")]` to allow any ident to be used as keyword. The final goal is to allow (proc-)macro crates' owners to write documentation of the keywords they might introduce.

r? ``@jyn514``

3 years agoRollup merge of #79443 - GuillaumeGomez:improve-rustdoc-js-error-output, r=jyn514
Dylan DPC [Sun, 29 Nov 2020 02:14:19 +0000 (03:14 +0100)]
Rollup merge of #79443 - GuillaumeGomez:improve-rustdoc-js-error-output, r=jyn514

Improve rustdoc JS tests error output

It's pretty common when starting to add new tests for rustdoc-js to have issues to understand the errors. With this, it should make things a bit simpler. So now, in case of an error, it displays:

```
---- [js-doc-test] rustdoc-js/basic.rs stdout ----

error: rustdoc-js test failed!
failed to decode compiler output as json: line: {
output: Checking "basic" ... FAILED
==> Result not found in 'others': '{"path":"basic","name":"Fo"}'
Diff of first error:
{
    "path": "basic",
    - "name": "Fo",
    + "name": "Foo",
}
thread '[js-doc-test] rustdoc-js/basic.rs' panicked at 'explicit panic', src/tools/compiletest/src/json.rs:126:21
```

I think it was ``@camelid`` who asked about it a few days ago?

r? ``@jyn514``

3 years agoRollup merge of #79395 - Havvy:test-move-if, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Nov 2020 02:14:17 +0000 (03:14 +0100)]
Rollup merge of #79395 - Havvy:test-move-if, r=Mark-Simulacrum

Move ui if tests from top-level into `expr/if`

This lowers the number of top-level files in src/test/ui from 1612 to 1604.

3 years agoRollup merge of #79363 - ssomers:btree_cleanup_comments, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Nov 2020 02:14:15 +0000 (03:14 +0100)]
Rollup merge of #79363 - ssomers:btree_cleanup_comments, r=Mark-Simulacrum

BTreeMap: try to enhance various comments

All in internal documentation, propagating the "key-value pair" notation from public documentation.

r? ``@Mark-Simulacrum``

3 years agoRollup merge of #79340 - GuillaumeGomez:rename-stability, r=jyn514
Dylan DPC [Sun, 29 Nov 2020 02:14:13 +0000 (03:14 +0100)]
Rollup merge of #79340 - GuillaumeGomez:rename-stability, r=jyn514

Rename "stability" CSS class to "item-info" and combine `document_stability` with `document_short`

Follow-up of #79300

The point of this PR is to make the CSS class more accurate since it's not only about stability anymore.

r? ``@jyn514``

3 years agoRollup merge of #79327 - TimDiekmann:static-alloc-pin-in-box, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Nov 2020 02:14:07 +0000 (03:14 +0100)]
Rollup merge of #79327 - TimDiekmann:static-alloc-pin-in-box, r=Mark-Simulacrum

Require allocator to be static for boxed `Pin`-API

Allocators has to retain their validity until the instance and all of its clones are dropped. When pinning a value, it must live forever, thus, the allocator requires a `'static` lifetime for pinning a value. [Example from reddit](https://www.reddit.com/r/rust/comments/jymzdw/the_story_continues_vec_now_supports_custom/gd7qak2?utm_source=share&utm_medium=web2x&context=3):

```rust
let alloc = MyAlloc(/* ... */);
let pinned = Box::pin_in(42, alloc);
mem::forget(pinned); // Now `value` must live forever
// Otherwise `Pin`'s invariants are violated, storage invalidated
// before Drop was called.
// borrow of `memory` can end here, there is no value keeping it.
drop(alloc); // Oh, value doesn't live forever.
```

3 years agoFix a bootstrap comment
nooberfsh [Sun, 29 Nov 2020 02:02:24 +0000 (10:02 +0800)]
Fix a bootstrap comment

3 years agoAuto merge of #79511 - cjgillot:fitem-2, r=lcnr
bors [Sat, 28 Nov 2020 22:52:18 +0000 (22:52 +0000)]
Auto merge of #79511 - cjgillot:fitem-2, r=lcnr

Do not visit ForeignItemRef for HIR indexing and validation.

Similarly to what is done for ImplItemRef and TraitItemRef.

Fixes #79487

r? `@lcnr`

3 years agoRemove unnecessary `mut` binding
Joshua Nelson [Sat, 28 Nov 2020 19:52:25 +0000 (14:52 -0500)]
Remove unnecessary `mut` binding

3 years agoAdd test for issue #54121:
Julian Wollersberger [Sat, 28 Nov 2020 18:44:31 +0000 (19:44 +0100)]
Add test for issue #54121:
"simple type inference fails depending on order of trait bounds"

3 years agoDo not visit ForeignItemRef for HIR indexing and validation.
Camille GILLOT [Sat, 28 Nov 2020 17:08:11 +0000 (18:08 +0100)]
Do not visit ForeignItemRef for HIR indexing and validation.

Similarly to what is done for ImplItemRef and TraitItemRef.

Fixes #79487

3 years agoAuto merge of #79507 - jonas-schievink:rollup-e5yeayh, r=jonas-schievink
bors [Sat, 28 Nov 2020 15:17:13 +0000 (15:17 +0000)]
Auto merge of #79507 - jonas-schievink:rollup-e5yeayh, r=jonas-schievink

Rollup of 10 pull requests

Successful merges:

 - #78086 (Improve doc for 'as _')
 - #78853 (rustc_parse: fix ConstBlock expr span)
 - #79234 (Resolve typedefs in HashMap gdb/lldb pretty-printers)
 - #79344 (Convert UNC path to local path to satisfy install script on Windows)
 - #79383 (Fix bold code formatting in keyword docs)
 - #79460 (Remove intermediate vectors from `add_bounds`)
 - #79474 (Change comments on types to doc-comments)
 - #79476 (Sync rustc_codegen_cranelift)
 - #79478 (Expand docs on Peekable::peek_mut)
 - #79486 (Slightly improve code samples in E0591)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #79486 - camelid:E0591-code-cleanup, r=lcnr
Jonas Schievink [Sat, 28 Nov 2020 14:58:30 +0000 (15:58 +0100)]
Rollup merge of #79486 - camelid:E0591-code-cleanup, r=lcnr

Slightly improve code samples in E0591

* Improve formatting
* Don't hide `unsafe` block - it's important!

3 years agoRollup merge of #79478 - lukaslueg:peek_mut_docs, r=m-ou-se
Jonas Schievink [Sat, 28 Nov 2020 14:58:28 +0000 (15:58 +0100)]
Rollup merge of #79478 - lukaslueg:peek_mut_docs, r=m-ou-se

Expand docs on Peekable::peek_mut

Slightly expand docs on `std::iter::Peekable::peek_mut`, tracked in #78302

r? `@m-ou-se`

3 years agoRollup merge of #79476 - bjorn3:sync_cg_clif-2020-11-27, r=bjorn3
Jonas Schievink [Sat, 28 Nov 2020 14:58:26 +0000 (15:58 +0100)]
Rollup merge of #79476 - bjorn3:sync_cg_clif-2020-11-27, r=bjorn3

Sync rustc_codegen_cranelift

This implements a few extra simd intrinsics, fixes yet another 128bit bug and updates a few dependencies. It also fixes an cg_clif subtree update that did compile, but that caused a panic when compiling libcore. Other than that this is mostly cleanups.

`@rustbot` modify labels: +A-codegen +A-cranelift +T-compiler

3 years agoRollup merge of #79474 - jyn514:query-mode, r=Aaron1011
Jonas Schievink [Sat, 28 Nov 2020 14:58:25 +0000 (15:58 +0100)]
Rollup merge of #79474 - jyn514:query-mode, r=Aaron1011

Change comments on types to doc-comments

Found while investigating https://github.com/rust-lang/rust/issues/79459.

r? `@Aaron1011`

3 years agoRollup merge of #79460 - bugadani:simplify, r=jonas-schievink
Jonas Schievink [Sat, 28 Nov 2020 14:58:23 +0000 (15:58 +0100)]
Rollup merge of #79460 - bugadani:simplify, r=jonas-schievink

Remove intermediate vectors from `add_bounds`

This PR removes two short lived vectors that don't serve any obvious purpose.

3 years agoRollup merge of #79383 - abdnh:patch-1, r=shepmaster
Jonas Schievink [Sat, 28 Nov 2020 14:58:21 +0000 (15:58 +0100)]
Rollup merge of #79383 - abdnh:patch-1, r=shepmaster

Fix bold code formatting in keyword docs

3 years agoRollup merge of #79344 - JRF63:fix_install_script_win, r=Mark-Simulacrum
Jonas Schievink [Sat, 28 Nov 2020 14:58:19 +0000 (15:58 +0100)]
Rollup merge of #79344 - JRF63:fix_install_script_win, r=Mark-Simulacrum

Convert UNC path to local path to satisfy install script on Windows

`mkdir` with the `-p` flag attempts to create `//?` if passed a UNC path. This fails on both MSYS2 and Git Bash.

The UNC paths come from [canonicalizing](https://github.com/rust-lang/rust/blob/32da90b431919eedb3e281a91caea063ba4edb77/src/bootstrap/install.rs#L79) the install prefix path. `mkdir -p` gets invoked on the [install script](https://github.com/rust-lang/rust-installer/blob/d66f476b4d5e7fdf1ec215c9ac16c923dc292324/install-template.sh#L149).

3 years agoRollup merge of #79234 - ortem:fix-hashmap-pretty-printers, r=Mark-Simulacrum
Jonas Schievink [Sat, 28 Nov 2020 14:58:17 +0000 (15:58 +0100)]
Rollup merge of #79234 - ortem:fix-hashmap-pretty-printers, r=Mark-Simulacrum

Resolve typedefs in HashMap gdb/lldb pretty-printers

`GetTypedefedType` (LLDB) and `strip_typedefs` (GDB) calls are needed to resolve key and value types completely.
Without these calls, debugger doesn't show the actual type.

**Before** (without `GetTypedefedType`):
```
(lldb) frame variable hm[0]
(T) hm[0] = { ... }
```

**After** (with `GetTypedefedType`):
```
(lldb) frame variable hm[0]
((i32, alloc::string::String)) hm[0] = { ... }
```

Based on https://github.com/intellij-rust/intellij-rust/pull/6258

3 years agoRollup merge of #78853 - calebcartwright:fix-const-block-expr-span, r=spastorino
Jonas Schievink [Sat, 28 Nov 2020 14:58:15 +0000 (15:58 +0100)]
Rollup merge of #78853 - calebcartwright:fix-const-block-expr-span, r=spastorino

rustc_parse: fix ConstBlock expr span

The span for a ConstBlock expression should presumably run through the end of the block it contains and not stop at the keyword, just like is done with similar block-containing expression kinds, such as a TryBlock

3 years agoRollup merge of #78086 - poliorcetics:as-placeholder, r=Mark-Simulacrum
Jonas Schievink [Sat, 28 Nov 2020 14:58:13 +0000 (15:58 +0100)]
Rollup merge of #78086 - poliorcetics:as-placeholder, r=Mark-Simulacrum

Improve doc for 'as _'

Fix #78042.

`@rustbot` modify labels: A-coercions T-doc

3 years agoCleanup: shorter and faster code
Aleksey Kladov [Sat, 28 Nov 2020 14:47:34 +0000 (17:47 +0300)]
Cleanup: shorter and faster code

3 years agoRequire allocator to be static for boxed `Pin`-API
Tim Diekmann [Sat, 28 Nov 2020 14:24:30 +0000 (15:24 +0100)]
Require allocator to be static for boxed `Pin`-API

3 years agoBTreeMap: try to enhance various comments & local identifiers
Stein Somers [Thu, 5 Nov 2020 12:23:11 +0000 (13:23 +0100)]
BTreeMap: try to enhance various comments & local identifiers

3 years agoAuto merge of #78296 - Aaron1011:fix/stmt-tokens, r=petrochenkov
bors [Sat, 28 Nov 2020 07:48:56 +0000 (07:48 +0000)]
Auto merge of #78296 - Aaron1011:fix/stmt-tokens, r=petrochenkov

Properly handle attributes on statements

We now collect tokens for the underlying node wrapped by `StmtKind`
nstead of storing tokens directly in `Stmt`.

`LazyTokenStream` now supports capturing a trailing semicolon after it
is initially constructed. This allows us to avoid refactoring statement
parsing to wrap the parsing of the semicolon in `parse_tokens`.

Attributes on item statements
(e.g. `fn foo() { #[bar] struct MyStruct; }`) are now treated as
item attributes, not statement attributes, which is consistent with how
we handle attributes on other kinds of statements. The feature-gating
code is adjusted so that proc-macro attributes are still allowed on item
statements on stable.

Two built-in macros (`#[global_allocator]` and `#[test]`) needed to be
adjusted to support being passed `Annotatable::Stmt`.

3 years agoAuto merge of #79353 - cjgillot:procmacro, r=petrochenkov
bors [Sat, 28 Nov 2020 03:20:09 +0000 (03:20 +0000)]
Auto merge of #79353 - cjgillot:procmacro, r=petrochenkov

Setup proc-macro metadata at encoding instead of decoding

This should improve the common non-proc-macro case for metadata decoding.

3 years agoSlightly improve code samples in E0591
Camelid [Sat, 28 Nov 2020 01:18:29 +0000 (17:18 -0800)]
Slightly improve code samples in E0591

* Improve formatting
* Don't hide `unsafe` block - it's important!

3 years agoAuto merge of #79469 - rust-lang:revert-77467-query-docs, r=jyn514
bors [Sat, 28 Nov 2020 00:53:02 +0000 (00:53 +0000)]
Auto merge of #79469 - rust-lang:revert-77467-query-docs, r=jyn514

Revert "Normalize `<X as Y>::T` for rustdoc"

Reverts rust-lang/rust#77467 by disabling normalization. See https://github.com/rust-lang/rust/issues/79459; I intend to reland normalization once that's fixed.

r? `@Aaron1011`
cc `@oli-obk` `@GuillaumeGomez`

3 years agoAuto merge of #79284 - Nadrieril:constructor-module, r=varkor
bors [Fri, 27 Nov 2020 22:34:59 +0000 (22:34 +0000)]
Auto merge of #79284 - Nadrieril:constructor-module, r=varkor

Split match exhaustiveness into two files

I feel the constructor-related things in the `_match` module make enough sense on their own so I split them off. It makes `_match` feel less like a complicated mess. I'm not aware of PRs in progress against this module apart from my own so hopefully I'm not annoying too many people.
I have a lot of questions about the conventions in naming and modules around the compiler. Like, why is the module named `_match`? Could I rename it to `usefulness` maybe? Should `deconstruct_pat` be a submodule of `_match` since only `_match` uses it? Is it ok to move big piles of code around even if it makes git blame more difficult?

r? `@varkor`
`@rustbot` modify labels: +A-exhaustiveness-checking

3 years agoadd enable-full-tools to freebsd builds to prevent occasional link errors when compil...
Sreehari S [Fri, 27 Nov 2020 22:21:23 +0000 (14:21 -0800)]
add enable-full-tools to freebsd builds to prevent occasional link errors when compiling rust programs

3 years agoExpand docs on Peekable::peek_mut
Lukas Lueg [Fri, 27 Nov 2020 20:46:39 +0000 (21:46 +0100)]
Expand docs on Peekable::peek_mut

3 years agoBump recursion_limit in rustc_ast_passes
Aaron Hill [Fri, 27 Nov 2020 20:46:19 +0000 (15:46 -0500)]
Bump recursion_limit in rustc_ast_passes

When cfg(parallel_compiler) is enabled, we end up trying to prove
Send/Sync bounds for some deeply nested types (at least when rustdoc is
run).

3 years agoMerge commit '5988bbd24aa87732bfa1d111ba00bcdaa22c481a' into sync_cg_clif-2020-11-27
bjorn3 [Fri, 27 Nov 2020 19:48:53 +0000 (20:48 +0100)]
Merge commit '5988bbd24aa87732bfa1d111ba00bcdaa22c481a' into sync_cg_clif-2020-11-27

3 years agoEncode proc_macro directly.
Camille GILLOT [Sun, 15 Nov 2020 17:34:10 +0000 (18:34 +0100)]
Encode proc_macro directly.

Encode proc_macro name directly.

Do not store None values.

3 years agoAuto merge of #79372 - jyn514:more-cleanup, r=GuillaumeGomez
bors [Fri, 27 Nov 2020 19:30:58 +0000 (19:30 +0000)]
Auto merge of #79372 - jyn514:more-cleanup, r=GuillaumeGomez

Cleanup more of rustdoc

-  Use `Item::from_def_id` for StructField
- Use `from_def_id_and_parts` for primitives and keywords
- Take `String` instead of `Symbol` in `from_def_id` - this avoids having to intern then immediately stringify the existing string.
- Remove unused `get_stability` and `get_deprecation`
- Remove unused `attrs` field from `primitives`
- Remove unused `attrs` field from `keywords`

This will probably conflict with https://github.com/rust-lang/rust/pull/79335 and I would prefer for that PR to land first - I'm anxious for https://github.com/rust-lang/rust/pull/77467 to land :)

Makes https://github.com/rust-lang/rust/issues/76998 easier to add.

r? `@GuillaumeGomez`

3 years agoChange comments on types to doc-comments
Joshua Nelson [Fri, 27 Nov 2020 19:17:25 +0000 (14:17 -0500)]
Change comments on types to doc-comments

3 years agoRename `_match` to `usefulness`
Nadrieril [Fri, 27 Nov 2020 18:43:28 +0000 (18:43 +0000)]
Rename `_match` to `usefulness`

3 years agoRename `pat_constructor` to `Constructor::from_pat`
Nadrieril [Sat, 21 Nov 2020 23:26:53 +0000 (23:26 +0000)]
Rename `pat_constructor` to `Constructor::from_pat`

3 years agoMove the definitions of the two `Ctxt`s to the top
Nadrieril [Sat, 21 Nov 2020 22:41:17 +0000 (22:41 +0000)]
Move the definitions of the two `Ctxt`s to the top

3 years agoExtract everything related to pattern deconstruction to a new module
Nadrieril [Sat, 21 Nov 2020 23:13:32 +0000 (23:13 +0000)]
Extract everything related to pattern deconstruction to a new module

3 years agoNo need to expose `Matrix` internals
Nadrieril [Sat, 21 Nov 2020 23:12:53 +0000 (23:12 +0000)]
No need to expose `Matrix` internals

3 years agoDisentangle `Fields` and `PatStack`
Nadrieril [Wed, 18 Nov 2020 22:07:37 +0000 (22:07 +0000)]
Disentangle `Fields` and `PatStack`

3 years agoMove `Constructor::apply` to `Fields`
Nadrieril [Sat, 21 Nov 2020 21:22:13 +0000 (21:22 +0000)]
Move `Constructor::apply` to `Fields`

3 years agoRevert the effect of #77467 by disabling normalization in rustdoc
oli [Fri, 27 Nov 2020 17:08:49 +0000 (17:08 +0000)]
Revert the effect of #77467 by disabling normalization in rustdoc

3 years agoRevert "Use the new component dependency option of the rust-toolchain file"
bjorn3 [Fri, 27 Nov 2020 17:05:05 +0000 (18:05 +0100)]
Revert "Use the new component dependency option of the rust-toolchain file"

This reverts commit 648caced6eb0d23c31758f69f2f44a7d748526b9.

Rustup on github actions isn't yet updated

3 years agoSync from rust c9228570668803e3e6402770d55f23a12c9ae686
bjorn3 [Fri, 27 Nov 2020 17:01:29 +0000 (18:01 +0100)]
Sync from rust c9228570668803e3e6402770d55f23a12c9ae686

3 years agoRustup to rustc 1.50.0-nightly (72da5a9d8 2020-11-26)
bjorn3 [Fri, 27 Nov 2020 17:01:01 +0000 (18:01 +0100)]
Rustup to rustc 1.50.0-nightly (72da5a9d8 2020-11-26)

3 years agoRemove unused is_doc_keyword function
Guillaume Gomez [Fri, 27 Nov 2020 13:55:06 +0000 (14:55 +0100)]
Remove unused is_doc_keyword function

3 years agoAdd tests for doc_keyword feature extension
Guillaume Gomez [Fri, 27 Nov 2020 13:28:17 +0000 (14:28 +0100)]
Add tests for doc_keyword feature extension

3 years agoUse the new component dependency option of the rust-toolchain file
bjorn3 [Fri, 27 Nov 2020 15:52:17 +0000 (16:52 +0100)]
Use the new component dependency option of the rust-toolchain file

3 years agoAllow to have any valid ident used as keyword in doc_keyword feature
Guillaume Gomez [Fri, 27 Nov 2020 13:27:59 +0000 (14:27 +0100)]
Allow to have any valid ident used as keyword in doc_keyword feature

3 years agoAuto merge of #77484 - terhechte:support-ios-catalyst-macabi-arm64-target-triple...
bors [Fri, 27 Nov 2020 15:58:26 +0000 (15:58 +0000)]
Auto merge of #77484 - terhechte:support-ios-catalyst-macabi-arm64-target-triple, r=nikomatsakis

Add support for Arm64 Catalyst on ARM Macs

This is an iteration on https://github.com/rust-lang/rust/pull/63467 which was merged a while ago. In the aforementioned PR, I added support for the `X86_64-apple-ios-macabi` target triple, which is Catalyst, iOS apps running on macOS.

Very soon, Apple will launch ARM64 based Macs which will introduce `aarch64_apple_darwin.rs`, macOS apps using the Darwin ABI running on ARM. This PR adds support for Catalyst apps on ARM Macs: iOS apps compiled for the darwin ABI.

I don't have access to a Apple Developer Transition Kit (DTK), so I can't really test if the generated binaries work correctly. I'm vaguely hopeful that somebody with access to a DTK could give this a spin.

3 years agoDon't lint on redundant semicolons after item statements
Aaron Hill [Fri, 27 Nov 2020 14:36:59 +0000 (09:36 -0500)]
Don't lint on redundant semicolons after item statements

This preserves the current lint behavior for now.

Linting after item statements currently prevents the compiler from bootstrapping.
Fixing this is blocked on fixing this upstream in Cargo, and bumping the Cargo
submodule.

3 years agoAuto merge of #79318 - cjgillot:fitem, r=lcnr
bors [Fri, 27 Nov 2020 13:45:22 +0000 (13:45 +0000)]
Auto merge of #79318 - cjgillot:fitem, r=lcnr

Store HIR ForeignItem in a side table

In a similar fashion to Item, ImplItem and TraitItem.

3 years agoRemove intermediate vectors from add_bounds
Dániel Buga [Fri, 27 Nov 2020 11:36:14 +0000 (12:36 +0100)]
Remove intermediate vectors from add_bounds

3 years agoAuto merge of #79433 - calebcartwright:parse-attr-vis, r=petrochenkov
bors [Fri, 27 Nov 2020 11:23:11 +0000 (11:23 +0000)]
Auto merge of #79433 - calebcartwright:parse-attr-vis, r=petrochenkov

rustc_parse: restore public visibility on parse_attribute

Make `parse_attribute` public as rustfmt is a downstream consumer. Refs https://github.com/rust-lang/rust/pull/78782#discussion_r530658904

r? `@petrochenkov`

3 years agoAuto merge of #78194 - bugadani:generic, r=varkor
bors [Fri, 27 Nov 2020 06:53:47 +0000 (06:53 +0000)]
Auto merge of #78194 - bugadani:generic, r=varkor

Skip most of `create_substs_for_ast_path` if type is not generic

3 years agoUse custom macro instead of println
Aaron Hill [Fri, 27 Nov 2020 02:44:09 +0000 (21:44 -0500)]
Use custom macro instead of println

Loading a macro from libstd causes us to load serialized
`SyntaxContext`s in a platform-dependent way, causing the printed spans
to differ between platforms.

3 years agoAuto merge of #79266 - b-naber:gat_trait_path_parser, r=petrochenkov
bors [Fri, 27 Nov 2020 00:18:24 +0000 (00:18 +0000)]
Auto merge of #79266 - b-naber:gat_trait_path_parser, r=petrochenkov

Generic Associated Types in Trait Paths - Ast part

The Ast part of https://github.com/rust-lang/rust/pull/78978

r? `@petrochenkov`

3 years agoRebase fallout.
Camille GILLOT [Thu, 26 Nov 2020 21:26:52 +0000 (22:26 +0100)]
Rebase fallout.

3 years agoSkip most of create_substs_for_ast_path if type is not generic
Dániel Buga [Wed, 21 Oct 2020 16:25:28 +0000 (18:25 +0200)]
Skip most of create_substs_for_ast_path if type is not generic

Co-authored-by: varkor <github@varkor.com>
3 years agoFix new 'unnecessary trailing semicolon' warnings
Aaron Hill [Wed, 25 Nov 2020 22:00:28 +0000 (17:00 -0500)]
Fix new 'unnecessary trailing semicolon' warnings

3 years agoAdd additional semicolon test
Aaron Hill [Wed, 25 Nov 2020 21:58:10 +0000 (16:58 -0500)]
Add additional semicolon test

3 years agoOnly eat semicolons for statements that need them
Aaron Hill [Wed, 25 Nov 2020 21:52:24 +0000 (16:52 -0500)]
Only eat semicolons for statements that need them

When parsing a statement (e.g. inside a function body),
we now consider `struct Foo {};` and `$stmt;` to each consist
of two statements: `struct Foo {}` and `;`, and `$stmt` and `;`.

As a result, an attribute macro invoke as
`fn foo() { #[attr] struct Bar{}; }` will see `struct Bar{}` as its
input. Additionally, the 'unused semicolon' lint now fires in more
places.

3 years agoProperly handle attributes on statements
Aaron Hill [Tue, 17 Nov 2020 19:27:44 +0000 (14:27 -0500)]
Properly handle attributes on statements

We now collect tokens for the underlying node wrapped by `StmtKind`
instead of storing tokens directly in `Stmt`.

`LazyTokenStream` now supports capturing a trailing semicolon after it
is initially constructed. This allows us to avoid refactoring statement
parsing to wrap the parsing of the semicolon in `parse_tokens`.

Attributes on item statements
(e.g. `fn foo() { #[bar] struct MyStruct; }`) are now treated as
item attributes, not statement attributes, which is consistent with how
we handle attributes on other kinds of statements. The feature-gating
code is adjusted so that proc-macro attributes are still allowed on item
statements on stable.

Two built-in macros (`#[global_allocator]` and `#[test]`) needed to be
adjusted to support being passed `Annotatable::Stmt`.

3 years agoAuto merge of #79338 - Aaron1011:fix/token-reparse-cache, r=petrochenkov
bors [Thu, 26 Nov 2020 22:02:45 +0000 (22:02 +0000)]
Auto merge of #79338 - Aaron1011:fix/token-reparse-cache, r=petrochenkov

Cache pretty-print/retokenize result to avoid compile time blowup

Fixes #79242

If a `macro_rules!` recursively builds up a nested nonterminal
(passing it to a proc-macro at each step), we will end up repeatedly
pretty-printing/retokenizing the same nonterminals. Unfortunately, the
'probable equality' check we do has a non-trivial cost, which leads to a
blowup in compilation time.

As a workaround, we cache the result of the 'probable equality' check,
which eliminates the compilation time blowup for the linked issue. This
commit only touches a single file (other than adding tests), so it
should be easy to backport.

The proper solution is to remove the pretty-print/retokenize hack
entirely. However, this will almost certainly break a large number of
crates that were relying on hygiene bugs created by using the reparsed
`TokenStream`. As a result, we will definitely not want to backport
such a change.

3 years agoImprove rustdoc JS tests error output
Guillaume Gomez [Thu, 26 Nov 2020 13:02:01 +0000 (14:02 +0100)]
Improve rustdoc JS tests error output

3 years agoUse visitor for its very purpose.
Camille GILLOT [Thu, 26 Nov 2020 18:12:24 +0000 (19:12 +0100)]
Use visitor for its very purpose.

3 years agoFormatting.
Camille GILLOT [Thu, 26 Nov 2020 18:11:43 +0000 (19:11 +0100)]
Formatting.

3 years agoBless test.
Camille GILLOT [Thu, 26 Nov 2020 07:16:17 +0000 (08:16 +0100)]
Bless test.

3 years agoUpdate test.
Camille GILLOT [Mon, 23 Nov 2020 17:05:36 +0000 (18:05 +0100)]
Update test.

3 years agoRemove ForeignMod struct.
Camille GILLOT [Wed, 11 Nov 2020 21:40:09 +0000 (22:40 +0100)]
Remove ForeignMod struct.

3 years agoStore ForeignItem in a side table.
Camille GILLOT [Wed, 11 Nov 2020 20:57:54 +0000 (21:57 +0100)]
Store ForeignItem in a side table.

3 years agoUpdate coverage output now that primitives have proper spans
Joshua Nelson [Tue, 24 Nov 2020 04:55:57 +0000 (23:55 -0500)]
Update coverage output now that primitives have proper spans

3 years agoRemove unused `attrs` field from `keywords`
Joshua Nelson [Tue, 24 Nov 2020 03:40:36 +0000 (22:40 -0500)]
Remove unused `attrs` field from `keywords`

3 years agoUse `from_def_id_and_parts` for primitives and keywords
Joshua Nelson [Tue, 24 Nov 2020 03:33:10 +0000 (22:33 -0500)]
Use `from_def_id_and_parts` for primitives and keywords

- Take `String` instead of `Symbol` - this avoids having to intern then
  immediately stringify the existing string.
- Remove unused `get_stability` and `get_deprecation`
- Remove unused `attrs` field from `primitives`

3 years agoUse `Item::from_def_id` for StructField
Joshua Nelson [Tue, 24 Nov 2020 03:03:37 +0000 (22:03 -0500)]
Use `Item::from_def_id` for StructField

3 years agorustc_parse: restore pub vis on parse_attribute
Caleb Cartwright [Thu, 26 Nov 2020 01:54:08 +0000 (19:54 -0600)]
rustc_parse: restore pub vis on parse_attribute

3 years agoAuto merge of #77671 - flip1995:lint_list_always_plugins, r=oli-obk,Manishearth
bors [Thu, 26 Nov 2020 18:51:45 +0000 (18:51 +0000)]
Auto merge of #77671 - flip1995:lint_list_always_plugins, r=oli-obk,Manishearth

Always print lints from plugins, if they're available

Currently you can get a list of lints and lint groups by running `rustc
-Whelp`. This prints an additional line at the end:
```
Compiler plugins can provide additional lints and lint groups. To see a listing of these, re-run `rustc -W help` with a crate filename.
```

Clippy is such a "compiler plugin", that provides additional lints.
Running `clippy-driver -Whelp` (`rustc` wrapper) still only prints the
rustc lints with the above message at the end. But when running
`clippy-driver -Whelp main.rs`, where `main.rs` is any rust file, it
also prints Clippy lints. I don't think this is a good approach from a
UX perspective: Why is a random file necessary to print a help message?

This PR changes this behavior: Whenever a compiler callback
registers lints, it is assumed that these lints come from a plugin and
are printed without having to specify a Rust source file.

Fixes rust-lang/rust-clippy#6122

cc `@Manishearth` `@ebroto` for the Clippy changes.

3 years agoAuto merge of #77467 - jyn514:query-docs, r=oli-obk
bors [Thu, 26 Nov 2020 16:31:12 +0000 (16:31 +0000)]
Auto merge of #77467 - jyn514:query-docs, r=oli-obk

Normalize `<X as Y>::T` for rustdoc

- Only run for `QPath::Resolved` with `Some` self parameter (`<X as Y>::T`)
- Fall back to the previous behavior if the path can't be resolved

The first commit is a pure refactor and should probably be reviewed by `@GuillaumeGomez.` I recommend reviewing the second commit on its own.

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

r? `@eddyb`
cc `@danielhenrymantilla` , `@lcnr`

3 years agoAuto merge of #79441 - jonas-schievink:rollup-l9v00bl, r=jonas-schievink
bors [Thu, 26 Nov 2020 14:14:57 +0000 (14:14 +0000)]
Auto merge of #79441 - jonas-schievink:rollup-l9v00bl, r=jonas-schievink

Rollup of 10 pull requests

Successful merges:

 - #77758 (suggest turbofish syntax for uninferred const arguments)
 - #79000 (Move lev_distance to rustc_ast, make non-generic)
 - #79362 (Lower patterns before using the bound variable)
 - #79365 (Upgrades the coverage map to Version 4)
 - #79402 (Fix typos)
 - #79412 (Clean up rustdoc tests by removing unnecessary features)
 - #79413 (Fix persisted doctests on Windows / when using workspaces)
 - #79420 (Fixes a word typo in librustdoc)
 - #79421 (Fix docs formatting for `thir::pattern::_match`)
 - #79428 (Fixup compiler docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRemove redundant `lift_to_tcx`
Joshua Nelson [Thu, 26 Nov 2020 12:59:51 +0000 (07:59 -0500)]
Remove redundant `lift_to_tcx`

... and fix some fuzzy wording in the debug logging.

3 years agoRollup merge of #79428 - camelid:fixup-compiler-docs, r=davidtwco
Jonas Schievink [Thu, 26 Nov 2020 12:39:20 +0000 (13:39 +0100)]
Rollup merge of #79428 - camelid:fixup-compiler-docs, r=davidtwco

Fixup compiler docs

The sublist was being rendered as a code block because it was indented 4
spaces.

3 years agoRollup merge of #79421 - camelid:_match-docs-fmt, r=petrochenkov
Jonas Schievink [Thu, 26 Nov 2020 12:39:18 +0000 (13:39 +0100)]
Rollup merge of #79421 - camelid:_match-docs-fmt, r=petrochenkov

Fix docs formatting for `thir::pattern::_match`

They were being rendered all on one line.

3 years agoRollup merge of #79420 - njasm:patch_rustdoc, r=GuillaumeGomez
Jonas Schievink [Thu, 26 Nov 2020 12:39:16 +0000 (13:39 +0100)]
Rollup merge of #79420 - njasm:patch_rustdoc, r=GuillaumeGomez

Fixes a word typo in librustdoc

Fixes a word typo in librustdoc

3 years agoRollup merge of #79413 - Swatinem:rustdoc-persist-crate, r=GuillaumeGomez
Jonas Schievink [Thu, 26 Nov 2020 12:39:15 +0000 (13:39 +0100)]
Rollup merge of #79413 - Swatinem:rustdoc-persist-crate, r=GuillaumeGomez

Fix persisted doctests on Windows / when using workspaces

When using the unstable `--persist-doctests` option,
Windows path separators were not escaped properly. Also when running
the command in a workspace, crate files can overwrite each other.

Before: `src\lib_rs_1_0\rust_out`
After: `\crate_a_src_lib_rs_1_0\rust_out`, `\crate_b_src_lib_rs_1_0\rust_out`

3 years agoRollup merge of #79412 - GuillaumeGomez:cleanup-rustdoc-tests, r=jyn514
Jonas Schievink [Thu, 26 Nov 2020 12:39:13 +0000 (13:39 +0100)]
Rollup merge of #79412 - GuillaumeGomez:cleanup-rustdoc-tests, r=jyn514

Clean up rustdoc tests by removing unnecessary features

r? ``@jyn514``

3 years agoRollup merge of #79402 - bugadani:typos, r=matthewjasper
Jonas Schievink [Thu, 26 Nov 2020 12:39:11 +0000 (13:39 +0100)]
Rollup merge of #79402 - bugadani:typos, r=matthewjasper

Fix typos

3 years agoRollup merge of #79365 - richkadel:llvm-cov-map-version-4, r=wesleywiser
Jonas Schievink [Thu, 26 Nov 2020 12:39:09 +0000 (13:39 +0100)]
Rollup merge of #79365 - richkadel:llvm-cov-map-version-4, r=wesleywiser

Upgrades the coverage map to Version 4

Changes the coverage map injected into binaries compiled with
`-Zinstrument-coverage` to LLVM Coverage Mapping Format, Version 4 (from
Version 3). Note, binaries compiled with this version will require LLVM
tools from at least LLVM Version 11.

r? ``@wesleywiser``

3 years agoRollup merge of #79362 - cjgillot:relou, r=oli-obk
Jonas Schievink [Thu, 26 Nov 2020 12:39:07 +0000 (13:39 +0100)]
Rollup merge of #79362 - cjgillot:relou, r=oli-obk

Lower patterns before using the bound variable

So as to avoid having to lower patterns twice.

3 years agoRollup merge of #79000 - sivadeilra:user/ardavis/lev_distance, r=wesleywiser
Jonas Schievink [Thu, 26 Nov 2020 12:39:05 +0000 (13:39 +0100)]
Rollup merge of #79000 - sivadeilra:user/ardavis/lev_distance, r=wesleywiser

Move lev_distance to rustc_ast, make non-generic

rustc_ast currently has a few dependencies on rustc_lexer. Ideally, an AST
would not have any dependency its lexer, for minimizing
design-time dependencies. Breaking this dependency would also have practical
benefits, since modifying rustc_lexer would not trigger a rebuild of rustc_ast.

This commit does not remove the rustc_ast --> rustc_lexer dependency,
but it does remove one of the sources of this dependency, which is the
code that handles fuzzy matching between symbol names for making suggestions
in diagnostics. Since that code depends only on Symbol, it is easy to move
it to rustc_span. It might even be best to move it to a separate crate,
since other tools such as Cargo use the same algorithm, and have simply
contain a duplicate of the code.

This changes the signature of find_best_match_for_name so that it is no
longer generic over its input. I checked the optimized binaries, and this
function was duplicated for nearly every call site, because most call sites
used short-lived iterator chains, generic over Map and such. But there's
no good reason for a function like this to be generic, since all it does
is immediately convert the generic input (the Iterator impl) to a concrete
Vec<Symbol>. This has all of the costs of generics (duplicated method bodies)
with no benefit.

Changing find_best_match_for_name to be non-generic removed about 10KB of
code from the optimized binary. I know it's a drop in the bucket, but we have
to start reducing binary size, and beginning to tame over-use of generics
is part of that.

3 years agoRollup merge of #77758 - Stupremee:turbofish-help-for-const, r=varkor
Jonas Schievink [Thu, 26 Nov 2020 12:39:00 +0000 (13:39 +0100)]
Rollup merge of #77758 - Stupremee:turbofish-help-for-const, r=varkor

suggest turbofish syntax for uninferred const arguments

When not providing a const generic value, and it can not be inferred, the following suggestion is suggested:
![image](https://user-images.githubusercontent.com/39732259/95616180-af127b80-0a69-11eb-8877-551c815f9627.png)

Resolves #76737

r? ``@varkor``

3 years agoAuto merge of #79427 - Aaron1011:fix/const-array-index, r=oli-obk
bors [Thu, 26 Nov 2020 11:59:17 +0000 (11:59 +0000)]
Auto merge of #79427 - Aaron1011:fix/const-array-index, r=oli-obk

Resolve inference variables before trying to remove overloaded indexing

Fixes #79152

This code was already set up to handle indexing an array. However, it
appears that we never end up with an inference variable for the slice
case, so the missing call to `resolve_vars_if_possible` had no effect
until now.