Commit Graph

107372 Commits

Author SHA1 Message Date
Dylan DPC
3e7a18e5e5
Rollup merge of #69391 - memoryruins:memalias, r=Mark-Simulacrum
Add rustdoc aliases to `ptr::copy` and `ptr::copy_nonoverlapping`

This PR adds a [rustdoc alias](https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html#add-aliases-for-an-item-in-documentation-search) to `ptr::copy` and `ptr::copy_nonoverlapping` using the commonly used terms `memcpy` and `memmove`. The motivation for this PR is to improve discoverability for these functions, since I've noticed users overlook these functions on multiple occasions (and they have thus reached for [libc](https://crates.io/crates/libc) without need). Currently std docs state:

https://doc.rust-lang.org/nightly/std/ptr/fn.copy_nonoverlapping.html
> `copy_nonoverlapping` is semantically equivalent to C's `memcpy`, but with the argument order swapped.

https://doc.rust-lang.org/nightly/std/ptr/fn.copy.html
> `copy` is semantically equivalent to C's `memmove`, but with the argument order swapped.

#### search results before adding a rustdoc alias:
![screenshot 6517](https://user-images.githubusercontent.com/6868531/75102985-78fbb680-55c2-11ea-8e41-04979e6fa6f6.png)
![screenshot 6518](https://user-images.githubusercontent.com/6868531/75102984-78632000-55c2-11ea-9673-8822aae636d1.png)

#### after adding `#[doc(alias = "memcpy")]` and `#[doc(alias = "memmove")]`:
![screenshot 6516](https://user-images.githubusercontent.com/6868531/75102986-78fbb680-55c2-11ea-93b9-1929be940043.png)
![screenshot 6515](https://user-images.githubusercontent.com/6868531/75102987-78fbb680-55c2-11ea-9861-ce8a77a0c3b9.png)
2020-02-24 20:10:13 +01:00
Dylan DPC
d91657877a
Rollup merge of #69220 - wesleywiser:doc_self_profile_unstable_book, r=nikomatsakis
Add documentation for the `-Zself-profile` flag
2020-02-24 20:10:12 +01:00
Vadim Petrochenkov
f7d55be7e5 resolve: lifetimes.rs -> late/lifetime.rs 2020-02-24 21:46:21 +03:00
Vadim Petrochenkov
d134385823 syntax: Remove Nt(Impl,Trait,Foreign)Item 2020-02-24 20:25:32 +03:00
Ana-Maria
0445574340 Replace uses of Cell::get + Cell::set with Cell::replace. 2020-02-24 16:23:55 +00:00
Vadim Petrochenkov
4dbdadf94d rustc_metadata: Use binary search from standard library
instead of a hand rolled one.
2020-02-24 19:17:07 +03:00
Matthias Krüger
addd7426be don't explicitly compare against true or false 2020-02-24 16:52:40 +01:00
Ralf Jung
4e867535f3 no more codegen for miri_start_panic 2020-02-24 16:42:26 +01:00
bors
834bc5650a Auto merge of #69344 - RalfJung:miri, r=oli-obk
bump Miri

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

r? @ghost Cc @oli-obk
2020-02-24 14:54:39 +00:00
Matthias Krüger
1892ff7aa6 librustc_macros: remove redundant single component path import 2020-02-24 14:56:30 +01:00
Matthias Krüger
d4a005bd03 librustc{, codegen_ssa,infer,mir_build}: don't clone types that are copy 2020-02-24 14:56:29 +01:00
Matthias Krüger
5ae4500eff remove redundant clones in librustc_mir_build and librustc_data_structures 2020-02-24 14:56:29 +01:00
Matthias Krüger
3fb76946cd submodules: update rls from 10bf331 to 5fde462
Changes:
````
Update cargo.
````

Fixes #69383
Fixes #69286

r? @Xanewok
2020-02-24 13:47:34 +01:00
Ralf Jung
ffa1aa6434 bump Miri once more 2020-02-24 13:08:24 +01:00
Guillaume Gomez
ca5bbd190a Clean up E0368 and E0369 explanations 2020-02-24 12:57:19 +01:00
bors
d9a328a0ad Auto merge of #69424 - pietroalbini:rollup-3oelogm, r=pietroalbini
Rollup of 5 pull requests

Successful merges:

 - #69372 (Updates links in various Compiler Error Index entries)
 - #69385 (Relax str::get_unchecked precondition to permit empty slicing)
 - #69386 (Fix minor error in `MaybeUninit::get_mut()` doc example)
 - #69394 (Clean up E0367 explanation)
 - #69405 (docs: Stdin::read_line: mention the appending)

Failed merges:

r? @ghost
2020-02-24 11:41:30 +00:00
Andreas Molzer
329022dfad Address method comments 2020-02-24 11:23:47 +01:00
Pietro Albini
ba3fee6537
Rollup merge of #69405 - NieDzejkob:docs-readline-appends, r=joshtriplett
docs: Stdin::read_line: mention the appending

The fact that `stdin().read_line()` is an [unpleasant](https://twitter.com/Michcioperz/status/1231646797661167617?s=20) [footgun](https://rustbattle.net/battle/straight-finch-8-e4f4). Let's make it clearer in the documentation.
2020-02-24 11:15:36 +01:00
Pietro Albini
1cfb6c2ab0
Rollup merge of #69394 - GuillaumeGomez:clean-up-0367, r=Dylan-DPC
Clean up E0367 explanation

r? @Dylan-DPC
2020-02-24 11:15:34 +01:00
Pietro Albini
c293ac9503
Rollup merge of #69386 - danielhenrymantilla:maybe_uninit_docs_replace_chunk_with_windows, r=Dylan-DPC
Fix minor error in `MaybeUninit::get_mut()` doc example

In the `MaybeUninit::get_mut()` example I wanted to assert that the slice was sorted and mistakenly used `.chunks(2)` rather than `.windows(2)` to assert it, as @ametisf pointed out in https://github.com/rust-lang/rust/pull/65948#issuecomment-589988183 .

This fixes it.
2020-02-24 11:15:33 +01:00
Pietro Albini
d73aa67208
Rollup merge of #69385 - ridiculousfish:relax_get_unchecked, r=nagisa
Relax str::get_unchecked precondition to permit empty slicing

Prior to this commit, `str` documented that `get_unchecked` had
the precondition that "`begin` must come before `end`". This would appear
to prohibit empty slices (i.e. begin == end).

In practice, get_unchecked is called often with empty slices. Let's relax
the precondition so as to allow them.
2020-02-24 11:15:31 +01:00
Pietro Albini
331044627a
Rollup merge of #69372 - yawpitch:master, r=varkor
Updates links in various Compiler Error Index entries

Currently many of the links in the online https://doc.rust-lang.org/error-index.html are not clickable, and many of them don't resolve correctly as they point to older versions of rustbyexample and the reference.
2020-02-24 11:15:30 +01:00
flip1995
a2a8980001
Update Clippy 2020-02-24 09:13:13 +01:00
David Tolnay
9c3ee1bc35
Bump core::primitive to 1.43 2020-02-23 23:59:39 -08:00
bors
79cd224e75 Auto merge of #69366 - Centril:unified-items, r=petrochenkov
parse: unify item parsing & filter illegal item kinds

This PR fully unifies item parsing into a single `fn parse_item_common` method which produces `Option<Item>`. The `Item` is then mapped into `ForeignItem` and `AssocItem` as necessary by transforming the `*Kind` and converting contextually bad variants into `None`, thereby filtering them away.

The PR does not yet unmerge the definition of `ForeignItemKind` from `AssocItemKind`. I've left that as future work as it didn't feel like this parser-focused PR would be the best one to deal with it. Changes to the AST data structures are instead kept to a reasonable minimum.

Based on https://github.com/rust-lang/rust/pull/69361.

Fixes https://github.com/rust-lang/rust/issues/48137.
RELNOTES: Now, `item` macro fragments can be interpolated into `impl`, `trait`, and `extern` contexts. See `src/test/ui/parser/issue-48137-macros-cannot-interpolate-impl-items.rs` for the relevant test.

r? @petrochenkov
cc @estebank
2020-02-24 00:31:01 +00:00
Mazdak Farrokhzad
1c75f5aaa1 parse: test bad variants wrt. issue 48137. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
fde5939d1c parse: tweak diagnostic wordings 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
e66a39bb65 parse: tweak parse_item_ for more reuse. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
62930d3151 parse/ast: move Defaultness into variants. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
842027f35b parse: NtItem -> parse_item_common. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
b01c1e2092 parser: tweak item kind wording 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
ab84914fe4 parser: tweak unmatched wording 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
d446c73e6a parser: refactor away at_end 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
abc46a579b parse: harden default test. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
a3b0829414 parse: move token hack into parse_item_common. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
a05c83b2eb parse: use parse_item_common in parse_assoc_item_. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
a63f35daee parse: use parse_item_common in parse_foreign_item. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
a920a05603 parse: recover default on free items. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
9ed4c09983 parse: extract error_on_unmatched_vis. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
7017058e6b ast: add Defaultness to Item, making AssocItem an alias. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
d41fc138bf parse_defaultness: avoid hardcoded list of keywords. 2020-02-24 00:59:38 +01:00
Mazdak Farrokhzad
fa2a792491 add Span to ast::Defaultness::Default. 2020-02-24 00:59:38 +01:00
Jakub Kądziołka
b3e0d272af
docs: Stdin::read_line: mention the appending 2020-02-23 21:19:25 +01:00
bors
6d0e58bff8 Auto merge of #69393 - Dylan-DPC:rollup-rxbd1zg, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #69336 (Do not ping the infrastructure team on toolstate changes)
 - #69351 (Improve external MinGW detection)
 - #69361 (parse: allow `type Foo: Ord` syntactically)
 - #69375 (Rename CodeMap to SourceMap follow up)
 - #69376 (parser: Cleanup `Parser::bump_with` and its uses)

Failed merges:

r? @ghost
2020-02-23 19:26:35 +00:00
bors
b1f395de64 Auto merge of #69084 - yaahc:delayed-doc-lint, r=petrochenkov
Split non macro portion of unused_doc_comment from macro part into two passes/lints

## Motivation

This change is motivated by the needs of the [spandoc library](https://github.com/yaahc/spandoc). The specific use case is that my macro is removing doc comments when an attribute is applied to a fn with doc comments, but I would like the lint to still appear when I forget to add the `#[spandoc]` attribute to a fn, so I don't want to have to silence the lint globally.

## Approach

This change splits the `unused _doc_comment` lint into two lints, `unused_macro_doc_comment` and `unused_doc_comment`. The non macro portion is moved into an `early_lint_pass` rather than a pre_expansion_pass. This allows proc macros to silence `unused_doc_comment` warnings by either adding an attribute to silence it or by removing the doc comment before the early_pass runs.

The `unused_macro_doc_comment` lint however will still be impossible for proc-macros to silence, but the only alternative that I can see is to remove this lint entirely, which I don't think is acceptable / is a decision I'm not comfortable making personally, so instead I opted to split the macro portion of the check into a separate lint so that it can be silenced globally with an attribute if necessary without needing to globally silence the `unused_doc_comment` lint as well, which is still desireable.

fixes https://github.com/rust-lang/rust/issues/67838
2020-02-23 16:09:41 +00:00
Vadim Petrochenkov
e355a33077 Deduplicate identifier printing a bit 2020-02-23 17:35:48 +03:00
bors
87b0d83745 Auto merge of #69351 - mati865:mingw-ultimate-fix, r=cramertj
Improve external MinGW detection

Fixes #68872
2020-02-23 12:52:48 +00:00
Michael Morehouse
c103a16f3a
Update links
Formatting fixes

Now that I can actually run `python x.py test src/tools/tidy` locally
... my god it takes a long time to compile when you're on a cellular
connection.

Removing unnecessary whitespaces

Updates src/test/ui/json-short.stderr golden test file

Fixes test failure by updating the golden file for changes
in src/librustc_error_codes/error_codes/E0601.md

Update src/librustc_error_codes/error_codes/E0080.md

Co-Authored-By: varkor <github@varkor.com>

Update src/librustc_error_codes/error_codes/E0080.md

Co-Authored-By: varkor <github@varkor.com>

Update src/librustc_error_codes/error_codes/E0080.md

Co-Authored-By: varkor <github@varkor.com>

Update src/librustc_error_codes/error_codes/E0154.md

Co-Authored-By: varkor <github@varkor.com>

Update src/librustc_error_codes/error_codes/E0154.md

Co-Authored-By: varkor <github@varkor.com>

Update src/librustc_error_codes/error_codes/E0661.md

Co-Authored-By: varkor <github@varkor.com>

Update src/librustc_error_codes/error_codes/E0662.md

Co-Authored-By: varkor <github@varkor.com>

Update src/librustc_error_codes/error_codes/E0663.md

Co-Authored-By: varkor <github@varkor.com>

Update src/librustc_error_codes/error_codes/E0664.md

Co-Authored-By: varkor <github@varkor.com>

Update src/test/ui/json-short.stderr

Co-Authored-By: varkor <github@varkor.com>

Update src/librustc_error_codes/error_codes/E0260.md

Co-Authored-By: varkor <github@varkor.com>

Update src/librustc_error_codes/error_codes/E0154.md

Co-Authored-By: varkor <github@varkor.com>

Update src/librustc_error_codes/error_codes/E0260.md

Co-Authored-By: varkor <github@varkor.com>

Apply suggestions from code review

Co-Authored-By: varkor <github@varkor.com>

Fixing 1 character over 80 cascade
2020-02-23 12:22:44 +00:00
Guillaume Gomez
78e4bd1c75 Clean up E0367 explanation 2020-02-23 12:02:32 +01:00
bors
9c230f39c1 Auto merge of #69336 - Mark-Simulacrum:no-infra-toolstate, r=Dylan-DPC
Do not ping the infrastructure team on toolstate changes

To my knowledge, there is essentially never any particular action that the infra team needs to take on these pings, and they are currently relatively annoying.

cc rust-lang/infra -- does anyone *want* these notifications?
2020-02-23 09:40:18 +00:00