]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoadd assertions on existing tests with missing doc source
François Mockers [Wed, 14 Jul 2021 22:30:11 +0000 (00:30 +0200)]
add assertions on existing tests with missing doc source

3 years agocomment about link without a href
François Mockers [Sun, 11 Jul 2021 00:18:21 +0000 (02:18 +0200)]
comment about link without a href

3 years agoonly remove link for TyMethod
François Mockers [Tue, 6 Jul 2021 18:19:54 +0000 (20:19 +0200)]
only remove link for TyMethod

3 years agoadd check on anchor link
François Mockers [Mon, 5 Jul 2021 00:09:20 +0000 (02:09 +0200)]
add check on anchor link

3 years agoreview - better error names/doc
François Mockers [Sun, 4 Jul 2021 23:33:51 +0000 (01:33 +0200)]
review - better error names/doc

3 years agoadd mcve as test
François Mockers [Sun, 4 Jul 2021 23:30:48 +0000 (01:30 +0200)]
add mcve as test

3 years agofix dead link for method in trait of blanket impl from third party crate
François Mockers [Sun, 27 Jun 2021 09:10:36 +0000 (11:10 +0200)]
fix dead link for method in trait of blanket impl from third party crate

3 years agoAuto merge of #86572 - rylev:force-warnings-always, r=nikomatsakis
bors [Tue, 6 Jul 2021 16:50:33 +0000 (16:50 +0000)]
Auto merge of #86572 - rylev:force-warnings-always, r=nikomatsakis

Force warnings even when can_emit_warnings == false

Fixes an issue mentioned in #85512 with --cap-lints overriding --force-warnings.

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

r? `@ehuss`

3 years agoAuto merge of #86231 - nagisa:nagisa/abi-allowlist, r=petrochenkov
bors [Tue, 6 Jul 2021 14:02:19 +0000 (14:02 +0000)]
Auto merge of #86231 - nagisa:nagisa/abi-allowlist, r=petrochenkov

Replace per-target ABI denylist with an allowlist

It makes very little sense to maintain denylists of ABIs when, as far as
non-generic ABIs are concerned, targets usually only support a small
subset of the available ABIs.

This has historically been a cause of bugs such as us allowing use of
the platform-specific ABIs on x86 targets – these in turn would cause
LLVM errors or assertions to fire.

In this PR we got rid of the per-target ABI denylists, and instead compute
which ABIs are supported with a simple match based on, mostly, the
`Target::arch` field. Among other things, this makes it impossible to
forget to consider this problem (in either direction) and forces one to
consider what the ABI support looks like when adding an ABI (rarely)
rather than target (often), which should hopefully also reduce the
cognitive load on both contributors as well as reviewers.

Fixes #57182

Sponsored by: standard.ai

---

## Summary for teams

One significant user-facing change after this PR is that there's now a future compat warning when building…

* `stdcall`, `fastcall`, `thiscall` using code with targets other than 32-bit x86 (i386...i686) or *-windows-*;
* `vectorcall` using code when building for targets other than x86 (either 32 or 64 bit) or *-windows-*.

Previously these ABIs have been accepted much more broadly, even for architectures and targets where this made no sense (e.g. on wasm32) and would fall back to the C ABI. In practice this doesn't seem to be used too widely and the [breakages in crater](https://github.com/rust-lang/rust/pull/86231#issuecomment-866300943) that we see are mostly about Windows-specific code that was missing relevant `cfg`s and just happened to successfully `check` on Linux for one reason or another.

The intention is that this warning becomes a hard error after some time.

3 years agoAdd missing docs and remove dead code
Ryan Levick [Tue, 6 Jul 2021 11:47:03 +0000 (13:47 +0200)]
Add missing docs and remove dead code

3 years agoAuto merge of #86143 - bjorn3:revert_revert_merge_crate_disambiguator, r=michaelwoerister
bors [Tue, 6 Jul 2021 11:31:59 +0000 (11:31 +0000)]
Auto merge of #86143 - bjorn3:revert_revert_merge_crate_disambiguator, r=michaelwoerister

Reland "Merge CrateDisambiguator into StableCrateId"

Reverts https://github.com/rust-lang/rust/pull/85891 as this revert of #85804 made perf even worse.

r? `@Mark-Simulacrum`

3 years agoReplace per-target ABI denylist with an allowlist
Simonas Kazlauskas [Fri, 11 Jun 2021 11:22:13 +0000 (14:22 +0300)]
Replace per-target ABI denylist with an allowlist

It makes very little sense to maintain denylists of ABIs when, as far as
non-generic ABIs are concerned, targets usually only support a small
subset of the available ABIs.

This has historically been a cause of bugs such as us allowing use of
the platform-specific ABIs on x86 targets – these in turn would cause
LLVM errors or assertions to fire.

Fixes #57182

Sponsored by: standard.ai

3 years agoTruncate hex stable crate id to 8 characters (32 bits)
bjorn3 [Mon, 5 Jul 2021 09:33:04 +0000 (11:33 +0200)]
Truncate hex stable crate id to 8 characters (32 bits)

3 years agoMake tcx.stable_crate_id() faster
bjorn3 [Wed, 30 Jun 2021 16:39:28 +0000 (18:39 +0200)]
Make tcx.stable_crate_id() faster

3 years agoRevert "Revert "Update mir opt tests""
bjorn3 [Tue, 8 Jun 2021 16:59:36 +0000 (18:59 +0200)]
Revert "Revert "Update mir opt tests""

This reverts commit 8d5fb5bf7d5c63dcfaea381e00ded67c21fab3a3.

