]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoEmit warning when named arguments are used positionally in format
Preston From [Sat, 25 Jun 2022 05:52:13 +0000 (23:52 -0600)]
Emit warning when named arguments are used positionally in format

Addresses Issue 98466 by emitting a warning if a named argument
is used like a position argument (i.e. the name is not used in
the string to be formatted).

Fixes rust-lang#98466

2 years agoAuto merge of #99210 - Dylan-DPC:rollup-879cp1t, r=Dylan-DPC
bors [Wed, 13 Jul 2022 17:13:27 +0000 (17:13 +0000)]
Auto merge of #99210 - Dylan-DPC:rollup-879cp1t, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #98574 (Lower let-else in MIR)
 - #99011 (`UnsafeCell` blocks niches inside its nested type from being available outside)
 - #99030 (diagnostics: error messages when struct literals fail to parse)
 - #99155 (Keep unstable target features for asm feature checking)
 - #99199 (Refactor: remove an unnecessary `span_to_snippet`)

Failed merges:

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

2 years agoAuto merge of #98145 - ouz-a:some_branch, r=oli-obk
bors [Wed, 13 Jul 2022 14:32:33 +0000 (14:32 +0000)]
Auto merge of #98145 - ouz-a:some_branch, r=oli-obk

Pull Derefer before ElaborateDrops

_Follow up work to #97025 #96549 #96116 #95887 #95649_

This moves `Derefer` before `ElaborateDrops` and creates a new `Rvalue` called `VirtualRef` that allows us to bypass many constraints for `DerefTemp`.

r? `@oli-obk`

2 years agoRollup merge of #99199 - TaKO8Ki:remove-unnecessary-span-to-snippet, r=cjgillot
Dylan DPC [Wed, 13 Jul 2022 14:02:37 +0000 (19:32 +0530)]
Rollup merge of #99199 - TaKO8Ki:remove-unnecessary-span-to-snippet, r=cjgillot

Refactor: remove an unnecessary `span_to_snippet`

`span_suggestion_hidden` does not show the suggested code and the suggestion is used just for rustfix, so `span_to_snippet` is unnecessary here.

2 years agoRollup merge of #99155 - Amanieu:unstable-target-features, r=davidtwco
Dylan DPC [Wed, 13 Jul 2022 14:02:36 +0000 (19:32 +0530)]
Rollup merge of #99155 - Amanieu:unstable-target-features, r=davidtwco

Keep unstable target features for asm feature checking

Inline assembly uses the target features to determine which registers
are available on the current target. However it needs to be able to
access unstable target features for this.

Fixes #99071

2 years agoRollup merge of #99030 - rust-lang:notriddle/field-recovery, r=petrochenkov
Dylan DPC [Wed, 13 Jul 2022 14:02:35 +0000 (19:32 +0530)]
Rollup merge of #99030 - rust-lang:notriddle/field-recovery, r=petrochenkov

diagnostics: error messages when struct literals fail to parse

If an expression is supplied where a field is expected, the parser can become convinced that it's a shorthand field syntax when it's not.

This PR addresses it by explicitly recording the permitted `:` token immediately after the identifier, and also adds a suggestion to insert the name of the field if it looks like a complex expression.

Fixes #98917

2 years agoRollup merge of #99011 - oli-obk:UnsoundCell, r=eddyb
Dylan DPC [Wed, 13 Jul 2022 14:02:34 +0000 (19:32 +0530)]
Rollup merge of #99011 - oli-obk:UnsoundCell, r=eddyb

`UnsafeCell` blocks niches inside its nested type from being available outside

fixes #87341

This implements the plan by `@eddyb` in https://github.com/rust-lang/rust/issues/87341#issuecomment-886083646

Somewhat related PR (not strictly necessary, but that cleanup made this PR simpler): #94527

2 years agoRollup merge of #98574 - dingxiangfei2009:let-else-thir, r=oli-obk
Dylan DPC [Wed, 13 Jul 2022 14:02:33 +0000 (19:32 +0530)]
Rollup merge of #98574 - dingxiangfei2009:let-else-thir, r=oli-obk

Lower let-else in MIR

This MR will switch to lower let-else statements in MIR building instead.

To lower let-else in MIR, we build a mini-switch two branches. One branch leads to the matching case, and the other leads to the `else` block. This arrangement will allow temporary lifetime analysis running as-is so that the temporaries are properly extended according to the same rule applied to regular `let` statements.

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

Fix #98672

2 years agoAuto merge of #99203 - GuillaumeGomez:rollup-b2re0dv, r=GuillaumeGomez
bors [Wed, 13 Jul 2022 11:10:51 +0000 (11:10 +0000)]
Auto merge of #99203 - GuillaumeGomez:rollup-b2re0dv, r=GuillaumeGomez

Rollup of 10 pull requests

