]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #80128 - pierwill:pierwill-docs-fieldpat, r=jyn514
Mara Bos [Wed, 30 Dec 2020 20:56:49 +0000 (20:56 +0000)]
Rollup merge of #80128 - pierwill:pierwill-docs-fieldpat, r=jyn514

Edit rustc_ast::ast::FieldPat docs

Punctuation fixes.

3 years agoRollup merge of #79479 - camelid:intersperse, r=m-ou-se
Mara Bos [Wed, 30 Dec 2020 20:56:47 +0000 (20:56 +0000)]
Rollup merge of #79479 - camelid:intersperse, r=m-ou-se

Add `Iterator::intersperse`

This is a rebase of #75784. I'm hoping to push this past the finish line!

cc `@jonas-schievink`

3 years agoRollup merge of #78934 - DeveloperC286:issue_60302_vec, r=m-ou-se
Mara Bos [Wed, 30 Dec 2020 20:56:45 +0000 (20:56 +0000)]
Rollup merge of #78934 - DeveloperC286:issue_60302_vec, r=m-ou-se

refactor: removing library/alloc/src/vec/mod.rs ignore-tidy-filelength

This PR removes the need for ignore-tidy-filelength for library/alloc/src/vec/mod.rs which is part of the issue #60302

It is probably easiest to review this PR by looking at it commit by commit rather than looking at the overall diff.

3 years agoAdd tracking issue
Camelid [Sat, 28 Nov 2020 23:55:07 +0000 (15:55 -0800)]
Add tracking issue

3 years agoAdd Iterator::intersperse
Jonas Schievink [Fri, 21 Aug 2020 19:56:40 +0000 (21:56 +0200)]
Add Iterator::intersperse

3 years agoFix rustdoc link in vec/into_iter.rs.
Mara Bos [Wed, 30 Dec 2020 15:35:02 +0000 (15:35 +0000)]
Fix rustdoc link in vec/into_iter.rs.

3 years agoAuto merge of #80510 - JohnTitor:rollup-gow7y0l, r=JohnTitor
bors [Wed, 30 Dec 2020 15:30:56 +0000 (15:30 +0000)]
Auto merge of #80510 - JohnTitor:rollup-gow7y0l, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #80185 (Fix ICE when pointing at multi bytes character)
 - #80260 (slightly more typed interface to panic implementation)
 - #80311 (Improvements to NatVis support)
 - #80337 (Use `desc` as a doc-comment for queries if there are no doc comments)
 - #80381 (Revert "Cleanup markdown span handling")
 - #80492 (remove empty wraps, don't return Results from from infallible functions)
 - #80509 (where possible, pass slices instead of &Vec or &String (clippy::ptr_arg))

Failed merges:

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

3 years agoRollup merge of #80509 - matthiaskrgr:ptr_arg, r=varkor
Yuki Okushi [Wed, 30 Dec 2020 13:49:26 +0000 (22:49 +0900)]
Rollup merge of #80509 - matthiaskrgr:ptr_arg, r=varkor

where possible, pass slices instead of &Vec or &String (clippy::ptr_arg)

3 years agoRollup merge of #80492 - matthiaskrgr:tasty_wraps, r=varkor
Yuki Okushi [Wed, 30 Dec 2020 13:49:24 +0000 (22:49 +0900)]
Rollup merge of #80492 - matthiaskrgr:tasty_wraps, r=varkor

remove empty wraps, don't return Results from from infallible functions

This makes code easier to understand because it is more obvious when a function actually can't fail (return Err or None)

Make functions that only ever return Some(x), return x directly
Remove return type from functions that return Option<(), Err> but would only ever return Ok(()).

Found with `clippy::unnecessary_wraps`

3 years agoRollup merge of #80381 - rust-lang:revert-80244-spans, r=GuillaumeGomez
Yuki Okushi [Wed, 30 Dec 2020 13:49:23 +0000 (22:49 +0900)]
Rollup merge of #80381 - rust-lang:revert-80244-spans, r=GuillaumeGomez

Revert "Cleanup markdown span handling"

Reverts rust-lang/rust#80244. This caused a diagnostic regression, originally it was:

```
warning: unresolved link to `std::process::Comman`
 --> link.rs:3:10
  |
3 | //! [a]: std::process::Comman
  |          ^^^^^^^^^^^^^^^^^^^^ no item named `Comman` in module `process`
  |
  = note: `#[warn(broken_intra_doc_links)]` on by default
```
but after that PR rustdoc now displays
```
warning: unresolved link to `std::process::Comman`
 --> link.rs:1:14
  |
1 | //! Links to [a] [link][a]
  |              ^^^ no item named `Comman` in module `process`
  |
  = note: `#[warn(broken_intra_doc_links)]` on by default
