]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoMove const def nearer usage.
Giles Cope [Sun, 14 Feb 2021 18:23:30 +0000 (18:23 +0000)]
Move const def nearer usage.

3 years agoSlightly more explicit
Giles Cope [Fri, 12 Feb 2021 13:42:42 +0000 (13:42 +0000)]
Slightly more explicit

3 years agoUnify way to flip 6th bit. (Same assembly generated)
Giles Cope [Mon, 8 Feb 2021 12:21:36 +0000 (12:21 +0000)]
Unify way to flip 6th bit. (Same assembly generated)

3 years agoPulling out constant.
Giles Cope [Sat, 6 Feb 2021 20:35:21 +0000 (20:35 +0000)]
Pulling out constant.

3 years agoSlight perf improvement on char::to_ascii_lowercase
Giles Cope [Sat, 6 Feb 2021 19:14:13 +0000 (19:14 +0000)]
Slight perf improvement on char::to_ascii_lowercase

3 years agoAuto merge of #81250 - sivadeilra:remove_xp_compat, r=joshtriplett,m-ou-se
bors [Sun, 24 Jan 2021 12:34:08 +0000 (12:34 +0000)]
Auto merge of #81250 - sivadeilra:remove_xp_compat, r=joshtriplett,m-ou-se

Remove delay-binding for Win XP and Vista

The minimum supported Windows version is now Windows 7. Windows XP
and Windows Vista are no longer supported; both are already broken, and
require extra steps to use.

This commit removes the delayed-binding support for Windows API
functions that are present on all supported Windows targets. This has
several benefits: Removes needless complexity. Removes a load and
dynamic call on hot paths in mutex acquire / release. This may have
performance benefits.

* "Drop official support for Windows XP"
  https://github.com/rust-lang/compiler-team/issues/378

* "Firefox has ended support for Windows XP and Vista"
  https://support.mozilla.org/en-US/kb/end-support-windows-xp-and-vista

3 years agoAuto merge of #80838 - nagisa:nagisa/stack-probe-type, r=cuviper
bors [Sun, 24 Jan 2021 09:44:42 +0000 (09:44 +0000)]
Auto merge of #80838 - nagisa:nagisa/stack-probe-type, r=cuviper

Target stack-probe support configurable finely

This adds capability to configure the target's stack probe support in a
more precise manner than just on/off. In particular now we allow
choosing between always inline-asm, always call or either one of those
depending on the LLVM version.

Note that this removes the ability to turn off the generation of the
stack-probe attribute. This is valid to replace it with inline-asm for all targets because
`probe-stack="inline-asm"` will not generate any machine code on targets
that do not currently support stack probes. This makes support for stack
probes on targets that don't have any right now automatic with LLVM
upgrades in the future.

(This is valid to do based on the fact that clang unconditionally sets
this attribute when `-fstack-clash-protection` is used, AFAICT)

cc #77885
r? `@cuviper`

3 years agoAuto merge of #80919 - cjgillot:defkey-span, r=oli-obk
bors [Sun, 24 Jan 2021 06:51:17 +0000 (06:51 +0000)]
Auto merge of #80919 - cjgillot:defkey-span, r=oli-obk

Generate metadata by iterating on DefId instead of traversing the HIR tree 1/N

Sample from #80347.

3 years agoAuto merge of #80594 - bjorn3:abi_refactor3, r=petrochenkov
bors [Sun, 24 Jan 2021 02:59:14 +0000 (02:59 +0000)]
Auto merge of #80594 - bjorn3:abi_refactor3, r=petrochenkov

Various ABI refactorings

This includes changes to the rust abi and various refactorings that will hopefully make it easier to use the abi handling infrastructure of rustc in cg_clif. There are several refactorings that I haven't done. I am opening this draft PR to check that I haven't broken any non x86_64 architectures.

r? `@ghost`

3 years agoAuto merge of #79811 - Aaron1011:expn-data-disambig, r=petrochenkov
bors [Sun, 24 Jan 2021 00:10:20 +0000 (00:10 +0000)]
Auto merge of #79811 - Aaron1011:expn-data-disambig, r=petrochenkov

Add disambiugator to ExpnData

I still need to write a bunch of comments. Opening to see how bad the perf impact is.

cc https://github.com/rust-lang/rust/issues/79560

3 years agoAuto merge of #81304 - jonas-schievink:rollup-d9kuugm, r=jonas-schievink
bors [Sat, 23 Jan 2021 21:13:14 +0000 (21:13 +0000)]
Auto merge of #81304 - jonas-schievink:rollup-d9kuugm, r=jonas-schievink

Rollup of 15 pull requests