Successful merges:

 - #98789 (rustdoc-json-types: Clean up derives.)
 - #98848 (Build the Clippy book as part of x.py doc)
 - #99020 (check non_exhaustive attr and private fields for transparent types)
 - #99132 (Add some autolabels for A-bootstrap and T-infra)
 - #99148 (Clarify that [iu]size bounds were only defined for the target arch)
 - #99152 (Use CSS variables to handle theming (part 2))
 - #99168 (Add regression test for #74713)
 - #99176 (:arrow_up: rust-analyzer)
 - #99183 (Mention rust-analyzer maintainers when `proc_macro` bridge is changed)
 - #99185 (llvm-wrapper: adapt for LLVM API change)

Failed merges:

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

2 years agoLimit test to x86 targets for reproducability
Oli Scherer [Wed, 13 Jul 2022 10:11:35 +0000 (10:11 +0000)]
Limit test to x86 targets for reproducability

2 years agoRollup merge of #99185 - krasimirgg:llvm-wrapper-inlineasm, r=nikic
Guillaume Gomez [Wed, 13 Jul 2022 08:38:50 +0000 (10:38 +0200)]
Rollup merge of #99185 - krasimirgg:llvm-wrapper-inlineasm, r=nikic

llvm-wrapper: adapt for LLVM API change

This adapts RustWrapper's ` LLVMRustInlineAsmVerify` for LLVM commit https://github.com/llvm/llvm-project/commit/00797b88e0113aeea03045b18b3f63332f850dfe.

2 years agoRollup merge of #99183 - jonas-schievink:proc_macro-mention-r-a, r=jyn514
Guillaume Gomez [Wed, 13 Jul 2022 08:38:49 +0000 (10:38 +0200)]
Rollup merge of #99183 - jonas-schievink:proc_macro-mention-r-a, r=jyn514

Mention rust-analyzer maintainers when `proc_macro` bridge is changed

rust-analyzer vendors a modified copy of the `proc_macro` crate in order to expand procedural macros built by Cargo. Since the ABI used by proc macros can change, we need to follow along with those changes. Getting notified when the proc macro bridge changes should make that easier, since that's what defines the ABI.

cc ```@rust-lang/wg-rls-2```

2 years agoRollup merge of #99176 - lnicola:rust-analyzer-2022-07-12, r=lnicola
Guillaume Gomez [Wed, 13 Jul 2022 08:38:48 +0000 (10:38 +0200)]
Rollup merge of #99176 - lnicola:rust-analyzer-2022-07-12, r=lnicola

:arrow_up: rust-analyzer

r? ``@ghost``

2 years agoRollup merge of #99168 - TaKO8Ki:add-regression-test-for-74713, r=Dylan-DPC
Guillaume Gomez [Wed, 13 Jul 2022 08:38:47 +0000 (10:38 +0200)]
Rollup merge of #99168 - TaKO8Ki:add-regression-test-for-74713, r=Dylan-DPC

Add regression test for #74713

closes #74713

2 years agoRollup merge of #99152 - GuillaumeGomez:css-theme-var, r=jsha
Guillaume Gomez [Wed, 13 Jul 2022 08:38:46 +0000 (10:38 +0200)]
Rollup merge of #99152 - GuillaumeGomez:css-theme-var, r=jsha

Use CSS variables to handle theming (part 2)

Follow-up of https://github.com/rust-lang/rust/pull/98460.

As usual, there shouldn't be any UI change.