```
which IMO is much less clear.

cc `@bugadani,` thanks for catching this in https://github.com/rust-lang/rust/pull/77859.
r? `@GuillaumeGomez`

3 years agoRollup merge of #80337 - jyn514:add-query-desc, r=varkor
Yuki Okushi [Wed, 30 Dec 2020 13:49:21 +0000 (22:49 +0900)]
Rollup merge of #80337 - jyn514:add-query-desc, r=varkor

Use `desc` as a doc-comment for queries if there are no doc comments

This at least gives *some* idea of what the query does even if it's not very readable. Some examples:

![image](https://user-images.githubusercontent.com/23638587/103021399-13e15c00-4518-11eb-8121-940774ae2fd1.png)
![image](https://user-images.githubusercontent.com/23638587/103021448-222f7800-4518-11eb-8ee6-cc10795fdc22.png)
![image](https://user-images.githubusercontent.com/23638587/103021434-1d6ac400-4518-11eb-885b-59d00c57bc70.png)

I want to turn `{}` into either `_` or the stringified expr, but [I'm not sure how to do that](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Evaluate.20format.20string.20in.20proc-macro). In the meantime, this is better than having no docs at all.

3 years agoRollup merge of #80311 - sivadeilra:natvis, r=petrochenkov
Yuki Okushi [Wed, 30 Dec 2020 13:49:19 +0000 (22:49 +0900)]
Rollup merge of #80311 - sivadeilra:natvis, r=petrochenkov

Improvements to NatVis support

NatVis files describe how to display types in some Windows debuggers,
such as Visual Studio, WinDbg, and VS Code.

This commit makes several improvements:

* Adds visualizers for Rc<T>, Weak<T>, and Arc<T>.

* Changes [size] to [len], for consistency with the Rust API.
  Visualizers often use [size] to mirror the size() method on C++ STL
  collections.

* Several visualizers used the PVOID and ULONG typedefs. These are part
  of the Windows API; they are not guaranteed to always be defined in a
  pure Rust DLL/EXE. I converted PVOID to `void*` and `ULONG` to
  `unsigned long`.

* Cosmetic change: Removed {} braces around the visualized display
  for `Option` types. They now display simply as `Some(value)` or
  `None`, which reflects what is written in source code.

* The visualizer for `alloc::string::String` makes assumptions about
  the layout of `String` (it casts `String*` to another type), rather
  than using symbolic expressions. This commit changes the visualizer
  so that it simply uses symbolic expressions to access the string
  data and string length.

* The visualizers for `str` and `String` now place the character data
  array under a synthetic `[chars]` node. When expanding a `String`
  node, users rarely want to see an array of characters. This just places
  them behind one expansion node / level.

3 years agoRollup merge of #80260 - RalfJung:less-untyped-panics, r=m-ou-se
Yuki Okushi [Wed, 30 Dec 2020 13:49:17 +0000 (22:49 +0900)]
Rollup merge of #80260 - RalfJung:less-untyped-panics, r=m-ou-se

slightly more typed interface to panic implementation

The panic payload is currently being passed around as a `usize`. However, it actually is a pointer, and the involved types are available on all ends of this API, so I propose we use the proper pointer type to avoid some casts. Avoiding int-to-ptr casts also makes this code work with `miri -Zmiri-track-raw-pointers`.

3 years agoRollup merge of #80185 - JohnTitor:issue-80134, r=davidtwco
Yuki Okushi [Wed, 30 Dec 2020 13:49:16 +0000 (22:49 +0900)]
Rollup merge of #80185 - JohnTitor:issue-80134, r=davidtwco

Fix ICE when pointing at multi bytes character

Fixes #80134

Seems this ICE was introduced by #73953, checking width of span to avoid ICE.

3 years agoFix ICE when pointing at multi bytes character
Yuki Okushi [Sat, 19 Dec 2020 10:29:56 +0000 (19:29 +0900)]
Fix ICE when pointing at multi bytes character

3 years agoAuto merge of #79684 - usbalbin:const_copy, r=oli-obk
bors [Wed, 30 Dec 2020 12:43:02 +0000 (12:43 +0000)]
Auto merge of #79684 - usbalbin:const_copy, r=oli-obk

Make copy[_nonoverlapping] const

Constifies
* `intrinsics::copy` and `intrinsics::copy_nonoverlapping`
* `ptr::read` and `ptr::read_unaligned`
  * `*const T::read` and `*const T::read_unaligned`
  * `*mut T::read` and `*mut T::read_unaligned`
* `MaybeUninit::assume_init_read`

3 years agoremove unused return types such as empty Results or Options that would always be...
Matthias Krüger [Tue, 29 Dec 2020 21:24:15 +0000 (22:24 +0100)]
remove unused return types such as empty Results or Options that would always be Some(..)

remove unused return type of dropck::check_drop_obligations()
don't wrap return type in Option in get_macro_by_def_id() since we would always return Some(..)
remove redundant return type of back::write::optimize()
don't Option-wrap return type of compute_type_parameters() since we always return Some(..)
don't return empty Result in assemble_generator_candidates()
don't return empty Result in assemble_closure_candidates()
don't return empty result in assemble_fn_pointer_candidates()
don't return empty result in assemble_candidates_from_impls()
don't return empty result in assemble_candidates_from_auto_impls()
don't return emtpy result in assemble_candidates_for_trait_alias()
don't return empty result in assemble_builtin_bound_candidates()
don't return empty results in assemble_extension_candidates_for_traits_in_scope() and assemble_extension_candidates_for_trait()
remove redundant wrapping of return type of StripItem::strip() since it always returns Some(..)
remove unused return type of assemble_extension_candidates_for_all_traits()

3 years agowhere possible, pass slices instead of &Vec or &String (clippy::ptr_arg)
Matthias Krüger [Wed, 30 Dec 2020 11:59:07 +0000 (12:59 +0100)]
where possible, pass slices instead of &Vec or &String (clippy::ptr_arg)

3 years agoAuto merge of #80503 - JohnTitor:rollup-b26vglu, r=JohnTitor
bors [Wed, 30 Dec 2020 09:51:42 +0000 (09:51 +0000)]
Auto merge of #80503 - JohnTitor:rollup-b26vglu, r=JohnTitor

Rollup of 13 pull requests

Successful merges:

 - #79812 (Lint on redundant trailing semicolon after item)
 - #80348 (remove redundant clones (clippy::redundant_clone))
 - #80358 (Edit rustc_span documentation)
 - #80457 (Add missing commas to `rustc_ast_pretty::pp` docs)
 - #80461 (Add llvm-libunwind change to bootstrap CHANGELOG)
 - #80464 (Use Option::map_or instead of open coding it)
 - #80465 (Fix typo in ffi-pure.md)
 - #80467 (More uses of the matches! macro)
 - #80469 (Fix small typo in time comment)
 - #80472 (Use sans-serif font for the "all items" page links)
 - #80477 (Make forget intrinsic safe)
 - #80482 (don't clone copy types)
 - #80487 (don't redundantly repeat field names)

Failed merges:

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

3 years agoRollup merge of #80487 - matthiaskrgr:field_names, r=jyn514
Yuki Okushi [Wed, 30 Dec 2020 09:15:29 +0000 (18:15 +0900)]
Rollup merge of #80487 - matthiaskrgr:field_names, r=jyn514

don't redundantly repeat field names

r? `@Dylan-DPC`

3 years agoRollup merge of #80482 - matthiaskrgr:cl0ne_on_copy, r=jyn514
Yuki Okushi [Wed, 30 Dec 2020 09:15:27 +0000 (18:15 +0900)]
Rollup merge of #80482 - matthiaskrgr:cl0ne_on_copy, r=jyn514

don't clone copy types

r? `@Dylan-DPC`

3 years agoRollup merge of #80477 - tmiasko:safe-forget, r=oli-obk
Yuki Okushi [Wed, 30 Dec 2020 09:15:25 +0000 (18:15 +0900)]
Rollup merge of #80477 - tmiasko:safe-forget, r=oli-obk

Make forget intrinsic safe

3 years agoRollup merge of #80472 - GuillaumeGomez:sans-serif-for-all-items-page, r=Nemo157
Yuki Okushi [Wed, 30 Dec 2020 09:15:23 +0000 (18:15 +0900)]
Rollup merge of #80472 - GuillaumeGomez:sans-serif-for-all-items-page, r=Nemo157

Use sans-serif font for the "all items" page links

The "all items" pages' links aren't using a sans-serif font unlike the rest of equivalent items in the other module pages. ``@Nemo157`` reported me this issue so here is the fix!

r? ``@Nemo157``

3 years agoRollup merge of #80469 - BlackHoleFox:fix-time-typo, r=jonas-schievink
Yuki Okushi [Wed, 30 Dec 2020 09:15:21 +0000 (18:15 +0900)]
Rollup merge of #80469 - BlackHoleFox:fix-time-typo, r=jonas-schievink

Fix small typo in time comment

I was reading through [this PR](https://github.com/rust-lang/rust/pull/77727/files) and noticed a [small typo](https://github.com/rust-lang/rust/pull/77727/files#diff-3183738c82f747fd92bb573712073aa384b16e14d154bf2df18f41077edc31cbR240) smuggled though. This just fixes that.

3 years agoRollup merge of #80467 - LingMan:more_matches, r=oli-obk
Yuki Okushi [Wed, 30 Dec 2020 09:15:20 +0000 (18:15 +0900)]
Rollup merge of #80467 - LingMan:more_matches, r=oli-obk

More uses of the matches! macro

`@rustbot` modify labels +C-cleanup +T-compiler

3 years agoRollup merge of #80465 - eltociear:patch-3, r=jyn514
Yuki Okushi [Wed, 30 Dec 2020 09:15:18 +0000 (18:15 +0900)]
Rollup merge of #80465 - eltociear:patch-3, r=jyn514

Fix typo in ffi-pure.md

accesing -> accessing

3 years agoRollup merge of #80464 - LingMan:map_or, r=oli-obk
Yuki Okushi [Wed, 30 Dec 2020 09:15:16 +0000 (18:15 +0900)]
Rollup merge of #80464 - LingMan:map_or, r=oli-obk

Use Option::map_or instead of open coding it

``@rustbot`` modify labels +C-cleanup +T-compiler

3 years agoRollup merge of #80461 - rust-lang:tmandry-patch-1, r=Mark-Simulacrum
Yuki Okushi [Wed, 30 Dec 2020 09:15:14 +0000 (18:15 +0900)]
Rollup merge of #80461 - rust-lang:tmandry-patch-1, r=Mark-Simulacrum

Add llvm-libunwind change to bootstrap CHANGELOG

From #77703.

This doesn't need a `changelog-seen` version bump because the old values aren't accepted anymore, meaning anyone who was using this had to change it already.

r? ``@Mark-Simulacrum``

3 years agoRollup merge of #80457 - camelid:pretty-docs-commas, r=jonas-schievink
Yuki Okushi [Wed, 30 Dec 2020 09:15:13 +0000 (18:15 +0900)]
Rollup merge of #80457 - camelid:pretty-docs-commas, r=jonas-schievink

Add missing commas to `rustc_ast_pretty::pp` docs

3 years agoRollup merge of #80358 - pierwill:edit_rustc_span, r=lcnr
Yuki Okushi [Wed, 30 Dec 2020 09:15:11 +0000 (18:15 +0900)]
Rollup merge of #80358 - pierwill:edit_rustc_span, r=lcnr

Edit rustc_span documentation

Various changes to the `rustc_span` docs, including the following:

- Additions to top-level docs
- Edits to the source_map module docs
- Edits to documentation for `Span` and `SpanData`
- Added intra-docs links
- Documentation for Levenshtein distances
- Fixed missing punctuation

3 years agoRollup merge of #80348 - matthiaskrgr:less_clones, r=Dylan-DPC
Yuki Okushi [Wed, 30 Dec 2020 09:15:04 +0000 (18:15 +0900)]
Rollup merge of #80348 - matthiaskrgr:less_clones, r=Dylan-DPC

remove redundant clones (clippy::redundant_clone)

3 years agoRollup merge of #79812 - Aaron1011:lint-item-trailing-semi, r=oli-obk
Yuki Okushi [Wed, 30 Dec 2020 09:15:03 +0000 (18:15 +0900)]
Rollup merge of #79812 - Aaron1011:lint-item-trailing-semi, r=oli-obk

Lint on redundant trailing semicolon after item

We now lint on code like this:

```rust
fn main() {
    fn foo() {};
    struct Bar {};
}
```

Previously, this caused warnings in Cargo, so it was disabled.

3 years agoAuto merge of #79472 - Aaron1011:new-remove-pretty-print-hack, r=petrochenkov
bors [Wed, 30 Dec 2020 07:04:49 +0000 (07:04 +0000)]
Auto merge of #79472 - Aaron1011:new-remove-pretty-print-hack, r=petrochenkov

Replace pretty-print/compare/retokenize hack with targeted workarounds

Based on https://github.com/rust-lang/rust/pull/78296
cc https://github.com/rust-lang/rust/issues/43081

The 'pretty-print/compare/retokenize' hack is used to try to avoid passing an outdated `TokenStream` to a proc-macro when the underlying AST is modified in some way (e.g. cfg-stripping before derives). Unfortunately, retokenizing throws away spans (including hygiene information), which causes issues of its own. Every improvement to the accuracy of the pretty-print/retokenize comparison has resulted in non-trivial ecosystem breakage due to hygiene changes. In extreme cases, users deliberately wrote unhygienic `macro_rules!` macros (likely because they did not realize that the compiler's behavior was a bug).

Additionaly, the comparison between the original and pretty-printed/retoknized token streams comes at a non-trivial runtime cost, as shown by https://github.com/rust-lang/rust/pull/79338

This PR removes the pretty-print/compare/retokenize logic from `nt_to_tokenstream`. We only discard the original `TokenStream` under two circumstances:
* Inner attributes are used (detected by examining the AST)
* `cfg`/`cfg_attr` processing modifies the AST. This is detected by making the visitor update a flag when it performs a modification, instead of trying to detect the modification after-the-fact. Note that a 'matching' `cfg` (e.g. `#[cfg(not(FALSE)]`) does not actually get removed from the AST, allowing us to preserve the original `TokenStream`.