Successful merges:

 - #79841 (More clear documentation for NonNull<T>)
 - #81072 (PlaceRef::ty: use method call syntax)
 - #81130 (Edit rustc_middle::dep_graph module documentation)
 - #81170 (Avoid hash_slice in VecDeque's Hash implementation)
 - #81243 (mir: Improve size_of handling when arg is unsized)
 - #81245 (Update cargo)
 - #81249 (Lower closure prototype after its body.)
 - #81252 (Add more self-profile info to rustc_resolve)
 - #81275 (Fix <unknown> queries and add more timing info to render_html)
 - #81281 (Inline methods of Path and OsString)
 - #81283 (Note library tracking issue template in tracking issue template.)
 - #81285 (Remove special casing of rustdoc in rustc_lint)
 - #81288 (rustdoc: Fix visibility of trait and impl items)
 - #81298 (replace RefCell with Cell in FnCtxt)
 - #81301 (Fix small typo)

Failed merges:

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

3 years agoAdd disambiugator to ExpnData
Aaron Hill [Mon, 7 Dec 2020 22:44:40 +0000 (17:44 -0500)]
Add disambiugator to ExpnData

Due to macro expansion, its possible to end up with two distinct
`ExpnId`s that have the same `ExpnData` contents. This violates the
contract of `HashStable`, since two unequal `ExpnId`s will end up with
equal `Fingerprint`s.

This commit adds a `disambiguator` field to `ExpnData`, which is used to
force two otherwise-equivalent `ExpnData`s to be distinct.

3 years agoRollup merge of #81301 - davidgu:patch-1, r=jonas-schievink
Jonas Schievink [Sat, 23 Jan 2021 19:16:19 +0000 (20:16 +0100)]
Rollup merge of #81301 - davidgu:patch-1, r=jonas-schievink

Fix small typo

Fractional part of `12.34e56` seems to be incorrectly stated as '45' and not '34'

3 years agoRollup merge of #81298 - lcnr:big-money-big-prices, r=oli-obk
Jonas Schievink [Sat, 23 Jan 2021 19:16:17 +0000 (20:16 +0100)]
Rollup merge of #81298 - lcnr:big-money-big-prices, r=oli-obk

replace RefCell with Cell in FnCtxt

small cleanup

3 years agoRollup merge of #81288 - camelid:fix-trait-item-vis, r=jyn514
Jonas Schievink [Sat, 23 Jan 2021 19:16:16 +0000 (20:16 +0100)]
Rollup merge of #81288 - camelid:fix-trait-item-vis, r=jyn514

rustdoc: Fix visibility of trait and impl items

Fixes #81274.

r? `@jyn514`

3 years agoRollup merge of #81283 - m-ou-se:tracking-issue-note, r=Mark-Simulacrum
Jonas Schievink [Sat, 23 Jan 2021 19:16:14 +0000 (20:16 +0100)]
Rollup merge of #81283 - m-ou-se:tracking-issue-note, r=Mark-Simulacrum

Note library tracking issue template in tracking issue template.

3 years agoRollup merge of #81281 - a1phyr:inline_path, r=dtolnay
Jonas Schievink [Sat, 23 Jan 2021 19:16:12 +0000 (20:16 +0100)]
Rollup merge of #81281 - a1phyr:inline_path, r=dtolnay

Inline methods of Path and OsString

These methods are not generic, and therefore aren't candidates for cross-crate inlining without an `#[inline]` attribute.

3 years agoRollup merge of #81275 - jyn514:time-render, r=wesleywiser
Jonas Schievink [Sat, 23 Jan 2021 19:16:10 +0000 (20:16 +0100)]
Rollup merge of #81275 - jyn514:time-render, r=wesleywiser

Fix <unknown> queries and add more timing info to render_html

Closes https://github.com/rust-lang/rust/issues/81251.

##  Fix `<unknown>` queries

This happened because `alloc_query_strings` was never called.

##  Add more timing info to render_html

This still has some issues I'm not sure how to work out:

- `create_renderer` and `renderer_after_krate` aren't shown by default.
  I want something like `verbose_generic_activity_with_arg`, but it doesn't exist.

I'm also not sure how to show activities that aren't on by default - I
tried `-Z self-profile -Z self-profile-args=all`, but it didn't show up.

r? `@wesleywiser`

3 years agoRollup merge of #81252 - jyn514:resolve-timing, r=petrochenkov
Jonas Schievink [Sat, 23 Jan 2021 19:16:09 +0000 (20:16 +0100)]
Rollup merge of #81252 - jyn514:resolve-timing, r=petrochenkov

Add more self-profile info to rustc_resolve

The idea is to help me find out where the time is being spent in compiling the docs for `windows-rs`: https://github.com/microsoft/windows-rs/issues/420#issuecomment-764991646

3 years agoRollup merge of #81249 - cjgillot:issue-79537, r=oli-obk
Jonas Schievink [Sat, 23 Jan 2021 19:16:07 +0000 (20:16 +0100)]
Rollup merge of #81249 - cjgillot:issue-79537, r=oli-obk

Lower closure prototype after its body.

Fixes #79537.

r? `@Mark-Simulacrum`

