]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAdjust pretty-print compat hack to work with item statements
Aaron Hill [Wed, 25 Nov 2020 16:31:22 +0000 (11:31 -0500)]
Adjust pretty-print compat hack to work with item statements

3 years agoInvoke attributes on the statement for statement items
Aaron Hill [Tue, 24 Nov 2020 19:47:49 +0000 (14:47 -0500)]
Invoke attributes on the statement for statement items

3 years agoHandle `Annotatable::Stmt` in some builtin macros
Aaron Hill [Mon, 23 Nov 2020 00:32:39 +0000 (19:32 -0500)]
Handle `Annotatable::Stmt` in some builtin macros

This is preparation for PR #78296, which will require us to handle
statement items in addition to normal items.

3 years agoAuto merge of #79335 - jyn514:doctree-crate, r=GuillaumeGomez
bors [Tue, 24 Nov 2020 16:08:23 +0000 (16:08 +0000)]
Auto merge of #79335 - jyn514:doctree-crate, r=GuillaumeGomez

Get rid of doctree::{ExternalCrate, ForeignItem, Trait, Function}

Closes #79314, closes #79331, closes #79332. Follow-up to #79264 and #79312, continues breaking up #78082.

r? `@GuillaumeGomez`

3 years agoGet rid of doctree::ExternCrate
Joshua Nelson [Mon, 23 Nov 2020 02:51:57 +0000 (21:51 -0500)]
Get rid of doctree::ExternCrate

3 years agoGet rid of doctree::Trait
Joshua Nelson [Mon, 23 Nov 2020 02:32:18 +0000 (21:32 -0500)]
Get rid of doctree::Trait

3 years agoGet rid of doctree::Function
Joshua Nelson [Mon, 23 Nov 2020 02:20:08 +0000 (21:20 -0500)]
Get rid of doctree::Function

3 years agoGet rid of doctree::ForeignItem
Joshua Nelson [Sun, 22 Nov 2020 19:03:02 +0000 (14:03 -0500)]
Get rid of doctree::ForeignItem

3 years agoAuto merge of #79377 - jonas-schievink:rollup-ye81i66, r=jonas-schievink
bors [Tue, 24 Nov 2020 12:27:30 +0000 (12:27 +0000)]
Auto merge of #79377 - jonas-schievink:rollup-ye81i66, r=jonas-schievink

Rollup of 10 pull requests

Successful merges:

 - #76858 (Add exploit mitigations chapter to the rustc book)
 - #79310 (Make `fold_item_recur` non-nullable)
 - #79312 (Get rid of `doctree::Impl`)
 - #79321 (Accept '!' in intra-doc links)
 - #79346 (Allow using `-Z fewer-names=no` to retain value names)
 - #79351 (Fix typo in `keyword` docs for traits)
 - #79354 (BTreeMap: cut out the ceremony around BoxedNode)
 - #79358 (BTreeMap/BTreeSet: make public doc more consistent)
 - #79367 (Allow disabling TrapUnreachable via -Ztrap-unreachable=no)
 - #79374 (Add note to use nightly when using expr in const generics)

Failed merges:

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

3 years agoRollup merge of #79374 - mendess:const-param-expr-diagnostic, r=lcnr
Jonas Schievink [Tue, 24 Nov 2020 12:17:51 +0000 (13:17 +0100)]
Rollup merge of #79374 - mendess:const-param-expr-diagnostic, r=lcnr

Add note to use nightly when using expr in const generics

As recommended by `@Icnr` in #73899 and in zulip, I've added a note saying that const expressions can be used in nightly.

```
error: generic parameters may not be used in const operations
  --> $DIR/issue-61935.rs:10:23
   |
 6 |         Self:FooImpl<{N==0}>
   |                       ^ cannot perform const operation using `N`
   |
   = help: const parameters may only be used as standalone arguments, i.e. `N`
   = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this

error: aborting due to previous error
```

I hope the note is well written :sweat_smile:

3 years agoRollup merge of #79367 - Dirbaio:trap-unreachable, r=jonas-schievink
Jonas Schievink [Tue, 24 Nov 2020 12:17:49 +0000 (13:17 +0100)]
Rollup merge of #79367 - Dirbaio:trap-unreachable, r=jonas-schievink

Allow disabling TrapUnreachable via -Ztrap-unreachable=no

Currently this is only possible by defining a custom target, which is quite unwieldy.

This is useful for embedded targets where small code size is desired. For example, on my project (thumbv7em-none-eabi) this yields a 0.6% code size reduction: 132892 bytes -> 132122 bytes (770 bytes down).

3 years agoRollup merge of #79358 - ssomers:btree_public_comments, r=Mark-Simulacrum
Jonas Schievink [Tue, 24 Nov 2020 12:17:47 +0000 (13:17 +0100)]
Rollup merge of #79358 - ssomers:btree_public_comments, r=Mark-Simulacrum

BTreeMap/BTreeSet: make public doc more consistent

Tweaks #72876 and #73667 and propagate them to `BTreeSet`.

3 years agoRollup merge of #79354 - ssomers:btree_bereave_BoxedNode, r=Mark-Simulacrum
Jonas Schievink [Tue, 24 Nov 2020 12:17:45 +0000 (13:17 +0100)]
Rollup merge of #79354 - ssomers:btree_bereave_BoxedNode, r=Mark-Simulacrum

BTreeMap: cut out the ceremony around BoxedNode

The opposite direction of #79093.

r? ``@Mark-Simulacrum``

3 years agoRollup merge of #79351 - Takashiidobe:keyword-docs-typo, r=m-ou-se
Jonas Schievink [Tue, 24 Nov 2020 12:17:43 +0000 (13:17 +0100)]
Rollup merge of #79351 - Takashiidobe:keyword-docs-typo, r=m-ou-se