In all other cases, we preserve the original `TokenStream`.

This could use a bit of refactoring/renaming - opening for a Crater run.

r? `@ghost`

3 years agoUse `desc` as a doc-comment if none exist yet
Joshua Nelson [Wed, 23 Dec 2020 16:45:30 +0000 (11:45 -0500)]
Use `desc` as a doc-comment if none exist yet

- Replace {} with the stringified expr

  Giant thank you to `@danielhenrymantilla` for figuring out how to make
  this work :heart:

- Note that this is just an approximation and it would be better to add
  a doc-comment

3 years agoAuto merge of #80453 - petrochenkov:nocfail, r=Mark-Simulacrum
bors [Tue, 29 Dec 2020 23:20:46 +0000 (23:20 +0000)]
Auto merge of #80453 - petrochenkov:nocfail, r=Mark-Simulacrum

Remove `compile-fail` test suite

By moving all of its tests to `ui` test suite.
Now we have directives like `// dont-check-compiler-stderr` that allow to disable `.stderr` comparison for platform-dependent tests without introducing a whole new test suite.

3 years agoRemove unnecessary semicolon from Clippy test
Aaron Hill [Tue, 29 Dec 2020 22:15:53 +0000 (17:15 -0500)]
Remove unnecessary semicolon from Clippy test

