Commit graph

153015 commits

Author SHA1 Message Date
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
Oli Scherer
93c4aa80b8 Don't collect into a Vec that is immediately being iterated on again. 2021-08-10 11:03:10 +00:00
bors
76c4a337d1 Auto merge of #7535 - LeSeulArtichaut:7518-self-ty-arg, r=xFrednet
Properly handle `Self` type for `trivially_copy_pass_by_ref`

changelog: properly handle `Self` type for [`trivially_copy_pass_by_ref`].

Fixes #7518
2021-08-10 10:25:26 +00:00
Benoît du Garreau
361398009b Specialize Vec::clone_from for Copy types
This should improve performance and reduce code size.

This also improves `clone_from` for `String`, `OsString` and `PathBuf`.
2021-08-10 11:53:40 +02:00
ivmarkov
459eaa6bae STD support for the ESP-IDF framework 2021-08-10 12:09:00 +03:00
Yuki Okushi
b7b0291147
Move some UI tests to more suitable subdirs 2021-08-10 13:34:05 +09:00
jackh726
62b8a5ef04 Reduce verbosity of RUSTC_LOG 2021-08-09 21:39:39 -04:00
bors
f998e89e43 Auto merge of #7478 - DevinR528:preemtive, r=llogiq
Fix nonstandard_macro_braces FP and docs of disallowed_types

changelog: Fix FP in [`nonstandard_macro_braces`] lint
2021-08-10 00:52:04 +00:00
Mara Bos
38383017d6 Remove size_of == 1 case from fill specialization. 2021-08-09 19:25:28 +02:00
Esteban Kuber
f3021b3561 Use smaller spans when suggesting method call disambiguation 2021-08-09 16:47:09 +00:00
Mara Bos
260f9b9e91 Link to edition guide instead of issues for 2021 lints. 2021-08-09 17:45:01 +02:00
Hans Kratz
02295f464a Test: Use smallvec directly instead of boxed. 2021-08-09 15:42:37 +00:00
Chase Wilson
ab2c5902ca
Added tracking issue to unstable attribute 2021-08-09 10:24:03 -05:00
Chase Wilson
9d8081e8b6
Enabled unzip_option feature for core tests & unzip docs 2021-08-09 10:24:02 -05:00