Fix typo in `keyword` docs for traits

This PR fixes a small typo in the `keyword_docs.rs` file, describing the differences between the 2015 and 2018 editions of traits.

3 years agoRollup merge of #79346 - tmiasko:more-names, r=jonas-schievink
Jonas Schievink [Tue, 24 Nov 2020 12:17:41 +0000 (13:17 +0100)]
Rollup merge of #79346 - tmiasko:more-names, r=jonas-schievink

Allow using `-Z fewer-names=no` to retain value names

Change `-Z fewer-names` into an optional boolean flag and allow using it
to either discard value names when true or retain them when false,
regardless of other settings.

3 years agoRollup merge of #79321 - camelid:intra-doc-bang, r=Manishearth
Jonas Schievink [Tue, 24 Nov 2020 12:17:39 +0000 (13:17 +0100)]
Rollup merge of #79321 - camelid:intra-doc-bang, r=Manishearth

Accept '!' in intra-doc links

This will allow linking to things like `Result<T, !>`.

*See <https://github.com/rust-lang/rust/pull/77832#discussion_r528409079>.*

r? ``@jyn514``

3 years agoRollup merge of #79312 - jyn514:doctree-impl, r=GuillaumeGomez
Jonas Schievink [Tue, 24 Nov 2020 12:17:37 +0000 (13:17 +0100)]
Rollup merge of #79312 - jyn514:doctree-impl, r=GuillaumeGomez

Get rid of `doctree::Impl`

Follow-up to https://github.com/rust-lang/rust/pull/79264, continues breaking up https://github.com/rust-lang/rust/pull/78082. At some point I want to introduce `MaybeInlined`, but I think I'll wait until I need `MaybeInlined::InlinedWithOriginal` because it's not very useful in other situations.

r? ``@GuillaumeGomez``

3 years agoRollup merge of #79310 - jyn514:fold-item-cleanup, r=GuillaumeGomez
Jonas Schievink [Tue, 24 Nov 2020 12:17:35 +0000 (13:17 +0100)]
Rollup merge of #79310 - jyn514:fold-item-cleanup, r=GuillaumeGomez

Make `fold_item_recur` non-nullable

This gets rid of a bunch of `unwrap()`s and makes it a little more clear
what's going on.

Originally I wanted to make `fold_item` non-nullable too, which would
have been a lot nicer to work with, but unfortunately `stripper` does
actually return `None` in some places. I might make a follow-up moving
stripper to be special and not a pass so that passes can be
non-nullable.

Found while working on https://github.com/rust-lang/rust/issues/76998.

3 years agoRollup merge of #76858 - rcvalle:rust-lang-exploit-mitigations, r=steveklabnik
Jonas Schievink [Tue, 24 Nov 2020 12:17:28 +0000 (13:17 +0100)]
Rollup merge of #76858 - rcvalle:rust-lang-exploit-mitigations, r=steveklabnik

Add exploit mitigations chapter to the rustc book

This section documents the exploit mitigations applicable to the Rust compiler when building programs for the Linux operating system on the AMD64 architecture and equivalent. This was done for a project I'm currently working on, and I hope it'll also be helpful to others.

3 years agoSwap note for help
mendess [Tue, 24 Nov 2020 11:05:55 +0000 (11:05 +0000)]
Swap note for help

3 years agoRequested changes
mendess [Tue, 24 Nov 2020 10:28:18 +0000 (10:28 +0000)]
Requested changes

3 years agoAdd note to use nightly when using expr in const generics
mendess [Tue, 24 Nov 2020 09:35:08 +0000 (09:35 +0000)]
Add note to use nightly when using expr in const generics

3 years agoAuto merge of #79294 - petrochenkov:determ, r=varkor
bors [Tue, 24 Nov 2020 09:17:33 +0000 (09:17 +0000)]
Auto merge of #79294 - petrochenkov:determ, r=varkor

resolve: Do not put macros into `module.unexpanded_invocations` unless necessary

Macro invocations in modules <sup>(*)</sup> need to be tracked because they can produce named items when expanded.
We cannot give definite answer to queries like "does this module declare name `n`?" until all macro calls in that module are expanded.

Previously we marked too many macros as potentially producing named items.
E.g. in this example
```rust
mod m {
    const C: u32 = line!();
}
```
`line!()` cannot emit any items into module `m`, but it was still marked.
This PR fixes that and marks macro calls as "unexpanded in module" only if they can actually emit named items into that module.

Diagnostics in UI test outputs have different order now because this change affects macro expansion order.

<sup>*</sup> Any containers for named items are called modules in resolve (that includes blocks, traits and enums in addition to `mod` items).

3 years agoAuto merge of #79228 - flip1995:clippyup, r=oli-obk
bors [Tue, 24 Nov 2020 06:56:02 +0000 (06:56 +0000)]
Auto merge of #79228 - flip1995:clippyup, r=oli-obk

Update Clippy

Biweekly Clippy update

r? `@Manishearth`

3 years agoAdd exploit mitigations chapter to the rustc book
Ramon de C Valle [Fri, 18 Sep 2020 00:47:56 +0000 (17:47 -0700)]
Add exploit mitigations chapter to the rustc book

This section documents the exploit mitigations applicable to the Rust
compiler when building programs for the Linux operating system on the
AMD64 architecture and equivalent.

3 years agoAuto merge of #78953 - mzohreva:mz/from_raw_fd, r=Mark-Simulacrum
bors [Tue, 24 Nov 2020 03:12:20 +0000 (03:12 +0000)]
Auto merge of #78953 - mzohreva:mz/from_raw_fd, r=Mark-Simulacrum