3 years agoRevert "Revert "Update tests""
bjorn3 [Tue, 8 Jun 2021 16:36:38 +0000 (18:36 +0200)]
Revert "Revert "Update tests""

This reverts commit 715c68fe90c6f1d0b3004ad18f16e0811f209992.

3 years agoRevert "Revert "Fix test""
bjorn3 [Tue, 8 Jun 2021 16:36:36 +0000 (18:36 +0200)]
Revert "Revert "Fix test""

This reverts commit 6c5b6985fdce0921fe4ac0247fd026355953c1ea.

3 years agoRevert "Revert "Merge CrateDisambiguator into StableCrateId""
bjorn3 [Tue, 8 Jun 2021 16:36:30 +0000 (18:36 +0200)]
Revert "Revert "Merge CrateDisambiguator into StableCrateId""

This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.

3 years agoAuto merge of #86694 - cjgillot:pmmd, r=petrochenkov
bors [Tue, 6 Jul 2021 08:50:24 +0000 (08:50 +0000)]
Auto merge of #86694 - cjgillot:pmmd, r=petrochenkov

Store macro parent module in ExpnData.

As a consequence, its value is hashed as part of the ExpnId's stable hash.

Closes #85999

3 years agoStore macro parent module in ExpnData.
Camille GILLOT [Mon, 28 Jun 2021 17:29:55 +0000 (19:29 +0200)]
Store macro parent module in ExpnData.

3 years agoAuto merge of #86644 - Stupremee:replace-fakedefids-with-itemid, r=jyn514
bors [Tue, 6 Jul 2021 04:13:52 +0000 (04:13 +0000)]
Auto merge of #86644 - Stupremee:replace-fakedefids-with-itemid, r=jyn514

rustdoc: Replace `FakeDefId` with new `ItemId` type

Follow up from #84707