3 years agoRemove unnecessary semicolon from Rustdoc-generated code
Aaron Hill [Mon, 28 Dec 2020 19:44:33 +0000 (14:44 -0500)]
Remove unnecessary semicolon from Rustdoc-generated code

3 years agoRemove trailing semicolon in librustdoc
Aaron Hill [Tue, 8 Dec 2020 02:52:13 +0000 (21:52 -0500)]
Remove trailing semicolon in librustdoc

3 years agoLint on redundant trailing semicolon after item
Aaron Hill [Mon, 7 Dec 2020 23:10:48 +0000 (18:10 -0500)]
Lint on redundant trailing semicolon after item

We now lint on code like this:

```rust
fn main() {
    fn foo() {};
    struct Bar {};
}
```

Previously, this caused warnings in Cargo, so it was disabled.

3 years agodon't redundantly repeat field names
Matthias Krüger [Tue, 29 Dec 2020 21:02:47 +0000 (22:02 +0100)]
don't redundantly repeat field names

3 years agoRemove `compile-fail` test suite
Vadim Petrochenkov [Mon, 28 Dec 2020 17:15:16 +0000 (20:15 +0300)]
Remove `compile-fail` test suite

3 years agodon't clone copy types
Matthias Krüger [Tue, 29 Dec 2020 18:33:48 +0000 (19:33 +0100)]
don't clone copy types

3 years agoMore uses of the matches! macro
LingMan [Tue, 29 Dec 2020 00:20:06 +0000 (01:20 +0100)]
More uses of the matches! macro

3 years agoUse sans-serif font for the "all items" page links
Guillaume Gomez [Tue, 29 Dec 2020 14:56:52 +0000 (15:56 +0100)]
Use sans-serif font for the "all items" page links

3 years agoRemove pretty-print/reparse hack, and add derive-specific hack
Aaron Hill [Mon, 23 Nov 2020 06:43:55 +0000 (01:43 -0500)]
Remove pretty-print/reparse hack, and add derive-specific hack