You can test it [here](https://rustdoc.crud.net/imperio/css-theme-var/bar/index.html).

r? `@jsha`

2 years agoRollup merge of #99148 - SOF3:clarify-xsize-bound, r=scottmcm
Guillaume Gomez [Wed, 13 Jul 2022 08:38:45 +0000 (10:38 +0200)]
Rollup merge of #99148 - SOF3:clarify-xsize-bound, r=scottmcm

Clarify that [iu]size bounds were only defined for the target arch

2 years agoRollup merge of #99132 - jyn514:autolabel, r=Mark-Simulacrum
Guillaume Gomez [Wed, 13 Jul 2022 08:38:44 +0000 (10:38 +0200)]
Rollup merge of #99132 - jyn514:autolabel, r=Mark-Simulacrum

Add some autolabels for A-bootstrap and T-infra

2 years agoRollup merge of #99020 - fee1-dead-contrib:repr_transparent_non_exhaustive, r=oli-obk
Guillaume Gomez [Wed, 13 Jul 2022 08:38:43 +0000 (10:38 +0200)]
Rollup merge of #99020 - fee1-dead-contrib:repr_transparent_non_exhaustive, r=oli-obk

check non_exhaustive attr and private fields for transparent types

Fixes #78586.

2 years agoRollup merge of #98848 - flip1995:clippy-book, r=jyn514
Guillaume Gomez [Wed, 13 Jul 2022 08:38:42 +0000 (10:38 +0200)]
Rollup merge of #98848 - flip1995:clippy-book, r=jyn514

Build the Clippy book as part of x.py doc

r? ``@ehuss`` since you said you would be interested in helping moving this forward.

cc ``@jyn514`` as part of the bootstrap team.

2 years agoRollup merge of #98789 - aDotInTheVoid:rjdt-derives, r=jsha
Guillaume Gomez [Wed, 13 Jul 2022 08:38:41 +0000 (10:38 +0200)]
Rollup merge of #98789 - aDotInTheVoid:rjdt-derives, r=jsha

rustdoc-json-types: Clean up derives.

Closes #96189

Everything is `Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize` except `Crate` and `Item` which arn't `Hash`, as they have `HashMap`'s. See linked issue for reasoning.

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

2 years agoAuto merge of #99066 - est31:remove_box_librustdoc, r=jsha
bors [Wed, 13 Jul 2022 08:29:57 +0000 (08:29 +0000)]
Auto merge of #99066 - est31:remove_box_librustdoc, r=jsha

Remove most box syntax from librustdoc

This is the second attempt after the librustdoc specific changes have been reverted from #87781 in #89134, due to a minor, but exant regression caused by the changes. ~~There have been some changes to librustdoc in the past and maybe thanks to them there is no regression any more. If there is still a regression, one can investigate further and maybe find ways to fix the regressions. Thus, i request a perf run.~~ Edit: turns out there is still a regression, but it's caused only by a subset of the changes. So I've changed this PR to only contains the changes that don't cause any performance regressions, keeping the regression causing changes for a later PR.

2 years agoAuto merge of #99149 - ferrocene:pa-nightly-branch, r=Mark-Simulacrum
bors [Wed, 13 Jul 2022 05:24:18 +0000 (05:24 +0000)]
Auto merge of #99149 - ferrocene:pa-nightly-branch, r=Mark-Simulacrum

Configure nightly branch name in `stage0.json`

The beta version number detection code relies on git to know how many merge commits were made since we branched off, and in doing so hardcodes `master` as the default branch name. This works for rust-lang/rust, but is problematic for forks that use a different default branch name (in Ferrocene we use `main` instead).

This PR changes the code to instead load the default branch name from `src/stage0.json`. `bump-stage0` has also been updated to remove the need to update it every time a new field is added to `stage0.json`.

2 years agofix documentation
Deadbeef [Tue, 12 Jul 2022 10:33:52 +0000 (10:33 +0000)]
fix documentation

2 years agoavoid `&str` to `String` conversions
Takayuki Maeda [Wed, 13 Jul 2022 04:24:38 +0000 (13:24 +0900)]
avoid `&str` to `String` conversions

2 years agoremove an unnecessary `span_to_snippet`
Takayuki Maeda [Wed, 13 Jul 2022 04:24:06 +0000 (13:24 +0900)]
remove an unnecessary `span_to_snippet`

2 years agoAuto merge of #99101 - RalfJung:interpret-projections, r=oli-obk
bors [Wed, 13 Jul 2022 02:43:25 +0000 (02:43 +0000)]
Auto merge of #99101 - RalfJung:interpret-projections, r=oli-obk

interpret: refactor projection handling code

Moves our projection handling code into a common file, and avoids the use of a
general mplace-based fallback function by have more specialized implementations.

mplace_index (and the other slice-related functions) could be more efficient by
copy-pasting the body of operand_index. Or we could do some trait magic to share
the code between them. But for now this is probably fine.

This is the common part of https://github.com/rust-lang/rust/pull/99013 and https://github.com/rust-lang/rust/pull/99097. I am seeing some strange perf results so this probably should be its own change so we know which diff caused which perf changes...

r? `@oli-obk`

2 years agoUpdate compiler/rustc_parse/src/parser/expr.rs
Michael Howell [Tue, 12 Jul 2022 14:34:49 +0000 (07:34 -0700)]
Update compiler/rustc_parse/src/parser/expr.rs

Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2 years agollvm-wrapper: adapt for LLVM API change
Krasimir Georgiev [Tue, 12 Jul 2022 15:36:28 +0000 (15:36 +0000)]
llvm-wrapper: adapt for LLVM API change

2 years agoMention rust-analyzer maintainers when `proc_macro` bridge is changed
Jonas Schievink [Tue, 12 Jul 2022 15:31:18 +0000 (17:31 +0200)]
Mention rust-analyzer maintainers when `proc_macro` bridge is changed

2 years agoignore wasm=32 & bless
ouz-a [Tue, 12 Jul 2022 13:02:17 +0000 (16:02 +0300)]
ignore wasm=32 & bless

2 years agoAuto merge of #99177 - Dylan-DPC:rollup-m0k9q2w, r=Dylan-DPC
bors [Tue, 12 Jul 2022 11:36:58 +0000 (11:36 +0000)]
Auto merge of #99177 - Dylan-DPC:rollup-m0k9q2w, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #98622 (rustc_target: Flip the default for `TargetOptions::executables` to true)
 - #98633 (Fix last `let_chains` blocker)
 - #98972 (Suggest adding a missing zero to a floating point number)
 - #99038 (Some more `EarlyBinder` cleanups)
 - #99154 (use PlaceRef::iter_projections to fix old FIXME)
 - #99171 (Put back UI test regex)

Failed merges:

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

2 years agoRollup merge of #99171 - GuillaumeGomez:rustdoc-ui-test-regex, r=Dylan-DPC
Dylan DPC [Tue, 12 Jul 2022 11:36:36 +0000 (17:06 +0530)]
Rollup merge of #99171 - GuillaumeGomez:rustdoc-ui-test-regex, r=Dylan-DPC

Put back UI test regex

I just realized I overwrote these two commits in https://github.com/rust-lang/rust/pull/99055 when force pushing to fix the stdout output...

r? `@Dylan-DPC`

2 years agoRollup merge of #99154 - rosehuds:master, r=cjgillot
Dylan DPC [Tue, 12 Jul 2022 11:36:35 +0000 (17:06 +0530)]
Rollup merge of #99154 - rosehuds:master, r=cjgillot

use PlaceRef::iter_projections to fix old FIXME

I added this function in 53481a5a8fde83ed1a5d7e8302be028a4c7d8da5

2 years agoRollup merge of #99038 - jackh726:earlybinder-cleanup, r=lcnr
Dylan DPC [Tue, 12 Jul 2022 11:36:34 +0000 (17:06 +0530)]
Rollup merge of #99038 - jackh726:earlybinder-cleanup, r=lcnr

Some more `EarlyBinder` cleanups

First commit has a couple unrelated cleanups, but otherwise each commit is self-explanatory

r? rust-lang/types

2 years agoRollup merge of #98972 - TaKO8Ki:suggest-adding-missing-zero-to-floating-point-number...
Dylan DPC [Tue, 12 Jul 2022 11:36:33 +0000 (17:06 +0530)]
Rollup merge of #98972 - TaKO8Ki:suggest-adding-missing-zero-to-floating-point-number, r=compiler-errors

Suggest adding a missing zero to a floating point number

fixes #98836

2 years agoRollup merge of #98633 - c410-f3r:yet-another-let-chain, r=estebank
Dylan DPC [Tue, 12 Jul 2022 11:36:33 +0000 (17:06 +0530)]
Rollup merge of #98633 - c410-f3r:yet-another-let-chain, r=estebank

Fix last `let_chains` blocker

In order to forbid things like `let x = (let y = 1);` or `if let a = 1 && { let x = let y = 1; } {}`, the parser **HAS** to know the context of `let`.

This context thing is not a surprise in the parser because you can see **a lot** of ad hoc fixes mixing parsing logic with validation logic creating code that looks more like spaghetti with tomato sauce.

To make things even greater, a new ad hoc fix was added to only allow `let`s in a valid `let_chains` context by checking the previously processed token. This was the only solution I could think of and believe me, I thought about it for a long time 👍

In the long term, it should be preferable to segregate different responsibilities or create a more robust and cleaner parser framework.

cc https://github.com/rust-lang/rust/pull/94927
cc https://github.com/rust-lang/rust/issues/53667

2 years agoRollup merge of #98622 - petrochenkov:executables, r=oli-obk
Dylan DPC [Tue, 12 Jul 2022 11:36:32 +0000 (17:06 +0530)]
Rollup merge of #98622 - petrochenkov:executables, r=oli-obk

rustc_target: Flip the default for `TargetOptions::executables` to true

This flag is true for most targets and the remaining targets may be mistakes.

2 years agoadd new rval, pull deref early
ouz-a [Mon, 13 Jun 2022 13:37:41 +0000 (16:37 +0300)]
add new rval, pull deref early

2 years agofix the typo
Ding Xiang Fei [Tue, 12 Jul 2022 11:24:08 +0000 (13:24 +0200)]
fix the typo

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Tue, 12 Jul 2022 11:18:31 +0000 (14:18 +0300)]
:arrow_up: rust-analyzer

