]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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

3 years agoSuggest `'a` when given `a` only when appropriate
Esteban Küber [Wed, 20 Jan 2021 01:51:48 +0000 (17:51 -0800)]
Suggest `'a` when given `a` only when appropriate

When encountering a name `a` that isn't resolved, but a label `'a` is
found in the current ribs, only suggest `'a` if this name is the value
expression of a `break` statement.

Solve FIXME.

3 years agoAccount for labels when suggesting `loop` instead of `while true`
Esteban Küber [Tue, 19 Jan 2021 23:51:51 +0000 (15:51 -0800)]
Account for labels when suggesting `loop` instead of `while true`

3 years agoRefactor token collection to capture trailing token immediately
Aaron Hill [Thu, 14 Jan 2021 15:42:01 +0000 (10:42 -0500)]
Refactor token collection to capture trailing token immediately

3 years agoDeny internal lints for rustdoc
Joshua Nelson [Fri, 22 Jan 2021 03:51:58 +0000 (22:51 -0500)]
Deny internal lints for rustdoc

3 years agoFix rustc::internal lints on rustdoc
Joshua Nelson [Fri, 1 Jan 2021 04:25:30 +0000 (23:25 -0500)]
Fix rustc::internal lints on rustdoc

3 years agoAuto merge of #81177 - Aaron1011:fix/force-capture-tokens, r=petrochenkov
bors [Fri, 22 Jan 2021 02:42:38 +0000 (02:42 +0000)]
Auto merge of #81177 - Aaron1011:fix/force-capture-tokens, r=petrochenkov

Force token collection to run when parsing nonterminals

Fixes #81007

Previously, we would fail to collect tokens in the proper place when
only builtin attributes were present. As a result, we would end up with
attribute tokens in the collected `TokenStream`, leading to duplication
when we attempted to prepend the attributes from the AST node.

We now explicitly track when token collection must be performed due to
nomterminal parsing.

3 years agoBump format version
Rune Tynan [Fri, 22 Jan 2021 02:18:31 +0000 (21:18 -0500)]
Bump format version

3 years agolibrary/core/test/iter.rs split attempt 2
Daniel Conley [Sat, 9 Jan 2021 22:55:41 +0000 (17:55 -0500)]
library/core/test/iter.rs split attempt 2

3 years agoAuto merge of #81160 - RalfJung:swap, r=oli-obk
bors [Fri, 22 Jan 2021 00:01:53 +0000 (00:01 +0000)]
Auto merge of #81160 - RalfJung:swap, r=oli-obk

use raw-ptr-addr-of for slice::swap

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

3 years agoAdd more self-profile info to rustc_resolve
Joshua Nelson [Thu, 21 Jan 2021 22:57:46 +0000 (17:57 -0500)]
Add more self-profile info to rustc_resolve

3 years agoLower closure prototype after its body.
Camille GILLOT [Thu, 21 Jan 2021 21:09:15 +0000 (22:09 +0100)]
Lower closure prototype after its body.

3 years agoAuto merge of #81152 - lzutao:intersperse_fold, r=m-ou-se
bors [Thu, 21 Jan 2021 21:05:34 +0000 (21:05 +0000)]
Auto merge of #81152 - lzutao:intersperse_fold, r=m-ou-se

Fix intersperse_fold

Here is a standalone playground link in case anybody wants to modify code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=626b4d044fb74f044a36098ad907e40f

Fixes #81145

cc #79479 `@jonas-schievink`

3 years agoFix typo
Lukas Lueg [Thu, 21 Jan 2021 19:31:37 +0000 (20:31 +0100)]
Fix typo

3 years agomir: Improve size_of handling when arg is unsized
Ömer Sinan Ağacan [Thu, 21 Jan 2021 17:10:40 +0000 (20:10 +0300)]
mir: Improve size_of handling when arg is unsized

3 years agoExpand docs on Iterator::intersperse
Lukas Lueg [Mon, 18 Jan 2021 19:40:25 +0000 (20:40 +0100)]
Expand docs on Iterator::intersperse

3 years agoUpdate cargo
Eric Huss [Thu, 21 Jan 2021 18:16:42 +0000 (10:16 -0800)]
Update cargo

3 years agoRename alloc::force_expr to __rust_force_expr.
Mara Bos [Thu, 21 Jan 2021 17:30:49 +0000 (18:30 +0100)]
Rename alloc::force_expr to __rust_force_expr.

