Commit graph

152963 commits

Author SHA1 Message Date
Yuki Okushi
9775e88ce9
Rollup merge of #87925 - ehuss:update-books, r=ehuss
Update books

## nomicon

2 commits in f51734eb5566c826b471977747ea3d7d6915bbe9..0c7e5bd1428e7838252bb57b7f0fbfda4ec82f02
2021-07-23 18:24:35 +0900 to 2021-08-04 10:18:22 -0700
- Document lifetime elision for fn types, Fn*, impl (rust-lang/nomicon#298)
- Remove unnecessary `extern crate`s (rust-lang/nomicon#297)

## reference

3 commits in 3b7be075af5d6e402a18efff672a8a265b4596fd..4884fe45c14f8b22121760fb117181bb4da8dfe0
2021-07-26 13:20:11 -0700 to 2021-07-28 21:31:28 -0700
- Mention "function item type to `fn pointer`" coercion (rust-lang/reference#1079)
- example for bindings after at (rust-lang/reference#1027)
- array-expr.md: fix typo; 'polish' sentence (rust-lang/reference#1080)

## book

10 commits in a07036f864b37896b31eb996cd7aedb489f69a1f..7e49659102f0977d9142190e1ba23345c0f00eb1
2021-07-26 20:19:46 -0400 to 2021-08-03 21:41:35 -0400
- Make explicit that enum variant construction is a function
- Clarify why None means we have to annotate the type
- Make the convert quotes script able to do one chapter
- Snapshot of chapter 5
-  (rust-lang/book#2811)
-  (rust-lang/book#2809)
- Ugh quote script, that's not right
- Introduce the dbg macro. Connects to rust-lang/book#1658
- Add an example of declaring and instantiating unit-like structs. Fixes rust-lang/book#2442.
- Remove authors field from all the manifests (rust-lang/book#2805)

## rustc-dev-guide

5 commits in 09343d6f921d2a07c66f8c41ec3d65bf1fa52556..c4644b427cbdaafc7a87be0ccdf5d8aaa07ac35f
2021-07-26 00:37:28 +0200 to 2021-08-10 20:41:44 +0900
- Remove a dead link in `new-target.md` + other nits (rust-lang/rustc-dev-guide#1186)
- Add description of -opt-bisect-limit LLVM option (rust-lang/rustc-dev-guide#1182)
- Fixed team responsible for stabilization (rust-lang/rustc-dev-guide#1181)
- Add S-Inactive PRs as another source of things contributors could work on (rust-lang/rustc-dev-guide#1177)
- git.md: Fix No-Merge Policy link

## embedded-book

1 commits in 09986cd352404eb4659db44613b27cac9aa652fc..4f9fcaa30d11ba52b641e6fd5206536d65838af9
2021-07-18 19:26:46 +0000 to 2021-08-06 17:43:12 +0000
- Fix typo in 'Memory Mapped Registers'  (rust-embedded/book#298)
2021-08-12 15:32:57 +09:00
Yuki Okushi
4c632d9068
Rollup merge of #87903 - jackh726:logging-cleanup, r=oli-obk
Reduce verbosity of tracing output of  RUSTC_LOG

The current output is really hard to read, I find, for things like trait selection. I nearly always end up removing these calls locally.

r? ```@oli-obk``` since you originally authored this
2021-08-12 15:32:56 +09:00
Yuki Okushi
8fe868d82d
Rollup merge of #87878 - lnicola:rust-analyzer-2021-08-09, r=lnicola
⬆️ rust-analyzer
2021-08-12 15:32:55 +09:00
Yuki Okushi
53a66acbd3
Rollup merge of #87671 - jesyspa:issue-87319-multiple-newlines, r=estebank
Warn when an escaped newline skips multiple lines

Resolves #87319
2021-08-12 15:32:54 +09:00
Yuki Okushi
688094b868
Rollup merge of #85835 - Seppel3210:master, r=yaahc
Implement Extend<(A, B)> for (Extend<A>, Extend<B>)

I oriented myself at the implementation of `Iterator::unzip` and also rewrote the impl in terms of `(A, B)::extend` after that.

Since (A, B) now also implements Extend we could also mention in the documentation of unzip that it can do "nested unzipping" (you could unzip `Iterator<Item=(A, (B, C))>` into `(Vec<A>, (Vec<B>, Vec<C>))` for example) but I'm not sure of that so I'm asking here 🙂

(P.S. I saw a couple of people asking if there is an unzip3 but there isn't. So this could be a way to get equivalent functionality)
2021-08-12 15:32:53 +09:00
bors
eb2226b1f1 Auto merge of #85296 - bjorn3:plugin_cleanup, r=petrochenkov
Plugin interface cleanup

The first commit performs two uncontroversial cleanups. The second commit removes `#[plugin_registrar]` and instead requires you to export a `__rustc_plugin_registrar` function, this will require a change to servo's script_plugins (cc `@jdm)`
2021-08-12 04:30:41 +00:00
Jade
295df88986 Reword is_trait_item description 2021-08-11 18:28:42 -07:00
bors
25d3e14da7 Auto merge of #87843 - kornelski:try_reserve, r=m-ou-se
TryReserveErrorKind tests and inline

A small follow-up to #87408
2021-08-12 01:16:22 +00:00
F3real
979ce29086 Correctly report inclusive range in no_effect lint 2021-08-12 01:05:41 +02:00
bors
ccffcafd55 Auto merge of #86532 - estebank:delete-suggestion-underline, r=petrochenkov
Make deleted code in a suggestion clearer

Show suggestions that include deletions in a way similar to `diff`'s output.

<img width="628" alt="" src="https://user-images.githubusercontent.com/1606434/123350316-9078e580-d50f-11eb-89b9-78431b85e23f.png">

For changes that do not have deletions, use `+` as an underline for additions and `~` as an underline for replacements.

<img width="631" alt="" src="https://user-images.githubusercontent.com/1606434/123701745-1ac68f80-d817-11eb-950b-09e5afd7532f.png">

For multiline suggestions, we now use `~` in the gutter to signal replacements and `+` to signal whole line replacements/additions.

<img width="834" alt="" src="https://user-images.githubusercontent.com/1606434/123701331-8eb46800-d816-11eb-9dcd-ef9098071afb.png">

In all cases we now use color to highlight the specific spans and snippets.
2021-08-11 19:26:01 +00:00
Jack O'Connor
a0103e50d5 set the executable bit on pre-commit.sh
`x.py setup` hardlinks this file into .git/hooks. Prior to this commit,
that led to the following warning emitted by `git commit`:

    hint: The '.git/hooks/pre-commit' hook was ignored because it's not set as executable.

Making the checked-in script executable fixes this issue, as the
hardlinked copy uses the same flags.

It looks like the file was originally executable, but that bit was
unset in commit b908905b3d of
https://github.com/rust-lang/rust/pull/85305. It's possible that was
unintentional.
2021-08-11 15:06:33 -04:00
Matthias Geier
f7784ef534
fix line numbers 2021-08-11 20:42:01 +02:00
Matthias Geier
ee63ebe11b
rustfmt 2021-08-11 20:35:48 +02:00
Matthias Geier
573b897441
Add test for similar names "iter" and "item" 2021-08-11 20:32:26 +02:00
Guillaume Gomez
cc319f88a7 Fix rustdoc-js tool string "parsing"
Improve tool: add support for multiline comments
2021-08-11 20:20:17 +02:00
bors
b1b38604f2 Auto merge of #7541 - LeSeulArtichaut:for-never-loop, r=camsteffen
`never_loop`: suggest using an `if let` instead of a `for` loop

changelog: suggest using an `if let` statement instead of a `for` loop that [`never_loop`]s

Fixes #7537, r? `@camsteffen.`
2021-08-11 14:49:37 +00:00
LeSeulArtichaut
fc0af8e4d8 never_loop: suggest using an if let instead of a for loop 2021-08-11 16:35:33 +02:00
Esteban Kuber
652b6a771f update clippy 2021-08-11 14:21:33 +00:00
Esteban Kuber
657caa5bf2 update clippy 2021-08-11 14:21:33 +00:00
Santiago Pastorino
0aa0d59e51
Make concrete_opaque_types be FxHashSet<DefId> 2021-08-11 09:48:25 -03:00
Anton Golov
07aacf53c5 Renamed variable str -> tail for clarity 2021-08-11 13:57:28 +02:00
bors
362e0f55eb Auto merge of #87892 - rust-lang:spec-fill-size-one-bye, r=the8472
Remove size_of == 1 case from `fill` specialization.

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

See [discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/potential.20UB.20in.20slice.3A.3Afill/near/248875743).
2021-08-11 11:40:20 +00:00
Anton Golov
efe069c599 Add UI tests for string escape warnings. 2021-08-11 12:13:24 +02:00
Esteban Küber
99f2977031 Modify structured suggestion output
* On suggestions that include deletions, use a diff inspired output format
* When suggesting addition, use `+` as underline
* Color highlight modified span
2021-08-11 09:46:24 +00:00
Anton Golov
2dff700c4f Update format string tests to explicitly escape multiple newlines
From what I can tell, the goal of the tests is to ensure that the error
formatting is correct.  I think this is still being tested as intended
after this change.
2021-08-11 11:35:08 +02:00
Anton Golov
a03fbfe2ff Warn when an escaped newline skips multiple lines 2021-08-11 11:35:08 +02:00
bors
d488de82f3 Auto merge of #87587 - oli-obk:lazy_tait, r=spastorino
Various refactorings of the TAIT infrastructure

Before this PR we used to store the opaque type knowledge outside the `InferCtxt`, so it got recomputed on every opaque type instantiation.

I also removed a feature gate check that makes no sense in the planned lazy TAIT resolution scheme

Each commit passes all tests, so this PR is best reviewed commit by commit.

r? `@spastorino`
2021-08-11 05:14:45 +00:00
bors
47b41b7788 Auto merge of #87254 - rusticstuff:rustc_codegen_llvm_dont_emit_zero_sized_padding, r=eddyb
LLVM codegen: Don't emit zero-sized padding for fields

Currently padding is emitted before fields of a struct and at the end of the struct regardless of the ABI. Even if no padding is required zero-sized padding fields are emitted. This is not useful and - more importantly - it make it impossible to generate the exact vector types that LLVM expects for certain ARM SIMD intrinsics. This change should unblock the implementation of many ARM intrinsics using the `unadjusted` ABI, see https://github.com/rust-lang/stdarch/issues/1143#issuecomment-827404092.

This is a proof of concept only because the field lookup now takes O(number of fields) time compared to O(1) before since it recalculates the mapping at every lookup. I would like to find out how big the performance impact actually is before implementing caching or restricting this behavior to the `unadjusted` ABI.

cc `@SparrowLii` `@bjorn3`

([Discussion on internals](https://internals.rust-lang.org/t/feature-request-add-a-way-in-rustc-for-generating-struct-type-llvm-ir-without-paddings/15007))
2021-08-11 01:36:23 +00:00
bors
e8e1b32a78 Auto merge of #87923 - JohnTitor:rollup-id54fyz, r=JohnTitor
Rollup of 14 pull requests

Successful merges:

 - #86840 (Constify implementations of `(Try)From` for int types)
 - #87582 (Implement `Printer` for `&mut SymbolPrinter`)
 - #87636 (Added the `Option::unzip()` method)
 - #87700 (Expand explanation of E0530)
 - #87811 (Do not ICE on HIR based WF check when involving lifetimes)
 - #87848 (removed references to parent/child from std::thread documentation)
 - #87854 (correctly handle enum variants in `opt_const_param_of`)
 - #87861 (Fix heading colours in Ayu theme)
 - #87865 (Clarify terms in rustdoc book)
 - #87876 (add `windows` count test)
 - #87880 (Remove duplicate trait bounds in `rustc_data_structures::graph`)
 - #87881 (Proper table row formatting in platform support)
 - #87889 (Use smaller spans when suggesting method call disambiguation)
 - #87895 (typeck: don't suggest inaccessible fields in struct literals and suggest ignoring inaccessible fields in struct patterns)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-08-10 22:37:57 +00:00
Jade
23d398b184 tree-wide: Fix all the rustdoc warnings 2021-08-10 14:40:26 -07:00
Jade
c78cc7ac1f Add is_trait_item, refactor or_fun_call and unwrap_or_else_default 2021-08-10 14:40:26 -07:00
Jade
11ef04728c Add unwrap_or_else_default lint
This will catch `unwrap_or_else(Default::default)` on Result and Option
and suggest `unwrap_or_default()` instead.
2021-08-10 14:40:26 -07:00
Eric Huss
e62cd4040e Update cargo 2021-08-10 13:40:56 -07:00
Eric Huss
107ed0ace9 Update books 2021-08-10 12:38:00 -07:00
Yuki Okushi
4be63b2b5c
Rollup merge of #87895 - TheWastl:issue-87872, r=estebank
typeck: don't suggest inaccessible fields in struct literals and suggest ignoring inaccessible fields in struct patterns

Fixes #87872.

This PR adjusts the missing field diagnostic logic in typeck so that when any of the missing fields in a struct literal or pattern is inaccessible then the error is less confusing, even if some of the missing fields are accessible.

See also #76524.
2021-08-11 04:18:47 +09:00
Yuki Okushi
4d4915ae48
Rollup merge of #87889 - estebank:method-call-disambiguate, r=oli-obk
Use smaller spans when suggesting method call disambiguation

Use smaller spans when suggesting method call disambiguation.
2021-08-11 04:18:46 +09:00
Yuki Okushi
22f864e364
Rollup merge of #87881 - badboy:platform-support-formatting, r=ehuss
Proper table row formatting in platform support

Also moves the target into alphabetical order
2021-08-11 04:18:45 +09:00
Yuki Okushi
e72754dc59
Rollup merge of #87880 - pierwill:graph-duplicate-trait-bound, r=LeSeulArtichaut
Remove duplicate trait bounds in `rustc_data_structures::graph`

Remove duplicate trait bounds in `rustc_data_structures::graph`.
2021-08-11 04:18:44 +09:00
Yuki Okushi
9d21b5a39d
Rollup merge of #87876 - lcnr:windows_no_panic, r=m-ou-se
add `windows` count test

cc #87767
2021-08-11 04:18:43 +09:00
Yuki Okushi
b9b8f5b444
Rollup merge of #87865 - tsoutsman:master, r=GuillaumeGomez
Clarify terms in rustdoc book

Fixes #70898

I chose to completely remove the term directive over attribute because rustdoc has a lint called `invalid_codeblock_attributes` and the term attributes is used throughout the book. I slightly changed the introductory sentence to describe the relationship between annotations and attributes.

I also moved the text explaining the example from below the blocks to above the blocks which is more in line with the rest of the book. I also changed the description for the `should_panic` attribute as I found it a little confusing. Finally, some of the blocks were `text` and some were `rust` so I changed them all to `text` which is in line with the rest of the book.
2021-08-11 04:18:41 +09:00
Yuki Okushi
deee28a14d
Rollup merge of #87861 - tsoutsman:patch-1, r=GuillaumeGomez
Fix heading colours in Ayu theme

Closes #87828
The issue seems to stem from #87210 where code headings were changed from a heading containing a `code` element to a heading with the `code-header` class. `rustdoc.css` was updated, but `ayu.css` was missed.
2021-08-11 04:18:40 +09:00
Yuki Okushi
6c92656624
Rollup merge of #87854 - BoxyUwU:var-None, r=oli-obk
correctly handle enum variants in `opt_const_param_of`

Fixes #87542

`opt_const_param_of` was returning `None` for args on an enum variant `Enum::Variant::<10>` because we called `generics_of` on the enum variant which has no generics.

r? `@oli-obk`
2021-08-11 04:18:39 +09:00
Yuki Okushi
6412bf98ea
Rollup merge of #87848 - godmar:@godmar/thread-join-documentation-fix, r=joshtriplett
removed references to parent/child from std::thread documentation

- also clarifies how thread.join and detaching of threads works
- the previous prose implied that there is a relationship between a
spawning thread and the thread being spawned, and that "child" threads
couldn't outlive their "parents" unless detached, which is incorrect.
2021-08-11 04:18:38 +09:00
Yuki Okushi
bcef40e5fb
Rollup merge of #87811 - estebank:issue-87549, r=oli-obk
Do not ICE on HIR based WF check when involving lifetimes

Fix #87549.
2021-08-11 04:18:37 +09:00
Yuki Okushi
4442806626
Rollup merge of #87700 - kornelski:e530text, r=oli-obk
Expand explanation of E0530

The explanation didn't cover a puzzling case of enum variants missing fields.
2021-08-11 04:18:36 +09:00
Yuki Okushi
bdc92f10e7
Rollup merge of #87636 - Kixiron:unzip-option, r=scottmcm
Added the `Option::unzip()` method

* Adds the `Option::unzip()` method to turn an `Option<(T, U)>` into `(Option<T>, Option<U>)` under the `unzip_option` feature
* Adds tests for both `Option::unzip()` and `Option::zip()`, I noticed that `.zip()` didn't have any
* Adds `#[inline]` to a few of `Option`'s methods that were missing it
2021-08-11 04:18:34 +09:00
Yuki Okushi
43b7cad3e5
Rollup merge of #87582 - tmiasko:symbol-printer, r=michaelwoerister
Implement `Printer` for `&mut SymbolPrinter`

to avoid passing `SymbolPrinter` by value.
2021-08-11 04:18:33 +09:00
Yuki Okushi
3b41447a02
Rollup merge of #86840 - usbalbin:const_from, r=oli-obk
Constify implementations of `(Try)From` for int types

I believe this to be one of the (many?) things blocking const (Range) iterators.

~~If this is to be merged maybe that should wait until `#![feature(const_trait_impl)]` no longer needs `#![allow(incomplete_features)]`?~~ - Done
2021-08-11 04:18:33 +09:00
TheWastl
cda6ecfc3d typeck: better diagnostics for missing inaccessible fields in struct literals/patterns
- typeck/expr: don't suggest adding fields in struct literals with inaccessible fields
- typeck/pat: suggest ignoring inaccessible fields in struct patterns
2021-08-10 16:18:37 +02:00
bjorn3
a501308ec1 Replace #[plugin_registrar] with exporting __rustc_plugin_registrar 2021-08-10 14:20:48 +02:00