]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #78618 - workingjubilee:ieee754-fmt, r=m-ou-se
bors [Sat, 27 Mar 2021 10:40:16 +0000 (10:40 +0000)]
Auto merge of #78618 - workingjubilee:ieee754-fmt, r=m-ou-se

Add IEEE 754 compliant fmt/parse of -0, infinity, NaN

This pull request improves the Rust float formatting/parsing libraries to comply with IEEE 754's formatting expectations around certain special values, namely signed zero, the infinities, and NaN. It also adds IEEE 754 compliance tests that, while less stringent in certain places than many of the existing flt2dec/dec2flt capability tests, are intended to serve as the beginning of a roadmap to future compliance with the standard. Some relevant documentation is also adjusted with clarifying remarks.

This PR follows from discussion in https://github.com/rust-lang/rfcs/issues/1074, and closes #24623.

The most controversial change here is likely to be that -0 is now printed as -0. Allow me to explain: While there appears to be community support for an opt-in toggle of printing floats as if they exist in the naively expected domain of numbers, i.e. not the extended reals (where floats live), IEEE 754-2019 is clear that a float converted to a string should be capable of being transformed into the original floating point bit-pattern when it satisfies certain conditions (namely, when it is an actual numeric value i.e. not a NaN and the original and destination float width are the same). -0 is given special attention here as a value that should have its sign preserved. In addition, the vast majority of other programming languages not only output `-0` but output `-0.0` here.