3 years agotest: updated expected Vec src path
C [Sat, 5 Dec 2020 14:21:50 +0000 (14:21 +0000)]
test: updated expected Vec src path

3 years agodocs: fixing references
C [Sat, 5 Dec 2020 13:47:27 +0000 (13:47 +0000)]
docs: fixing references

3 years agofix: moved import into #[cfg(test)]
C [Sat, 5 Dec 2020 13:27:03 +0000 (13:27 +0000)]
fix: moved import into #[cfg(test)]

3 years agostyle: applying Rust style
C [Sat, 5 Dec 2020 01:44:07 +0000 (01:44 +0000)]
style: applying Rust style

3 years agorefactor: removing // ignore-tidy-filelength
C [Sat, 5 Dec 2020 01:42:29 +0000 (01:42 +0000)]
refactor: removing // ignore-tidy-filelength

3 years agorefactor: moved SpecExtend into spec_extend.rs
C [Sat, 5 Dec 2020 01:41:44 +0000 (01:41 +0000)]
refactor: moved SpecExtend into spec_extend.rs

3 years agorefactor: moving SpecFromIter into spec_from_iter.rs
C [Sat, 5 Dec 2020 01:37:10 +0000 (01:37 +0000)]
refactor: moving SpecFromIter into spec_from_iter.rs

3 years agorefactor: moved SpecFromIterNested to spec_from_iter_nested.rs
C [Sat, 5 Dec 2020 01:30:20 +0000 (01:30 +0000)]
refactor: moved SpecFromIterNested to spec_from_iter_nested.rs

3 years agorefactor: moved InPlaceDrop into in_place_drop.rs
C [Sat, 5 Dec 2020 01:26:52 +0000 (01:26 +0000)]
refactor: moved InPlaceDrop into in_place_drop.rs

3 years agorefactor: moved SetLenOnDrop to set_len_on_drop
C [Sat, 5 Dec 2020 01:21:51 +0000 (01:21 +0000)]
refactor: moved SetLenOnDrop to set_len_on_drop

3 years agorefactor: moved SpecFromElem to spec_from_elem.rs
C [Sat, 5 Dec 2020 01:14:31 +0000 (01:14 +0000)]
refactor: moved SpecFromElem to spec_from_elem.rs

3 years agorefactor: moved PartialEq into partial_eq
C [Sat, 5 Dec 2020 01:07:34 +0000 (01:07 +0000)]
refactor: moved PartialEq into partial_eq

3 years agorefactor: moving SourceIterMarker into source_iter_marker.rs
C [Sat, 5 Dec 2020 01:04:06 +0000 (01:04 +0000)]
refactor: moving SourceIterMarker into source_iter_marker.rs

3 years agorefactor: moved IsZero into is_zero.rs
C [Sat, 5 Dec 2020 00:52:48 +0000 (00:52 +0000)]
refactor: moved IsZero into is_zero.rs

3 years agorefactor: moving AsIntoIter into into_iter.rs
C [Sat, 5 Dec 2020 00:47:54 +0000 (00:47 +0000)]
refactor: moving AsIntoIter into into_iter.rs

3 years agorefactor: moved IntoIter into into_iter.rs
C [Sat, 5 Dec 2020 00:45:20 +0000 (00:45 +0000)]
refactor: moved IntoIter into into_iter.rs

3 years agorefactor: moved Vec impl Cow into cow.rs
C [Sat, 5 Dec 2020 00:17:25 +0000 (00:17 +0000)]
refactor: moved Vec impl Cow into cow.rs

3 years agorefactor: moving Drain into drain.rs
C [Sat, 5 Dec 2020 00:12:42 +0000 (00:12 +0000)]
refactor: moving Drain into drain.rs

3 years agorefactor: moving Splice into splice.rs
C [Sat, 5 Dec 2020 00:04:32 +0000 (00:04 +0000)]
refactor: moving Splice into splice.rs

3 years agorefactor: moving DrainFilter into drain_filter.rs
C [Fri, 4 Dec 2020 23:58:11 +0000 (23:58 +0000)]
refactor: moving DrainFilter into drain_filter.rs

3 years agorefactor: moving vec.rs to vec/mod.rs
C [Fri, 4 Dec 2020 23:50:05 +0000 (23:50 +0000)]
refactor: moving vec.rs to vec/mod.rs

3 years agoAuto merge of #80014 - jyn514:box-item-kind, r=nnethercote
bors [Tue, 29 Dec 2020 10:41:01 +0000 (10:41 +0000)]
Auto merge of #80014 - jyn514:box-item-kind, r=nnethercote

[rustdoc] Box ItemKind to reduce the size of `Item`

This brings the size of `Item` from

```
[src/librustdoc/lib.rs:103] std::mem::size_of::<Item>() = 536
```

to

```
[src/librustdoc/lib.rs:103] std::mem::size_of::<Item>() = 136
```

This is an alternative to https://github.com/rust-lang/rust/pull/79967; I don't think it makes sense to make both changes.

Helps with #79103.

3 years agoFix small typo in time comment
BlackHoleFox [Tue, 29 Dec 2020 08:10:29 +0000 (02:10 -0600)]
Fix small typo in time comment

3 years agoAuto merge of #79084 - simonvandel:instcombine-perf, r=oli-obk
bors [Tue, 29 Dec 2020 06:21:18 +0000 (06:21 +0000)]
Auto merge of #79084 - simonvandel:instcombine-perf, r=oli-obk

Small perf changes for InstCombine