3 years agoTurn alloc's force_expr macro into a regular macro_rules!{}.
Mara Bos [Thu, 21 Jan 2021 16:12:14 +0000 (17:12 +0100)]
Turn alloc's force_expr macro into a regular macro_rules!{}.

Otherwise rust-analyzer doesn't understand vec![].

3 years agoAuto merge of #81122 - tmiasko:no-drop, r=davidtwco
bors [Thu, 21 Jan 2021 17:02:49 +0000 (17:02 +0000)]
Auto merge of #81122 - tmiasko:no-drop, r=davidtwco

Visit only terminators when removing unneeded drops

No functional changes intended

3 years agoEnforce statically that `MIN_NON_ZERO_CAP` is calculated at compile time
Joshua Nelson [Thu, 21 Jan 2021 16:57:01 +0000 (11:57 -0500)]
Enforce statically that `MIN_NON_ZERO_CAP` is calculated at compile time

Previously, it would usually get computed by LLVM, but this enforces it.

3 years agorequire gat substs to be invariant
Bastian Kauschke [Thu, 31 Dec 2020 14:35:21 +0000 (15:35 +0100)]
require gat substs to be invariant

3 years agoAuto merge of #81240 - JohnTitor:rollup-ieaz82a, r=JohnTitor
bors [Thu, 21 Jan 2021 12:18:32 +0000 (12:18 +0000)]
Auto merge of #81240 - JohnTitor:rollup-ieaz82a, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #79655 (Add Vec visualization to understand capacity)
 - #80172 (Use consistent punctuation for 'Prelude contents' docs)
 - #80429 (Add regression test for mutual recursion in obligation forest)
 - #80601 (Improve grammar in documentation of format strings)
 - #81046 (Improve unknown external crate error)
 - #81178 (Visit only terminators when removing landing pads)
 - #81179 (Fix broken links with `--document-private-items` in the standard library)
 - #81184 (Remove unnecessary `after_run` function)
 - #81185 (Fix ICE in mir when evaluating SizeOf on unsized type)
 - #81187 (Fix typo in counters.rs)
 - #81219 (Document security implications of std::env::temp_dir)

Failed merges:

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

3 years agoRollup merge of #81219 - joshtriplett:temp_dir-docs, r=sfackler
Yuki Okushi [Thu, 21 Jan 2021 11:04:56 +0000 (20:04 +0900)]
Rollup merge of #81219 - joshtriplett:temp_dir-docs, r=sfackler

Document security implications of std::env::temp_dir

Update the sample code to not create an insecure temporary file.

3 years agoRollup merge of #81187 - eltociear:patch-6, r=jonas-schievink
Yuki Okushi [Thu, 21 Jan 2021 11:04:55 +0000 (20:04 +0900)]
Rollup merge of #81187 - eltociear:patch-6, r=jonas-schievink

Fix typo in counters.rs

formating -> formatting

3 years agoRollup merge of #81185 - osa1:fix_80742, r=oli-obk
Yuki Okushi [Thu, 21 Jan 2021 11:04:53 +0000 (20:04 +0900)]
Rollup merge of #81185 - osa1:fix_80742, r=oli-obk

Fix ICE in mir when evaluating SizeOf on unsized type

Not quite ready yet. This tries to fix #80742 as discussed on [Zulip topic][1],
by using `delay_span_bug`.

I don't understand what `delay_span_bug` does. It seems like my error message
is never used. With this patch, in this program:

```rust
#![allow(incomplete_features)]
#![feature(const_evaluatable_checked)]
#![feature(const_generics)]

use std::fmt::Debug;
use std::marker::PhantomData;
use std::mem::size_of;

struct Inline<T>
where
    [u8; size_of::<T>() + 1]: ,
{
    _phantom: PhantomData<T>,
    buf: [u8; size_of::<T>() + 1],
}

impl<T> Inline<T>
where
    [u8; size_of::<T>() + 1]: ,
{
    pub fn new(val: T) -> Inline<T> {
        todo!()
    }
}

fn main() {
    let dst = Inline::<dyn Debug>::new(0); // line 27
}
```

these errors are printed, both for line 27 (annotated line above):