2 years agoadd more tests
Deadbeef [Sun, 10 Jul 2022 13:31:58 +0000 (13:31 +0000)]
add more tests

2 years agocheck non_exhaustive attr and private fields for transparent types
Deadbeef [Thu, 7 Jul 2022 16:55:41 +0000 (16:55 +0000)]
check non_exhaustive attr and private fields for transparent types

2 years agoUpdate -zhelp and -chelp rustdoc-ui tests to use regex-error-pattern
Guillaume Gomez [Tue, 12 Jul 2022 09:20:36 +0000 (11:20 +0200)]
Update -zhelp and -chelp rustdoc-ui tests to use regex-error-pattern

2 years agoAdd regex-error-pattern flag in compiletest
Guillaume Gomez [Tue, 12 Jul 2022 09:19:52 +0000 (11:19 +0200)]
Add regex-error-pattern flag in compiletest

2 years agoAlways check Cell alongside with `UnsafeCell`
Oli Scherer [Tue, 12 Jul 2022 07:29:36 +0000 (07:29 +0000)]
Always check Cell alongside with `UnsafeCell`

2 years agoUse some more visible sigils than `,`
Oli Scherer [Tue, 12 Jul 2022 07:22:52 +0000 (07:22 +0000)]
Use some more visible sigils than `,`