3 years agoAdd static assertion for the size of ItemKind
Joshua Nelson [Tue, 29 Dec 2020 05:31:46 +0000 (00:31 -0500)]
Add static assertion for the size of ItemKind

3 years agoFix typo in ffi-pure.md
Ikko Ashimine [Tue, 29 Dec 2020 04:37:21 +0000 (13:37 +0900)]
Fix typo in ffi-pure.md

accesing -> accessing

3 years agoUse Option::map_or instead of open coding it
LingMan [Tue, 29 Dec 2020 03:27:37 +0000 (04:27 +0100)]
Use Option::map_or instead of open coding it

3 years agoAuto merge of #80449 - m-ou-se:rollup-kp2e5n8, r=m-ou-se
bors [Tue, 29 Dec 2020 00:16:54 +0000 (00:16 +0000)]
Auto merge of #80449 - m-ou-se:rollup-kp2e5n8, r=m-ou-se

Rollup of 11 pull requests

Successful merges:

 - #80383 (clarify wrapping ptr arithmetic docs)
 - #80390 (BTreeMap: rename the area access methods)
 - #80393 (Add links to the source for the rustc and rustdoc books.)
 - #80398 (Use raw version of align_of in rc data_offset)
 - #80402 (Document `InferTy` & co.)
 - #80403 (fix: small typo error in chalk/mod.rs)
 - #80410 (rustdoc book: fix example)
 - #80419 (Add regression test for #80375)
 - #80430 (Add "length" as doc alias to len methods)
 - #80431 (Add "chr" as doc alias to char::from_u32)
 - #80448 (Fix stabilization version of deque_range feature.)

Failed merges:

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

3 years agoMake forget intrinsic safe
Tomasz Miąsko [Tue, 29 Dec 2020 00:00:00 +0000 (00:00 +0000)]
Make forget intrinsic safe

3 years agoAdd llvm-libunwind change to bootstrap CHANGELOG
Tyler Mandry [Mon, 28 Dec 2020 23:57:53 +0000 (15:57 -0800)]
Add llvm-libunwind change to bootstrap CHANGELOG

From #77703.

3 years agoAdd missing commas to `rustc_ast_pretty::pp` docs
Camelid [Mon, 28 Dec 2020 22:23:20 +0000 (14:23 -0800)]
Add missing commas to `rustc_ast_pretty::pp` docs

3 years agouse exhaustive pattern match to prevent future bugs
Simon Vandel Sillesen [Mon, 28 Dec 2020 22:19:35 +0000 (23:19 +0100)]
use exhaustive pattern match to prevent future bugs

3 years agoImprovements to NatVis support
Arlie Davis [Tue, 22 Dec 2020 22:02:07 +0000 (14:02 -0800)]
Improvements to NatVis support

NatVis files describe how to display types in some Windows debuggers,
such as Visual Studio, WinDbg, and VS Code.

This commit makes several improvements:

* Adds visualizers for Rc<T>, Weak<T>, and Arc<T>.

* Changes [size] to [len], for consistency with the Rust API.
  Visualizers often use [size] to mirror the size() method on C++ STL
  collections.

* Several visualizers used the PVOID and ULONG typedefs. These are part
  of the Windows API; they are not guaranteed to always be defined in a
  pure Rust DLL/EXE. I converted PVOID to `void*` and `ULONG` to
  `unsigned long`.

* Cosmetic change: Removed {} braces around the visualized display
  for `Option` types. They now display simply as `Some(value)` or
  `None`, which reflects what is written in source code.

* The visualizer for `alloc::string::String` makes assumptions about
  the layout of `String` (it casts `String*` to another type), rather
  than using symbolic expressions. This commit changes the visualizer
  so that it simply uses symbolic expressions to access the string
  data and string length.

3 years agoRollup merge of #80448 - m-ou-se:deque-range-version, r=m-ou-se
Mara Bos [Mon, 28 Dec 2020 19:09:35 +0000 (19:09 +0000)]
Rollup merge of #80448 - m-ou-se:deque-range-version, r=m-ou-se

Fix stabilization version of deque_range feature.

See https://github.com/rust-lang/rust/pull/79022#issuecomment-751315315

3 years agoRollup merge of #80431 - xfix:add-chr-as-doc-alias, r=steveklabnik
Mara Bos [Mon, 28 Dec 2020 19:09:34 +0000 (19:09 +0000)]
Rollup merge of #80431 - xfix:add-chr-as-doc-alias, r=steveklabnik

Add "chr" as doc alias to char::from_u32

Many programming languages provide a function called `chr` - Perl, Python, PHP, Visual Basic, SQL. This change makes `char::from_u32` easier to discover in the documentation.

`ord` is not added as its name conflicts with `Ord` trait, and it's not exactly clear what it could point to (`<u32 as From<char>>::from`?). I don't think it's exactly necessary, as `char::from_u32` documentation page says you can do reverse conversion with `as` operator anyway.

3 years agoRollup merge of #80430 - xfix:add-length-as-doc-alias, r=steveklabnik
Mara Bos [Mon, 28 Dec 2020 19:09:32 +0000 (19:09 +0000)]
Rollup merge of #80430 - xfix:add-length-as-doc-alias, r=steveklabnik

Add "length" as doc alias to len methods

Currently when searching for `length` there are no results: https://doc.rust-lang.org/std/?search=length. This makes `len` methods appear when searching for `length`.

3 years agoRollup merge of #80419 - LeSeulArtichaut:80375-test-case, r=lcnr
Mara Bos [Mon, 28 Dec 2020 19:09:31 +0000 (19:09 +0000)]
Rollup merge of #80419 - LeSeulArtichaut:80375-test-case, r=lcnr