- "no function or associated item named `new` found for struct `Inline<dyn
  Debug>` in the current scope"
- "the size for values of type `dyn Debug` cannot be known at compilation time"

Second error makes sense, but I'm not sure about the first one and why it's
even printed.

Finally, I'm not sure about the span passing in `const_eval`.

[1]: https://rust-lang.zulipchat.com/#narrow/stream/269128-miri/topic/Help.20fixing.20.2380742

3 years agoRollup merge of #81184 - jyn514:combine-after, r=CraftSpider
Yuki Okushi [Thu, 21 Jan 2021 11:04:51 +0000 (20:04 +0900)]
Rollup merge of #81184 - jyn514:combine-after, r=CraftSpider

Remove unnecessary `after_run` function

It's called at the same time and in the same place as `after_krate`, so
they can be combined.

3 years agoRollup merge of #81179 - CPerezz:fix_interal_doc_warns, r=jyn514
Yuki Okushi [Thu, 21 Jan 2021 11:04:50 +0000 (20:04 +0900)]
Rollup merge of #81179 - CPerezz:fix_interal_doc_warns, r=jyn514

Fix broken links with `--document-private-items` in the standard library

As it was suggested in #81037 `SpecFromIter` is not
in the scope and therefore we get a warning when we try to
do document private intems in `rust/library/alloc/`.

This addresses #81037 by adding the trait in the scope as ```@jyn514```
suggested and also adding an `allow(unused_imports)` flag so that
the compiler does not complain, Since the trait is not used
per se in the code, it's just needed to have properly documented
docs.

3 years agoRollup merge of #81178 - tmiasko:no-landing-pads, r=oli-obk
Yuki Okushi [Thu, 21 Jan 2021 11:04:48 +0000 (20:04 +0900)]
Rollup merge of #81178 - tmiasko:no-landing-pads, r=oli-obk

Visit only terminators when removing landing pads

No functional changes intended

3 years agoRollup merge of #81046 - rylev:unknown-external-crate, r=estebank
Yuki Okushi [Thu, 21 Jan 2021 11:04:45 +0000 (20:04 +0900)]
Rollup merge of #81046 - rylev:unknown-external-crate, r=estebank

Improve unknown external crate error

This improves error messages when unknown items in the crate root are encountered.

Fixes #63799

r? ```@estebank```

3 years agoRollup merge of #80601 - steffahn:improve_format_string_grammar, r=m-ou-se
Yuki Okushi [Thu, 21 Jan 2021 11:04:43 +0000 (20:04 +0900)]
Rollup merge of #80601 - steffahn:improve_format_string_grammar, r=m-ou-se

Improve grammar in documentation of format strings

The docs previously were
* using some weird `<` and `>` around some nonterminals
  * _correct me if these **did** have any meaning_
* using of a (not explicitly defined) `text` nonterminal that didn’t explicitly disallow productions containing `'{'` or `'}'`
* incorrect in not allowing for `x?` and `X?` productions of `type`
* unnecessarily ambiguous, both
  * allowing `type` to be `''`, and
  * using an optional `[type]`
* using inconsistent underscore/hyphenation style between `format_string` and `format_spec` vs `maybe-format`

_Rendered:_
![Screenshot_20210101_230901](https://user-images.githubusercontent.com/3986214/103447038-69d7a180-4c86-11eb-8fa0-0a6160a7ff7a.png)
_(current docs: https://doc.rust-lang.org/nightly/std/fmt/#syntax)_

```@rustbot``` modify labels: T-doc

3 years agoRollup merge of #80429 - JulianKnodt:ob_forest, r=Mark-Simulacrum
Yuki Okushi [Thu, 21 Jan 2021 11:04:41 +0000 (20:04 +0900)]
Rollup merge of #80429 - JulianKnodt:ob_forest, r=Mark-Simulacrum

Add regression test for mutual recursion in obligation forest

Add regression test for #75860 with a slightly smaller example.
I was looking at what caused the issue and was surprised when it errors out on nightly, so I just added a regression test which should effectively close the issue, altho it would be nice to find the fix for reference.

Also I found that 80066 is not fixed by whatever fixed 75860.

3 years agoRollup merge of #80172 - camelid:prelude-docs-consistent-punct, r=steveklabnik
Yuki Okushi [Thu, 21 Jan 2021 11:04:39 +0000 (20:04 +0900)]
Rollup merge of #80172 - camelid:prelude-docs-consistent-punct, r=steveklabnik

Use consistent punctuation for 'Prelude contents' docs