2 years agoadd regression test for #74713
Takayuki Maeda [Tue, 12 Jul 2022 05:21:09 +0000 (14:21 +0900)]
add regression test for #74713

2 years agoimplement a suggestion for a floating point number with a type suffix
Takayuki Maeda [Tue, 12 Jul 2022 04:59:51 +0000 (13:59 +0900)]
implement a suggestion for a floating point number with a type suffix

2 years agouse a loop rather than try_fold
Ralf Jung [Mon, 11 Jul 2022 17:42:08 +0000 (13:42 -0400)]
use a loop rather than try_fold

2 years agointerpret: refactor projection handling code
Ralf Jung [Mon, 4 Jul 2022 12:48:05 +0000 (08:48 -0400)]
interpret: refactor projection handling code

Moves our projection handling code into a common file, and avoids the use of a
general mplace-based fallback function by have more specialized implementations.

mplace_index (and the other slice-related functions) could be more efficient by
copy-pasting the body of operand_index. Or we could do some trait magic to share
the code between them. But for now this is probably fine.

2 years agoAuto merge of #99165 - matthiaskrgr:rollup-rqpelfa, r=matthiaskrgr
bors [Tue, 12 Jul 2022 00:25:45 +0000 (00:25 +0000)]
Auto merge of #99165 - matthiaskrgr:rollup-rqpelfa, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #97210 (Support `-A`, `-W`, `-D` and `-F` when running `./x.py clippy`)
 - #99055 (Fix rustdoc help options)
 - #99075 (Fix duplicated type annotation suggestion)
 - #99124 (Fix sized check ICE in asm check)
 - #99142 (fix(doctest): treat fatal parse errors as incomplete attributes)
 - #99145 (Don't rerun the build script for the compiler each time on non-windows platforms)
 - #99146 (Do not error during method probe on `Sized` predicates for types that aren't the method receiver)
 - #99161 (compiletest: trim edition before passing as flag)

Failed merges:

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

2 years agoadd tests for async await
Ding Xiang Fei [Mon, 11 Jul 2022 21:20:27 +0000 (23:20 +0200)]
add tests for async await

2 years agoextract method to read scrutinee conditionally
Ding Xiang Fei [Mon, 11 Jul 2022 19:11:03 +0000 (21:11 +0200)]
extract method to read scrutinee conditionally

2 years agomove else block into the `Local` struct
Ding Xiang Fei [Tue, 5 Jul 2022 21:31:18 +0000 (23:31 +0200)]
move else block into the `Local` struct

2 years agolower let-else in MIR instead
Ding Xiang Fei [Thu, 2 Jun 2022 14:39:47 +0000 (22:39 +0800)]
lower let-else in MIR instead

2 years agoRemove box syntax from Box<BareFunctionDecl> construction
est31 [Sun, 10 Jul 2022 22:13:21 +0000 (00:13 +0200)]
Remove box syntax from Box<BareFunctionDecl> construction

The type has 144 bytes according to compiler internal rustdoc.

2 years agoRemove box syntax for Box<rustdoc::clean::types::Type> construction
est31 [Sun, 10 Jul 2022 21:59:33 +0000 (23:59 +0200)]
Remove box syntax for Box<rustdoc::clean::types::Type> construction

The type has 80 bytes according to compiler internal rustdoc.

2 years agoRemove box syntax for Box<ImplItem> construction
est31 [Sun, 10 Jul 2022 21:42:47 +0000 (23:42 +0200)]
Remove box syntax for Box<ImplItem> construction

ImplItem only has 80 bytes according to compiler internal rustdoc.

2 years agoRemove box syntax for Box<Attributes> construction
est31 [Sun, 10 Jul 2022 21:49:33 +0000 (23:49 +0200)]
Remove box syntax for Box<Attributes> construction

Attributes only has 48 bytes according to compiler internal rustdoc.

2 years agoRemove box syntax from Box<dyn Iterator> construction
est31 [Sun, 10 Jul 2022 22:16:01 +0000 (00:16 +0200)]
Remove box syntax from Box<dyn Iterator> construction