Add regression test for #80375

This will also make sure that #80375 is handled if #79135 has to be reverted (which won't happen 🤞).

Closes #80375.
r? `@lcnr`

3 years agoRollup merge of #80410 - MarcoIeni:patch-1, r=jonas-schievink
Mara Bos [Mon, 28 Dec 2020 19:09:29 +0000 (19:09 +0000)]
Rollup merge of #80410 - MarcoIeni:patch-1, r=jonas-schievink

rustdoc book: fix example

`lib.rs` file is created only if `--lib` flag is specified

3 years agoRollup merge of #80403 - 0xflotus:patch-1, r=jyn514
Mara Bos [Mon, 28 Dec 2020 19:09:27 +0000 (19:09 +0000)]
Rollup merge of #80403 - 0xflotus:patch-1, r=jyn514

fix: small typo error in chalk/mod.rs

3 years agoRollup merge of #80402 - camelid:inferty-docs, r=matthewjasper
Mara Bos [Mon, 28 Dec 2020 19:09:25 +0000 (19:09 +0000)]
Rollup merge of #80402 - camelid:inferty-docs, r=matthewjasper

Document `InferTy` & co.

I finally figured out what `TyVid` means! The name is quite opaque, so I
decided to document it and related types.

I don't know that much about `InferTy` & co., but I was able to *infer*
( :) ) from the names and what I know generally about type inference to
add some basic documentation.

3 years agoRollup merge of #80398 - CAD97:fix-80365, r=dtolnay
Mara Bos [Mon, 28 Dec 2020 19:09:24 +0000 (19:09 +0000)]
Rollup merge of #80398 - CAD97:fix-80365, r=dtolnay

Use raw version of align_of in rc data_offset

This was missed in #73845 when switching to use the raw operators.
Fixes #80365

3 years agoRollup merge of #80393 - ehuss:doc-git-link, r=jyn514
Mara Bos [Mon, 28 Dec 2020 19:09:22 +0000 (19:09 +0000)]
Rollup merge of #80393 - ehuss:doc-git-link, r=jyn514

Add links to the source for the rustc and rustdoc books.

This adds a little icon in the upper-right corner of the books so that readers can find the source if they want to make changes or file issues. This is already included in several of the other books.

3 years agoRollup merge of #80390 - ssomers:btree_cleanup_slices_2, r=Mark-Simulacrum
Mara Bos [Mon, 28 Dec 2020 19:09:20 +0000 (19:09 +0000)]
Rollup merge of #80390 - ssomers:btree_cleanup_slices_2, r=Mark-Simulacrum

BTreeMap: rename the area access methods

r? `@Mark-Simulacrum`

3 years agoRollup merge of #80383 - RalfJung:wrapping-ptr-arithmetic, r=dtolnay
Mara Bos [Mon, 28 Dec 2020 19:09:18 +0000 (19:09 +0000)]
Rollup merge of #80383 - RalfJung:wrapping-ptr-arithmetic, r=dtolnay

clarify wrapping ptr arithmetic docs

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

`@steffahn` please let me know if this helps avoid the misunderstanding. :)

3 years agoFix stabilization version of deque_range feature.
Mara Bos [Mon, 28 Dec 2020 19:04:27 +0000 (20:04 +0100)]
Fix stabilization version of deque_range feature.

3 years agoAuto merge of #80439 - Dylan-DPC:rollup-rdxcvon, r=Dylan-DPC
bors [Mon, 28 Dec 2020 15:57:50 +0000 (15:57 +0000)]
Auto merge of #80439 - Dylan-DPC:rollup-rdxcvon, r=Dylan-DPC

Rollup of 11 pull requests

Successful merges:

 - #79662 (Move some more code out of CodegenBackend::{codegen_crate,link})
 - #79815 (Update RELEASES.md for 1.49.0)
 - #80284 (Suggest fn ptr rather than fn item and suggest to use `Fn` trait bounds rather than the unique closure type in E0121)
 - #80331 (Add more comments to trait queries)
 - #80344 (use matches!() macro in more places)
 - #80353 (BTreeMap: test split_off (and append) more thoroughly)
 - #80362 (Document rustc_macros on nightly-rustc)
 - #80399 (Remove FIXME in rustc_privacy)
 - #80408 (Sync rustc_codegen_cranelift)
 - #80411 (rustc_span: Remove `Symbol::with`)
 - #80434 (bootstrap: put the component name in the tarball temp dir path)

Failed merges:

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

3 years agoRollup merge of #80434 - pietroalbini:tarball-temp-dir, r=Mark-Simulacrum
Dylan DPC [Mon, 28 Dec 2020 13:13:23 +0000 (14:13 +0100)]
Rollup merge of #80434 - pietroalbini:tarball-temp-dir, r=Mark-Simulacrum

bootstrap: put the component name in the tarball temp dir path

This should not matter right now, but if we ever parallelize rustbuild this will avoid tarball contents being merged together.

r? `@Mark-Simulacrum`

3 years agoRollup merge of #80411 - petrochenkov:nosymwith, r=matthewjasper
Dylan DPC [Mon, 28 Dec 2020 13:13:21 +0000 (14:13 +0100)]
Rollup merge of #80411 - petrochenkov:nosymwith, r=matthewjasper

rustc_span: Remove `Symbol::with`

A subset of https://github.com/rust-lang/rust/pull/79425 that is a pure refactoring.

3 years agoRollup merge of #80408 - bjorn3:sync_cg_clif-2020-12-27, r=bjorn3
Dylan DPC [Mon, 28 Dec 2020 13:13:19 +0000 (14:13 +0100)]
Rollup merge of #80408 - bjorn3:sync_cg_clif-2020-12-27, r=bjorn3