Add Metadata in std::os::fortanix_sgx::io::FromRawFd

Needed for https://github.com/fortanix/rust-sgx/pull/291

cc `@jethrogb`

3 years agoAuto merge of #78636 - dtolnay:puncteq, r=petrochenkov
bors [Tue, 24 Nov 2020 00:30:25 +0000 (00:30 +0000)]
Auto merge of #78636 - dtolnay:puncteq, r=petrochenkov

Add PartialEq<char> for proc_macro::Punct

`punct.as_char() == '░'` is pervasive when parsing anything involving punct. I think `punct == '░'` is sufficiently unambiguous that it makes sense to provide the impl.

https://github.com/rust-lang/rust/blob/1899c489d4c30b2640d30b77ac04f0a548834d81/library/proc_macro/src/quote.rs#L79
https://github.com/rust-lang/rust/blob/1899c489d4c30b2640d30b77ac04f0a548834d81/library/proc_macro/src/quote.rs#L83
https://github.com/rust-lang/rust/blob/1899c489d4c30b2640d30b77ac04f0a548834d81/src/test/ui/suggestions/auxiliary/issue-61963.rs#L26
https://github.com/rust-lang/rust/blob/1899c489d4c30b2640d30b77ac04f0a548834d81/src/test/ui/proc-macro/auxiliary/three-equals.rs#L23

3 years agoAllow disabling TrapUnreachable via -Ztrap-unreachable=no
Dario Nieuwenhuis [Mon, 23 Nov 2020 23:55:10 +0000 (00:55 +0100)]
Allow disabling TrapUnreachable via -Ztrap-unreachable=no

This is useful for embedded targets where small code size is desired.
For example, on my project (thumbv7em-none-eabi) this yields a 0.6% code size reduction.

3 years agoAuto merge of #78343 - camelid:macros-qualify-panic, r=m-ou-se
bors [Mon, 23 Nov 2020 22:05:28 +0000 (22:05 +0000)]
Auto merge of #78343 - camelid:macros-qualify-panic, r=m-ou-se

Qualify `panic!` as `core::panic!` in non-built-in `core` macros

Fixes #78333.

-----

Otherwise code like this

    #![no_implicit_prelude]

    fn main() {
        ::std::todo!();
        ::std::unimplemented!();
    }

will fail to compile, which is unfortunate and presumably unintended.

This changes many invocations of `panic!` in a `macro_rules!` definition
to invocations of `$crate::panic!`, which makes the invocations hygienic.

Note that this does not make the built-in macro `assert!` hygienic.

3 years agoClean up `core` macros documentation
Camelid [Sun, 25 Oct 2020 01:38:25 +0000 (18:38 -0700)]
Clean up `core` macros documentation

* Switch a couple links over to intra-doc links
* Clean up some formatting/typography

3 years agoQualify `panic!` as `core::panic!` in non-built-in `core` macros
Camelid [Sun, 25 Oct 2020 01:35:46 +0000 (18:35 -0700)]
Qualify `panic!` as `core::panic!` in non-built-in `core` macros

Otherwise code like this

    #![no_implicit_prelude]

    fn main() {
        ::std::todo!();
        ::std::unimplemented!();
    }

will fail to compile, which is unfortunate and presumably unintended.

This changes many invocations of `panic!` in a `macro_rules!` definition
to invocations of `$crate::panic!`, which makes the invocations hygienic.

Note that this does not make the built-in macro `assert!` hygienic.

3 years agoAuto merge of #78439 - lzutao:rm-clouldabi, r=Mark-Simulacrum
bors [Mon, 23 Nov 2020 19:01:19 +0000 (19:01 +0000)]
Auto merge of #78439 - lzutao:rm-clouldabi, r=Mark-Simulacrum

Drop support for all cloudabi targets

`cloudabi` is a tier-3 target, and [it is no longer being maintained upstream][no].

This PR drops supports for cloudabi targets. Those targets are:
* aarch64-unknown-cloudabi
* armv7-unknown-cloudabi
* i686-unknown-cloudabi
* x86_64-unknown-cloudabi

Since this drops supports for a target, I'd like somebody to tag `relnotes` label to this PR.

Some other issues:
* The tidy exception for `cloudabi` crate is still remained because
  * `parking_lot v0.9.0` and `parking_lot v0.10.2` depends on `cloudabi v0.0.3`.
  * `parking_lot v0.11.0` depends on `cloudabi v0.1.0`.

[no]: https://github.com/NuxiNL/cloudabi#note-this-project-is-unmaintained

3 years agoBTreeMap/BTreeSet: make public doc more consistent
Stein Somers [Mon, 23 Nov 2020 18:09:23 +0000 (19:09 +0100)]
BTreeMap/BTreeSet: make public doc more consistent

3 years agoAuto merge of #79345 - jonas-schievink:rollup-1yhhzx9, r=jonas-schievink
bors [Mon, 23 Nov 2020 16:33:03 +0000 (16:33 +0000)]
Auto merge of #79345 - jonas-schievink:rollup-1yhhzx9, r=jonas-schievink

Rollup of 10 pull requests

Successful merges:

 - #76829 (stabilize const_int_pow)
 - #79080 (MIR visitor: Don't treat debuginfo field access as a use of the struct)
 - #79236 (const_generics: assert resolve hack causes an error)
 - #79287 (Allow using generic trait methods in `const fn`)
 - #79324 (Use Option::and_then instead of open-coding it)
 - #79325 (Reduce boilerplate with the `?` operator)
 - #79330 (Fix typo in comment)
 - #79333 (doc typo)
 - #79337 (Use Option::map instead of open coding it)
 - #79343 (Add my (`@flip1995)` work mail to the mailmap)