The iterators created should be pretty light weight.

2 years agoRollup merge of #99161 - fee1-dead-contrib:compile-test-edition-trim, r=jyn514
Matthias Krüger [Mon, 11 Jul 2022 20:39:10 +0000 (22:39 +0200)]
Rollup merge of #99161 - fee1-dead-contrib:compile-test-edition-trim, r=jyn514

compiletest: trim edition before passing as flag

This makes `edition: 2021` work instead of the ugly
`edition:2021` one has to write.

2 years agoRollup merge of #99146 - compiler-errors:issue-61525, r=lcnr
Matthias Krüger [Mon, 11 Jul 2022 20:39:09 +0000 (22:39 +0200)]
Rollup merge of #99146 - compiler-errors:issue-61525, r=lcnr

Do not error during method probe on `Sized` predicates for types that aren't the method receiver

Fixes #61525

This is safe even though we're skipping an error because we end up confirming the method, which means we're still checking the `Sized` predicate in the end. It just means that we don't emit an erroneous message as below:

```
error: the `query` method cannot be invoked on a trait object
  --> src/lib.rs:14:11
   |
14 |         1.query::<dyn ToString>("")
   |           ^^^^^
   |
   = note: another candidate was found in the following trait, perhaps add a `use` for it:
           `use crate::Example;`
```

Also fixes erroneously suggesting the same trait over again, as seen in the `issue-35976.rs` UI test.

2 years agoRollup merge of #99145 - jyn514:dont-rerun-build-script, r=wesleywiser
Matthias Krüger [Mon, 11 Jul 2022 20:39:08 +0000 (22:39 +0200)]
Rollup merge of #99145 - jyn514:dont-rerun-build-script, r=wesleywiser

Don't rerun the build script for the compiler each time on non-windows platforms

In practice, this doesn't matter very much because the script takes ~no time to run.
But this makes `CARGO_LOG=info` easier to read, and theoretically saves a few milliseconds.

2 years agoRollup merge of #99142 - notriddle:notriddle/doctest-multiline-crate-attributes,...
Matthias Krüger [Mon, 11 Jul 2022 20:39:07 +0000 (22:39 +0200)]
Rollup merge of #99142 - notriddle:notriddle/doctest-multiline-crate-attributes, r=GuillaumeGomez

fix(doctest): treat fatal parse errors as incomplete attributes

Fixes #99089

2 years agoRollup merge of #99124 - compiler-errors:issue-99122, r=oli-obk
Matthias Krüger [Mon, 11 Jul 2022 20:39:06 +0000 (22:39 +0200)]
Rollup merge of #99124 - compiler-errors:issue-99122, r=oli-obk

Fix sized check ICE in asm check