Sync rustc_codegen_cranelift

The highlight of this sync are two JIT mode improvements. The first is that it is now possible to use JIT mode when using `-Zcodegen-backend` instead of the custom driver using `-Cllvm-args=mode=jit`. The second one is a new JIT mode that lazily compiles functions when they are called the first time: https://github.com/bjorn3/rustc_codegen_cranelift/pull/1120

In addition this includes a few small runtime performance improvements and various fixes for rustc changes that didn't cause compilation to fail.

r? ``@ghost``

``@rustbot`` label +A-codegen +A-cranelift +T-compiler

3 years agoRollup merge of #80399 - jyn514:hir-id-cleanup, r=marmeladema
Dylan DPC [Mon, 28 Dec 2020 13:13:17 +0000 (14:13 +0100)]
Rollup merge of #80399 - jyn514:hir-id-cleanup, r=marmeladema

Remove FIXME in rustc_privacy

#71104 has been fixed.

r? ``@marmeladema`` if you have time, otherwise ``@petrochenkov``

3 years agoRollup merge of #80362 - jyn514:rustc-macros, r=ehuss
Dylan DPC [Mon, 28 Dec 2020 13:13:16 +0000 (14:13 +0100)]
Rollup merge of #80362 - jyn514:rustc-macros, r=ehuss

Document rustc_macros on nightly-rustc

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

![image](https://user-images.githubusercontent.com/23638587/103113442-b7ba2d00-4628-11eb-8a4d-c542f2d170e1.png)
![image](https://user-images.githubusercontent.com/23638587/103113448-bc7ee100-4628-11eb-8657-2d72e88de656.png)

r? ``@ehuss``

3 years agoRollup merge of #80353 - ssomers:btree_test_split_off, r=Mark-Simulacrum
Dylan DPC [Mon, 28 Dec 2020 13:13:14 +0000 (14:13 +0100)]
Rollup merge of #80353 - ssomers:btree_test_split_off, r=Mark-Simulacrum

BTreeMap: test split_off (and append) more thoroughly

Using DeterministicRng as a poor man's property based testing rig.
r? ``@Mark-Simulacrum``

3 years agoRollup merge of #80344 - matthiaskrgr:matches, r=Dylan-DPC
Dylan DPC [Mon, 28 Dec 2020 13:13:12 +0000 (14:13 +0100)]
Rollup merge of #80344 - matthiaskrgr:matches, r=Dylan-DPC

use matches!() macro in more places

3 years agoRollup merge of #80331 - jyn514:docs, r=varkor
Dylan DPC [Mon, 28 Dec 2020 13:13:10 +0000 (14:13 +0100)]
Rollup merge of #80331 - jyn514:docs, r=varkor

Add more comments to trait queries

This also adds back a comment that was mistakenly removed in
ac9dfc3e7785c9bba96ebac4fd51726189e1bf91.

3 years agoRollup merge of #80284 - ThePuzzlemaker:issue-80179-fix, r=varkor
Dylan DPC [Mon, 28 Dec 2020 13:13:08 +0000 (14:13 +0100)]
Rollup merge of #80284 - ThePuzzlemaker:issue-80179-fix, r=varkor

Suggest fn ptr rather than fn item and suggest to use `Fn` trait bounds rather than the unique closure type in E0121

Previously, using `_` as a return type in a function that returned a function/closure would provide a diagnostic that would cause a papercut. For example:
```rust
fn f() -> i32 { 0 }
fn fn_ptr() -> _ { f }
fn closure() -> _ { || 0 }
```
would result in this diagnostic:
```rust
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
 --> <anon>:2:16
  |
2 | fn fn_ptr() -> _ { f }
  |                ^
  |                |
  |                not allowed in type signatures
  |                help: replace with the correct return type: `fn() -> i32 {f}`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
 --> <anon>:3:17
  |
3 | fn closure() -> _ { || 0 }
  |                 ^
  |                 |
  |                 not allowed in type signatures
  |                 help: replace with the correct return type: `[closure@<anon>:3:21: 3:25]`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0121`.
```
As can be seen, it was suggested to use the function definition return type `fn() -> i32 { f }` which is not valid syntax as a return type. Additionally, closures cause a papercut as unique closure types (notated in this case as `[closure@<anon>:3:21: 3:25]`) are not valid syntax either.

Instead, this PR implements this version of the diagnostic (this example is for the same code featured above):
```rust
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
 --> <anon>:2:16
  |
2 | fn fn_ptr() -> _ { f }
  |                ^
  |                |
  |                not allowed in type signatures
  |                help: replace with the correct return type: `fn() -> i32`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
 --> <anon>:3:17
  |
3 | fn closure() -> _ { || 0 }
  |                 ^ not allowed in type signatures
  |
  = help: consider using an `Fn`, `FnMut`, or `FnOnce` trait bound
  = note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0121`.
```
As can be seen in this diagnostic, the papercut for returning a function item is fixed by suggesting the usage of a function pointer as the return type. As for closures, it's suggested to use an `Fn`, `FnMut`, or `FnOnce` trait bound (with further reading on closures and `Fn` traits in *The Book* for beginners). I did not implement a suggestion to use `impl Fn() -> i32` syntax as that was out-of-scope for my abilities at the moment, therefore someone in the future may want to implement that. Also, it's possible to use either `impl Trait` syntax, generics, or generics with a `where` clause, and some users may not want to use `impl Trait` syntax for their own reasons.

This PR fixes #80179.