Failed merges:

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

3 years agoBTreeMap: cut out the ceremony around BoxedNode
Stein Somers [Mon, 23 Nov 2020 15:40:48 +0000 (16:40 +0100)]
BTreeMap: cut out the ceremony around BoxedNode

3 years agoFix typo in keyword docs for traits
takashiidobe [Mon, 23 Nov 2020 15:48:19 +0000 (10:48 -0500)]
Fix typo in keyword docs for traits

3 years agoRollup merge of #79343 - flip1995:mailmap, r=Mark-Simulacrum
Jonas Schievink [Mon, 23 Nov 2020 14:25:55 +0000 (15:25 +0100)]
Rollup merge of #79343 - flip1995:mailmap, r=Mark-Simulacrum

Add my (@flip1995) work mail to the mailmap

3 years agoRollup merge of #79337 - LingMan:map, r=jyn514
Jonas Schievink [Mon, 23 Nov 2020 14:25:53 +0000 (15:25 +0100)]
Rollup merge of #79337 - LingMan:map, r=jyn514

Use Option::map instead of open coding it

r?  `@jonas-schievink` since you're frequently sniping these minor cleanups anyway.
`@rustbot` modify labels +C-cleanup  +T-compiler

3 years agoRollup merge of #79333 - o752d:patch-3, r=Mark-Simulacrum
Jonas Schievink [Mon, 23 Nov 2020 14:25:51 +0000 (15:25 +0100)]
Rollup merge of #79333 - o752d:patch-3, r=Mark-Simulacrum

doc typo

plus a small edit for clarity

3 years agoRollup merge of #79330 - jyn514:typo, r=jyn514
Jonas Schievink [Mon, 23 Nov 2020 14:25:49 +0000 (15:25 +0100)]
Rollup merge of #79330 - jyn514:typo, r=jyn514

Fix typo in comment

This is trivial enough I'm just going to merge without review.

r? `@ghost`

3 years agoRollup merge of #79325 - LingMan:try_op, r=jonas-schievink
Jonas Schievink [Mon, 23 Nov 2020 14:25:47 +0000 (15:25 +0100)]
Rollup merge of #79325 - LingMan:try_op, r=jonas-schievink

Reduce boilerplate with the `?` operator

`@rustbot` modify labels to +C-cleanup.

3 years agoRollup merge of #79324 - LingMan:and_then, r=jonas-schievink
Jonas Schievink [Mon, 23 Nov 2020 14:25:46 +0000 (15:25 +0100)]
Rollup merge of #79324 - LingMan:and_then, r=jonas-schievink

Use Option::and_then instead of open-coding it

`@rustbot` modify labels to +C-cleanup.

3 years agoRollup merge of #79287 - jonas-schievink:const-trait-impl, r=oli-obk
Jonas Schievink [Mon, 23 Nov 2020 14:25:44 +0000 (15:25 +0100)]
Rollup merge of #79287 - jonas-schievink:const-trait-impl, r=oli-obk

Allow using generic trait methods in `const fn`

Next step for https://github.com/rust-lang/rust/issues/67792, this now also allows code like the following:

```rust
struct S;

impl const PartialEq for S {
    fn eq(&self, _: &S) -> bool {
        true
    }
}

const fn equals_self<T: PartialEq>(t: &T) -> bool {
    *t == *t
}

pub const EQ: bool = equals_self(&S);
```

This works by threading const-ness of trait predicates through trait selection, in particular through `ParamCandidate`, and exposing it in the resulting `ImplSource`.

Since this change makes two bounds `T: Trait` and `T: ?const Trait` that only differ in their const-ness be treated like different bounds, candidate winnowing has been changed to drop the `?const` candidate in favor of the const candidate, to avoid ambiguities when both a const and a non-const bound is present.

3 years agoRollup merge of #79236 - lcnr:mcg-resolve-dsb, r=eddyb
Jonas Schievink [Mon, 23 Nov 2020 14:25:42 +0000 (15:25 +0100)]
Rollup merge of #79236 - lcnr:mcg-resolve-dsb, r=eddyb

const_generics: assert resolve hack causes an error

prevent the min_const_generics `HACK`s in resolve from triggering a fallback path which successfully compiles so that we don't have to worry about future compat issues when removing it

r? `@eddyb` cc `@varkor`

3 years agoRollup merge of #79080 - camelid:mir-visit-debuginfo-project, r=jonas-schievink
Jonas Schievink [Mon, 23 Nov 2020 14:25:40 +0000 (15:25 +0100)]
Rollup merge of #79080 - camelid:mir-visit-debuginfo-project, r=jonas-schievink

MIR visitor: Don't treat debuginfo field access as a use of the struct

Fixes #77454.

r? `@jonas-schievink`

3 years agoRollup merge of #76829 - tspiteri:const-int-pow, r=oli-obk
Jonas Schievink [Mon, 23 Nov 2020 14:25:38 +0000 (15:25 +0100)]
Rollup merge of #76829 - tspiteri:const-int-pow, r=oli-obk

stabilize const_int_pow

This also requires stabilizing constctlz for const ctlz_nonzero.

3 years agoAuto merge of #79186 - JulianKnodt:str_from, r=Mark-Simulacrum
bors [Mon, 23 Nov 2020 14:20:22 +0000 (14:20 +0000)]
Auto merge of #79186 - JulianKnodt:str_from, r=Mark-Simulacrum

Change slice::to_vec to not use extend_from_slice

I saw this [Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/String.3A.3Afrom%28.26str%29.20wonky.20codegen/near/216164455), and didn't see any update from it, so I thought I'd try to fix it. This converts `to_vec` to no longer use `extend_from_slice`, but relies on knowing that the allocated capacity is the same size as the input.