Fixes (beta nominated, so doesn't close) #99122

1. Moves a check for unresolved inference variables to _before_ other checks that could possibly ICE. We're not changing behavior here, just doing the same thing earlier in the function.
2. Erases region variables in sized check (which are not resolved at this point) because rustc will also ICE when region vars are passed to a query which does not canonicalize them.

2 years agoRollup merge of #99075 - danobi:dup_type_hint_sugg, r=petrochenkov
Matthias Krüger [Mon, 11 Jul 2022 20:39:05 +0000 (22:39 +0200)]
Rollup merge of #99075 - danobi:dup_type_hint_sugg, r=petrochenkov

Fix duplicated type annotation suggestion

Before, there was more or less duplicated suggestions to add type hints.
Fix by clearing more generic suggestions when a more specific suggestion
is possible.

This fixes #93506 .

2 years agoRollup merge of #99055 - GuillaumeGomez:rustdoc-help-options, r=jyn514
Matthias Krüger [Mon, 11 Jul 2022 20:39:04 +0000 (22:39 +0200)]
Rollup merge of #99055 - GuillaumeGomez:rustdoc-help-options, r=jyn514

Fix rustdoc help options

Fixes #98976.

Since you're the one who found out about the problem and also provided the solution (thanks for both!):

r? ```@jyn514```

2 years agoRollup merge of #97210 - Milo123459:clippy-args, r=jyn514
Matthias Krüger [Mon, 11 Jul 2022 20:39:03 +0000 (22:39 +0200)]
Rollup merge of #97210 - Milo123459:clippy-args, r=jyn514

Support `-A`, `-W`, `-D` and `-F` when running `./x.py clippy`

Resolves #97059

This PR adds support for `-A`, `-W`, `-D` and `-F` when running `./x.py clippy`.

2 years agoAuto merge of #96978 - lqd:win_pgo2, r=Mark-Simulacrum
bors [Mon, 11 Jul 2022 20:32:06 +0000 (20:32 +0000)]
Auto merge of #96978 - lqd:win_pgo2, r=Mark-Simulacrum

Utilize PGO for windows x64 rustc dist builds

This PR adds PGO support for the CI x64 windows dist builds.

These are the results from running the rustc-perf benchmarks:
![image](https://user-images.githubusercontent.com/247183/177662869-683a8034-7c95-42bf-9900-9ffd66677fcf.png)

Thanks to `@Kobzol,` `@michaelwoerister,` `@wesleywiser,` `@Mark-Simulacrum` for their precious help.

2 years agorustc_target: Flip the default for `TargetOptions::executables` to true
Vadim Petrochenkov [Tue, 28 Jun 2022 13:34:07 +0000 (16:34 +0300)]
rustc_target: Flip the default for `TargetOptions::executables` to true

Also change `executables` to true for linux-kernel and windows-uwp-gnu targets

2 years agoFix sized check ICE in intrisicck
Michael Goulet [Sun, 10 Jul 2022 18:55:38 +0000 (18:55 +0000)]
Fix sized check ICE in intrisicck

2 years agoAuto merge of #98637 - cjgillot:bare-trait-anon-lt, r=petrochenkov
bors [Mon, 11 Jul 2022 17:09:37 +0000 (17:09 +0000)]
Auto merge of #98637 - cjgillot:bare-trait-anon-lt, r=petrochenkov

Create fresh lifetime parameters for bare fn trait too

The current code fails to account for the equivalence between `dyn FnMut(&mut u8)` and bare `FnMut(&mut u8)`, and treated them differently.

This PR introduces a special case for `Fn` traits, which are always fully resolved.

Fixes #98616
Fixes #98726
This will require a beta-backport, as beta contains that bug.

r? `@petrochenkov`

2 years agocompiletest: trim edition before passing as flag
Deadbeef [Mon, 11 Jul 2022 16:41:32 +0000 (16:41 +0000)]
compiletest: trim edition before passing as flag

This makes `edition: 2021` work instead of the ugly
`edition:2021` one has to write.

2 years agoOnly check relative sizes on platform specific types
Oli Scherer [Mon, 11 Jul 2022 15:41:38 +0000 (15:41 +0000)]
Only check relative sizes on platform specific types

2 years agotidy
Oli Scherer [Mon, 11 Jul 2022 14:35:04 +0000 (14:35 +0000)]
tidy

2 years agoSimplify size checking
Oli Scherer [Mon, 11 Jul 2022 14:23:32 +0000 (14:23 +0000)]
Simplify size checking

2 years agoDon't allow accidental runtime-checks
Oli Scherer [Mon, 11 Jul 2022 14:16:14 +0000 (14:16 +0000)]
Don't allow accidental runtime-checks

2 years agointroduce PGO on the `dist-x86_64-msvc` builder
Rémy Rakic [Tue, 14 Jun 2022 19:02:26 +0000 (21:02 +0200)]
introduce PGO on the `dist-x86_64-msvc` builder

This adds windows-specific behavior into the PGO script, and enables it
on CI.

2 years agomake linux PGO script more generic
Rémy Rakic [Tue, 14 Jun 2022 20:19:07 +0000 (22:19 +0200)]
make linux PGO script more generic

This extracts the linux-isms into variables, so that the script can be
extended to do PGO on windows. These variables will be overriden in a
few spots, in windows-specific blocks.

2 years agoplaceholders -> inference vars in comment
Jack Huey [Mon, 11 Jul 2022 13:52:25 +0000 (09:52 -0400)]
placeholders -> inference vars in comment

2 years agoAdd test for issue 99071
Amanieu d'Antras [Mon, 11 Jul 2022 13:47:22 +0000 (14:47 +0100)]
Add test for issue 99071

2 years agoextend bootstrap for PGO on windows
Rémy Rakic [Mon, 16 May 2022 01:40:52 +0000 (03:40 +0200)]
extend bootstrap for PGO on windows

When building LLVM/LLD as part of a build that asks LLVM to generate profiles, e.g. when
doing PGO, cmake or clang-cl don't automatically link clang's profiler runtime in,
causing undefined reference errors at link-time.

We do that manually, by adding clang's resource library folder to the library search path:
- for LLVM itself, by extending the linker args that `rustc_llvm`'s build script
  uses, to avoid the linker errors when linking `rustc_driver`.
- for LLD, by extending cmake's linker flags during the LLD build step.

2 years agouse PlaceRef::iter_projections to fix old FIXME
Rose Hudson [Mon, 11 Jul 2022 13:42:49 +0000 (14:42 +0100)]
use PlaceRef::iter_projections to fix old FIXME

I added this function in 53481a5a8fde83ed1a5d7e8302be028a4c7d8da5

2 years agoKeep unstable target features for asm feature checking
Amanieu d'Antras [Mon, 11 Jul 2022 13:26:58 +0000 (14:26 +0100)]
Keep unstable target features for asm feature checking

Inline assembly uses the target features to determine which registers
are available on the current target. However it needs to be able to
access unstable target features for this.

Fixes #99071

2 years agobump CI LLVM to 14.0.5
Rémy Rakic [Fri, 13 May 2022 07:22:36 +0000 (09:22 +0200)]
bump CI LLVM to 14.0.5

The version 14.0.2 we currently use is busted on windows at the very
least.

2 years agoContinue themes CSS migration over CSS variables
Guillaume Gomez [Mon, 11 Jul 2022 12:51:39 +0000 (14:51 +0200)]
Continue themes CSS migration over CSS variables

2 years agoRemove unused CSS rules
Guillaume Gomez [Mon, 11 Jul 2022 13:01:03 +0000 (15:01 +0200)]
Remove unused CSS rules

2 years agoAuto merge of #99151 - Dylan-DPC:rollup-40aqkxy, r=Dylan-DPC
bors [Mon, 11 Jul 2022 12:16:20 +0000 (12:16 +0000)]
Auto merge of #99151 - Dylan-DPC:rollup-40aqkxy, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #98882 (explain doc comments in macros a bit)
 - #98907 (Deny float const params even when `adt_const_params` is enabled)
 - #99091 (Do not mention private types from other crates as impl candidates)
 - #99140 (Implement `SourceMap::is_span_accessible`)
 - #99147 (Mention similarly named associated type even if it's not clearly in supertrait)

Failed merges:

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

2 years agotidy
Oli Scherer [Mon, 11 Jul 2022 11:07:03 +0000 (11:07 +0000)]
tidy

2 years agoMake tests work on 32 bit and 64 bit
Oli Scherer [Mon, 11 Jul 2022 10:43:47 +0000 (10:43 +0000)]
Make tests work on 32 bit and 64 bit

2 years agoShow sizes in error output
Oli Scherer [Mon, 11 Jul 2022 10:34:01 +0000 (10:34 +0000)]
Show sizes in error output

2 years agoRename assertion macro
Oli Scherer [Mon, 11 Jul 2022 10:31:21 +0000 (10:31 +0000)]
Rename assertion macro

2 years agoSimplify assertion macro
Oli Scherer [Mon, 11 Jul 2022 10:30:50 +0000 (10:30 +0000)]
Simplify assertion macro

2 years agoMove checks to compile-time
Oli Scherer [Mon, 11 Jul 2022 10:29:02 +0000 (10:29 +0000)]
Move checks to compile-time

2 years agoHide niches in SIMD types, too
Oli Scherer [Mon, 11 Jul 2022 10:25:41 +0000 (10:25 +0000)]
Hide niches in SIMD types, too

2 years agoMore obvious closure name
Oli Scherer [Mon, 11 Jul 2022 10:11:28 +0000 (10:11 +0000)]
More obvious closure name

2 years agoRollup merge of #99147 - compiler-errors:issue-55673, r=lcnr
Dylan DPC [Mon, 11 Jul 2022 09:49:33 +0000 (15:19 +0530)]
Rollup merge of #99147 - compiler-errors:issue-55673, r=lcnr

Mention similarly named associated type even if it's not clearly in supertrait

Due to query cycle avoidance, we sometimes restrict the candidates in `complain_about_assoc_type_not_found` too much so that we can't detect typo replacements from just supertraits.

This creates a more general note of the existence of a similarly named associated type from _all_ visible traits when possible.

Fixes #55673

2 years agoRollup merge of #99140 - TaKO8Ki:implement-is-accessible-span, r=fee1-dead
Dylan DPC [Mon, 11 Jul 2022 09:49:32 +0000 (15:19 +0530)]
Rollup merge of #99140 - TaKO8Ki:implement-is-accessible-span, r=fee1-dead

Implement `SourceMap::is_span_accessible`

This patch adds `SourceMap::is_span_accessible` and replaces `span_to_snippet(span).is_ok()` and `span_to_snippet(span).is_err()` with it. This removes a `&str` to `String` conversion.

2 years agoRollup merge of #99091 - compiler-errors:private-types-should-stay-private, r=lcnr
Dylan DPC [Mon, 11 Jul 2022 09:49:31 +0000 (15:19 +0530)]
Rollup merge of #99091 - compiler-errors:private-types-should-stay-private, r=lcnr

Do not mention private types from other crates as impl candidates

Fixes #99080

2 years agoRollup merge of #98907 - compiler-errors:plz-no-float, r=oli-obk
Dylan DPC [Mon, 11 Jul 2022 09:49:30 +0000 (15:19 +0530)]
Rollup merge of #98907 - compiler-errors:plz-no-float, r=oli-obk

Deny float const params even when `adt_const_params` is enabled

Supersedes #98825
Fixes #98813

r? ``@oli-obk``