While IEEE 754 offers a broad leeway in how to handle producing what it calls a "decimal character sequence", it is clear that the operations a language provides should be capable of round tripping, and it is confusing to advertise the f32 and f64 types as binary32 and binary64 yet have the most basic way of producing a string and then reading it back into a floating point number be non-conformant with the standard. Further, existing documentation suggested that e.g. -0 would be printed with -0 regardless of the presence of the `+` fmt character, but it prints "+0" instead if given such (which was what led to the opening of #24623).

There are other parsing and formatting issues for floating point numbers which prevent Rust from complying with the standard, as well as other well-documented challenges on the arithmetic level, but I hope that this can be the beginning of motion towards solving those challenges.

3 years agoAuto merge of #83547 - JohnTitor:rollup-qh7j6hg, r=JohnTitor
bors [Sat, 27 Mar 2021 07:59:24 +0000 (07:59 +0000)]
Auto merge of #83547 - JohnTitor:rollup-qh7j6hg, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #83239 (Remove/replace some outdated crates from the dependency tree)
 - #83328 (Fixes to inline assmebly tests)
 - #83343 (Simplify and fix byte skipping in format! string parser)
 - #83388 (Make # pretty print format easier to discover)
 - #83431 (Tell GitHub to highlight `config.toml.example` as TOML)
 - #83508 (Use the direct link to the platform support page)
 - #83511 (compiletest: handle llvm_version with suffix like "12.0.0libcxx")
 - #83524 (Document that the SocketAddr memory representation is not stable)
 - #83525 (fix doc comment for `ty::Dynamic`)

Failed merges:

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

3 years agoRollup merge of #83525 - rust-lang:lcnr-doc-patch, r=jonas-schievink
Yuki Okushi [Sat, 27 Mar 2021 03:37:25 +0000 (12:37 +0900)]
Rollup merge of #83525 - rust-lang:lcnr-doc-patch, r=jonas-schievink

fix doc comment for `ty::Dynamic`

3 years agoRollup merge of #83524 - faern:document-socketaddr-mem-layout, r=sfackler
Yuki Okushi [Sat, 27 Mar 2021 03:37:24 +0000 (12:37 +0900)]
Rollup merge of #83524 - faern:document-socketaddr-mem-layout, r=sfackler

Document that the SocketAddr memory representation is not stable

Intended to help out with #78802. Work has been put into finding and fixing code that assumes the memory layout of `SocketAddrV4` and `SocketAddrV6`. But it turns out there are cases where new code continues to make the same assumption ([example](https://github.com/spacejam/seaslug/commit/96927dc2b7b918860a79c4eb6336051e52c6137a#diff-917db3d8ca6f862ebf42726b23c72a12b35e584e497ebdb24e474348d7c6ffb6R610-R621)).

The memory layout of a type in `std` is never part of the public API. Unless explicitly stated I guess. But since that is invalidly relied upon by a considerable amount of code for these particular types, it might make sense to explicitly document this. This can be temporary. Once #78802 lands it does not make sense to rely on the layout any longer, and this documentation can also be removed.

3 years agoRollup merge of #83511 - 12101111:fix-llvm-version-suffix, r=Mark-Simulacrum
Yuki Okushi [Sat, 27 Mar 2021 03:37:23 +0000 (12:37 +0900)]
Rollup merge of #83511 - 12101111:fix-llvm-version-suffix, r=Mark-Simulacrum

compiletest: handle llvm_version with suffix like "12.0.0libcxx"

The previous code only remove the suffix begin with `-`, but Gentoo Linux [define `LLVM_VERSION_SUFFIX="libcxx"`](https://github.com/gentoo/gentoo/blob/604d79f327176eecb05293d7154e24231229cb31/sys-devel/llvm/llvm-11.1.0.ebuild#L378) when llvm is linked to libc++ and lead to a panic:

```
thread 'main' panicked at 'Malformed version component: ParseIntError { kind: InvalidDigit }', src/tools/compiletest/src/header.rs:968:28
```

This new code will handle all suffix not beginning with digit or dot.

3 years agoRollup merge of #83508 - JohnTitor:platform-support-link, r=joshtriplett
Yuki Okushi [Sat, 27 Mar 2021 03:37:22 +0000 (12:37 +0900)]
Rollup merge of #83508 - JohnTitor:platform-support-link, r=joshtriplett

Use the direct link to the platform support page

3 years agoRollup merge of #83431 - camelid:config-example-gitattributes, r=Mark-Simulacrum
Yuki Okushi [Sat, 27 Mar 2021 03:37:21 +0000 (12:37 +0900)]
Rollup merge of #83431 - camelid:config-example-gitattributes, r=Mark-Simulacrum

Tell GitHub to highlight `config.toml.example` as TOML

This should be a nice small quality of life improvement when looking at
`config.toml.example` on GitHub or looking at diffs of it in PRs.

3 years agoRollup merge of #83388 - alamb:alamb/fmt-dcs, r=Mark-Simulacrum
Yuki Okushi [Sat, 27 Mar 2021 03:37:20 +0000 (12:37 +0900)]
Rollup merge of #83388 - alamb:alamb/fmt-dcs, r=Mark-Simulacrum

Make # pretty print format easier to discover

# Rationale:

I use (cargo cult?) three formats in rust:  `{}`, debug `{:?}`, and pretty-print debug `{:#?}`. I discovered `{:#?}` in some blog post or guide when I started working in Rust. While `#` is documented I think it is hard to discover. So taking the good advice of ```@carols10cents```  I am trying to improve the docs with a PR

As a reminder "pretty print" means that where `{:?}` will print something like
```
foo: { b1: 1, b2: 2}
```

`{:#?}` will prints something like
```
foo {
  b1: 1
  b2: 3
}
```

# Changes
Add an example to `fmt` to try and make it easier to discover `#`

3 years agoRollup merge of #83343 - osa1:issue83340, r=jackh726
Yuki Okushi [Sat, 27 Mar 2021 03:37:19 +0000 (12:37 +0900)]
Rollup merge of #83343 - osa1:issue83340, r=jackh726

Simplify and fix byte skipping in format! string parser

Fixes '\\' handling in format strings.

Fixes #83340

3 years agoRollup merge of #83328 - tmiasko:asm-test, r=joshtriplett
Yuki Okushi [Sat, 27 Mar 2021 03:37:19 +0000 (12:37 +0900)]
Rollup merge of #83328 - tmiasko:asm-test, r=joshtriplett

Fixes to inline assmebly tests

* Join test thread to make assertion effective in sym.rs test case
* Use a single codegen unit to reduce non-determinism in srcloc.rs test #82886

3 years agoRollup merge of #83239 - JohnTitor:reduce-deps, r=Mark-Simulacrum
Yuki Okushi [Sat, 27 Mar 2021 03:37:18 +0000 (12:37 +0900)]
Rollup merge of #83239 - JohnTitor:reduce-deps, r=Mark-Simulacrum

Remove/replace some outdated crates from the dependency tree

- Remove `cloudabi` by updating `parking_lot` to 0.11.1.
- Replace `packed_simd` with `packed_simd2` by updating `bytecount` to 0.6.2.

3 years agoAuto merge of #83418 - ehuss:update-cargo, r=ehuss
bors [Fri, 26 Mar 2021 23:01:18 +0000 (23:01 +0000)]
Auto merge of #83418 - ehuss:update-cargo, r=ehuss

Update cargo

12 commits in 90691f2bfe9a50291a98983b1ed2feab51d5ca55..1e8703890f285befb5e32627ad4e0a0454dde1fb
2021-03-16 21:36:55 +0000 to 2021-03-26 16:59:39 +0000
- tests: Tolerate "exit status" in error messages (rust-lang/cargo#9307)
- Default macOS targets to `unpacked` debuginfo (rust-lang/cargo#9298)
- Fix publication of packages with metadata and resolver (rust-lang/cargo#9300)
- Fix config includes not working. (rust-lang/cargo#9299)
- Emit note when `--future-incompat-report` had nothing to report (rust-lang/cargo#9263)
- RFC 3052: Stop including authors field in manifests made by cargo new (rust-lang/cargo#9282)
- Refactor feature handling, and improve error messages. (rust-lang/cargo#9290)
- Split out cargo-util package for cargo-test-support. (rust-lang/cargo#9292)
- Fix redundant_semicolons warning in resolver-tests. (rust-lang/cargo#9293)
- Use serde's error message option to avoid implementing `Deserialize`. (rust-lang/cargo#9237)
- Allow `cargo update` to operate with the --offline flag (rust-lang/cargo#9279)
- Fix typo in faq.md (rust-lang/cargo#9285)

3 years agoUpdate cargo
Eric Huss [Fri, 26 Mar 2021 19:29:08 +0000 (12:29 -0700)]
Update cargo

3 years agofix doc comment for `ty::Dynamic
lcnr [Fri, 26 Mar 2021 18:52:09 +0000 (19:52 +0100)]
fix doc comment for `ty::Dynamic

3 years agoDocument that the SocketAddr memory representation is not stable
Linus Färnstrand [Fri, 26 Mar 2021 18:44:06 +0000 (19:44 +0100)]
Document that the SocketAddr memory representation is not stable

3 years agoAuto merge of #83488 - Aaron1011:ban-expr-inner-attrs, r=petrochenkov
bors [Fri, 26 Mar 2021 17:26:18 +0000 (17:26 +0000)]
Auto merge of #83488 - Aaron1011:ban-expr-inner-attrs, r=petrochenkov

Ban custom inner attributes in expressions and statements

Split out from https://github.com/rust-lang/rust/pull/82608

Custom inner attributes are unstable, so this won't break any stable users.
This allows us to speed up token collection, and avoid a redundant call to `collect_tokens_no_attrs` when parsing an `Expr` that has outer attributes.

r? `@petrochenkov`

3 years agoAuto merge of #83404 - michaelwoerister:issue83045, r=eddyb
bors [Fri, 26 Mar 2021 14:39:02 +0000 (14:39 +0000)]
Auto merge of #83404 - michaelwoerister:issue83045, r=eddyb

Fix #83045 by moving some crate loading verification code to a better place

r? `@eddyb`

3 years agoAuto merge of #82980 - tmiasko:import-cold-multiplier, r=michaelwoerister
bors [Fri, 26 Mar 2021 11:57:44 +0000 (11:57 +0000)]
Auto merge of #82980 - tmiasko:import-cold-multiplier, r=michaelwoerister

Import small cold functions

The Rust code is often written under an assumption that for generic
methods inline attribute is mostly unnecessary, since for optimized
builds using ThinLTO, a method will be code generated in at least one
CGU and available for import.

For example, deref implementations for Box, Vec, MutexGuard, and
MutexGuard are not currently marked as inline, neither is identity
implementation of From trait.

In PGO builds, when functions are determined to be cold, the default
multiplier of zero will stop the import, no matter how trivial the
implementation.

Increase slightly the default multiplier from 0 to 0.1.

r? `@ghost`

3 years agoHandle llvm_version with suffix like "12.0.0libcxx"
12101111 [Fri, 26 Mar 2021 09:29:52 +0000 (17:29 +0800)]
Handle llvm_version with suffix like "12.0.0libcxx"

3 years agoAuto merge of #83079 - osa1:issue83046, r=m-ou-se
bors [Fri, 26 Mar 2021 09:11:18 +0000 (09:11 +0000)]
Auto merge of #83079 - osa1:issue83046, r=m-ou-se

Update char::escape_debug_ext to handle different escapes in strings and chars

Fixes #83046

The program

    fn main() {
        println!("{:?}", '"');
        println!("{:?}", "'");
    }

would previously print

    '\"'
    "\'"

With this patch it now prints:

    '"'
    "'"

3 years agoFix #83045 by moving some crate loading verification code to a better place.
Michael Woerister [Mon, 22 Mar 2021 17:09:33 +0000 (18:09 +0100)]
Fix #83045 by moving some crate loading verification code to a better place.

3 years agoUpdate char::escape_debug_ext to handle different escapes in strings vs. chars
Ömer Sinan Ağacan [Fri, 26 Mar 2021 08:23:51 +0000 (11:23 +0300)]
Update char::escape_debug_ext to handle different escapes in strings vs. chars

Fixes #83046

The program

    fn main() {
        println!("{:?}", '"');
        println!("{:?}", "'");
    }

would previously print

    '\"'
    "\'"

With this patch it now prints:

    '"'
    "'"

3 years agoAuto merge of #83480 - flip1995:clippyup, r=Dylan-DPC
bors [Fri, 26 Mar 2021 06:30:16 +0000 (06:30 +0000)]
Auto merge of #83480 - flip1995:clippyup, r=Dylan-DPC

Update Clippy

Bi-weekly Clippy update.

r? `@Manishearth`

3 years agoUse the direct link to the platform support page
JohnTitor [Fri, 26 Mar 2021 05:32:19 +0000 (14:32 +0900)]
Use the direct link to the platform support page

3 years agoAuto merge of #83503 - Dylan-DPC:rollup-mqvjfav, r=Dylan-DPC
bors [Fri, 26 Mar 2021 04:10:13 +0000 (04:10 +0000)]
Auto merge of #83503 - Dylan-DPC:rollup-mqvjfav, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #83055 ([rustdoc] Don't document stripped items in JSON renderer.)
 - #83437 (Refactor #82270 as lint instead of an error)
 - #83444 (Fix bootstrap tests on beta)
 - #83456 (Add docs for Vec::from functions)
 - #83463 (ExitStatusExt: Fix missing word in two docs messages)
 - #83470 (Fix patch note about #80653 not mentioning nested nor recursive)
 - #83485 (Mark asm tests as requiring LLVM 10.0.1)
 - #83486 (Don't ICE when using `#[global_alloc]` on a non-item statement)

Failed merges:

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

3 years agoRollup merge of #83486 - Aaron1011:fix/global-alloc-error, r=petrochenkov
Dylan DPC [Fri, 26 Mar 2021 01:34:45 +0000 (02:34 +0100)]
Rollup merge of #83486 - Aaron1011:fix/global-alloc-error, r=petrochenkov

Don't ICE when using `#[global_alloc]` on a non-item statement

Fixes #83469

We need to return an `Annotatable::Stmt` if we were passed an
`Annotatable::Stmt`

3 years agoRollup merge of #83485 - Amanieu:asm_llvm10, r=joshtriplett
Dylan DPC [Fri, 26 Mar 2021 01:34:44 +0000 (02:34 +0100)]
Rollup merge of #83485 - Amanieu:asm_llvm10, r=joshtriplett

Mark asm tests as requiring LLVM 10.0.1

3 years agoRollup merge of #83470 - danielhenrymantilla:patch-1, r=jyn514
Dylan DPC [Fri, 26 Mar 2021 01:34:43 +0000 (02:34 +0100)]
Rollup merge of #83470 - danielhenrymantilla:patch-1, r=jyn514

Fix patch note about #80653 not mentioning nested nor recursive

Which thus missed the point of the change: `rustdoc` already bundled documentation for methods accessible through one layer of `Deref`, it has now been enhanced to keep recursing 🙂

r? ``@jyn514``

3 years agoRollup merge of #83463 - ijackson:exitstatusext-doc-grammar, r=kennytm
Dylan DPC [Fri, 26 Mar 2021 01:34:42 +0000 (02:34 +0100)]
Rollup merge of #83463 - ijackson:exitstatusext-doc-grammar, r=kennytm

ExitStatusExt: Fix missing word in two docs messages

Looks like I missed the lack of these "and"s.

3 years agoRollup merge of #83456 - notriddle:vec-from-docs, r=JohnTitor
Dylan DPC [Fri, 26 Mar 2021 01:34:41 +0000 (02:34 +0100)]
Rollup merge of #83456 - notriddle:vec-from-docs, r=JohnTitor

Add docs for Vec::from functions

Part of #51430

3 years agoRollup merge of #83444 - Mark-Simulacrum:bootstrap-beta, r=pietroalbini
Dylan DPC [Fri, 26 Mar 2021 01:34:40 +0000 (02:34 +0100)]
Rollup merge of #83444 - Mark-Simulacrum:bootstrap-beta, r=pietroalbini

Fix bootstrap tests on beta

Forward-porting a fix from the beta branch, which led to test failure on beta.

r? ``@pietroalbini``

3 years agoRollup merge of #83437 - Amanieu:asm_syntax, r=petrochenkov
Dylan DPC [Fri, 26 Mar 2021 01:34:39 +0000 (02:34 +0100)]
Rollup merge of #83437 - Amanieu:asm_syntax, r=petrochenkov

Refactor #82270 as lint instead of an error

This PR fixes several issues with #82270 which generated an error when `.intel_syntax` or `.att_syntax` was used in inline assembly:
- It is now a warn-by-default lint instead of an error.
- The lint only triggers on x86. `.intel_syntax` and `.att_syntax` are only valid on x86.
- The lint no longer provides machine-applicable suggestions for two reasons:
- These changes should not be made automatically since changes to assembly code can be very subtle.
- The template string is not always just a string: it can contain macro invocation (`concat!`), raw strings, escape characters, etc.

cc ``@asquared31415``

3 years agoRollup merge of #83055 - aDotInTheVoid:selective-strip-item-doc, r=jyn514
Dylan DPC [Fri, 26 Mar 2021 01:34:38 +0000 (02:34 +0100)]
Rollup merge of #83055 - aDotInTheVoid:selective-strip-item-doc, r=jyn514

[rustdoc] Don't document stripped items in JSON renderer.

Fixes #80664, see [my comment there](https://github.com/rust-lang/rust/issues/80664#issuecomment-797557948) for why

Note that we already do something similar in `convert_item`:

https://github.com/rust-lang/rust/blob/bb4cdf8ec034dca5c056ec9295f38062e5b7e871/src/librustdoc/json/conversions.rs#L28-L31

``@rustbot`` modify labels: +T-rustdoc +A-rustdoc-json

r? ``@jyn514``
cc ``@CraftSpider``

3 years agoAuto merge of #83465 - michaelwoerister:safe-read_raw_bytes, r=cjgillot
bors [Fri, 26 Mar 2021 01:28:59 +0000 (01:28 +0000)]
Auto merge of #83465 - michaelwoerister:safe-read_raw_bytes, r=cjgillot

Allow for reading raw bytes from rustc_serialize::Decoder without unsafe code

The current `read_raw_bytes` method requires using `MaybeUninit` and `unsafe`. I don't think this is necessary. Let's see if a safe interface has any performance drawbacks.

This is a followup to #83273 and will make it easier to rebase #82183.

r? `@cjgillot`

3 years agoAuto merge of #82873 - GuillaumeGomez:rustdoc-const-ty, r=jyn514
bors [Thu, 25 Mar 2021 22:09:27 +0000 (22:09 +0000)]
Auto merge of #82873 - GuillaumeGomez:rustdoc-const-ty, r=jyn514

Rework rustdoc const type

This PR is mostly about two things:
 1. Not storing some information in the `clean::Constant` type
 2. Using `TyCtxt` in the formatting (which we will need in any case as we move forward in any case).

Also: I'm very curious of the perf change in here.

Thanks a lot `@danielhenrymantilla` for your `Captures` idea! It allowed me to solve the lifetime issue completely. :)

r? `@jyn514`

3 years agoAvoid double-collection for expression nonterminals
Aaron Hill [Thu, 25 Mar 2021 22:05:49 +0000 (18:05 -0400)]
Avoid double-collection for expression nonterminals

3 years agoBan custom inner attributes in expressions and statements
Aaron Hill [Mon, 1 Mar 2021 21:02:09 +0000 (16:02 -0500)]
Ban custom inner attributes in expressions and statements

3 years agoMark inline asm tests as requiring LLVM 10.0.1
Amanieu d'Antras [Thu, 25 Mar 2021 20:21:58 +0000 (20:21 +0000)]
Mark inline asm tests as requiring LLVM 10.0.1

3 years agoDon't ICE when using `#[global_alloc]` on a non-item statement
Aaron Hill [Thu, 25 Mar 2021 19:40:50 +0000 (15:40 -0400)]
Don't ICE when using `#[global_alloc]` on a non-item statement

Fixes #83469

We need to return an `Annotatable::Stmt` if we were passed an
`Annotatable::Stmt`

3 years agoAuto merge of #82743 - jackh726:resolve-refactor, r=nikomatsakis
bors [Thu, 25 Mar 2021 19:28:16 +0000 (19:28 +0000)]
Auto merge of #82743 - jackh726:resolve-refactor, r=nikomatsakis

Refactor rustc_resolve::late::lifetimes to resolve per-item

There are some changes to tests that I'd like some feedback on; so this is still WIP.

The reason behind this change will (hopefully) allow us to (as part of #76814) be able to essentially use the lifetime resolve code to resolve *all* late bound vars (including those of super traits). Currently, it only resolves those that are *syntactically* in scope. In #76814, I'm essentially finding that I would essentially have to redo the passing of bound vars through scopes (i.e. when instantiating a poly trait ref), and that's what this code does anyways. However, to be able to do this (ask super traits what bound vars are in scope), we have to be able to resolve items separately.

The first commit is actually partially orthogonal. Essentially removing one use of late bound debruijn indices.

Not exactly sure who would be best to review here.
Let r? `@nikomatsakis`

3 years agoUpdate Cargo.lock
flip1995 [Thu, 25 Mar 2021 18:29:39 +0000 (19:29 +0100)]
Update Cargo.lock

3 years agoMerge commit '0e87918536b9833bbc6c683d1f9d51ee2bf03ef1' into clippyup
flip1995 [Thu, 25 Mar 2021 18:29:11 +0000 (19:29 +0100)]
Merge commit '0e87918536b9833bbc6c683d1f9d51ee2bf03ef1' into clippyup

3 years agoBless nll test
Jack Huey [Thu, 25 Mar 2021 18:11:03 +0000 (14:11 -0400)]
Bless nll test

3 years agoAuto merge of #6971 - flip1995:rustup, r=flip1995
bors [Thu, 25 Mar 2021 17:49:06 +0000 (17:49 +0000)]
Auto merge of #6971 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoBump Clippy Version -> 0.1.53
flip1995 [Thu, 25 Mar 2021 17:48:48 +0000 (18:48 +0100)]
Bump Clippy Version -> 0.1.53

3 years agoBump nightly version -> 2021-03-25
flip1995 [Thu, 25 Mar 2021 17:38:52 +0000 (18:38 +0100)]
Bump nightly version -> 2021-03-25

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 25 Mar 2021 17:38:13 +0000 (18:38 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoAuto merge of #83424 - cjgillot:noparam, r=lcnr
bors [Thu, 25 Mar 2021 16:35:19 +0000 (16:35 +0000)]
Auto merge of #83424 - cjgillot:noparam, r=lcnr

GenericParam does not need to be a HIR owner.

The special case is not required.

Universal impl traits design to regular generic parameters, and their content is owned by the enclosing item.

Existential (and opaque) impl traits generate their own enclosing item, and are collected through it.

3 years agoFix patch note about #80653 not mentioning nested nor recursive
Daniel Henry-Mantilla [Thu, 25 Mar 2021 14:00:03 +0000 (15:00 +0100)]
Fix patch note about #80653 not mentioning nested nor recursive

Which thus missed the point of the change: `rustdoc` already bundled documentation for methods accessible through one layer of `Deref`, it now has been enhanced to keep recursing 🙂

3 years agowrite-up what is happening
Niko Matsakis [Thu, 25 Mar 2021 13:22:15 +0000 (09:22 -0400)]
write-up what is happening

3 years agoRefactor #82270 as lint instead of an error
Amanieu d'Antras [Wed, 24 Mar 2021 04:52:57 +0000 (04:52 +0000)]
Refactor #82270 as lint instead of an error

3 years agoAuto merge of #83387 - cuviper:min-llvm-10, r=nagisa
bors [Thu, 25 Mar 2021 13:11:18 +0000 (13:11 +0000)]
Auto merge of #83387 - cuviper:min-llvm-10, r=nagisa

Update the minimum external LLVM to 10

r? `@nikic`

3 years agoAllow for reading raw bytes from rustc_serialize::Decoder without unsafe code.
Michael Woerister [Thu, 25 Mar 2021 10:43:03 +0000 (11:43 +0100)]
Allow for reading raw bytes from rustc_serialize::Decoder without unsafe code.

3 years agoExitStatusExt: Fix missing word in two docs messages
Ian Jackson [Thu, 25 Mar 2021 10:48:27 +0000 (10:48 +0000)]
ExitStatusExt: Fix missing word in two docs messages

Looks like I missed the lack of these "and"s.

Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoAuto merge of #82565 - m-ou-se:ununstabilize-bits, r=kennytm
bors [Thu, 25 Mar 2021 10:29:58 +0000 (10:29 +0000)]
Auto merge of #82565 - m-ou-se:ununstabilize-bits, r=kennytm

Revert reverting of stabilizing integer::BITS.

Now that `lexical-core` has an updated version that won't break with this stabilization, let's try to stabilize this again.

See https://github.com/rust-lang/rust/issues/81654#issuecomment-778564715

Tracking issue with FCP: https://github.com/rust-lang/rust/issues/76904

3 years agoChange wording
Michael Howell [Thu, 25 Mar 2021 09:58:34 +0000 (02:58 -0700)]
Change wording

3 years agoAuto merge of #83445 - erikdesjardins:rmunion, r=RalfJung
bors [Thu, 25 Mar 2021 07:48:52 +0000 (07:48 +0000)]
Auto merge of #83445 - erikdesjardins:rmunion, r=RalfJung

RemoveZsts: don't touch unions

This should fix a Miri ICE

r? `@RalfJung`

3 years agoAuto merge of #83307 - richkadel:cov-unused-functions-1.1, r=tmandry
bors [Thu, 25 Mar 2021 05:07:34 +0000 (05:07 +0000)]
Auto merge of #83307 - richkadel:cov-unused-functions-1.1, r=tmandry

coverage bug fixes and optimization support

Adjusted LLVM codegen for code compiled with `-Zinstrument-coverage` to
address multiple, somewhat related issues.

Fixed a significant flaw in prior coverage solution: Every counter
generated a new counter variable, but there should have only been one
counter variable per function. This appears to have bloated .profraw
files significantly. (For a small program, it increased the size by
about 40%. I have not tested large programs, but there is anecdotal
evidence that profraw files were way too large. This is a good fix,
regardless, but hopefully it also addresses related issues.

Fixes: #82144
Invalid LLVM coverage data produced when compiled with -C opt-level=1

Existing tests now work up to at least `opt-level=3`. This required a
detailed analysis of the LLVM IR, comparisons with Clang C++ LLVM IR
when compiled with coverage, and a lot of trial and error with codegen
adjustments.

The biggest hurdle was figuring out how to continue to support coverage
results for unused functions and generics. Rust's coverage results have
three advantages over Clang's coverage results:

1. Rust's coverage map does not include any overlapping code regions,
   making coverage counting unambiguous.
2. Rust generates coverage results (showing zero counts) for all unused
   functions, including generics. (Clang does not generate coverage for
   uninstantiated template functions.)
3. Rust's unused functions produce minimal stubbed functions in LLVM IR,
   sufficient for including in the coverage results; while Clang must
   generate the complete LLVM IR for each unused function, even though
   it will never be called.

This PR removes the previous hack of attempting to inject coverage into
some other existing function instance, and generates dedicated instances
for each unused function. This change, and a few other adjustments
(similar to what is required for `-C link-dead-code`, but with lower
impact), makes it possible to support LLVM optimizations.

Fixes: #79651
Coverage report: "Unexecuted instantiation:..." for a generic function
from multiple crates

Fixed by removing the aforementioned hack. Some "Unexecuted
instantiation" notices are unavoidable, as explained in the
`used_crate.rs` test, but `-Zinstrument-coverage` has new options to
back off support for either unused generics, or all unused functions,
which avoids the notice, at the cost of less coverage of unused
functions.

Fixes: #82875
Invalid LLVM coverage data produced with crate brotli_decompressor

Fixed by disabling the LLVM function attribute that forces inlining, if
`-Z instrument-coverage` is enabled. This attribute is applied to
Rust functions with `#[inline(always)], and in some cases, the forced
inlining breaks coverage instrumentation and reports.

FYI: `@wesleywiser`

r? `@tmandry`

3 years agoAuto merge of #6959 - ebobrow:iss-6927-fix, r=camsteffen
bors [Thu, 25 Mar 2021 03:01:35 +0000 (03:01 +0000)]
Auto merge of #6959 - ebobrow:iss-6927-fix, r=camsteffen

Check for `.to_string().into_bytes()` in string_lit_to_bytes

fixes #6927

changelog: Add a check for `into_bytes()` to string_lit_to_bytes lint

3 years agoAuto merge of #83454 - JohnTitor:rollup-9ae0565, r=JohnTitor
bors [Thu, 25 Mar 2021 02:26:19 +0000 (02:26 +0000)]
Auto merge of #83454 - JohnTitor:rollup-9ae0565, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #83041 (stabilize debug_non_exhaustive)
 - #83349 (Remove Option::{unwrap_none, expect_none}.)
 - #83420 (Add documentation for rustdoc-gui tests)
 - #83421 (Add Result::into_err where the Ok variant is the never type)
 - #83427 (small cleanups in rustc_errors / emitter)
 - #83434 (Update RELEASES.md)
 - #83440 (Use intra-doc link in core::cell)
 - #83442 (LLVMWrapper: attractive nuisance macros)

Failed merges:

 - #83438 (Update RELEASES.md)

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

3 years agoAdd docs for Vec::from functions
Michael Howell [Thu, 25 Mar 2021 01:43:18 +0000 (18:43 -0700)]
Add docs for Vec::from functions

Part of #51430

3 years agocheck for `.to_string().into_bytes()` in string_lit_to_bytes
Elliot Bobrow [Wed, 24 Mar 2021 00:10:27 +0000 (17:10 -0700)]
check for `.to_string().into_bytes()` in string_lit_to_bytes

apply changes from review

3 years agoRollup merge of #83442 - durin42:remove-questionable-macros, r=cuviper
Yuki Okushi [Thu, 25 Mar 2021 00:07:32 +0000 (09:07 +0900)]
Rollup merge of #83442 - durin42:remove-questionable-macros, r=cuviper

LLVMWrapper: attractive nuisance macros

This came up in the review of #83425: it's hard to imagine a use of
LLVM_VERSION_LE() or LLVM_VERSION_EQ() that's not asking for trouble
when a point release gets created, so let's just discard them to prevent
the issue.

3 years agoRollup merge of #83440 - fee1-dead:core-cell-intralink, r=jyn514
Yuki Okushi [Thu, 25 Mar 2021 00:07:31 +0000 (09:07 +0900)]
Rollup merge of #83440 - fee1-dead:core-cell-intralink, r=jyn514

Use intra-doc link in core::cell

``@rustbot`` label T-doc A-intra-doc-links

r? ``@jyn514``

3 years agoRollup merge of #83434 - wesleywiser:update_releases, r=Mark-Simulacrum
Yuki Okushi [Thu, 25 Mar 2021 00:07:30 +0000 (09:07 +0900)]
Rollup merge of #83434 - wesleywiser:update_releases, r=Mark-Simulacrum

Update RELEASES.md

This change was backed out in #83412 so we should remove the reference
to it from the release notes.

3 years agoRollup merge of #83427 - llogiq:refactor-emitter, r=estebank
Yuki Okushi [Thu, 25 Mar 2021 00:07:29 +0000 (09:07 +0900)]
Rollup merge of #83427 - llogiq:refactor-emitter, r=estebank

small cleanups in rustc_errors / emitter

This is either moving code around so it gets called less often or using if let instead of match in a few cases.

3 years agoRollup merge of #83421 - faern:add-into-err, r=joshtriplett
Yuki Okushi [Thu, 25 Mar 2021 00:07:28 +0000 (09:07 +0900)]
Rollup merge of #83421 - faern:add-into-err, r=joshtriplett

Add Result::into_err where the Ok variant is the never type

Equivalent of #66045 but for the inverse situation where `T: Into<!>` rather than `E: Into<!>`.

I'm using the same feature gate name. I can't see why one of these methods would be OK to stabilize but not the other.

Tracking issue: #61695

3 years agoRollup merge of #83420 - GuillaumeGomez:rustdoc-gui-tests-doc, r=CraftSpider
Yuki Okushi [Thu, 25 Mar 2021 00:07:27 +0000 (09:07 +0900)]
Rollup merge of #83420 - GuillaumeGomez:rustdoc-gui-tests-doc, r=CraftSpider

Add documentation for rustdoc-gui tests

I think a bit of documentation doesn't hurt in this case considering how "out of the ordinary" this is.

r? ``@jyn514``

3 years agoRollup merge of #83349 - m-ou-se:unwrap-none, r=dtolnay
Yuki Okushi [Thu, 25 Mar 2021 00:07:26 +0000 (09:07 +0900)]
Rollup merge of #83349 - m-ou-se:unwrap-none, r=dtolnay

Remove Option::{unwrap_none, expect_none}.

This removes `Option::unwrap_none` and `Option::expect_none` since we're not going to stabilize them, see https://github.com/rust-lang/rust/issues/62633.

Closes #62633

3 years agoRollup merge of #83041 - guswynn:stable_debug_struct, r=m-ou-se
Yuki Okushi [Thu, 25 Mar 2021 00:07:24 +0000 (09:07 +0900)]
Rollup merge of #83041 - guswynn:stable_debug_struct, r=m-ou-se

stabilize debug_non_exhaustive

tracking issue: https://github.com/rust-lang/rust/issues/67364

but it is still an open question whether the other `Debug*` struct's should have a similar method. I would guess that would best be put underneath a new feature gate, as this one seems uncontroversial enough to stabilize as is

3 years agoBump debug_non_exhaustive stabilization to 1.53.
Mara Bos [Wed, 24 Mar 2021 21:54:04 +0000 (22:54 +0100)]
Bump debug_non_exhaustive stabilization to 1.53.

3 years agoBump int_bits_const stable version to 1.53.
Mara Bos [Fri, 26 Feb 2021 21:39:32 +0000 (22:39 +0100)]
Bump int_bits_const stable version to 1.53.

3 years agoRevert "Revert stabilizing integer::BITS."
Mara Bos [Fri, 26 Feb 2021 21:38:24 +0000 (22:38 +0100)]
Revert "Revert stabilizing integer::BITS."

3 years agoAuto merge of #6952 - Jarcho:new_ret_no_self_fp, r=Manishearth
bors [Wed, 24 Mar 2021 21:09:01 +0000 (21:09 +0000)]
Auto merge of #6952 - Jarcho:new_ret_no_self_fp, r=Manishearth

Fix `new_ret_no_self` false positive

fixes: #1724

changelog: Fix false positive with `new_ret_no_self` when returning `Self` with different generic arguments

3 years agoSplit clean::Constant enum into a struct and an enum
Guillaume Gomez [Wed, 10 Mar 2021 20:03:51 +0000 (21:03 +0100)]
Split clean::Constant enum into a struct and an enum

3 years agoAuto merge of #83220 - Aaron1011:fix/eval-region-cache, r=nikomatsakis
bors [Wed, 24 Mar 2021 20:51:37 +0000 (20:51 +0000)]
Auto merge of #83220 - Aaron1011:fix/eval-region-cache, r=nikomatsakis

Use `EvaluatedToOkModuloRegions` whenever we erase regions

Fixes #80691

When we evaluate a trait predicate, we convert an
`EvaluatedToOk` result to `EvaluatedToOkModuloRegions` if we erased any
regions. We cache the result under a region-erased 'freshened'
predicate, so `EvaluatedToOk` may not be correct for other predicates
that have the same cache key.

3 years agoRename clean::Constant did fields to def_id
Guillaume Gomez [Wed, 10 Mar 2021 16:31:51 +0000 (17:31 +0100)]
Rename clean::Constant did fields to def_id

3 years agoImprove new Constant variants' name
Guillaume Gomez [Mon, 8 Mar 2021 16:44:54 +0000 (17:44 +0100)]
Improve new Constant variants' name

3 years agoStore tcx and cache when they are used multiple times instead of calling functions...
Guillaume Gomez [Sun, 7 Mar 2021 22:11:12 +0000 (23:11 +0100)]
Store tcx and cache when they are used multiple times instead of calling functions every time

3 years agoRework rustdoc const type
Guillaume Gomez [Sun, 7 Mar 2021 17:09:35 +0000 (18:09 +0100)]
Rework rustdoc const type

3 years agoReview comments
Jack Huey [Fri, 12 Mar 2021 17:38:42 +0000 (12:38 -0500)]
Review comments

3 years agoresolve late lifetimes by item
Jack Huey [Sun, 28 Feb 2021 02:31:56 +0000 (21:31 -0500)]
resolve late lifetimes by item

This reverts commit 22ae20733515d710c1134600bc1e29cdd76f6b9b.

3 years agoRename `contains_adt` to `contains_adt_constructor`
Jason Newcomb [Wed, 24 Mar 2021 20:19:27 +0000 (16:19 -0400)]
Rename `contains_adt` to `contains_adt_constructor`

3 years agoFix false positive with `new_ret_no_self` when returning `Self` with different generi...
Jason Newcomb [Tue, 23 Mar 2021 01:38:14 +0000 (21:38 -0400)]
Fix false positive with `new_ret_no_self` when returning `Self` with different generic arguments

3 years agoUse `EvaluatedToOkModuloRegions` whenever we erase regions
Aaron Hill [Tue, 16 Mar 2021 23:28:27 +0000 (19:28 -0400)]
Use `EvaluatedToOkModuloRegions` whenever we erase regions

Fixes #80691

When we evaluate a trait predicate, we convert an
`EvaluatedToOk` result to `EvaluatedToOkModuloRegions` if we erased any
regions. We cache the result under a region-erased 'freshened'
predicate, so `EvaluatedToOk` may not be correct for other predicates
that have the same cache key.

3 years agoRename `span` to `source`
Nixon Enraght-Moony [Wed, 24 Mar 2021 19:44:23 +0000 (19:44 +0000)]
Rename `span` to `source`

Caused by
https://github.com/rust-lang/rust/commit/b0659f9b1bfb92626c40dabceb3268f88bb26224#diff-ede26372490522288745c5b3df2b6b2a1cc913dcd09b29af3a49935afe00c7e6L464-R464

3 years agoAuto merge of #6962 - TaKO8Ki:fix-false-positive-in-manual-flatten, r=llogiq
bors [Wed, 24 Mar 2021 18:42:20 +0000 (18:42 +0000)]
Auto merge of #6962 - TaKO8Ki:fix-false-positive-in-manual-flatten, r=llogiq

Fix false positive in `manual_flatten`

This pull request fixes false positive in `manual_flatten` in case using a slice of references .

closes: #6893

changelog: fix false positive in `manual_flatten`

3 years agoLLVMWrapper: attractive nuisance macros
Augie Fackler [Wed, 24 Mar 2021 14:25:03 +0000 (10:25 -0400)]
LLVMWrapper: attractive nuisance macros

THis came up in the review of #83425: it's hard to imagine a use of
LLVM_VERSION_LE() or LLVM_VERSION_EQ() that's not asking for trouble
when a point release gets created, so let's just discard them to prevent
the issue.

3 years agoRemoveZsts: don't touch unions
Erik Desjardins [Wed, 24 Mar 2021 17:00:36 +0000 (13:00 -0400)]
RemoveZsts: don't touch unions

3 years agoDon't call `item` on modules for json renderer
Nixon Enraght-Moony [Wed, 24 Mar 2021 15:54:20 +0000 (15:54 +0000)]
Don't call `item` on modules for json renderer

Closes #80664

3 years agoBetter errors in jsondocck
Nixon Enraght-Moony [Wed, 24 Mar 2021 15:52:47 +0000 (15:52 +0000)]
Better errors in jsondocck

3 years agoFix bootstrap tests on beta
Mark Rousskov [Wed, 24 Mar 2021 16:03:59 +0000 (12:03 -0400)]
Fix bootstrap tests on beta

3 years agomerge imports
Takayuki Maeda [Wed, 24 Mar 2021 15:17:43 +0000 (00:17 +0900)]
merge imports

3 years agofix false positive in manual_flatten
Takayuki Maeda [Wed, 24 Mar 2021 15:15:15 +0000 (00:15 +0900)]
fix false positive in manual_flatten

3 years agoAuto merge of #83364 - sexxi-goose:fix-83176, r=nikomatsakis
bors [Wed, 24 Mar 2021 14:45:16 +0000 (14:45 +0000)]
Auto merge of #83364 - sexxi-goose:fix-83176, r=nikomatsakis

2229 migration: Don't try resolve regions before writeback

In the analysis use `resolve_vars_if_possible` instead of `fully_resolve`,
because we might not have performed regionck yet.

Fixes: #83176
r? `@nikomatsakis`

3 years agoUse intra-doc link in core::cell
Deadbeef [Wed, 24 Mar 2021 13:42:49 +0000 (21:42 +0800)]
Use intra-doc link in core::cell

3 years agoAuto merge of #83050 - osa1:issue83048, r=matthewjasper
bors [Wed, 24 Mar 2021 12:02:13 +0000 (12:02 +0000)]
Auto merge of #83050 - osa1:issue83048, r=matthewjasper

Run analyses before thir-tree dumps

Fixes #83048

3 years agoAuto merge of #83408 - ijackson:expose-splitinclusive, r=dtolnay
bors [Wed, 24 Mar 2021 09:21:06 +0000 (09:21 +0000)]
Auto merge of #83408 - ijackson:expose-splitinclusive, r=dtolnay

Expose str::SplitInclusive in alloc and therefore in std

This seems to have been omitted from the beginning when this feature was first introduced in 86bf96291d82.  Most users won't need to name this type which is probably why this wasn't noticed in the meantime.

See #83372 for a different but related bug.

### Notes for reviewers

I think I have got this right but TBH I am not very familiar with the relationship between core and std and so on.  <strike>I also haven't don't any kind of test (not even a build) yet.  I will do a local docs build to see that the type now appears in the std docs.</strike>  I did a local docs build and it has made this type appear as `std::str::SplitInclusive` as expected

The linkification of the return value from `str::split_inclusive` teleports me to the online url for `core::str::SplitInclusive`.  I think this may be a rustdoc anomaly (similar to #79630 maybe) but I am not sure.  Perhaps it means I haven't done the `std` -> `core` referrence correctly.

I made this insta-stable since it seems like simply a bug.  Please LMK if that is not right.  *(edited to add:)* In particular, IDK how this ought to relate to the (?)current release process.

3 years agoAuto merge of #75384 - JulianKnodt:cg_def, r=varkor,lcnr
bors [Wed, 24 Mar 2021 04:13:27 +0000 (04:13 +0000)]
Auto merge of #75384 - JulianKnodt:cg_def, r=varkor,lcnr

implement `feature(const_generics_defaults)`

Implements const generics defaults `struct Example<const N: usize=3>`, as well as a query for getting the default of a given const-parameter's def id. There are some remaining FIXME's but they were specified as not blocking for merging this PR. This also puts the defaults behind the unstable feature gate `#![feature(const_generics_defaults)]`.

~~This currently creates a field which is always false on `GenericParamDefKind` for future use when
consts are permitted to have defaults. I'm not sure if this is exactly what is best for adding default parameters, but I mimicked the style of type defaults, so hopefully this is ok.~~

r? `@lcnr`

3 years agoBump alloc::str::SplitInclusive to 1.53.0 release
David Tolnay [Wed, 24 Mar 2021 03:26:19 +0000 (20:26 -0700)]
Bump alloc::str::SplitInclusive to 1.53.0 release