3 years agoRollup merge of #81245 - ehuss:update-cargo, r=ehuss
Jonas Schievink [Sat, 23 Jan 2021 19:16:05 +0000 (20:16 +0100)]
Rollup merge of #81245 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in a73e5b7d567c3036b296fc6b33ed52c5edcd882e..783bc43c660bf39c1e562c8c429b32078ad3099b
2021-01-12 23:45:39 +0000 to 2021-01-20 19:02:26 +0000
- Fix some issues with `cargo doc` and the new feature resolver. (rust-lang/cargo#9077)
- Implement support for rust-version field in project metadata (rust-lang/cargo#8037)
- Fix a bug in Cargo's cyclic dep graph detection (rust-lang/cargo#9075)
- Typo correction: artifcats -&gt; artifacts (rust-lang/cargo#9081)
- Remove stray backtick from doc (rust-lang/cargo#9079)

3 years agoRollup merge of #81243 - osa1:fix_80742_2, r=RalfJung
Jonas Schievink [Sat, 23 Jan 2021 19:16:04 +0000 (20:16 +0100)]
Rollup merge of #81243 - osa1:fix_80742_2, r=RalfJung

mir: Improve size_of handling when arg is unsized

As discussed on Zulip with `@RalfJung.`

3 years agoRollup merge of #81170 - xfix:vecdeque-bug-fix, r=sfackler
Jonas Schievink [Sat, 23 Jan 2021 19:16:02 +0000 (20:16 +0100)]
Rollup merge of #81170 - xfix:vecdeque-bug-fix, r=sfackler

Avoid hash_slice in VecDeque's Hash implementation

Fixes #80303.

3 years agoRollup merge of #81130 - pierwill:edit-depnode, r=jyn514
Jonas Schievink [Sat, 23 Jan 2021 19:16:00 +0000 (20:16 +0100)]
Rollup merge of #81130 - pierwill:edit-depnode, r=jyn514

Edit rustc_middle::dep_graph module documentation

This is similar to work approved and then closed in https://github.com/rust-lang/rust/pull/80325 due to a bad rebase.

3 years agoRollup merge of #81072 - RalfJung:place-ref-ty, r=oli-obk
Jonas Schievink [Sat, 23 Jan 2021 19:15:59 +0000 (20:15 +0100)]
Rollup merge of #81072 - RalfJung:place-ref-ty, r=oli-obk

PlaceRef::ty: use method call syntax

3 years agoRollup merge of #79841 - fintelia:patch-6, r=kennytm
Jonas Schievink [Sat, 23 Jan 2021 19:15:54 +0000 (20:15 +0100)]
Rollup merge of #79841 - fintelia:patch-6, r=kennytm

More clear documentation for NonNull<T>

Rephrase and hopefully clarify the discussion of covariance in `NonNull<T>` documentation.

I'm very much not an expert so someone should definitely double check the correctness of what I'm saying. At the same time, the new language makes more sense to me, so hopefully it also is more logical to others whose knowledge of covariance basically begins and ends with the [Rustonomicon chapter](https://doc.rust-lang.org/nomicon/subtyping.html).

Related to #48929.

3 years agoFix small typo
David [Sat, 23 Jan 2021 17:31:40 +0000 (12:31 -0500)]
Fix small typo

3 years agoFix review comments
bjorn3 [Sat, 23 Jan 2021 16:55:39 +0000 (17:55 +0100)]
Fix review comments

3 years agoCalculate self-profile strings in `Compiler::enter` instead in codegen
Joshua Nelson [Fri, 22 Jan 2021 18:46:52 +0000 (13:46 -0500)]
Calculate self-profile strings in `Compiler::enter` instead in codegen

This avoids each tool having to separately find and call
`self_profile_alloc_strings`.

- Don't compute the global context if it hasn't yet been computed

  This avoids giving extraneous errors about unresolved names if an error
  occurs during parsing.

3 years agoAdd more timing info to render_html
Joshua Nelson [Fri, 22 Jan 2021 15:38:30 +0000 (10:38 -0500)]
Add more timing info to render_html

- Show `create_renderer` and `renderer_after_crate` by default
- Don't rewrite `extra_verbose_generic_activity`

3 years agoAuto merge of #80579 - RalfJung:no-fallible-promotion, r=oli-obk
bors [Sat, 23 Jan 2021 13:19:04 +0000 (13:19 +0000)]
Auto merge of #80579 - RalfJung:no-fallible-promotion, r=oli-obk

avoid promoting division, modulo and indexing operations that could fail

For division, `x / y` will still be promoted if `y` is a non-zero integer literal; however, `1/(1+1)` will not be promoted any more.

While at it, also see if we can reject promoting floating-point arithmetic (which are [complicated](https://github.com/rust-lang/unsafe-code-guidelines/issues/237) so maybe we should not promote them).

This will need a crater run to see if there's code out there that relies on these things being promoted.

If we can land this, promoteds in `fn`/`const fn` cannot fail to evaluate any more, which should let us do some simplifications in codegen/Miri!

Cc https://github.com/rust-lang/rfcs/pull/3027
Fixes https://github.com/rust-lang/rust/issues/61821
r? `@oli-obk`

3 years agoAllow to query the HIR crate node.
Camille GILLOT [Mon, 18 Jan 2021 18:15:53 +0000 (19:15 +0100)]
Allow to query the HIR crate node.

3 years agoFix proc macro crate encoding.
Camille GILLOT [Sat, 16 Jan 2021 22:14:42 +0000 (23:14 +0100)]
Fix proc macro crate encoding.

3 years agoFilter stability.
Camille GILLOT [Sat, 16 Jan 2021 22:16:02 +0000 (23:16 +0100)]
Filter stability.

3 years agoIterate on deprecation.
Camille GILLOT [Sun, 6 Dec 2020 21:21:42 +0000 (22:21 +0100)]
Iterate on deprecation.

3 years agoIterate on const_stability.
Camille GILLOT [Sun, 6 Dec 2020 21:21:00 +0000 (22:21 +0100)]
Iterate on const_stability.

3 years agoIterate on stability.
Camille GILLOT [Sun, 6 Dec 2020 21:20:24 +0000 (22:20 +0100)]
Iterate on stability.

3 years agoIterate DefId to encode expn_that_defined.
Camille GILLOT [Sat, 28 Nov 2020 21:12:56 +0000 (22:12 +0100)]
Iterate DefId to encode expn_that_defined.

3 years agoIterate DefId to encode attributes.
Camille GILLOT [Sat, 28 Nov 2020 21:10:00 +0000 (22:10 +0100)]
Iterate DefId to encode attributes.

3 years agoIterate DefId to encode visibility.
Camille GILLOT [Sat, 28 Nov 2020 21:07:46 +0000 (22:07 +0100)]
Iterate DefId to encode visibility.

3 years agoIterate to encode def_kind.
Camille GILLOT [Sat, 16 Jan 2021 13:35:16 +0000 (14:35 +0100)]
Iterate to encode def_kind.

3 years agoIterate DefId to encode spans.
Camille GILLOT [Sat, 28 Nov 2020 21:07:00 +0000 (22:07 +0100)]
Iterate DefId to encode spans.

3 years agoEncode DefKind directly.
Camille GILLOT [Sun, 15 Nov 2020 17:02:00 +0000 (18:02 +0100)]
Encode DefKind directly.

3 years agoInfallible version of def_span.
Camille GILLOT [Wed, 23 Dec 2020 09:32:00 +0000 (10:32 +0100)]
Infallible version of def_span.

3 years agoAdd some comments to PassMode
bjorn3 [Sat, 23 Jan 2021 11:57:35 +0000 (12:57 +0100)]
Add some comments to PassMode

3 years agoreplace RefCell with Cell in FnCtxt
Bastian Kauschke [Sat, 23 Jan 2021 10:47:38 +0000 (11:47 +0100)]
replace RefCell with Cell in FnCtxt

3 years agoNever create an temporary PassMode::Direct when it is not a valid pass mode for a...
bjorn3 [Tue, 29 Dec 2020 19:00:57 +0000 (20:00 +0100)]
Never create an temporary PassMode::Direct when it is not a valid pass mode for a type

3 years agoMove some code around
bjorn3 [Mon, 28 Dec 2020 15:34:05 +0000 (16:34 +0100)]
Move some code around

3 years agoUse PassMode::Pair by default for Abi::ScalarPair for all abi's and in return position
bjorn3 [Sun, 27 Dec 2020 18:59:37 +0000 (19:59 +0100)]
Use PassMode::Pair by default for Abi::ScalarPair for all abi's and in return position

Abi::ScalarPair is only ever used for types that don't have a stable
layout anyway so this doesn't break any FFI. It does however reduce the
amount of special casing on the abi outside of the code responsible for
abi specific adjustments to the pass mode.

3 years agoRemove unused dependency
bjorn3 [Sun, 27 Dec 2020 17:41:19 +0000 (18:41 +0100)]
Remove unused dependency

3 years agoAuto merge of #80715 - JulianKnodt:skip_opt, r=nagisa
bors [Sat, 23 Jan 2021 09:25:11 +0000 (09:25 +0000)]
Auto merge of #80715 - JulianKnodt:skip_opt, r=nagisa

Change branching in `iter.skip()`

Optimize branching in `Skip`, which was brought up in #80416.
This assumes that if `next` is called, it's likely that there will be more calls to `next`, and the branch for skip will only be hit once thus it's unlikely to take that path. Even w/o the `unlikely` intrinsic, it compiles more efficiently, I believe because the path where `next` is called is always taken.

It should be noted there are very few places in the compiler where `Skip` is used, so probably won't have a noticeable perf impact.

[New impl](https://godbolt.org/z/85rdj4)
[Old impl](https://godbolt.org/z/Wc74rh)

[Some additional asm examples](https://godbolt.org/z/feKzoz) although they really don't have a ton of difference between them.

3 years agoAuto merge of #80065 - b-naber:parse-angle-arg-diagnostics, r=petrochenkov
bors [Sat, 23 Jan 2021 06:27:21 +0000 (06:27 +0000)]
Auto merge of #80065 - b-naber:parse-angle-arg-diagnostics, r=petrochenkov

Improve diagnostics when parsing angle args

https://github.com/rust-lang/rust/pull/79266 introduced parsing of generic arguments in associated type constraints, this however resulted in possibly very confusing error messages in cases in which closing angle brackets were missing such as in `Vec<(u32, _, _) = vec![]`, which outputs an incorrectly parsed equality constraint error, as noted by `@cynecx.`

This PR tries to provide better error messages in such cases.

r? `@petrochenkov`

3 years agoAuto merge of #76391 - danii:master, r=cuviper
bors [Sat, 23 Jan 2021 03:33:16 +0000 (03:33 +0000)]
Auto merge of #76391 - danii:master, r=cuviper

Split up core/test/iter.rs into multiple files

This PR removes the `// ignore-tidy-filelength` at the top of [iter.rs](https://github.com/rust-lang/rust/blob/04f44fb9232dc960d213d0df4a203c387215a5ff/library/core/tests/iter.rs) by splitting it into several sub files. I have split the file per test, based on what I felt the test was really trying to test.
Addresses issue #60302.
- [associated_util.rs](https://github.com/rust-lang/rust/blob/d29180a8ed2752c5dfa2bca1d28ca05dc9bf6bf1/library/core/tests/iter/associated_util.rs) - For testing the module level functions. (Maybe should be renamed?)
- [collection.rs](https://github.com/rust-lang/rust/blob/d29180a8ed2752c5dfa2bca1d28ca05dc9bf6bf1/library/core/tests/iter/collection.rs) - For testing methods that use the values of all the items in an iterator, and creates one value from them, whether it be a Vec of all the values, or a number that represents the sum.
- [mod.rs](https://github.com/rust-lang/rust/blob/d29180a8ed2752c5dfa2bca1d28ca05dc9bf6bf1/library/core/tests/iter/mod.rs) - For utility structs used in all tests, and other tests I didn't know where to place.
- [range.rs](https://github.com/rust-lang/rust/blob/d29180a8ed2752c5dfa2bca1d28ca05dc9bf6bf1/library/core/tests/iter/range.rs) - For testing ranges.
- [transformation.rs](https://github.com/rust-lang/rust/blob/d29180a8ed2752c5dfa2bca1d28ca05dc9bf6bf1/library/core/tests/iter/transformation.rs) - For testing methods that transform all the values in an iterator.
- [util.rs](https://github.com/rust-lang/rust/blob/d29180a8ed2752c5dfa2bca1d28ca05dc9bf6bf1/library/core/tests/iter/util.rs) - For testing methods that provide utility in more specific use cases.

"Programatically"
-----------------------
You may have noticed I "Programatically" split up the file. [This is how](https://gist.github.com/danii/a58b3bcafa9faf1c3e4b01ad7495baf4) I managed to do that. ðŸ˜› Hope that's fine.

3 years agorustdoc: Fix visibility of trait and impl items
Camelid [Fri, 22 Jan 2021 23:02:49 +0000 (15:02 -0800)]
rustdoc: Fix visibility of trait and impl items

3 years agoAuto merge of #81017 - Aaron1011:collect-trailing-token, r=petrochenkov
bors [Sat, 23 Jan 2021 00:42:37 +0000 (00:42 +0000)]
Auto merge of #81017 - Aaron1011:collect-trailing-token, r=petrochenkov

Refactor token collection to capture trailing token immediately

Split out from https://github.com/rust-lang/rust/pull/80689 - when we start capturing more information about attribute targets, we'll need to know in advance if we're capturing a trailing token or not.

r? `@ghost`

3 years agoFix <unknown> queries
Joshua Nelson [Fri, 22 Jan 2021 15:31:18 +0000 (10:31 -0500)]
Fix <unknown> queries

This happened because `alloc_query_strings` was never called.

3 years agoEdit rustc_middle::dep_graph module documentation
pierwill [Sun, 17 Jan 2021 19:16:17 +0000 (11:16 -0800)]
Edit rustc_middle::dep_graph module documentation

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
Co-authored-by: Camelid <camelidcamel@gmail.com>
3 years agolibrary/core/tests/iter documentation and cleanup
Daniel Conley [Fri, 22 Jan 2021 22:39:17 +0000 (17:39 -0500)]
library/core/tests/iter documentation and cleanup

3 years agolibrary/core/tests/iter rearrange & add back missed doc comments
Daniel Conley [Fri, 22 Jan 2021 22:20:42 +0000 (17:20 -0500)]
library/core/tests/iter rearrange & add back missed doc comments

3 years agolibrary/core/test/iter add newlines between tests
Daniel Conley [Fri, 22 Jan 2021 21:58:21 +0000 (16:58 -0500)]
library/core/test/iter add newlines between tests

3 years agoAuto merge of #79233 - yoshuawuyts:alloc-doc-alias, r=GuillaumeGomez
bors [Fri, 22 Jan 2021 21:48:41 +0000 (21:48 +0000)]
Auto merge of #79233 - yoshuawuyts:alloc-doc-alias, r=GuillaumeGomez

Add doc aliases for memory allocations

This patch adds doc aliases for various C allocation functions, making it possible to search for the C-equivalent of a function and finding the (safe) Rust counterpart:

- `Vec::with_capacity` / `Box::new` / `vec!` -> alloc + malloc, allocates memory
- `Box::new_zeroed` -> calloc, allocates zeroed-out memory
- `Vec::{reserve,reserve_exact,try_reserve_exact,shrink_to_fit,shrink_to}` -> realloc, reallocates a previously allocated slice of memory

It's worth noting that `Vec::new` does not allocate, so we don't link to it. Instead people are probably looking for `Vec::with_capacity` or `vec!`. I hope this will allow people comfortable with the system allocation APIs to make it easier to find what they may be looking for.

Thanks!

3 years agoRemove special casing of rustdoc in rustc_lint
Joshua Nelson [Fri, 22 Jan 2021 19:50:21 +0000 (14:50 -0500)]
Remove special casing of rustdoc in rustc_lint

This is no longer necessary now that rustdoc doesn't run
everybody_loops.

3 years agoMore clear documentation for NonNull<T>
Jonathan Behrens [Tue, 8 Dec 2020 22:15:18 +0000 (17:15 -0500)]
More clear documentation for NonNull<T>

Rephrase and hopefully clarify the discussion of covariance in `NonNull<T>` documentation.

3 years agoAuto merge of #72160 - slo1:libstd-setgroups, r=KodrAus
bors [Fri, 22 Jan 2021 19:00:11 +0000 (19:00 +0000)]
Auto merge of #72160 - slo1:libstd-setgroups, r=KodrAus

Add setgroups to std::os::unix::process::CommandExt

Should fix #38527. I'm not sure groups is the greatest name though.

3 years agoNote library tracking issue template in tracking issue template.
Mara Bos [Fri, 22 Jan 2021 18:41:20 +0000 (19:41 +0100)]
Note library tracking issue template in tracking issue template.

3 years agoInline methods of Path and OsString
Benoît du Garreau [Fri, 22 Jan 2021 17:46:00 +0000 (18:46 +0100)]
Inline methods of Path and OsString

3 years agobless tests
b-naber [Fri, 22 Jan 2021 17:31:25 +0000 (18:31 +0100)]
bless tests

3 years agoAdd doc aliases for memory allocations
Yoshua Wuyts [Fri, 20 Nov 2020 14:25:43 +0000 (15:25 +0100)]
Add doc aliases for memory allocations

- Vec::with_capacity / Box::new -> alloc + malloc
- Box::new_zeroed -> calloc
- Vec::{reserve,reserve_exact,try_reserve_exact,shrink_to_fit,shrink_to} -> realloc

3 years agoadd and update tests
b-naber [Tue, 15 Dec 2020 20:03:25 +0000 (21:03 +0100)]
add and update tests

3 years agoimprove diagnostics for angle args
b-naber [Tue, 15 Dec 2020 16:43:24 +0000 (17:43 +0100)]
improve diagnostics for angle args

3 years agoAuto merge of #81271 - m-ou-se:rollup-xv7gq3w, r=m-ou-se
bors [Fri, 22 Jan 2021 16:04:36 +0000 (16:04 +0000)]
Auto merge of #81271 - m-ou-se:rollup-xv7gq3w, r=m-ou-se

Rollup of 10 pull requests

Successful merges:

 - #80573 (Deny rustc::internal lints for rustdoc and clippy)
 - #81173 (Expand docs on Iterator::intersperse)
 - #81194 (Stabilize std::panic::panic_any.)
 - #81202 (Don't prefix 0x for each segments in `dbg!(Ipv6)`)
 - #81225 (Make 'docs' nullable in rustdoc-json output)
 - #81227 (Remove doctree::StructType)
 - #81233 (Document why not use concat! in dbg! macro)
 - #81236 (Gracefully handle loop labels missing leading `'` in different positions)
 - #81241 (Turn alloc's force_expr macro into a regular macro_rules.)
 - #81242 (Enforce statically that `MIN_NON_ZERO_CAP` is calculated at compile time)

Failed merges:

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

3 years agoRollup merge of #81242 - jyn514:const-cap, r=sfackler
Mara Bos [Fri, 22 Jan 2021 14:30:22 +0000 (14:30 +0000)]
Rollup merge of #81242 - jyn514:const-cap, r=sfackler

Enforce statically that `MIN_NON_ZERO_CAP` is calculated at compile time

Previously, it would usually get computed by LLVM, but this enforces it. This removes the need for the comment saying "LLVM is smart enough".

I don't expect this to make a performance difference, but I do think it makes the performance properties easier to reason about.

3 years agoRollup merge of #81241 - m-ou-se:force-expr-macro-rules, r=oli-obk
Mara Bos [Fri, 22 Jan 2021 14:30:21 +0000 (14:30 +0000)]
Rollup merge of #81241 - m-ou-se:force-expr-macro-rules, r=oli-obk

Turn alloc's force_expr macro into a regular macro_rules.

This turns `alloc`'s `force_expr` macro into a regular `macro_rules`.

Otherwise rust-analyzer doesn't understand `vec![]`. See https://github.com/rust-analyzer/rust-analyzer/issues/7349 and https://github.com/rust-lang/rust/pull/81080#issuecomment-764741721

Edit: See https://github.com/rust-lang/rust/pull/81241#issuecomment-764812660 for a discussion of alternatives.

3 years agoRollup merge of #81236 - estebank:everybody-loop-now, r=oli-obk
Mara Bos [Fri, 22 Jan 2021 14:30:19 +0000 (14:30 +0000)]
Rollup merge of #81236 - estebank:everybody-loop-now, r=oli-obk

Gracefully handle loop labels missing leading `'` in different positions

Fix #81192.

* Account for labels when suggesting `loop` instead of `while true`
* Suggest `'a` when given `a` only when appropriate
* Add loop head span to hir
* Tweak error for invalid `break expr`
* Add more misspelled label tests
* Avoid emitting redundant "unused label" lint
* Parse loop labels missing a leading `'`

Each commit can be reviewed in isolation.

3 years agoRollup merge of #81233 - lzutao:dbg, r=KodrAus
Mara Bos [Fri, 22 Jan 2021 14:30:17 +0000 (14:30 +0000)]
Rollup merge of #81233 - lzutao:dbg, r=KodrAus

Document why not use concat! in dbg! macro

Original title: Reduce code generated by `dbg!` macro
The expanded code before/after: <https://rust.godbolt.org/z/hE3j95>.

---

We cannot use `concat!` since `file!` could contains `{` or the expression is a block (`{ .. }`).
Using it will generated malformed format strings.
So let's document this reason why we don't use `concat!` macro at all.

3 years agoRollup merge of #81227 - CraftSpider:struct-type-clean, r=jyn514
Mara Bos [Fri, 22 Jan 2021 14:30:16 +0000 (14:30 +0000)]
Rollup merge of #81227 - CraftSpider:struct-type-clean, r=jyn514

Remove doctree::StructType

Also removes it from the Union type, as unions can only ever be 'Plain'. Adds a new StructType to JSON, 'union', as the easiest way to encode the type of a union there. This leaves only one item in doctree, `Module`.

r? `@jyn514`

3 years agoRollup merge of #81225 - CraftSpider:json-opt-docs, r=jyn514
Mara Bos [Fri, 22 Jan 2021 14:30:14 +0000 (14:30 +0000)]
Rollup merge of #81225 - CraftSpider:json-opt-docs, r=jyn514

Make 'docs' nullable in rustdoc-json output

Matches the backing better, and makes it so there's a difference between 'empty docs' and 'no docs'.

3 years agoRollup merge of #81202 - lzutao:dbg_ipv6, r=Amanieu
Mara Bos [Fri, 22 Jan 2021 14:30:12 +0000 (14:30 +0000)]
Rollup merge of #81202 - lzutao:dbg_ipv6, r=Amanieu

Don't prefix 0x for each segments in `dbg!(Ipv6)`

Fixes #81182

3 years agoRollup merge of #81194 - m-ou-se:stabilize-panic-any, r=m-ou-se
Mara Bos [Fri, 22 Jan 2021 14:30:11 +0000 (14:30 +0000)]
Rollup merge of #81194 - m-ou-se:stabilize-panic-any, r=m-ou-se

Stabilize std::panic::panic_any.

This stabilizes `std::panic::panic_any`.

3 years agoRollup merge of #81173 - lukaslueg:intersperse_docs, r=m-ou-se
Mara Bos [Fri, 22 Jan 2021 14:30:09 +0000 (14:30 +0000)]
Rollup merge of #81173 - lukaslueg:intersperse_docs, r=m-ou-se

Expand docs on Iterator::intersperse

Unstable feature in #79524. This expands on the docs to bring them more in line with how other methods of `Iterator` are demonstrated.

3 years agoRollup merge of #80573 - jyn514:tool-lints, r=GuillaumeGomez
Mara Bos [Fri, 22 Jan 2021 14:30:03 +0000 (14:30 +0000)]
Rollup merge of #80573 - jyn514:tool-lints, r=GuillaumeGomez

Deny rustc::internal lints for rustdoc and clippy

- Fix rustc::internal lints for rustdoc
- Deny internal lints only for rustdoc and clippy (previously the lints were ignored for clippy because -Zunstable-options didn't get passed)

3 years agoAuto merge of #81101 - tmiasko:combine-now, r=nagisa
bors [Fri, 22 Jan 2021 13:10:48 +0000 (13:10 +0000)]
Auto merge of #81101 - tmiasko:combine-now, r=nagisa

Combine instructions immediately

3 years agoAuto merge of #80558 - lcnr:gat-variance, r=matthewjasper
bors [Fri, 22 Jan 2021 10:12:05 +0000 (10:12 +0000)]
Auto merge of #80558 - lcnr:gat-variance, r=matthewjasper

require gat substs to be invariant

fixes #69184, fixes #80766

r? `@matthewjasper` probably

3 years agoRemove delay-binding for Win XP and Vista
Arlie Davis [Thu, 21 Jan 2021 20:13:35 +0000 (12:13 -0800)]
Remove delay-binding for Win XP and Vista

The minimum supported Windows version is now Windows 7. Windows XP
and Windows Vista are no longer supported; both are already broken, and
require extra steps to use.

This commit removes the delayed-binding support for Windows API
functions that are present on all supported Windows targets. This has
several benefits: Removes needless complexity. Removes a load and
dynamic call on hot paths in mutex acquire / release. This may have
performance benefits.

* "Drop official support for Windows XP"
  https://github.com/rust-lang/compiler-team/issues/378

* "Firefox has ended support for Windows XP and Vista"
  https://support.mozilla.org/en-US/kb/end-support-windows-xp-and-vista

3 years agore-bless ui tests
Ralf Jung [Fri, 22 Jan 2021 09:56:28 +0000 (10:56 +0100)]
re-bless ui tests

3 years agoexpand successful-promotion test a bit
Ralf Jung [Wed, 6 Jan 2021 19:11:23 +0000 (20:11 +0100)]
expand successful-promotion test a bit

3 years agodo promote array indexing if we know it is in-bounds
Ralf Jung [Wed, 6 Jan 2021 19:03:22 +0000 (20:03 +0100)]
do promote array indexing if we know it is in-bounds

3 years agoupdate const_err description
Ralf Jung [Fri, 1 Jan 2021 17:41:10 +0000 (18:41 +0100)]
update const_err description

3 years agoavoid promoting division, modulo and indexing operations that could fail
Ralf Jung [Fri, 1 Jan 2021 13:47:45 +0000 (14:47 +0100)]
avoid promoting division, modulo and indexing operations that could fail

3 years agoUpdate src/test/ui/command/command-setgroups.rs to ignore windows
slo1 [Thu, 21 Jan 2021 19:51:42 +0000 (11:51 -0800)]
Update src/test/ui/command/command-setgroups.rs to ignore windows

3 years agoUpdate src/test/ui/command/command-setgroups.rs
slo1 [Fri, 15 Jan 2021 18:53:50 +0000 (10:53 -0800)]
Update src/test/ui/command/command-setgroups.rs

Co-authored-by: Ashley Mannix <kodraus@hey.com>
3 years agoAdd setgroups to std::os::unix::process::CommandExt
slo1 [Tue, 16 Jun 2020 04:39:34 +0000 (21:39 -0700)]
Add setgroups to std::os::unix::process::CommandExt

3 years agoAuto merge of #81135 - jyn514:no-backticks, r=flip1995
bors [Fri, 22 Jan 2021 06:13:19 +0000 (06:13 +0000)]
Auto merge of #81135 - jyn514:no-backticks, r=flip1995

Fix formatting for removed lints

- Don't add backticks for the reason a lint was removed. This is almost
never a code block, and when it is the backticks should be in the reason
itself.
- Don't assume clippy is the only tool that needs to be checked for
backwards compatibility

I split this out of https://github.com/rust-lang/rust/pull/80527/ because it kept causing tests to fail, and it's a good change to have anyway.

r? `@flip1995`

3 years agoDo not suggest using a break label when one is already present
Esteban Küber [Fri, 22 Jan 2021 02:13:05 +0000 (18:13 -0800)]
Do not suggest using a break label when one is already present

3 years agoFix clippy and comment
Esteban Küber [Fri, 22 Jan 2021 00:48:17 +0000 (16:48 -0800)]
Fix clippy and comment

3 years agoParse loop labels missing a leading `'`
Esteban Küber [Thu, 21 Jan 2021 04:03:29 +0000 (20:03 -0800)]
Parse loop labels missing a leading `'`

When encountering the following typo:

```rust
a: loop { break 'a; }
```

provide an appropriate suggestion.

3 years agoAvoid emitting redundant "unused label" lint
Esteban Küber [Thu, 21 Jan 2021 01:57:47 +0000 (17:57 -0800)]
Avoid emitting redundant "unused label" lint

3 years agoAdd more misspelled label tests
Esteban Küber [Thu, 21 Jan 2021 01:50:21 +0000 (17:50 -0800)]
Add more misspelled label tests

3 years agoTweak error for invalid `break expr`
Esteban Küber [Thu, 21 Jan 2021 01:25:27 +0000 (17:25 -0800)]
Tweak error for invalid `break expr`

Point at loop head on invalid `break expr`.
Suggest removing `expr` or using label if available.

3 years agoAdd loop head span to hir
Esteban Küber [Thu, 21 Jan 2021 01:15:08 +0000 (17:15 -0800)]
Add loop head span to hir