[Godbolt new v1](https://rust.godbolt.org/z/1bcWKG)
[Godbolt new v2 w/ drop guard](https://rust.godbolt.org/z/5jn76K)
[Godbolt old version](https://rust.godbolt.org/z/e4ePav)

After some amount of iteration, there are now two specializations for `to_vec`, one for `Copy` types that use memcpy, and one for clone types which is the original from this PR.

This is then used inside of `impl<T: Clone> FromIterator<Iter::Slice<T>> for Vec<T>` which is essentially equivalent to `&[T] -> Vec<T>`, instead of previous specialization of the `extend` function. This is because extend has to reason more about existing capacity by calling `reserve` on an existing vec, and thus produces worse asm.

Downsides: This allocates the exact capacity, so I think if many items are added to this `Vec` after, it might need to allocate whereas extending may not. I also noticed the number of faults went up in the benchmarks, but not sure where from exactly.

3 years agoAdd my (@flip1995) work mail to the mailmap
flip1995 [Mon, 23 Nov 2020 13:11:56 +0000 (14:11 +0100)]
Add my (@flip1995) work mail to the mailmap

3 years agoFix ICE in utils::implements_trait
flip1995 [Mon, 23 Nov 2020 12:52:27 +0000 (13:52 +0100)]
Fix ICE in utils::implements_trait

This only happend when debug_assertions were enabled in rustc

3 years agoMerge commit '3e7c6dec244539970b593824334876f8b6ed0b18' into clippyup
flip1995 [Mon, 23 Nov 2020 12:51:04 +0000 (13:51 +0100)]
Merge commit '3e7c6dec244539970b593824334876f8b6ed0b18' into clippyup

3 years agoAuto merge of #77893 - petertodd:2020-impl-default-for-phantompinned, r=dtolnay
bors [Mon, 23 Nov 2020 07:00:30 +0000 (07:00 +0000)]
Auto merge of #77893 - petertodd:2020-impl-default-for-phantompinned, r=dtolnay

Impl Default for PhantomPinned

`PhantomPinned` is just a marker type, with an obvious default value (the only value). So I can't think of a reason not to do this. Sure, it's used in exotic situations with unsafe code. But the people writing that code can decide for themselves if they can derive `Default`, and in many situations the derived impl will make sense:

```rust
#[derive(Default)]
struct NeedsPin {
   marker: PhantomPinned,
   buf: [u8; 1024],
   ptr_to_data: Option<*const u8>,
}
```

3 years agoAuto merge of #76226 - CDirkx:const-ipaddr, r=dtolnay
bors [Mon, 23 Nov 2020 04:47:25 +0000 (04:47 +0000)]
Auto merge of #76226 - CDirkx:const-ipaddr, r=dtolnay

Stabilize `IpAddr::is_ipv4` and `is_ipv6` as const

Insta-stabilize the methods `is_ipv4` and `is_ipv6` of `std::net::IpAddr` as const, in the same way as [PR#76198](https://github.com/rust-lang/rust/pull/76198).

Possible because of the recent stabilization of const control flow.

Part of #76225 and #76205.

3 years agoUse Option::map instead of open coding it
LingMan [Mon, 23 Nov 2020 03:58:21 +0000 (04:58 +0100)]
Use Option::map instead of open coding it

3 years agodoc typo
oliver [Mon, 23 Nov 2020 02:47:45 +0000 (02:47 +0000)]
doc typo

plus a small edit for clarity

3 years agoAuto merge of #79172 - a1phyr:cold_abort, r=Mark-Simulacrum
bors [Mon, 23 Nov 2020 02:25:13 +0000 (02:25 +0000)]
Auto merge of #79172 - a1phyr:cold_abort, r=Mark-Simulacrum

Add #[cold] attribute to `std::process::abort` and `alloc::alloc::handle_alloc_error`

3 years agoAdd comment and remove obsolete special case
Camelid [Mon, 23 Nov 2020 01:33:06 +0000 (17:33 -0800)]
Add comment and remove obsolete special case

3 years agoFix typo in comment
Joshua Nelson [Mon, 23 Nov 2020 01:32:36 +0000 (20:32 -0500)]
Fix typo in comment

3 years agoconst_int_pow will be stabilized in 1.50.0, not in 1.49.0
Trevor Spiteri [Mon, 23 Nov 2020 01:04:37 +0000 (02:04 +0100)]
const_int_pow will be stabilized in 1.50.0, not in 1.49.0

Same for constctlz.

3 years agostabilize const_int_pow
Trevor Spiteri [Fri, 2 Oct 2020 17:30:16 +0000 (19:30 +0200)]
stabilize const_int_pow

Also stabilize constctlz for const ctlz_nonzero.

The public methods stabilized const by this commit are:

  * `{i*,u*}::checked_pow`
  * `{i*,u*}::saturating_pow`
  * `{i*,u*}::wrapping_pow`
  * `{i*,u*}::overflowing_pow`
  * `{i*,u*}::pow`
  * `u*::next_power_of_two`
  * `u*::checked_next_power_of_two`
  * `u*::wrapping_next_power_of_two` (the method itself is still unstable)

3 years agoBump version to 1.50.0
Christiaan Dirkx [Mon, 23 Nov 2020 00:40:26 +0000 (01:40 +0100)]
Bump version to 1.50.0

3 years agoStabilize `IpAddr::is_ipv4` and `is_ipv6` as const
Christiaan Dirkx [Wed, 2 Sep 2020 00:05:42 +0000 (02:05 +0200)]
Stabilize `IpAddr::is_ipv4` and `is_ipv6` as const

Insta-stabilize the methods `is_ipv4` and `is_ipv6` of `IpAddr`.

Possible because of the recent stabilization of const control flow.

Also adds a test for these methods in a const context.

3 years agoAllow using `-Z fewer-names=no` to retain value names
Tomasz Miąsko [Mon, 23 Nov 2020 00:00:00 +0000 (00:00 +0000)]
Allow using `-Z fewer-names=no` to retain value names

Change `-Z fewer-names` into an optional boolean flag and allow using it
to either discard value names when true or retain them when false,
regardless of other settings.

3 years agoAuto merge of #79319 - m-ou-se:rollup-d9n5viq, r=m-ou-se
bors [Sun, 22 Nov 2020 23:59:48 +0000 (23:59 +0000)]
Auto merge of #79319 - m-ou-se:rollup-d9n5viq, r=m-ou-se

Rollup of 10 pull requests

Successful merges:

 - #76941 (Add f{32,64}::is_subnormal)
 - #77697 (Split each iterator adapter and source into individual modules)
 - #78305 (Stabilize alloc::Layout const functions)
 - #78608 (Stabilize refcell_take)
 - #78793 (Clean up `StructuralEq` docs)
 - #79267 (BTreeMap: address namespace conflicts)
 - #79293 (Add test for eval order for a+=b)
 - #79295 (BTreeMap: fix minor testing mistakes in #78903)
 - #79297 (BTreeMap: swap the names of NodeRef::new and Root::new_leaf)
 - #79299 (Stabilise `then`)

Failed merges:

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

3 years agoReduce boilerplate with the `?` operator
LingMan [Sun, 11 Oct 2020 18:52:48 +0000 (20:52 +0200)]
Reduce boilerplate with the `?` operator

3 years agoUse Option::and_then instead of open-coding it
LingMan [Sun, 11 Oct 2020 06:32:19 +0000 (08:32 +0200)]
Use Option::and_then instead of open-coding it

3 years agoAccept '!' in intra-doc links
Camelid [Sun, 22 Nov 2020 22:25:50 +0000 (14:25 -0800)]
Accept '!' in intra-doc links

This will allow linking to things like `Result<T, !>`.

3 years agoChange slice::to_vec to not use extend_from_slice
kadmin [Wed, 18 Nov 2020 22:59:47 +0000 (22:59 +0000)]
Change slice::to_vec to not use extend_from_slice

This also required adding a loop guard in case clone panics

Add specialization for copy

There is a better version for copy, so I've added specialization for that function
and hopefully that should speed it up even more.

Switch FromIter<slice::Iter> to use `to_vec`

Test different unrolling version for to_vec

Revert to impl

From benchmarking, it appears this version is faster

3 years agoDrop support for cloudabi targets
Lzu Tao [Tue, 27 Oct 2020 13:10:31 +0000 (13:10 +0000)]
Drop support for cloudabi targets

3 years agoRollup merge of #79299 - varkor:stabilise-then, r=m-ou-se
Mara Bos [Sun, 22 Nov 2020 22:01:08 +0000 (23:01 +0100)]
Rollup merge of #79299 - varkor:stabilise-then, r=m-ou-se

Stabilise `then`

Stabilises the lazy variant of https://github.com/rust-lang/rust/issues/64260 now that the FCP [has ended](https://github.com/rust-lang/rust/issues/64260#issuecomment-731636203).

I've kept the original feature gate `bool_to_option` for the strict variant (`then_some`), and created a new insta-stable feature gate `lazy_bool_to_option` for `then`.

3 years agoRollup merge of #79297 - ssomers:btree_post_redux, r=Mark-Simulacrum
Mara Bos [Sun, 22 Nov 2020 22:01:07 +0000 (23:01 +0100)]
Rollup merge of #79297 - ssomers:btree_post_redux, r=Mark-Simulacrum

BTreeMap: swap the names of NodeRef::new and Root::new_leaf

#78104 preserved the name of Root::new_leaf to minimize changes, but the resulting names are confusing.

r? `@Mark-Simulacrum`

3 years agoRollup merge of #79295 - ssomers:btree_fix_78903, r=Mark-Simulacrum
Mara Bos [Sun, 22 Nov 2020 22:01:05 +0000 (23:01 +0100)]
Rollup merge of #79295 - ssomers:btree_fix_78903, r=Mark-Simulacrum

BTreeMap: fix minor testing mistakes in #78903

Mostly a duplicate test case
r? `@Mark-Simulacrum`

3 years agoRollup merge of #79293 - Havvy:test-eval-order-compound-assign, r=Mark-Simulacrum
Mara Bos [Sun, 22 Nov 2020 22:01:03 +0000 (23:01 +0100)]
Rollup merge of #79293 - Havvy:test-eval-order-compound-assign, r=Mark-Simulacrum

Add test for eval order for a+=b

Yes, the order of evaluation *does* change depending on the types of
the operands. Cursed, I know.

I've elected to place this test into `expr/compound-assignment` creating
both the `expr` directory and the `compound-assignment` directory. I
plan in a future PR to also move the `if` directory and the loose `if`
tests into `expr/if` and other similar cleanups of the `test/ui`
directory.

Future work: Test more than just `+=`, but all operators. I don't know
if using a macro to generate these tests cases would be okay or not,
but it'd be boilerplatey without it. I'm also confident you cannot
change the evaluation order of one operator without changing all of
them.

Future work: Additionally, test more than just `i32 += i32` for the
primitive version. I don't actually know the full set of primitive
implementations, but I imagine there's enough to cause a combinatorial
explosion with the previous future work item. Somewhere on the order of
one to two hundred individual functions.

3 years agoRollup merge of #79267 - ssomers:btree_namespaces, r=Mark-Simulacrum
Mara Bos [Sun, 22 Nov 2020 22:01:02 +0000 (23:01 +0100)]
Rollup merge of #79267 - ssomers:btree_namespaces, r=Mark-Simulacrum

BTreeMap: address namespace conflicts

Fix an annoyance popping up whenever synchronizing the test cases with a version capable of miri-track-raw-pointers.

r? `@Mark-Simulacrum`

3 years agoRollup merge of #78793 - camelid:fixup-structuraleq, r=jyn514
Mara Bos [Sun, 22 Nov 2020 22:01:00 +0000 (23:01 +0100)]
Rollup merge of #78793 - camelid:fixup-structuraleq, r=jyn514

Clean up `StructuralEq` docs

3 years agoRollup merge of #78608 - ThinkChaos:stabilize_refcell_take, r=m-ou-se
Mara Bos [Sun, 22 Nov 2020 22:00:58 +0000 (23:00 +0100)]
Rollup merge of #78608 - ThinkChaos:stabilize_refcell_take, r=m-ou-se

Stabilize refcell_take

Tracking Issue: #71395

``@KodrAus`` nominated this for FCP, so here's a PR!
I've never made a stabilization PR, so please mention if there's anything I can improve, thanks.

3 years agoRollup merge of #78305 - ChrisDenton:const-layout, r=oli-obk
Mara Bos [Sun, 22 Nov 2020 22:00:56 +0000 (23:00 +0100)]
Rollup merge of #78305 - ChrisDenton:const-layout, r=oli-obk

Stabilize alloc::Layout const functions

Stabilizes #67521. In particular the following stable methods are stabilized as `const fn`:

* `size`
* `align`
* `from_size_align`

Stabilizing `size` and `align` should not be controversial as they are simple (usize and NonZeroUsize) fields and I don't think there's any reason to make them not const compatible in the future. That being true, the other methods are trivially `const`. The only other issue being returning a `Result` from a `const fn` but this has been made more usable by recent stabilizations.

3 years agoRollup merge of #77697 - WaffleLapkin:iter_split_adaptors, r=m-ou-se
Mara Bos [Sun, 22 Nov 2020 22:00:55 +0000 (23:00 +0100)]
Rollup merge of #77697 - WaffleLapkin:iter_split_adaptors, r=m-ou-se

Split each iterator adapter and source into individual modules

This PR creates individual modules for each iterator adapter and iterator source.

This is done to enhance the readability of corresponding modules (`adapters/mod.rs` and `sources.rs`) which were hard to navigate and read because of lots of repeated lines (e.g.: `adapters/mod.rs` was 3k lines long). This is also in line with some adapters which already had their own modules (`Flatten`, `FlatMap`, `Chain`, `Zip`, `Fuse`).

This PR also makes `Take`s adapter fields private (I have no idea why they were `pub(super)` before).

r? ``@LukasKalbertodt``

3 years agoRollup merge of #76941 - clarfonthey:is_subnormal, r=m-ou-se
Mara Bos [Sun, 22 Nov 2020 22:00:48 +0000 (23:00 +0100)]
Rollup merge of #76941 - clarfonthey:is_subnormal, r=m-ou-se

Add f{32,64}::is_subnormal

The docs recommend that you use dedicated methods instead of calling `classify` directly, although there isn't actually a way of checking if a number is subnormal without calling classify. There are dedicated methods for all other forms, excluding `is_zero` (which is just `== 0.0` anyway).

3 years agoStabilize `alloc::Layout const` functions
Chris Denton [Sun, 22 Nov 2020 21:21:46 +0000 (21:21 +0000)]
Stabilize `alloc::Layout const` functions

Stabilizes #67521. In particular the following stable methods are stabilized as const fn:

* size
* align
* from_size_align

3 years agoAuto merge of #79219 - shepmaster:beta-bump, r=Mark-Simulacrum
bors [Sun, 22 Nov 2020 21:38:03 +0000 (21:38 +0000)]
Auto merge of #79219 - shepmaster:beta-bump, r=Mark-Simulacrum

Bump bootstrap compiler version

r? `@Mark-Simulacrum`

/cc `@pietroalbini`

3 years agoAdd f{32,64}::is_subnormal
ltdk [Sat, 19 Sep 2020 20:31:47 +0000 (16:31 -0400)]
Add f{32,64}::is_subnormal

3 years agoStabilize refcell_take
ThinkChaos [Sat, 31 Oct 2020 18:06:25 +0000 (19:06 +0100)]
Stabilize refcell_take

3 years agoGet rid of `doctree::Impl`
Joshua Nelson [Sun, 22 Nov 2020 18:34:06 +0000 (13:34 -0500)]
Get rid of `doctree::Impl`

3 years agoAuto merge of #79243 - Nadrieril:consolidate-tests, r=varkor
bors [Sun, 22 Nov 2020 18:29:38 +0000 (18:29 +0000)]
Auto merge of #79243 - Nadrieril:consolidate-tests, r=varkor

Consolidate exhaustiveness-related tests

I hunted for tests that only exercised the match exhaustiveness algorithm and regrouped them. I also improved integer-range tests since I had found them lacking while hacking around.
The interest is mainly so that one can pass `--test-args patterns` and catch most relevant tests.

r? `@varkor`
`@rustbot` modify labels: +A-exhaustiveness-checking

3 years agoMake `fold_item_recur` non-nullable
Joshua Nelson [Sun, 22 Nov 2020 17:57:55 +0000 (12:57 -0500)]
Make `fold_item_recur` non-nullable

This gets rid of a bunch of `unwrap()`s and makes it a little more clear
what's going on.

Originally I wanted to make `fold_item` non-nullable too, which would
have been a lot nicer to work with, but unfortunately `stripper` does
actually return `None` in some places. I might make a follow-up moving
stripper to be special and not a pass so that passes can be
non-nullable.

3 years agoAuto merge of #79306 - GuillaumeGomez:rollup-4cnudfj, r=GuillaumeGomez
bors [Sun, 22 Nov 2020 15:40:03 +0000 (15:40 +0000)]
Auto merge of #79306 - GuillaumeGomez:rollup-4cnudfj, r=GuillaumeGomez

Rollup of 4 pull requests

Successful merges:

 - #78670 (Remove FIXME comment in some incremental test suite)
 - #79292 (Fix typo in doc comment for report_too_many_hashes)
 - #79300 (Prevent feature information to be hidden if it's on the impl directly)
 - #79302 (Add regression test for issue 73899)

Failed merges:

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

3 years agoAuto merge of #6361 - integer32llc:doc-style, r=carols10cents
bors [Sun, 22 Nov 2020 15:34:56 +0000 (15:34 +0000)]
Auto merge of #6361 - integer32llc:doc-style, r=carols10cents

Small grammar, punctuation, and code style improvements to docs

changelog: Made small grammar, punctuation, and code style improvements to docs

I recently found some places in rust-lang/rust that had lists without spaces after commas, which led me to look for more places, which led me over here to find:

- Some similar lists in code examples that could use spaces after commas to be idiomatic Rust style
- Some lists in documentation text that didn't have spaces after commas, needed an Oxford comma (fight me), or were otherwise misformatted
- Some other grammar improvements in the area of the other changes

These changes should only be in user-facing documentation or output.

3 years agoApply suggestions from code review to change "that" to "which"
Carol (Nichols || Goulding) [Sun, 22 Nov 2020 15:12:41 +0000 (10:12 -0500)]
Apply suggestions from code review to change "that" to "which"

Co-authored-by: oliver <16816606+o752d@users.noreply.github.com>
3 years agoSmall grammar, punctuation, and code style improvements to docs
Carol (Nichols || Goulding) [Sat, 21 Nov 2020 20:00:03 +0000 (15:00 -0500)]
Small grammar, punctuation, and code style improvements to docs

3 years agoRollup merge of #79302 - est31:issue_73899_test, r=lcnr
Guillaume Gomez [Sun, 22 Nov 2020 15:15:15 +0000 (16:15 +0100)]
Rollup merge of #79302 - est31:issue_73899_test, r=lcnr

Add regression test for issue 73899

Closes #73899

3 years agoRollup merge of #79300 - GuillaumeGomez:hidden-feature-info, r=jyn514
Guillaume Gomez [Sun, 22 Nov 2020 15:15:13 +0000 (16:15 +0100)]
Rollup merge of #79300 - GuillaumeGomez:hidden-feature-info, r=jyn514

Prevent feature information to be hidden if it's on the impl directly

Fixes #79279.

So when a `#[doc(cfg...)]` is used on a trait impl directly, it's not hidden by the toggle.

![Screenshot from 2020-11-22 14-40-11](https://user-images.githubusercontent.com/3050060/99905528-997fab00-2cd1-11eb-83be-ed06b0cb97df.png)

r? `@jyn514`

3 years agoRollup merge of #79292 - nico-abram:master, r=jonas-schievink
Guillaume Gomez [Sun, 22 Nov 2020 15:15:12 +0000 (16:15 +0100)]
Rollup merge of #79292 - nico-abram:master, r=jonas-schievink

Fix typo in doc comment for report_too_many_hashes

"to big" -> "too big"

3 years agoRollup merge of #78670 - sasurau4:test/check-pass-incremental, r=jyn514
Guillaume Gomez [Sun, 22 Nov 2020 15:15:10 +0000 (16:15 +0100)]
Rollup merge of #78670 - sasurau4:test/check-pass-incremental, r=jyn514

Remove FIXME comment in some incremental test suite

Helps with #62277

I removed FIXME comment in some incremental tests with [rustc_partition_codegened](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_incremental/assert_module_sources/index.html). This seems using codegen process. So it uses intentionally `build-pass`

3 years agoPrevent feature information to be hidden if it's on the impl directly
Guillaume Gomez [Sun, 22 Nov 2020 13:45:54 +0000 (14:45 +0100)]
Prevent feature information to be hidden if it's on the impl directly

3 years agoAdd some more tests
Jonas Schievink [Sun, 22 Nov 2020 14:51:05 +0000 (15:51 +0100)]
Add some more tests

3 years agoAdd regression test for issue 73899
est31 [Sun, 22 Nov 2020 13:53:31 +0000 (14:53 +0100)]
Add regression test for issue 73899

Adds regression test for https://github.com/rust-lang/rust/issues/73899

3 years agoAuto merge of #6363 - o752d:patch-2, r=flip1995
bors [Sun, 22 Nov 2020 14:08:01 +0000 (14:08 +0000)]
Auto merge of #6363 - o752d:patch-2, r=flip1995

a typo

typo

changelog: none

3 years agoAuto merge of #6364 - o752d:master, r=flip1995
bors [Sun, 22 Nov 2020 13:48:02 +0000 (13:48 +0000)]
Auto merge of #6364 - o752d:master, r=flip1995

revisiting a typo

changelog: none

3 years agoStabilise `then`
varkor [Sun, 22 Nov 2020 13:25:19 +0000 (13:25 +0000)]
Stabilise `then`

3 years agoAuto merge of #78816 - SkiFire13:fix-slice-pointer-provenance, r=RalfJung
bors [Sun, 22 Nov 2020 13:10:15 +0000 (13:10 +0000)]
Auto merge of #78816 - SkiFire13:fix-slice-pointer-provenance, r=RalfJung

<[T]>::reverse: Fix pointer provenance rules

Should fix #78749