`@Manishearth` [suggested](https://github.com/rust-lang/rust/pull/84707#issuecomment-831994669) that there should be a new `ItemId` type that can distinguish between auto traits, normal ids, and blanket impls instead of using `FakeDefId`s.

This type is introduced by this PR.

There are still some `FIXME`s left, because I was unsure what the best solution for them would be.

Especially the naming in general now is a bit weird right now and needs to be cleaned up. Now there are no "fake" ids so the `is_fake` method on `Item` does not really make sense and maybe the methods on `ItemId` should be renamed too?

Also, we need to represent the new item ids in the JSON backend somehow.

3 years agoAuto merge of #82985 - cjgillot:lint, r=jackh726
bors [Tue, 6 Jul 2021 00:33:21 +0000 (00:33 +0000)]
Auto merge of #82985 - cjgillot:lint, r=jackh726

Cleanup the computation of lint levels

This now uses an `IndexVec` and a special root `LintStackIndex = 0` to encode command-line levels.

3 years agoAuto merge of #86877 - bjorn3:remove_lib_source, r=petrochenkov
bors [Mon, 5 Jul 2021 21:52:34 +0000 (21:52 +0000)]
Auto merge of #86877 - bjorn3:remove_lib_source, r=petrochenkov

Remove LibSource

The information is stored in used_crate_source too anyway.

Split out of #86105

r? `@petrochenkov`

3 years agoAuto merge of #86891 - JohnTitor:rollup-gy2gan9, r=JohnTitor
bors [Mon, 5 Jul 2021 19:11:43 +0000 (19:11 +0000)]
Auto merge of #86891 - JohnTitor:rollup-gy2gan9, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #83581 (Add std::os::unix::fs::DirEntryExt2::file_name_ref(&self) -> &OsStr)
 - #85377 (aborts: Clarify documentation and comments)
 - #86685 (double-check mutability inside Allocation)
 - #86794 (Stabilize `Seek::rewind()`)
 - #86852 (Remove some doc aliases)
 - #86878 (:arrow_up: rust-analyzer)
 - #86886 (Remove `impl Clean for {Ident, Symbol}`)

Failed merges:

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

3 years agorustdoc: Use `impl_id` and `for_` DefId's for Blanket item id
Justus K [Sat, 3 Jul 2021 19:34:17 +0000 (21:34 +0200)]
rustdoc: Use `impl_id` and `for_` DefId's for Blanket item id

3 years agorustdoc: Add `PrimitiveType` to `ItemId::Primitive`
Justus K [Sat, 3 Jul 2021 15:21:39 +0000 (17:21 +0200)]
rustdoc: Add `PrimitiveType` to `ItemId::Primitive`

3 years agorustdoc: Convert new ItemId's to real Json Ids
Justus K [Sat, 3 Jul 2021 13:29:26 +0000 (15:29 +0200)]
rustdoc: Convert new ItemId's to real Json Ids

3 years agoRevert "rustdoc: Store DefId's in ItemId on heap for decreasing Item's size"
Justus K [Sun, 27 Jun 2021 07:28:17 +0000 (09:28 +0200)]
Revert "rustdoc: Store DefId's in ItemId on heap for decreasing Item's size"

This reverts commit 41a345d4c46dad1a98c9993bc78513415994e8ba.

3 years agorustdoc: Store DefId's in ItemId on heap for decreasing Item's size
Justus K [Sat, 26 Jun 2021 18:47:33 +0000 (20:47 +0200)]
rustdoc: Store DefId's in ItemId on heap for decreasing Item's size

3 years agorustdoc: Rename `expect_real` to `expect_def_id`, remove `Item::is_fake`
Justus K [Sat, 26 Jun 2021 15:10:52 +0000 (17:10 +0200)]
rustdoc: Rename `expect_real` to `expect_def_id`, remove `Item::is_fake`

3 years agorustdoc: Replace `FakeDefId` with new `ItemId` type
Justus K [Sat, 26 Jun 2021 11:52:31 +0000 (13:52 +0200)]
rustdoc: Replace `FakeDefId` with new `ItemId` type

3 years agoRollup merge of #86886 - jyn514:no-clean-symbol, r=GuillaumeGomez
Yuki Okushi [Mon, 5 Jul 2021 17:33:18 +0000 (02:33 +0900)]
Rollup merge of #86886 - jyn514:no-clean-symbol, r=GuillaumeGomez

Remove `impl Clean for {Ident, Symbol}`

These were only used once, in a place where it was trivial to replace.
Also, it's unclear what 'clean' would mean for these, so it seems better
to be explicit.

Found while reviewing https://github.com/rust-lang/rust/pull/86841, which makes the same change to `build_macro`, so the two will conflict.

r? `@GuillaumeGomez`

3 years agoRollup merge of #86878 - lnicola:rust-analyzer-2021-07-05, r=lnicola
Yuki Okushi [Mon, 5 Jul 2021 17:33:17 +0000 (02:33 +0900)]
Rollup merge of #86878 - lnicola:rust-analyzer-2021-07-05, r=lnicola

:arrow_up: rust-analyzer

3 years agoRollup merge of #86852 - Amanieu:remove_doc_aliases, r=joshtriplett
Yuki Okushi [Mon, 5 Jul 2021 17:33:16 +0000 (02:33 +0900)]
Rollup merge of #86852 - Amanieu:remove_doc_aliases, r=joshtriplett

Remove some doc aliases

As per the new doc alias policy in https://github.com/rust-lang/std-dev-guide/pull/25, this removes some controversial doc aliases:
- `malloc`, `alloc`, `realloc`, etc.
- `length` (alias for `len`)
- `delete` (alias for `remove` in collections and also file/directory deletion)

r? `@joshtriplett`

3 years agoRollup merge of #86794 - inquisitivecrystal:seek-rewind, r=m-ou-se
Yuki Okushi [Mon, 5 Jul 2021 17:33:15 +0000 (02:33 +0900)]
Rollup merge of #86794 - inquisitivecrystal:seek-rewind, r=m-ou-se

Stabilize `Seek::rewind()`

This stabilizes `Seek::rewind`. It seemed to fit into one of the existing tests, so I extended that test rather than adding a new one.

Closes #85149.

3 years agoRollup merge of #86685 - RalfJung:alloc-mut, r=oli-obk
Yuki Okushi [Mon, 5 Jul 2021 17:33:14 +0000 (02:33 +0900)]
Rollup merge of #86685 - RalfJung:alloc-mut, r=oli-obk

double-check mutability inside Allocation

r? `@oli-obk`

3 years agoRollup merge of #85377 - ijackson:abort-docs, r=m-ou-se
Yuki Okushi [Mon, 5 Jul 2021 17:33:13 +0000 (02:33 +0900)]
Rollup merge of #85377 - ijackson:abort-docs, r=m-ou-se

aborts: Clarify documentation and comments

In the docs for intrinsics::abort():

 * Strengthen the recommendation by to use process::abort instead.
 * Document the fact that it sometimes (ab)uses an LLVM debug trap and what the likely consequences are.
 * State that the precise behaviour is unstable.

In the docs for process::abort():

 * Promise that we have the same behaviour as C `abort()`.
 * Document the likely consequences, including, specifically, the consequences on Unix.

In the internal comment for unix::abort_internal:

 * Refer to the public docs for the public API functions.
 * Correct and expand the description of libc::abort.  Specifically:
 * Do not claim that abort() unregisters signal handlers.  It doesn't; it honours the SIGABRT handler.
 * Discuss, extensively, the issue with abort() flushing stdio buffers.
 * Describe the glibc behaviour in some detail.

Co-authored-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Fixes #40230

3 years agoRollup merge of #83581 - arennow:dir_entry_ext_unix_borrow_name, r=m-ou-se
Yuki Okushi [Mon, 5 Jul 2021 17:33:06 +0000 (02:33 +0900)]
Rollup merge of #83581 - arennow:dir_entry_ext_unix_borrow_name, r=m-ou-se

Add std::os::unix::fs::DirEntryExt2::file_name_ref(&self) -> &OsStr

Greetings!

This is my first PR here, so please forgive me if I've missed an important step or otherwise done something wrong. I'm very open to suggestions/fixes/corrections.

This PR adds a function that allows `std::fs::DirEntry` to vend a borrow of its filename on Unix platforms, which is especially useful for sorting. (Windows has (as I understand it) encoding differences that require an allocation.) This new function sits alongside the cross-platform [`file_name(&self) -> OsString`](https://doc.rust-lang.org/std/fs/struct.DirEntry.html#method.file_name) function.

I pitched this idea in an [internals thread](https://internals.rust-lang.org/t/allow-std-direntry-to-vend-borrows-of-its-filename/14328/4), and no one objected vehemently, so here we are.

I understand features in general, I believe, but I'm not at all confident that my whole-cloth invention of a new feature string (as required by the compiler) was correct (or that the name is appropriate). Further, there doesn't appear to be a test for the sibling `ino` function, so I didn't add one for this similarly trivial function either. If it's desirable that I should do so, I'd be happy to [figure out how to] do that.

The following is a trivial sample of a use-case for this function, in which directory entries are sorted without any additional allocations:

```rust
use std::os::unix::fs::DirEntryExt;
use std::{fs, io};

fn main() -> io::Result<()> {
    let mut entries = fs::read_dir(".")?.collect::<Result<Vec<_>, io::Error>>()?;
    entries.sort_unstable_by(|a, b| a.file_name_ref().cmp(b.file_name_ref()));

    for p in entries {
        println!("{:?}", p);
    }

    Ok(())
}
```

3 years agoAuto merge of #86674 - Aaron1011:new-querify-limits, r=michaelwoerister
bors [Mon, 5 Jul 2021 16:30:53 +0000 (16:30 +0000)]
Auto merge of #86674 - Aaron1011:new-querify-limits, r=michaelwoerister

Query-ify global limit attribute handling

Currently, we read various 'global limits' from inner attributes the crate root (`recursion_limit`, `move_size_limit`, `type_length_limit`, `const_eval_limit`). These limits are then stored in `Sessions`, allowing them to be access from a `TyCtxt` without registering a dependency on the crate root attributes.

This PR moves the calculation of these global limits behind queries, so that we properly track dependencies on crate root attributes. During the setup of macro expansion (before we've created a `TyCtxt`), we need to access the recursion limit, which is now done by directly calling into the code shared by the normal query implementations.

3 years agoDeduplicate info.used_crate_source indexing
bjorn3 [Mon, 5 Jul 2021 15:37:45 +0000 (17:37 +0200)]
Deduplicate info.used_crate_source indexing

3 years agoRemove `impl Clean for {Ident, Symbol}`
Joshua Nelson [Mon, 5 Jul 2021 15:18:13 +0000 (11:18 -0400)]
Remove `impl Clean for {Ident, Symbol}`

These were only used once, in a place where it was trivial to replace.
Also, it's unclear what 'clean' would mean for these, so it seems better
to be explicit.

3 years agoEnable dir_entry_ext2 feature in doc test.
Mara Bos [Mon, 5 Jul 2021 14:26:54 +0000 (16:26 +0200)]
Enable dir_entry_ext2 feature in doc test.

Co-authored-by: Yuki Okushi <jtitor@2k36.org>
3 years agoAuto merge of #84560 - cjgillot:inline-iter, r=m-ou-se
bors [Mon, 5 Jul 2021 13:12:07 +0000 (13:12 +0000)]
Auto merge of #84560 - cjgillot:inline-iter, r=m-ou-se

Inline Iterator as IntoIterator.

For some reason, it appears on rustc's own perf stats.

3 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Mon, 5 Jul 2021 11:17:18 +0000 (14:17 +0300)]
:arrow_up: rust-analyzer

3 years agos/die/terminate/ in abort documentation.
Mara Bos [Mon, 5 Jul 2021 10:43:45 +0000 (12:43 +0200)]
s/die/terminate/ in abort documentation.

3 years agoUse american spelling for behaviour
Mara Bos [Mon, 5 Jul 2021 10:40:23 +0000 (12:40 +0200)]
Use american spelling for behaviour

Co-authored-by: Yuki Okushi <jtitor@2k36.org>
3 years agoTalk about "terminate" rather than "die"
Ian Jackson [Mon, 7 Jun 2021 11:12:53 +0000 (12:12 +0100)]
Talk about "terminate" rather than "die"

Adapted from a suggestion by @m-ou-se.

Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoTalk about invalid instructions rather than debug traps
Ian Jackson [Mon, 7 Jun 2021 11:10:46 +0000 (12:10 +0100)]
Talk about invalid instructions rather than debug traps

And withdraw the allegation of "abuse".

Adapted from a suggestion by @m-ou-se.

Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoabort docs: Document buffer non-flushing
Ian Jackson [Mon, 17 May 2021 14:29:47 +0000 (15:29 +0100)]
abort docs: Document buffer non-flushing

There is discussion of this in #40230 which requests clarification.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoabort docs: Do not claim that intrinsics::abort is always a debug trap
Ian Jackson [Mon, 17 May 2021 14:23:47 +0000 (15:23 +0100)]
abort docs: Do not claim that intrinsics::abort is always a debug trap

As per discussion here
 https://github.com/rust-lang/rust/pull/85377#pullrequestreview-660460501

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoaborts: Clarify documentation and comments
Ian Jackson [Thu, 13 May 2021 17:59:41 +0000 (18:59 +0100)]
aborts: Clarify documentation and comments

In the docs for intrinsics::abort():

 * Strengthen the recommendation by to use process::abort instead.
 * Document the fact that it (ab)uses an LLVM debug trap and what the
   likely consequences are.
 * State that the precise behaviour is unstable.

In the docs for process::abort():

 * Promise that we have the same behaviour as C `abort()`.
 * Document the likely consequences, including, specifically, the
   consequences on Unix.

In the internal comment for unix::abort_internal:

 * Refer to the public docs for the public API functions.
 * Correct and expand the description of libc::abort.  Specifically:
 * Do not claim that abort() unregisters signal handlers.  It doesn't;
   it honours the SIGABRT handler.
 * Discuss, extensively, the issue with abort() flushing stdio buffers.
 * Describe the glibc behaviour in some detail.

Co-authored-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoAuto merge of #86861 - RalfJung:miri, r=RalfJung
bors [Mon, 5 Jul 2021 10:21:04 +0000 (10:21 +0000)]
Auto merge of #86861 - RalfJung:miri, r=RalfJung

update miri

Let's get https://github.com/rust-lang/miri/pull/1842 shipped. :)
Also fixes https://github.com/rust-lang/rust/issues/86863
Cc `@rust-lang/miri` r? `@ghost`

3 years agoRemove LibSource
bjorn3 [Mon, 7 Jun 2021 10:18:28 +0000 (12:18 +0200)]
Remove LibSource

The information is stored in used_crate_source too anyway

3 years agoAuto merge of #86663 - fee1-dead:use-rustdoc-css, r=GuillaumeGomez
bors [Mon, 5 Jul 2021 07:27:52 +0000 (07:27 +0000)]
Auto merge of #86663 - fee1-dead:use-rustdoc-css, r=GuillaumeGomez

Use rustdoc.css for error index

Closes #86512.

3 years agoupdate miri
Ralf Jung [Mon, 5 Jul 2021 07:23:22 +0000 (09:23 +0200)]
update miri

3 years agoAuto merge of #86282 - camelid:macro_rules-matchers, r=jyn514
bors [Mon, 5 Jul 2021 05:09:35 +0000 (05:09 +0000)]
Auto merge of #86282 - camelid:macro_rules-matchers, r=jyn514

Pretty-print macro matchers instead of using source code

Fixes #86208.

3 years agoAuto merge of #86867 - JohnTitor:convert-to-actual-assert, r=jackh726
bors [Mon, 5 Jul 2021 02:05:04 +0000 (02:05 +0000)]
Auto merge of #86867 - JohnTitor:convert-to-actual-assert, r=jackh726

Convert `debug_assert!` to `assert!` in `Binder::dummy`

This is needed for #85350 not to be passed.
r? `@jackh726`

3 years agoAuto merge of #86875 - JohnTitor:rollup-fuefamw, r=JohnTitor
bors [Sun, 4 Jul 2021 22:23:06 +0000 (22:23 +0000)]
Auto merge of #86875 - JohnTitor:rollup-fuefamw, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #86477 (E0716: clarify that equivalent code example is erroneous)
 - #86623 (Add check to ensure error code explanations are not removed anymore even if not emitted)
 - #86856 (Make x.py less verbose on failures)
 - #86858 (Stabilize `string_drain_as_str`)
 - #86859 (Add a regression test for issue-69323)
 - #86862 (re-export SwitchIntEdgeEffects)
 - #86864 (Add missing code example for Write::write_vectored)
 - #86874 (Bump deps)

Failed merges:

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

3 years agoRollup merge of #86874 - klensy:bump-deps, r=Mark-Simulacrum
Yuki Okushi [Sun, 4 Jul 2021 22:13:29 +0000 (07:13 +0900)]
Rollup merge of #86874 - klensy:bump-deps, r=Mark-Simulacrum

Bump deps

tidy: updated cargo_metadata to 0.12 (rustfmt only one left, that depends on 0.8 version in tree, waiting when it merges into rustc repo)

miow v0.3.6 -> v0.3.7, drops socket2 v0.3.19

curl v0.4.36 -> v0.4.38
curl-sys v0.4.42+curl-7.76.0 -> v0.4.44+curl-7.77.0
fixes CVE's https://curl.se/docs/vuln-7.76.0.html

3 years agoRollup merge of #86864 - GuillaumeGomez:example-write-vectored, r=JohnTitor
Yuki Okushi [Sun, 4 Jul 2021 22:13:28 +0000 (07:13 +0900)]
Rollup merge of #86864 - GuillaumeGomez:example-write-vectored, r=JohnTitor

Add missing code example for Write::write_vectored

3 years agoRollup merge of #86862 - tmiasko:re-export-SwitchIntEdgeEffects, r=jonas-schievink
Yuki Okushi [Sun, 4 Jul 2021 22:13:27 +0000 (07:13 +0900)]
Rollup merge of #86862 - tmiasko:re-export-SwitchIntEdgeEffects, r=jonas-schievink

re-export SwitchIntEdgeEffects

This makes it possible to use `switch_int_edge_effects` outside
`rustc_mir::dataflow::impls`.

3 years agoRollup merge of #86859 - JohnTitor:test-69323, r=jackh726
Yuki Okushi [Sun, 4 Jul 2021 22:13:26 +0000 (07:13 +0900)]
Rollup merge of #86859 - JohnTitor:test-69323, r=jackh726

Add a regression test for issue-69323

Closes #69323
r? `@jackh726`

3 years agoRollup merge of #86858 - JohnTitor:stabilize-string-drain-as-str, r=Mark-Simulacrum
Yuki Okushi [Sun, 4 Jul 2021 22:13:25 +0000 (07:13 +0900)]
Rollup merge of #86858 - JohnTitor:stabilize-string-drain-as-str, r=Mark-Simulacrum

Stabilize `string_drain_as_str`

Closes #76905, FCP is done: https://github.com/rust-lang/rust/issues/76905#issuecomment-873461688

3 years agoRollup merge of #86856 - jyn514:x.py-less-verbose, r=Mark-Simulacrum
Yuki Okushi [Sun, 4 Jul 2021 22:13:24 +0000 (07:13 +0900)]
Rollup merge of #86856 - jyn514:x.py-less-verbose, r=Mark-Simulacrum

Make x.py less verbose on failures

- Don't print the exact command run by rustbuild unless `--verbose` is set.
  This is almost always unhelpful, since it's just cargo with a lot of
  arguments (and you can't replicate it anyway unless you have the environment variables, which aren't printed by default).
- Don't print "Build completed unsuccessfully" unless --verbose is set.
  You can already tell the build failed by the errors above, and the
  time isn't particularly helpful.
- Don't print the full path to bootstrap. This is useless to everyone,
  even including when working on x.py itself. You can still opt-in to
  this being shown with `--verbose`, since it will throw an exception.

Before:

```
error[E0432]: unresolved import `x`
   --> library/std/src/lib.rs:343:5
    |
343 | use x;
    |     ^ no external crate `x`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `std`

To learn more, run the command again with --verbose.
command did not execute successfully: "/home/joshua/rustc4/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "8" "--release" "--features" "panic-unwind backtrace" "--manifest-path" "/home/joshua/rustc4/library/test/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit status: 101
failed to run: /home/joshua/rustc4/build/bootstrap/debug/bootstrap check
Build completed unsuccessfully in 0:00:13
```

After:

```
error[E0432]: unresolved import `x`
   --> library/std/src/lib.rs:343:5
    |
343 | use x;
    |     ^ no external crate `x`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `std`

To learn more, run the command again with --verbose.
```

cc https://github.com/rust-lang/rust/issues/86854, https://github.com/rust-lang/rust/pull/86022

r? `@Mark-Simulacrum`

3 years agoRollup merge of #86623 - GuillaumeGomez:prevent-explanation-removal, r=Mark-Simulacrum
Yuki Okushi [Sun, 4 Jul 2021 22:13:23 +0000 (07:13 +0900)]
Rollup merge of #86623 - GuillaumeGomez:prevent-explanation-removal, r=Mark-Simulacrum

Add check to ensure error code explanations are not removed anymore even if not emitted

The error explanations are useful in case you use older version of the compiler. Even more if they had an explanation. If they are not emitted, their explanations should be updated but not removed (as we did for a few of them, like E0001).

r? `@Mark-Simulacrum`

3 years agoRollup merge of #86477 - tlyu:e0716-clarification, r=JohnTitor
Yuki Okushi [Sun, 4 Jul 2021 22:13:22 +0000 (07:13 +0900)]
Rollup merge of #86477 - tlyu:e0716-clarification, r=JohnTitor

E0716: clarify that equivalent code example is erroneous

In E0716, there is a code block that is equivalent to the erroneous
code example. Especially when viewed with `rustc --explain`, it's
not obvious that it is also erroneous, and some users have been
confused when they try to change their code to match the erroneous
equivalent.

`@rustbot` label +A-diagnostics +D-newcomer-roadblock +T-compiler

3 years agoAuto merge of #86598 - yoshuawuyts:poll-method-docs, r=JohnTitor
bors [Sun, 4 Jul 2021 20:00:57 +0000 (20:00 +0000)]
Auto merge of #86598 - yoshuawuyts:poll-method-docs, r=JohnTitor

Add examples to the various methods of `core::task::Poll`

This improves the documentation of the various methods of [`core::task::Poll`](https://doc.rust-lang.org/std/task/enum.Poll.html). These currently have fairly simple docs with no examples. This PR changes these methods to be closer to `core::option::Option` and adds usage examples (and importantly: tests!) to `Poll`'s methods.

cc/ `@rust-lang/wg-async-foundations`

## Screenshots

<details>
<summary>View generated rustdoc page</summary>
<image src="https://user-images.githubusercontent.com/2467194/123286616-59ee9b00-d50e-11eb-9e02-40269070f904.png" alt="Poll in core::task"></details>

3 years agomiow v0.3.6 -> v0.3.7, drops socket2 v0.3.19
klensy [Sun, 4 Jul 2021 18:49:56 +0000 (21:49 +0300)]
miow v0.3.6 -> v0.3.7, drops socket2 v0.3.19
curl v0.4.36 -> v0.4.38
curl-sys v0.4.42+curl-7.76.0 -> v0.4.44+curl-7.77.0
fixes cve's https://curl.se/docs/vuln-7.76.0.html

3 years agoCombine individual limit queries into single `limits` query
Aaron Hill [Sun, 4 Jul 2021 18:02:51 +0000 (13:02 -0500)]
Combine individual limit queries into single `limits` query

3 years agoAuto merge of #86866 - nikomatsakis:issue-84841, r=oli-obk
bors [Sun, 4 Jul 2021 17:39:37 +0000 (17:39 +0000)]
Auto merge of #86866 - nikomatsakis:issue-84841, r=oli-obk

Hack: Ignore inference variables in certain queries

Fixes #84841
Fixes #86753

Some queries are not built to accept types with inference variables, which can lead to ICEs. These queries probably ought to be converted to canonical form, but as a quick workaround, we can return conservative results in the case that inference variables are found.

We should file a follow-up issue (and update the FIXMEs...) to do the proper refactoring.

cc `@arora-aman`

r? `@oli-obk`

3 years agoQuery-ify global limit attribute handling
Aaron Hill [Fri, 25 Jun 2021 23:48:26 +0000 (18:48 -0500)]
Query-ify global limit attribute handling

3 years agoAdd missing code example for Write::write_vectored
Guillaume Gomez [Sun, 4 Jul 2021 13:39:45 +0000 (15:39 +0200)]
Add missing code example for Write::write_vectored

3 years agotidy: update cargo_metadata to 0.12
klensy [Sun, 4 Jul 2021 16:58:04 +0000 (19:58 +0300)]
tidy: update cargo_metadata to 0.12

3 years agorevert broken formatting
Niko Matsakis [Sun, 4 Jul 2021 16:50:41 +0000 (12:50 -0400)]
revert broken formatting

3 years agoremove outdated comment
Niko Matsakis [Sun, 4 Jul 2021 16:50:35 +0000 (12:50 -0400)]
remove outdated comment

3 years agotag issues with FIXME
Niko Matsakis [Sun, 4 Jul 2021 16:50:28 +0000 (12:50 -0400)]
tag issues with FIXME

3 years agoAdd a regression test for issue-69323
Yuki Okushi [Sun, 4 Jul 2021 05:39:27 +0000 (14:39 +0900)]
Add a regression test for issue-69323

3 years agoUpdate compiler/rustc_middle/src/ty/normalize_erasing_regions.rs
Niko Matsakis [Sun, 4 Jul 2021 16:37:25 +0000 (12:37 -0400)]
Update compiler/rustc_middle/src/ty/normalize_erasing_regions.rs

Co-authored-by: Rémy Rakic <remy.rakic+github@gmail.com>
3 years agoConvert `debug_assert!` to `assert!` in `Binder::dummy`
Yuki Okushi [Sun, 4 Jul 2021 16:22:33 +0000 (01:22 +0900)]
Convert `debug_assert!` to `assert!` in `Binder::dummy`

This is needed for #85350 not to be passed.

3 years agoremove some ad-hoc has_infer_types checks that aren't needed anymore
Niko Matsakis [Sun, 4 Jul 2021 15:43:22 +0000 (11:43 -0400)]
remove some ad-hoc has_infer_types checks that aren't needed anymore

3 years agobe conservative in has_significant_drop
Niko Matsakis [Sun, 4 Jul 2021 15:41:40 +0000 (11:41 -0400)]
be conservative in has_significant_drop

3 years agoallow inference vars in type_implements_trait
Niko Matsakis [Sun, 4 Jul 2021 15:26:32 +0000 (11:26 -0400)]
allow inference vars in  type_implements_trait

3 years agoremove unused Option
Niko Matsakis [Sun, 4 Jul 2021 15:09:32 +0000 (11:09 -0400)]
remove unused Option

3 years agoE0716: clarify that equivalent code example is erroneous
Taylor Yu [Sat, 19 Jun 2021 20:28:32 +0000 (15:28 -0500)]
E0716: clarify that equivalent code example is erroneous

In E0716, there is a code block that is equivalent to the erroneous
code example. Especially when viewed with `rustc --explain`, it's
not obvious that it is also erroneous, and some users have been
confused when they try to change their code to match the erroneous
equivalent.

3 years agoAuto merge of #86048 - nbdd0121:no_floating_point, r=Amanieu
bors [Sun, 4 Jul 2021 14:18:57 +0000 (14:18 +0000)]
Auto merge of #86048 - nbdd0121:no_floating_point, r=Amanieu

core: add unstable no_fp_fmt_parse to disable float formatting code

In some projects (e.g. kernel), floating point is forbidden. They can disable
hardware floating point support and use `+soft-float` to avoid fp instructions
from being generated, but as libcore contains the formatting code for `f32`
and `f64`, some fp intrinsics are depended. One could define stubs for these
intrinsics that just panic [1], but it means that if any formatting functions
are accidentally used, mistake can only be caught during the runtime rather
than during compile-time or link-time, and they consume a lot of space without
LTO.

This patch provides an unstable cfg `no_fp_fmt_parse` to disable these.
A panicking stub is still provided for the `Debug` implementation (unfortunately)
because there are some SIMD types that use `#[derive(Debug)]`.

[1]: https://lkml.org/lkml/2021/4/14/1028

3 years agoAuto merge of #86213 - jhpratt:stabilize-const-from_utf8_unchecked, r=JohnTitor
bors [Sun, 4 Jul 2021 11:56:55 +0000 (11:56 +0000)]
Auto merge of #86213 - jhpratt:stabilize-const-from_utf8_unchecked, r=JohnTitor

Stabilize `str::from_utf8_unchecked` as `const`

This stabilizes `unsafe fn str::from_utf8_unchecked` as `const` pending FCP on #75196. By the time FCP finishes, the beta will have already been cut, so I've set 1.55 as the stable-since version.

(should also be +relnotes but I don't have the permission to do that)

r? `@m-ou-se`

Closes #75196

3 years agore-export SwitchIntEdgeEffects
Tomasz Miąsko [Sun, 4 Jul 2021 00:00:00 +0000 (00:00 +0000)]
re-export SwitchIntEdgeEffects

This makes it possible to use `switch_int_edge_effects` outside
`rustc_mir::dataflow::impls`.

3 years agoAuto merge of #86255 - Smittyvb:mir-alloc-oom, r=RalfJung,oli-obk
bors [Sun, 4 Jul 2021 09:15:36 +0000 (09:15 +0000)]
Auto merge of #86255 - Smittyvb:mir-alloc-oom, r=RalfJung,oli-obk

Support allocation failures when interpreting MIR

This closes #79601 by handling the case where memory allocation fails during MIR interpretation, and translates that failure into an `InterpError`. The error message is "tried to allocate more memory than available to compiler" to make it clear that the memory shortage is happening at compile-time by the compiler itself, and that it is not a runtime issue.

Now that memory allocation can fail, it would be neat if Miri could simulate low-memory devices to make it easy to see how much memory a Rust program needs.

Note that this breaks Miri because it assumes that allocation can never fail.

3 years agoAuto merge of #86849 - jyn514:rustdoc-group, r=Manishearth
bors [Sun, 4 Jul 2021 06:34:31 +0000 (06:34 +0000)]
Auto merge of #86849 - jyn514:rustdoc-group, r=Manishearth

Warn when `rustdoc::` group is omitted from lint names

When rustdoc lints were first made a tool lint, they gave an unconditional warning when you used the original name:
```
warning: lint `broken_intra_doc_links` has been renamed to `rustdoc::broken_intra_doc_links`
  --> $DIR/renamed-lint-still-applies.rs:2:9
   |
LL | #![deny(broken_intra_doc_links)]
   |         ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::broken_intra_doc_links`
   |
   = note: `#[warn(renamed_and_removed_lints)]` on by default
```
That was reverted in https://github.com/rust-lang/rust/pull/83203 because adding `rustdoc::x` lints would cause the code to break on old versions of the compiler (due to https://github.com/rust-lang/rust/issues/66079#issuecomment-788589193, "fixed" in https://github.com/rust-lang/rust/pull/83216 in the sense that you can now opt-in to not breaking on nightly, which is not ideal but `register_tool` is a long way from stabilizing). Since https://github.com/rust-lang/rust/pull/80527 is now on 1.52.0 stable, we can re-enable the warning. For nightly users, they can change immediately and still have their code work on stable; for stable users, they can change their code in 12 weeks and still have it work up to 3 releases back (about 18 weeks). That seems reasonable to me.

r? `@Manishearth` cc `@rust-lang/rustdoc`

3 years agoStabilize `string_drain_as_str`
Yuki Okushi [Sun, 4 Jul 2021 05:23:43 +0000 (14:23 +0900)]
Stabilize `string_drain_as_str`

3 years agoAuto merge of #86833 - crlf0710:remove-std-raw-mod, r=SimonSapin
bors [Sun, 4 Jul 2021 04:04:47 +0000 (04:04 +0000)]
Auto merge of #86833 - crlf0710:remove-std-raw-mod, r=SimonSapin

Remove the deprecated `core::raw` and `std::raw` module.

A few months has passed since #84207. I think now it's time for the final removal.

Closes #27751.

r? `@m-ou-se`

3 years agointroduce helper function
Niko Matsakis [Sun, 4 Jul 2021 02:15:32 +0000 (22:15 -0400)]
introduce helper function

3 years agoMake x.py less verbose on failures
Joshua Nelson [Sun, 4 Jul 2021 01:33:16 +0000 (21:33 -0400)]
Make x.py less verbose on failures

- Don't print the exact command run by rustbuild unless `--verbose` is set.
  This is almost always unhelpful, since it's just cargo with a lot of
  arguments.
- Don't print "Build completed unsuccessfully" unless --verbose is set.
  You can already tell the build failed by the errors above, and the
  time isn't particularly helpful.
- Don't print the full path to bootstrap. This is useless to everyone,
  even including when working on x.py itself. You can still opt-in to
  this being shown with `--verbose`, since it will throw an exception.

Before:

```
error[E0432]: unresolved import `x`
   --> library/std/src/lib.rs:343:5
    |
343 | use x;
    |     ^ no external crate `x`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `std`

To learn more, run the command again with --verbose.
command did not execute successfully: "/home/joshua/rustc4/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "8" "--release" "--features" "panic-unwind backtrace" "--manifest-path" "/home/joshua/rustc4/library/test/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit status: 101
failed to run: /home/joshua/rustc4/build/bootstrap/debug/bootstrap check
Build completed unsuccessfully in 0:00:13
```

After:

```
error[E0432]: unresolved import `x`
   --> library/std/src/lib.rs:343:5
    |
343 | use x;
    |     ^ no external crate `x`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `std`

To learn more, run the command again with --verbose.
```

3 years agoAuto merge of #85270 - ChrisDenton:win-env-case, r=m-ou-se
bors [Sun, 4 Jul 2021 01:24:05 +0000 (01:24 +0000)]
Auto merge of #85270 - ChrisDenton:win-env-case, r=m-ou-se

When using `process::Command` on Windows, environment variable names must be case-preserving but case-insensitive

When using `Command` to set the environment variables, the key should be compared as uppercase Unicode but when set it should preserve the original case.

Fixes #85242

3 years agorustc_ast_pretty: Don't print space after `$`
Noah Lev [Sat, 3 Jul 2021 22:10:06 +0000 (15:10 -0700)]
rustc_ast_pretty: Don't print space after `$`

For example, this code:

    $arg:expr

used to be pretty-printed as:

    $ arg : expr

but is now pretty-printed as:

    $arg : expr

3 years agoAuto merge of #85090 - Aaron1011:type-outlives-global, r=matthewjasper,jackh726
bors [Sat, 3 Jul 2021 22:42:58 +0000 (22:42 +0000)]
Auto merge of #85090 - Aaron1011:type-outlives-global, r=matthewjasper,jackh726

Return `EvaluatedToOk` when type in outlives predicate is global

A global type doesn't reference any local regions or types, so it's
guaranteed to outlive any region.

3 years agoPretty-print macro matchers instead of using source code
Noah Lev [Sun, 13 Jun 2021 22:30:05 +0000 (15:30 -0700)]
Pretty-print macro matchers instead of using source code

The output is not quite as nice as it used to be, but it does work.

3 years agoadd test case
Niko Matsakis [Sat, 3 Jul 2021 22:32:26 +0000 (18:32 -0400)]
add test case

3 years agoAuto merge of #86825 - ehuss:update-cargo, r=ehuss
bors [Sat, 3 Jul 2021 20:21:39 +0000 (20:21 +0000)]
Auto merge of #86825 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in 4952979031e2cf1d901c817a32e25a156a19db4c..3ebb5f15a940810f250b68821149387af583a79e
2021-07-01 01:14:50 +0000 to 2021-07-02 20:35:38 +0000
- Adjust the edition2021 resolver diff report. (rust-lang/cargo#9649)
- Include the linker in the fingerprint. (rust-lang/cargo#9647)
- Temporarily disable windows env test. (rust-lang/cargo#9646)
- Handle git deleted files with dirty worktree. (rust-lang/cargo#9645)
- Adjust error message with offline and frozen. (rust-lang/cargo#9644)

3 years agoWarn when `rustdoc::` group is omitted from lint names
Joshua Nelson [Sat, 3 Jul 2021 19:20:29 +0000 (15:20 -0400)]
Warn when `rustdoc::` group is omitted from lint names