]> git.lizzy.rs Git - rust.git/log
rust.git
22 months agoRollup merge of #100852 - Samyak2:samyak/100459, r=Mark-Simulacrum
Matthias Krüger [Thu, 1 Sep 2022 19:37:08 +0000 (21:37 +0200)]
Rollup merge of #100852 - Samyak2:samyak/100459, r=Mark-Simulacrum

Use `getuid` to check instead of `USER` env var in rustbuild

This makes it consistent with `x.py` as changed in #95671

Fixes #100459

22 months agoRollup merge of #94467 - ibraheemdev:master, r=pnkfelix
Matthias Krüger [Thu, 1 Sep 2022 19:37:07 +0000 (21:37 +0200)]
Rollup merge of #94467 - ibraheemdev:master, r=pnkfelix

Add `special_module_name` lint

Declaring `lib` as a module is one of the most common beginner mistakes when trying to setup a binary and library target in the same crate. `special_module_name` lints against it, as well as `mod main;`
```
warning: found module declaration for main.rs
  --> $DIR/special_module_name.rs:4:1
   |
LL | mod main;
   | ^^^^^^^^^
   |
   = note: a binary crate cannot be used as library

warning: found module declaration for lib.rs
  --> $DIR/special_module_name.rs:1:1
   |
LL | mod lib;
   | ^^^^^^^^
   |
   = note: `#[warn(special_module_name)]` on by default
   = note: lib.rs is the root of this crate's library target
   = help: to refer to it from other targets, use the library's name as the path
   ```

Note that the help message is not the best in that it doesn't provide an example of an import path (`the_actual_crate_name::`), and doesn't check whether the current file is part of a library/binary target to provide more specific error messages. I'm not sure where this lint would have to be run to access that information.

22 months agoAuto merge of #101239 - oli-obk:tracing_cleanup, r=estebank
bors [Thu, 1 Sep 2022 16:25:32 +0000 (16:25 +0000)]
Auto merge of #101239 - oli-obk:tracing_cleanup, r=estebank

Tracing cleanup

r? `@ghost`

22 months agoAdjust stderr file
Oli Scherer [Wed, 31 Aug 2022 14:46:51 +0000 (14:46 +0000)]
Adjust stderr file

22 months agotracing::instrument cleanup
Oli Scherer [Tue, 28 Jun 2022 15:18:07 +0000 (15:18 +0000)]
tracing::instrument cleanup

22 months agoAlways import all tracing macros for the entire crate instead of piecemeal by module
Oli Scherer [Wed, 31 Aug 2022 13:09:26 +0000 (13:09 +0000)]
Always import all tracing macros for the entire crate instead of piecemeal by module

22 months agoDirectly use the `instrument` macro instead of its full path
Oli Scherer [Wed, 31 Aug 2022 13:01:10 +0000 (13:01 +0000)]
Directly use the `instrument` macro instead of its full path

22 months agoAuto merge of #100606 - cuviper:upgrade-linux-ci, r=Mark-Simulacrum
bors [Thu, 1 Sep 2022 13:21:03 +0000 (13:21 +0000)]
Auto merge of #100606 - cuviper:upgrade-linux-ci, r=Mark-Simulacrum

ci: Upgrade non-dist Linux testers from ubuntu:16.04 to 22.04

The main goal of updating to 22.04 is to get away from `llvm.allow-old-toolchain`.
A side benefit is that they can also use the system `cmake` instead of building one.

22 months agoAuto merge of #100958 - mikebenfield:workaround, r=nikic
bors [Thu, 1 Sep 2022 10:30:10 +0000 (10:30 +0000)]
Auto merge of #100958 - mikebenfield:workaround, r=nikic

compiler/rustc_codegen_ssa/src/mir/place.rs: Remove LLVM bug workaround

This memset was inserted as a workaround to Rust issue #34427, which was
an LLVM bug that apparently no longer manifests.

22 months agoAuto merge of #100869 - nnethercote:replace-ThinVec, r=spastorino
bors [Thu, 1 Sep 2022 08:01:06 +0000 (08:01 +0000)]
Auto merge of #100869 - nnethercote:replace-ThinVec, r=spastorino

Replace `rustc_data_structures::thin_vec::ThinVec` with `thin_vec::ThinVec`

`rustc_data_structures::thin_vec::ThinVec` looks like this:
```
pub struct ThinVec<T>(Option<Box<Vec<T>>>);
```
It's just a zero word if the vector is empty, but requires two
allocations if it is non-empty. So it's only usable in cases where the
vector is empty most of the time.

This commit removes it in favour of `thin_vec::ThinVec`, which is also
word-sized, but stores the length and capacity in the same allocation as
the elements. It's good in a wider variety of situation, e.g. in enum
variants where the vector is usually/always non-empty.

The commit also:
- Sorts some `Cargo.toml` dependency lists, to make additions easier.
- Sorts some `use` item lists, to make additions easier.
- Changes `clean_trait_ref_with_bindings` to take a
  `ThinVec<TypeBinding>` rather than a `&[TypeBinding]`, because this
  avoid some unnecessary allocations.

r? `@spastorino`

22 months agoAuto merge of #100707 - dzvon:fix-typo, r=davidtwco
bors [Thu, 1 Sep 2022 05:39:58 +0000 (05:39 +0000)]
Auto merge of #100707 - dzvon:fix-typo, r=davidtwco

Fix a bunch of typo

This PR will fix some typos detected by [typos].

I only picked the ones I was sure were spelling errors to fix, mostly in
the comments.

[typos]: https://github.com/crate-ci/typos

22 months agoAuto merge of #100537 - petrochenkov:piccheck, r=oli-obk
bors [Thu, 1 Sep 2022 03:13:46 +0000 (03:13 +0000)]
Auto merge of #100537 - petrochenkov:piccheck, r=oli-obk

rustc_target: Add some more target spec sanity checking

22 months agoAuto merge of #100210 - mystor:proc_macro_diag_struct, r=eddyb
bors [Thu, 1 Sep 2022 00:26:53 +0000 (00:26 +0000)]
Auto merge of #100210 - mystor:proc_macro_diag_struct, r=eddyb

proc_macro/bridge: send diagnostics over the bridge as a struct

This removes some RPC when creating and emitting diagnostics, and
simplifies the bridge slightly.

After this change, there are no remaining methods which take advantage
of the support for `&mut` references to objects in the store as
arguments, meaning that support for them could technically be removed if
we wanted. The only remaining uses of immutable references into the
store are `TokenStream` and `SourceFile`.

r? `@eddyb`

22 months agoAuto merge of #101249 - matthiaskrgr:rollup-wahnoz8, r=matthiaskrgr
bors [Wed, 31 Aug 2022 21:45:18 +0000 (21:45 +0000)]
Auto merge of #101249 - matthiaskrgr:rollup-wahnoz8, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #100787 (Pretty printing give proper error message without panic)
 - #100838 (Suggest moving redundant generic args of an assoc fn to its trait)
 - #100844 (migrate rustc_query_system to use SessionDiagnostic)
 - #101140 (Update Clippy)
 - #101161 (Fix uintended diagnostic caused by `drain(..)`)
 - #101165 (Use more `into_iter` rather than `drain(..)`)
 - #101229 (Link “? operator” to relevant chapter in The Book)
 - #101230 (lint: avoid linting diag functions with diag lints)
 - #101236 (Avoid needless buffer zeroing in `std::sys::windows::fs`)
 - #101240 (Fix a typo on `wasm64-unknown-unknown` doc)

Failed merges:

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

22 months agoRollup merge of #101240 - JohnTitor:JohnTitor-patch-1, r=ehuss
Matthias Krüger [Wed, 31 Aug 2022 19:30:18 +0000 (21:30 +0200)]
Rollup merge of #101240 - JohnTitor:JohnTitor-patch-1, r=ehuss

Fix a typo on `wasm64-unknown-unknown` doc

22 months agoRollup merge of #101236 - thomcc:winfs-nozero, r=ChrisDenton
Matthias Krüger [Wed, 31 Aug 2022 19:30:17 +0000 (21:30 +0200)]
Rollup merge of #101236 - thomcc:winfs-nozero, r=ChrisDenton

Avoid needless buffer zeroing in `std::sys::windows::fs`

Followup to https://github.com/rust-lang/rust/pull/101171 and https://github.com/rust-lang/rust/pull/101193. This finishes up avoiding buffer zeroing pointed out in https://github.com/rust-lang/rust/pull/100729#issuecomment-1220055311 (thanks!)

r? `@ChrisDenton`

22 months agoRollup merge of #101230 - davidtwco:translation-internal-lint-no-self-lint, r=fee1...
Matthias Krüger [Wed, 31 Aug 2022 19:30:16 +0000 (21:30 +0200)]
Rollup merge of #101230 - davidtwco:translation-internal-lint-no-self-lint, r=fee1-dead

lint: avoid linting diag functions with diag lints

Functions annotated with `#[rustc_lint_diagnostics]` are used by the diagnostic migration lints to know when to lint, but functions that are annotated with this attribute shouldn't themselves be linted.

cc #100717 https://github.com/rust-lang/rust/pull/101041#discussion_r959303706

22 months agoRollup merge of #101229 - mgeisler:link-try-operator, r=thomcc
Matthias Krüger [Wed, 31 Aug 2022 19:30:15 +0000 (21:30 +0200)]
Rollup merge of #101229 - mgeisler:link-try-operator, r=thomcc

Link “? operator” to relevant chapter in The Book

Before, the text simply asked people to use a symbol which is hard to
search for. Now the text links back to the chapter on error
propagation in The Book. That should help people find the relevant
keywords for further searches.

22 months agoRollup merge of #101165 - ldm0:drain_to_iter, r=cjgillot
Matthias Krüger [Wed, 31 Aug 2022 19:30:13 +0000 (21:30 +0200)]
Rollup merge of #101165 - ldm0:drain_to_iter, r=cjgillot

Use more `into_iter` rather than `drain(..)`

Clearer semantic.

22 months agoRollup merge of #101161 - ldm0:ldm_fix_diagnostic, r=cjgillot
Matthias Krüger [Wed, 31 Aug 2022 19:30:12 +0000 (21:30 +0200)]
Rollup merge of #101161 - ldm0:ldm_fix_diagnostic, r=cjgillot

Fix uintended diagnostic caused by `drain(..)`

Calling `drain(..)` makes later `suggestable_variants.is_empty()` always true, which makes the diagnostics unintended.

22 months agoRollup merge of #101140 - Jarcho:clippyup, r=Jarcho
Matthias Krüger [Wed, 31 Aug 2022 19:30:11 +0000 (21:30 +0200)]
Rollup merge of #101140 - Jarcho:clippyup, r=Jarcho

Update Clippy

r? ```@Manishearth```

22 months agoRollup merge of #100844 - evopen:migrate-diag, r=davidtwco
Matthias Krüger [Wed, 31 Aug 2022 19:30:09 +0000 (21:30 +0200)]
Rollup merge of #100844 - evopen:migrate-diag, r=davidtwco

migrate rustc_query_system to use SessionDiagnostic

issues:
* variable list is not supported in fluent
* ~~cannot have two sub diagnostic with the same tag (eg. 2 .note or 2 .help)~~

allow multiple tag with SessionSubdiagnostic derive

22 months agoRollup merge of #100838 - hkmatsumoto:move-gen-args-to-trait-when-appropriate, r...
Matthias Krüger [Wed, 31 Aug 2022 19:30:08 +0000 (21:30 +0200)]
Rollup merge of #100838 - hkmatsumoto:move-gen-args-to-trait-when-appropriate, r=davidtwco

Suggest moving redundant generic args of an assoc fn to its trait

Closes #89064

22 months agoRollup merge of #100787 - chenyukang:fix-100770-pretty-crash, r=petrochenkov
Matthias Krüger [Wed, 31 Aug 2022 19:30:07 +0000 (21:30 +0200)]
Rollup merge of #100787 - chenyukang:fix-100770-pretty-crash, r=petrochenkov

Pretty printing give proper error message without panic

Fixes #100770

22 months agoAuto merge of #100085 - RalfJung:op-ty-len, r=oli-obk
bors [Wed, 31 Aug 2022 18:42:49 +0000 (18:42 +0000)]
Auto merge of #100085 - RalfJung:op-ty-len, r=oli-obk

interpret: use new OpTy::len for Len rvalue

This avoids a `force_allocation`.

22 months agoUse `CountIsStart` in clippy
Jason Newcomb [Wed, 31 Aug 2022 13:33:32 +0000 (09:33 -0400)]
Use `CountIsStart` in clippy

22 months agoFix a typo on `wasm64-unknown-unknown` doc
Yuki Okushi [Wed, 31 Aug 2022 13:27:37 +0000 (22:27 +0900)]
Fix a typo on `wasm64-unknown-unknown` doc

22 months agoMerge commit 'f51aade56f93175dde89177a92e3669ebd8e7592' into clippyup
Jason Newcomb [Wed, 31 Aug 2022 13:24:45 +0000 (09:24 -0400)]
Merge commit 'f51aade56f93175dde89177a92e3669ebd8e7592' into clippyup

22 months agofix a clippy test
Ralf Jung [Wed, 31 Aug 2022 13:24:40 +0000 (15:24 +0200)]
fix a clippy test

22 months agointerpret: use new OpTy::len for Len rvalue
Ralf Jung [Wed, 3 Aug 2022 00:52:15 +0000 (20:52 -0400)]
interpret: use new OpTy::len for Len rvalue

This avoids a `force_allocation`

22 months agoAuto merge of #101238 - RalfJung:rollup-bzcmobj, r=RalfJung
bors [Wed, 31 Aug 2022 13:01:38 +0000 (13:01 +0000)]
Auto merge of #101238 - RalfJung:rollup-bzcmobj, r=RalfJung

Rollup of 7 pull requests

Successful merges:

 - #90946 (Ignore `reference`s in "Type::inner_def_id")
 - #100730 (Migrate rustc_monomorphize to use SessionDiagnostic)
 - #100753 (translations(rustc_session): migrates `rustc_session` to use `SessionDiagnostic` - Pt. 1)
 - #100831 (Migrate `symbol_mangling` module to new diagnostics structs)
 - #101204 (rustdoc: Resugar async fn return type in `clean`, not `html`)
 - #101216 (Use in-page links for sanitizer docs.)
 - #101237 (fix into_iter on ZST)

Failed merges:

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

22 months agolint: avoid linting diag functions with diag lints
David Wood [Wed, 31 Aug 2022 11:06:22 +0000 (12:06 +0100)]
lint: avoid linting diag functions with diag lints

Functions annotated with `#[rustc_lint_diagnostics]` are used by the
diagnostic migration lints to know when to lint, but functions that are
annotated with this attribute shouldn't themselves be linted.

Signed-off-by: David Wood <david.wood@huawei.com>
22 months agoRollup merge of #101237 - RalfJung:into-iter-zst, r=thomcc
Ralf Jung [Wed, 31 Aug 2022 12:29:55 +0000 (14:29 +0200)]
Rollup merge of #101237 - RalfJung:into-iter-zst, r=thomcc

fix into_iter on ZST

Fixes https://github.com/rust-lang/rust/issues/101235
Thanks to `@ChrisDenton` for [spotting the problem](https://github.com/rust-lang/rust/pull/100819#pullrequestreview-1091755930).

22 months agoRollup merge of #101216 - ehuss:sanitizer-links, r=JohnTitor
Ralf Jung [Wed, 31 Aug 2022 12:29:54 +0000 (14:29 +0200)]
Rollup merge of #101216 - ehuss:sanitizer-links, r=JohnTitor

Use in-page links for sanitizer docs.

This updates the sanitizer documentation page so that the links in the summary at the top jump to the relevant sections within the page instead of leading away to a different site. I think this makes it a little easier to navigate this page which has gotten quite long.

This also fixes the broken link for MemTagSanitizer which was not defined.  It also adds MemTagSanitizer to the external summary list at the bottom of the page.

22 months agoRollup merge of #101204 - aDotInTheVoid:async-resugar-in-clean, r=GuillaumeGomez
Ralf Jung [Wed, 31 Aug 2022 12:29:54 +0000 (14:29 +0200)]
Rollup merge of #101204 - aDotInTheVoid:async-resugar-in-clean, r=GuillaumeGomez

rustdoc: Resugar async fn return type in `clean`, not `html`

This way it also happens for json output.

Fixes #101199

r? ``@GuillaumeGomez``

22 months agoRollup merge of #100831 - JhonnyBillM:migrate-symbol-mangling-to-diagnostics-structs...
Ralf Jung [Wed, 31 Aug 2022 12:29:53 +0000 (14:29 +0200)]
Rollup merge of #100831 - JhonnyBillM:migrate-symbol-mangling-to-diagnostics-structs, r=davidtwco

Migrate `symbol_mangling` module to new diagnostics structs

22 months agoRollup merge of #100753 - LuisCardosoOliveira:translation-migrate-session, r=davidtwco
Ralf Jung [Wed, 31 Aug 2022 12:29:52 +0000 (14:29 +0200)]
Rollup merge of #100753 - LuisCardosoOliveira:translation-migrate-session, r=davidtwco

translations(rustc_session): migrates `rustc_session` to use `SessionDiagnostic` - Pt. 1

## Description

This is the first PR for the migration of the module `rustc_session`. You can follow my progress [here](https://github.com/rust-lang/rust/issues/100717#issuecomment-1220279883).

The PR migrates the files `cgu_reuse_tracker` and `parse.rs` to use `SessionDiagnostic `.

22 months agoRollup merge of #100730 - CleanCut:diagnostics-rustc_monomorphize, r=davidtwco
Ralf Jung [Wed, 31 Aug 2022 12:29:51 +0000 (14:29 +0200)]
Rollup merge of #100730 - CleanCut:diagnostics-rustc_monomorphize, r=davidtwco

Migrate rustc_monomorphize to use SessionDiagnostic

### Description

- Migrates diagnostics in `rustc_monomorphize` to use `SessionDiagnostic`
- Adds an `impl IntoDiagnosticArg for PathBuf`

### TODO / Help!
- [x] I'm having trouble figuring out how to apply an optional note. 😕  Help!?
  - Resolved. It was bad docs. Fixed in https://github.com/rust-lang/rustc-dev-guide/pull/1437/files
- [x] `errors:RecursionLimit` should be `#[fatal ...]`, but that doesn't exist so it's `#[error ...]` at the moment.
  - Maybe I can switch after this is merged in? --> https://github.com/rust-lang/rust/pull/100694
  - Or maybe I need to manually implement `SessionDiagnostic` instead of deriving it?
- [x] How does one go about converting an error inside of [a call to struct_span_lint_hir](https://github.com/rust-lang/rust/blob/8064a495086c2e63c0ef77e8e82fe3b9b5dc535f/compiler/rustc_monomorphize/src/collector.rs#L917-L927)?
- [x] ~What placeholder do you use in the fluent template to refer to the value in a vector? It seems like [this code](https://github.com/rust-lang/rust/blob/0b79f758c9aa6646606662a6d623a0752286cd17/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs#L83-L114) ought to have the answer (or something near it)...but I can't figure it out.~ You can't. Punted.

22 months agoRollup merge of #90946 - GuillaumeGomez:def-id-remove-weird-case, r=Manishearth
Ralf Jung [Wed, 31 Aug 2022 12:29:51 +0000 (14:29 +0200)]
Rollup merge of #90946 - GuillaumeGomez:def-id-remove-weird-case, r=Manishearth

Ignore `reference`s in "Type::inner_def_id"

Fixes #90775.

Reopening of #90726.

As discussed on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/rendering.20for.20reference.20primitive.20doc.20page), the reference page shouldn't list these implementations (since they are listed on the types and on the traits in any case). And more generally, you don't implement something on a reference but on something behind a reference. I think it's the important point.

So currently it looks like this:

![Screenshot from 2021-11-16 10-20-41](https://user-images.githubusercontent.com/3050060/141957799-57aeadc5-41f8-45f6-a4a5-33b1eca6a500.png)

With this PR, only the implementations over generics behind a reference are kept.

You can test it [here](https://rustdoc.crud.net/imperio/def-id-remove-weird-case/std/primitive.reference.html).

cc ``@camelid``

22 months agofix into_iter on ZST
Ralf Jung [Wed, 31 Aug 2022 12:21:35 +0000 (14:21 +0200)]
fix into_iter on ZST

22 months agoAvoid needless buffer zeroing in `std::sys::windows::fs`
Thom Chiovoloni [Tue, 30 Aug 2022 13:15:34 +0000 (06:15 -0700)]
Avoid needless buffer zeroing in `std::sys::windows::fs`

22 months agoSessionDiagnostic for QueryOverflow error
Li Yuanheng [Sat, 27 Aug 2022 03:55:38 +0000 (11:55 +0800)]
SessionDiagnostic for QueryOverflow error

22 months agodelete leftover comment
Li Yuanheng [Thu, 25 Aug 2022 15:32:28 +0000 (23:32 +0800)]
delete leftover comment

22 months agouse derive proc macro to impl SessionDiagnostic
Yuanheng Li [Tue, 23 Aug 2022 03:19:38 +0000 (11:19 +0800)]
use derive proc macro to impl SessionDiagnostic

fixes `SessionSubdiagnostic` to accept multiple attributes
emitting list of fluent message remains unresolved

22 months agolink related issue to FIXME
Li Yuanheng [Mon, 22 Aug 2022 23:23:36 +0000 (07:23 +0800)]
link related issue to FIXME

Co-authored-by: David Wood <agile.lion3441@fuligin.ink>
22 months agomigrate rustc_query_system to use SessionDiagnostic
Yuanheng Li [Sun, 21 Aug 2022 13:37:05 +0000 (21:37 +0800)]
migrate rustc_query_system to use SessionDiagnostic

with manual impl SessionDiagnostic

22 months agoCorrect typo
Dezhi Wu [Thu, 18 Aug 2022 08:36:49 +0000 (16:36 +0800)]
Correct typo

22 months agoFix ci checks
Dezhi Wu [Thu, 18 Aug 2022 02:59:16 +0000 (10:59 +0800)]
Fix ci checks

22 months agoFix a bunch of typo
Dezhi Wu [Thu, 18 Aug 2022 02:13:37 +0000 (10:13 +0800)]
Fix a bunch of typo

This PR will fix some typos detected by [typos].

I only picked the ones I was sure were spelling errors to fix, mostly in
the comments.

[typos]: https://github.com/crate-ci/typos

22 months agoAdd regression test for implementations displayed on reference primitive type
Guillaume Gomez [Tue, 30 Aug 2022 18:51:58 +0000 (20:51 +0200)]
Add regression test for implementations displayed on reference primitive type

22 months agoPrint only blanket implementations on reference primitive type
Guillaume Gomez [Tue, 30 Aug 2022 18:21:56 +0000 (20:21 +0200)]
Print only blanket implementations on reference primitive type

22 months agoLink “? operator” to relevant chapter in The Book
Martin Geisler [Wed, 31 Aug 2022 08:35:36 +0000 (10:35 +0200)]
Link “? operator” to relevant chapter in The Book

Before, the text simply asked people to use a symbol which is hard to
search for. Now the text links back to the chapter on error
propagation in The Book. That should help people find the relevant
keywords for further searches.

22 months agoAuto merge of #9397 - Jarcho:trait_dup_order, r=dswij
bors [Wed, 31 Aug 2022 08:07:33 +0000 (08:07 +0000)]
Auto merge of #9397 - Jarcho:trait_dup_order, r=dswij

Fix the emission order of `trait_duplication_in_bounds`

Makes the lint emit in source order rather than whatever order the hash map happens to be in. This is currently blocking the sync into rustc.

changelog: None

22 months agoAuto merge of #101225 - matthiaskrgr:rollup-9s1chas, r=matthiaskrgr
bors [Wed, 31 Aug 2022 07:57:09 +0000 (07:57 +0000)]
Auto merge of #101225 - matthiaskrgr:rollup-9s1chas, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #100970 (Allow deriving multipart suggestions)
 - #100984 (Reinstate preloading of some dll imports)
 - #101011 (Use getentropy when possible on all Apple platforms)
 - #101025 (Add tier-3 support for powerpc64 and riscv64 openbsd)
 - #101049 (Remove span fatal from ast lowering)
 - #101100 (Make call suggestions more general and more accurate)
 - #101171 (Fix UB from misalignment and provenance widening in `std::sys::windows`)
 - #101185 (Tweak `WellFormedLoc`s a bit)

Failed merges:

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

22 months agoRollup merge of #101185 - compiler-errors:tweak-wf-locs, r=davidtwco
Matthias Krüger [Wed, 31 Aug 2022 05:58:02 +0000 (07:58 +0200)]
Rollup merge of #101185 - compiler-errors:tweak-wf-locs, r=davidtwco

Tweak `WellFormedLoc`s a bit

Gives a bit tighter spans in returns and generic ty defaults

22 months agoRollup merge of #101171 - thomcc:fix-winfs-ub, r=ChrisDenton
Matthias Krüger [Wed, 31 Aug 2022 05:58:01 +0000 (07:58 +0200)]
Rollup merge of #101171 - thomcc:fix-winfs-ub, r=ChrisDenton

Fix UB from misalignment and provenance widening in `std::sys::windows`

This fixes two types of UB:

1. Reading past the end of a reference in types like `&c::REPARSE_DATA_BUFFER` (see https://github.com/rust-lang/unsafe-code-guidelines/issues/256). This is fixed by using `addr_of!`. I think there are probably a couple more cases where we do this for other structures, and will look into it in a bit.

2. Failing to ensure that a `[u8; N]` on the stack is sufficiently aligned to convert to a `REPARSE_DATA_BUFFER`. ~~This was done by introducing a new `AlignedAs` struct that allows aligning one type to the alignment of another type. I expect there are other places where we have this issue too, or I wouldn't introduce this type, but will get to them after this lands.~~

    ~~Worth noting, it *is* implemented in a way that can cause problems depending on how we fix #81996, but this would be caught by the test I added (and presumably if we decide to fix that in a way that would break this code, we'd also introduce a `#[repr(simple)]` or `#[repr(linear)]` as a replacement for this usage of `#[repr(C)]`).~~

    Edit: None of that is still in the code, I just went with a `Align8` since that's all we'll need for almost everything we want to call.

These are more or less "potential UB" since it's likely at the moment everything works fine, although the alignment not causing issues might just be down to luck (and x86 being forgiving).

~~NB: I've only ensured this check builds, but will run tests soon.~~ All tests pass, including stage2 compiler tests.

r? ``@ChrisDenton``

22 months agoRollup merge of #101100 - compiler-errors:generalize-call-suggestions, r=petrochenkov
Matthias Krüger [Wed, 31 Aug 2022 05:58:00 +0000 (07:58 +0200)]
Rollup merge of #101100 - compiler-errors:generalize-call-suggestions, r=petrochenkov

Make call suggestions more general and more accurate

Cleans up some suggestions that have to do with adding `()` to make typeck happy.

1. Drive-by rename of `expr_t` to `base_ty` since it's the type of the `base_expr`
1. Autoderef until we get to a callable type in `suggest_fn_call`.
1. Don't erroneously suggest calling constructor when a method/field does not exist on it.
1. Suggest calling a method receiver if its function output has a method (e.g. `fn.method()` => `fn().method()`)
1. Extend call suggestions to type parameters, fn pointers, trait objects where possible
1. Suggest calling in operators too (fixes #101054)
1. Use `/* {ty} */` as argument placeholder instead of just `_`, which is confusing and makes suggestions look less like `if let` syntax.

22 months agoRollup merge of #101049 - JeanCASPAR:remove-span_fatal-from-ast_lowering, r=davidtwco
Matthias Krüger [Wed, 31 Aug 2022 05:57:59 +0000 (07:57 +0200)]
Rollup merge of #101049 - JeanCASPAR:remove-span_fatal-from-ast_lowering, r=davidtwco

Remove span fatal from ast lowering

Now the crate `rustc_ast_lowering` is fully migrated to `SessionDiagnostic`.

r? ``@davidtwco``

22 months agoRollup merge of #101025 - semarie:openbsd-archs, r=petrochenkov
Matthias Krüger [Wed, 31 Aug 2022 05:57:58 +0000 (07:57 +0200)]
Rollup merge of #101025 - semarie:openbsd-archs, r=petrochenkov

Add tier-3 support for powerpc64 and riscv64 openbsd

# powerpc64
- MCP for [powerpc64-unknown-openbsd tier-3 support](https://github.com/rust-lang/compiler-team/issues/551)
- only need to add spec definition in rustc_target

# riscv64
- MCP for [riscv64-unknown-openbsd tier-3 support](https://github.com/rust-lang/compiler-team/issues/552)
- add spec definition in rustc_target
- follow freebsd about avoiding linking with `libatomic`

22 months agoRollup merge of #101011 - BlackHoleFox:apple-random-improvements, r=thomcc
Matthias Krüger [Wed, 31 Aug 2022 05:57:56 +0000 (07:57 +0200)]
Rollup merge of #101011 - BlackHoleFox:apple-random-improvements, r=thomcc

Use getentropy when possible on all Apple platforms

As the current code comments say, `SecRandomCopyBytes` is very heavyweight (regardless of purpose) compared to just asking the kernel directly for bytes from its own CSPRNG. We were not previously making an attempt to use the more efficient `getentropy` call on other Apple targets, instead solely using it on macOS. As the function is available on newer versions of Apple's different OSes, this changes the random filling to always attempt it first everywhere, only falling back to the less ideal alternatives after. This also cleans up the multiple Apple `imp` blocks into one.

It also should give a perf improvement, even if its likely unnoticeably small.

Refed XCode header for `getentropy` in the SDK:
```h
int getentropy(void* buffer, size_t size) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
```

r? ``@thomcc``

22 months agoRollup merge of #100984 - ChrisDenton:reinstate-init, r=Mark-Simulacrum
Matthias Krüger [Wed, 31 Aug 2022 05:57:55 +0000 (07:57 +0200)]
Rollup merge of #100984 - ChrisDenton:reinstate-init, r=Mark-Simulacrum

Reinstate preloading of some dll imports

I've now come around to the conclusion that there is a justification for pre-loading the synchronization functions `WaitOnAddress` and `WakeByAddressSingle`. I've found this to have a particularly impact in testing frameworks that may have short lived processes which immediately spawn lots of threads.

Also, because pre-main initializers imply a single-threaded environment, we can switch back to using relaxed atomics which might be a minor perf improvement on some platforms (though I doubt it's particularly notable).

r? ``@Mark-Simulacrum`` and sorry for the churn here.

For convenience I'll summarise previous issues with preloading and the solutions that are included in this PR (if any):

**Issue:** User pre-main initializers may be run before std's
**Solution:** The std now uses initializers that are guaranteed to run earlier than the old initializers. A note is also added that users should not copy std's behaviour if they want to ensure they run their initializers after std.

**Issue:** Miri does not understand pre-main initializers.
**Solution:** For miri only, run the function loading lazily instead.

**Issue:** We should ideally use `LoadLibrary` to get "api-ms-win-core-synch-l1-2-0". Only "ntdll" and "kernel32" are guaranteed to always be loaded.
**Solution:** None. We can't use `LoadLibrary` pre-main. However, in the past `GetModuleHandle` has always worked in practice so this should hopefully not be a problem.

If/when Windows 7 support is dropped, we can finally remove all this for good and just use normal imports.

22 months agoRollup merge of #100970 - Xiretza:derive-multipart-suggestion, r=davidtwco
Matthias Krüger [Wed, 31 Aug 2022 05:57:54 +0000 (07:57 +0200)]
Rollup merge of #100970 - Xiretza:derive-multipart-suggestion, r=davidtwco

Allow deriving multipart suggestions

This turned into a bit more of a rewrite than I was initially hoping for... Still, I think the `SessionSubdiagnostic` derive is a little cleaner overall now, and closer to the `SessionDiagnostic` derive to make future code sharing easier.

r? ``@davidtwco``

22 months agoFix uintended diagnostic caused by `drain(..)`
Donough Liu [Mon, 29 Aug 2022 17:44:06 +0000 (18:44 +0100)]
Fix uintended diagnostic caused by `drain(..)`

22 months agoAuto merge of #101220 - JohnTitor:rollup-ov7upr7, r=JohnTitor
bors [Wed, 31 Aug 2022 02:24:44 +0000 (02:24 +0000)]
Auto merge of #101220 - JohnTitor:rollup-ov7upr7, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #100804 (Fix search results color on hover for ayu theme)
 - #100892 (Add `AsFd` implementations for stdio types on WASI.)
 - #100927 (Adding new Fuchsia rustup docs... reworking walkthrough)
 - #101088 (Set DebuginfoKind::Pdb in msvc_base)
 - #101159 (add tracking issue number to const_slice_split_at_not_mut)
 - #101192 (Remove path string)
 - #101193 (Avoid zeroing large stack buffers in stdio on Windows)
 - #101197 (:arrow_up: rust-analyzer)
 - #101200 (Add test for issue #85872)
 - #101219 (Update books)

Failed merges:

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

22 months agoRollup merge of #101219 - ehuss:update-books, r=ehuss
Yuki Okushi [Tue, 30 Aug 2022 23:47:24 +0000 (08:47 +0900)]
Rollup merge of #101219 - ehuss:update-books, r=ehuss

Update books

## nomicon

1 commits in 8e6aa3448515a0654e347b5e2510f1d4bc4d5a64..d880e6ac2acf133dce640da24b9fb692844f02d4
2022-08-15 15:36:13 -0700 to 2022-08-24 12:42:34 -0700
- Update lifetimes.md (rust-lang/nomicon#372)

## reference

2 commits in e647eb102890e8927f488bea12672b079eff8d9d..f62e93c28323ed9637d0a205a0c256498674a509
2022-08-16 11:35:27 -0700 to 2022-08-28 10:01:28 -0700
- Update examples of what implements `Termination` (rust-lang/reference#1256)
- allow to quickly edit a page directly on github (rust-lang/reference#1254)

## book

7 commits in 42ca0ef484fcc8437a0682cee23abe4b7c407d52..0a5421ceb238357b3634fb75234eba4d1dad643c
2022-08-12 21:52:02 -0400 to 2022-08-28 19:51:04 -0400
- Add a missing line generated by 'cargo new'
- Clarify ThreadPool-Worker analogy wording
- Fixed incorrect mutex lock usage
- Merge remote-tracking branch 'origin/pr/3314'
- Put interactive book notice in a blockquote box to draw attention to it
- Remove the word 'new' because someday it won't be new anymore
- Merge remote-tracking branch 'origin/pr/3304'

## rustc-dev-guide

27 commits in d3daa1f28e169087becbc5e2b49ac91ca0405a44..04892c1a6fc145602ac7367945fda9d4ee83c9fb
2022-08-13 10:00:38 +0900 to 2022-08-29 20:07:51 +0200
- Fix the link to `Parser` struct
- Remove a dangling link on "The `#[test]` attribute"
- Update the stabilization guide to refer to the new placeholder system
- Refine the lintstore section (rust-lang/rustc-dev-guide#1429)
- typo
- Updates text to refer to LLVM documentation.
- Updates LLVM prereqs since upgrade to C++17.
- we got 3 (rust-lang/rustc-dev-guide#1447)
- A few corrections
- Update some statements
- correct typo in parallel-rustc.md
- Correct some statements in parallel-rustc.md
- update parallel-rustc.md
- address review comment
- make date-check more easy to use
- update thir output (rust-lang/rustc-dev-guide#1445)
- do not offer option to run code (rust-lang/rustc-dev-guide#1442)
- fix quick-edit link (rust-lang/rustc-dev-guide#1441)
- Document changes introduced by kind-less SessionDiagnostics
- diagnostics: fix outdated use of string slugs (rust-lang/rustc-dev-guide#1436)
- Add missing lifetime (rust-lang/rustc-dev-guide#1439)
- more syntax fixes
- fix incorrect #[note] syntax
- Update slug style to use _ instead of - (rust-lang/rustc-dev-guide#1426)
- remove incorrect info (rust-lang/rustc-dev-guide#1435)
- fix lifetime name (rust-lang/rustc-dev-guide#1431)
- Update the date reference around Git submodule bug (rust-lang/rustc-dev-guide#1430)

22 months agoRollup merge of #101200 - nikic:issue-85872, r=compiler-errors
Yuki Okushi [Tue, 30 Aug 2022 23:47:23 +0000 (08:47 +0900)]
Rollup merge of #101200 - nikic:issue-85872, r=compiler-errors

Add test for issue #85872

This has been fixed by the LLVM 15 upgrade, add a codegen test.

Fixes #85872.

22 months agoRollup merge of #101197 - lnicola:rust-analyzer-2022-08-30, r=lnicola
Yuki Okushi [Tue, 30 Aug 2022 23:47:22 +0000 (08:47 +0900)]
Rollup merge of #101197 - lnicola:rust-analyzer-2022-08-30, r=lnicola

:arrow_up: rust-analyzer

r? ``@ghost``

22 months agoRollup merge of #101193 - thomcc:win-stdio-nozero, r=ChrisDenton
Yuki Okushi [Tue, 30 Aug 2022 23:47:21 +0000 (08:47 +0900)]
Rollup merge of #101193 - thomcc:win-stdio-nozero, r=ChrisDenton

Avoid zeroing large stack buffers in stdio on Windows

Does what it says on the tin, using `[MaybeUninit<u16>; N]` instead of `[0u16; N]`. These buffers seem to be around 8kb, which is big enough that this is likely to be a very nice perf boost to stdio-heavy windows code.

r? ``@ChrisDenton``

*(Note: this PR also has a commit that adds windows to CI, but as it mentions I'll revert that after it comes out green -- I can only do a check build on the machine I'm typing this on)*

22 months agoRollup merge of #101192 - TaKO8Ki:remove-path-string, r=compiler-errors
Yuki Okushi [Tue, 30 Aug 2022 23:47:20 +0000 (08:47 +0900)]
Rollup merge of #101192 - TaKO8Ki:remove-path-string, r=compiler-errors

Remove path string

22 months agoRollup merge of #101159 - tspiteri:track-const-slice-split_at, r=Mark-Simulacrum
Yuki Okushi [Tue, 30 Aug 2022 23:47:19 +0000 (08:47 +0900)]
Rollup merge of #101159 - tspiteri:track-const-slice-split_at, r=Mark-Simulacrum

add tracking issue number to const_slice_split_at_not_mut

Add issue number #101158 to `const_slice_split_at_not_mut` feature.

22 months agoRollup merge of #101088 - nicholasbishop:bishop-uefi-pdb, r=davidtwco
Yuki Okushi [Tue, 30 Aug 2022 23:47:18 +0000 (08:47 +0900)]
Rollup merge of #101088 - nicholasbishop:bishop-uefi-pdb, r=davidtwco

Set DebuginfoKind::Pdb in msvc_base

This PDB setting was added to `windows_msvc_base` in
https://github.com/rust-lang/rust/pull/98051. It's also needed for the
UEFI targets, and since `uefi_msvc_base` and `windows_msvc_base` are the
only things that inherit from `msvc_base`, just move the PDB setting up
to `mscv_base` to cover both.

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

22 months agoRollup merge of #100927 - andrewpollack:fuchsia-docs-rustup, r=tmandry
Yuki Okushi [Tue, 30 Aug 2022 23:47:17 +0000 (08:47 +0900)]
Rollup merge of #100927 - andrewpollack:fuchsia-docs-rustup, r=tmandry

Adding new Fuchsia rustup docs... reworking walkthrough

Docs improvements:
* Adding new `rustup` target add for Fuchsia targets
* Reworking walkthrough to show directory building as it happens
* Reworking walkthrough to use `hello_fuchsia_pkg/` directory

cc. `@djkoloski`

22 months agoRollup merge of #100892 - sunfishcode:wasi-stdio-asfd, r=joshtriplett
Yuki Okushi [Tue, 30 Aug 2022 23:47:15 +0000 (08:47 +0900)]
Rollup merge of #100892 - sunfishcode:wasi-stdio-asfd, r=joshtriplett

Add `AsFd` implementations for stdio types on WASI.

This mirrors the implementations on Unix platforms, and also mirrors the
existing `AsRawFd` impls.

22 months agoRollup merge of #100804 - GuillaumeGomez:search-results-color-ayu, r=notriddle
Yuki Okushi [Tue, 30 Aug 2022 23:47:14 +0000 (08:47 +0900)]
Rollup merge of #100804 - GuillaumeGomez:search-results-color-ayu, r=notriddle

Fix search results color on hover for ayu theme

Before:

![image](https://user-images.githubusercontent.com/3050060/185747851-038d2333-8b01-44a8-a104-ceb7410ac089.png)

After:

![image](https://user-images.githubusercontent.com/3050060/185747869-53b502f5-5800-470f-b897-2683f1cdb7ee.png)

You can test it [here](https://rustdoc.crud.net/imperio/search-results-color-ayu/foo/index.html?search=item).

r? ``@jsha``

22 months agoAuto merge of #99102 - JakobDegen:reorder-generators, r=oli-obk
bors [Tue, 30 Aug 2022 23:43:33 +0000 (23:43 +0000)]
Auto merge of #99102 - JakobDegen:reorder-generators, r=oli-obk

Rework definition of MIR phases to more closely reflect semantic concerns

Implements most of rust-lang/compiler-team#522 .

I tried my best to restrict this PR to the "core" parts of the MCP. In other words, this includes just enough changes to make the new definition of `MirPhase` make sense. That means there are a couple of FIXMEs lying around. Depending on what reviewers prefer, I can either fix them in this PR or send follow up PRs. There are also a couple other refactorings of the `rustc_mir_transform/src/lib.rs` file that I want to do in follow ups that I didn't leave explicit FIXMEs for.

22 months agoUpdate books
Eric Huss [Tue, 30 Aug 2022 23:18:42 +0000 (16:18 -0700)]
Update books

22 months agoUpdate src/doc/rustc/src/platform-support/fuchsia.md
andrewpollack [Tue, 30 Aug 2022 23:06:36 +0000 (16:06 -0700)]
Update src/doc/rustc/src/platform-support/fuchsia.md

Co-authored-by: Tyler Mandry <tmandry@gmail.com>
22 months agoUpdate src/doc/rustc/src/platform-support/fuchsia.md
andrewpollack [Tue, 30 Aug 2022 23:06:27 +0000 (16:06 -0700)]
Update src/doc/rustc/src/platform-support/fuchsia.md

Co-authored-by: Tyler Mandry <tmandry@gmail.com>
22 months agoUse in-page links for sanitizer docs.
Eric Huss [Tue, 30 Aug 2022 21:54:37 +0000 (14:54 -0700)]
Use in-page links for sanitizer docs.

22 months agoAdding new Fuchsia rustup docs... reworking walkthrough
Andrew Pollack [Tue, 23 Aug 2022 19:06:49 +0000 (19:06 +0000)]
Adding new Fuchsia rustup docs... reworking walkthrough

22 months agoAuto merge of #98919 - 5225225:stricter-invalid-value, r=RalfJung
bors [Tue, 30 Aug 2022 20:39:01 +0000 (20:39 +0000)]
Auto merge of #98919 - 5225225:stricter-invalid-value, r=RalfJung

Strengthen invalid_value lint to forbid uninit primitives, adjust docs to say that's UB

For context: https://github.com/rust-lang/rust/issues/66151#issuecomment-1174477404=

This does not make it a FCW, but it does explicitly state in the docs that uninit integers are UB.

This also doesn't affect any runtime behavior, uninit u32's will still successfully be created through mem::uninitialized.

22 months agoUPDATE - to support diag introduced in PR #100765
Jhonny Bill Mena [Sun, 21 Aug 2022 15:09:00 +0000 (11:09 -0400)]
UPDATE - to support diag introduced in PR #100765

22 months agoADD - diagnostics lints to symbol_mangling module
Jhonny Bill Mena [Sun, 21 Aug 2022 04:57:52 +0000 (00:57 -0400)]
ADD - diagnostics lints to symbol_mangling module

22 months agoADD - migrate InvalidDefPath to new diagnostics infra
Jhonny Bill Mena [Sun, 21 Aug 2022 04:51:33 +0000 (00:51 -0400)]
ADD - migrate InvalidDefPath to new diagnostics infra

22 months agoUPDATE - accept String instead of unused 'str
Jhonny Bill Mena [Sun, 21 Aug 2022 04:42:59 +0000 (00:42 -0400)]
UPDATE - accept String instead of unused 'str

22 months agoADD - migrate InvalidTraitItem and AltInvalidTraitItem errors
Jhonny Bill Mena [Sun, 21 Aug 2022 04:38:23 +0000 (00:38 -0400)]
ADD - migrate InvalidTraitItem and AltInvalidTraitItem errors

Thought of doing this by having a struct and an enum with Default and Alt cases, but not sure if we wanted to have the text in code instead of having “demangling()” and “demangling-alt()” in the ftl file.

Don’t like the current way of having structs representing the same-ish and using long names to distinguish their expectations, instead of putting this in an enum and handling the different cases inside the type.

I am fine with whichever option the team prefers; also understand having them as separate structs keeps it simple.

22 months agoADD - InvalidSymbolName to migrate symbol-name({}) error to new diagnostics infraestr...
Jhonny Bill Mena [Sat, 27 Aug 2022 04:24:13 +0000 (00:24 -0400)]
ADD - InvalidSymbolName to migrate symbol-name({}) error to new diagnostics infraestructure

ADD - dependencies needed to port a module to new Diagnostics infra (rustc_macros, rustc_errors, errors file, and fluent file)

22 months agoClean up render_assoc_items_inner a bit
Guillaume Gomez [Tue, 30 Aug 2022 15:11:07 +0000 (17:11 +0200)]
Clean up render_assoc_items_inner a bit

22 months agoAuto merge of #9373 - lukaslueg:result_large_err, r=Alexendoo
bors [Tue, 30 Aug 2022 18:20:45 +0000 (18:20 +0000)]
Auto merge of #9373 - lukaslueg:result_large_err, r=Alexendoo

Initial implementation `result_large_err`

This is a shot at #6560, #4652, and #3884. The lint checks for `Result` being returned from functions/methods where the `Err` variant is larger than a configurable threshold (the default of which is 128 bytes). There has been some discussion around this, which I'll try to quickly summarize:

* A large `Err`-variant may force an equally large `Result` if `Err` is actually bigger than `Ok`.
* There is a cost involved in large `Result`, as LLVM may choose to `memcpy` them around above a certain size.
* We usually expect the `Err` variant to be seldomly used, but pay the cost every time.
* `Result` returned from library code has a high chance of bubbling up the call stack, getting stuffed into `MyLibError { IoError(std::io::Error), ParseError(parselib::Error), ...}`, exacerbating the problem.

This PR deliberately does not take into account comparing the `Ok` to the `Err` variant (e.g. a ratio, or one being larger than the other). Rather we choose an absolute threshold for `Err`'s size, above which we warn. The reason for this is that `Err`s probably get `map_err`'ed further up the call stack, and we can't draw conclusions from the ratio at the point where the `Result` is returned. A relative threshold would also be less predictable, while not accounting for the cost of LLVM being forced to generate less efficient code if the `Err`-variant is _large_ in absolute terms.

We lint private functions as well as public functions, as the perf-cost applies to in-crate code as well.

In order to account for type-parameters, I conjured up `fn approx_ty_size`. The function relies on `LateContext::layout_of` to compute the actual size, and in case of failure (e.g. due to generics) tries to come up with an "at least size". In the latter case, the size of obviously wrong, but the inspected size certainly can't be smaller than that. Please give the approach a heavy dose of review, as I'm not actually familiar with the type-system at all (read: I have no idea what I'm doing).

The approach does, however flimsy it is, allow us to successfully lint situations like

```rust
pub union UnionError<T: Copy> {
    _maybe: T,
    _or_perhaps_even: (T, [u8; 512]),
}

// We know `UnionError<T>` will be at least 512 bytes, no matter what `T` is
pub fn param_large_union<T: Copy>() -> Result<(), UnionError<T>> {
    Ok(())
}
```

I've given some refactoring to `functions/result_unit_err.rs` to re-use some bits. This is also the groundwork for #6409

The default threshold is 128 because of https://github.com/rust-lang/rust-clippy/issues/4652#issue-505670554

`lintcheck` does not trigger this lint for a threshold of 128. It does warn for 64, though.

The suggestion currently is the following, which is just a placeholder for discussion to be had. I did have the computed size in a `span_label`. However, that might cause both ui-tests here and lints elsewhere to become flaky wrt to their output (as the size is platform dependent).

```
error: the `Err`-variant returned via this `Result` is very large
  --> $DIR/result_large_err.rs:36:34
   |
LL | pub fn param_large_error<R>() -> Result<(), (u128, R, FullyDefinedLargeError)> {
   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The `Err` variant is unusually large, at least 128 bytes
```

changelog: Add [`result_large_err`] lint

22 months agoAuto merge of #101203 - fortanix:raoul/remove_rls_from_git_submodule_update, r=jyn514
bors [Tue, 30 Aug 2022 17:33:24 +0000 (17:33 +0000)]
Auto merge of #101203 - fortanix:raoul/remove_rls_from_git_submodule_update, r=jyn514

Avoid bootstrap from updating rls submodule

Our CI performing tests of the `x86_64-fortanix-unknown-sgx` failed with:
```
21:00:53 + ./configure --enable-lld --disable-rpath --set llvm.ninja=false --set rust.verbose-tests=true
21:00:53 + ./x.py test --stage=1 --target=x86_64-fortanix-unknown-sgx library/std --host= --no-doc --exclude src/tools/linkchecker
21:00:53 Building rustbuild
21:00:53     Finished dev [unoptimized] target(s) in 0.11s
21:00:53 Updating submodule src/tools/rls
21:00:54 Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
21:00:54     Updating crates.io index
21:00:55     Updating git repository `[https://github.com/rust-lang/cargo`](https://github.com/rust-lang/cargo%60)
...
21:00:55     Updating git repository `[https://github.com/rust-lang/rust-clippy`](https://github.com/rust-lang/rust-clippy%60)
21:00:56     Updating git repository `[https://github.com/rust-lang/rustfmt`](https://github.com/rust-lang/rustfmt%60)
21:00:56 error: failed to select a version for `libgit2-sys`.
21:00:56     ... required by package `cargo v0.65.0 (https://github.com/rust-lang/cargo?rev=5514f1e0e1b3650ed8a78306198e90b66b292693#5514f1e0)`
21:00:56     ... which satisfies git dependency `cargo` of package `rls v1.41.0 (/home/jenkins/workspace/rust-sgx-ci/rust/src/tools/rls)`
21:00:56 versions that meet the requirements `^0.13.2` are: 0.13.4+1.4.2, 0.13.3+1.4.2, 0.13.2+1.4.2
21:00:56
21:00:56 the package `libgit2-sys` links to the native library `git2`, but it conflicts with a previous package which links to `git2` as well:
21:00:56 package `libgit2-sys v0.14.0+1.5.0`
21:00:56     ... which satisfies dependency `libgit2-sys = "^0.14.0"` of package `cargo v0.66.0 (/home/jenkins/workspace/rust-sgx-ci/rust/src/tools/cargo)`
21:00:56 Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links ='libgit2-sys' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.
21:00:56
21:00:56 failed to select a version for `libgit2-sys` which could resolve this conflict
```
This is related to the version bump of `libgit2-sys` in #11004, but the root cause is the RLS is sunset (#100863). When the bootstrapper manages the git submodules, the wrong repo commit is checked out. This PR removes rls from the list of rust submodules.

22 months agorustdoc: Resugar async fn return type in `clean`, not `html`
Nixon Enraght-Moony [Tue, 30 Aug 2022 14:29:41 +0000 (15:29 +0100)]
rustdoc: Resugar async fn return type in `clean`, not `html`

This way it also happens for json output.

Fixes #101199

22 months agoInitial implementation of `result_large_err`
Lukas Lueg [Wed, 24 Aug 2022 21:11:19 +0000 (23:11 +0200)]
Initial implementation of `result_large_err`

22 months agoAuto merge of #101195 - Dylan-DPC:rollup-rhjaz6r, r=Dylan-DPC
bors [Tue, 30 Aug 2022 14:52:02 +0000 (14:52 +0000)]
Auto merge of #101195 - Dylan-DPC:rollup-rhjaz6r, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #99517 (Display raw pointer as *{mut,const} T instead of *-ptr in errors)
 - #99928 (Do not leak type variables from opaque type relation)
 - #100473 (Attempt to normalize `FnDef` signature in `InferCtxt::cmp`)
 - #100653 (Move the cast_float_to_int fallback code to GCC)
 - #100941 (Point at the string inside literal and mention if we need string inte…)

Failed merges:

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

22 months agoAvoid bootstrap from updating rls submodule
Raoul Strackx [Tue, 30 Aug 2022 13:43:25 +0000 (15:43 +0200)]
Avoid bootstrap from updating rls submodule

22 months agoAvoid `MaybeUninit::uninit_array()`
Thom Chiovoloni [Tue, 30 Aug 2022 13:10:55 +0000 (06:10 -0700)]
Avoid `MaybeUninit::uninit_array()`

22 months agoAdd test for issue #85872
Nikita Popov [Tue, 30 Aug 2022 13:03:22 +0000 (15:03 +0200)]
Add test for issue #85872

This has been fixed by the LLVM 15 upgrade, add a codegen test.

Fixes #85872.

22 months agoChange fatal diagnostic to an error.
JeanCASPAR [Tue, 30 Aug 2022 12:26:09 +0000 (14:26 +0200)]
Change fatal diagnostic to an error.

Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
22 months agoFix UB in Windows `DirBuffIter` (provenance and alignment)
Thom Chiovoloni [Tue, 30 Aug 2022 08:45:30 +0000 (01:45 -0700)]
Fix UB in Windows `DirBuffIter` (provenance and alignment)

22 months ago:arrow_up: rust-analyzer
Laurențiu Nicola [Tue, 30 Aug 2022 11:51:24 +0000 (14:51 +0300)]
:arrow_up: rust-analyzer

22 months agoRollup merge of #100941 - lyming2007:issue-100584, r=oli-obk
Dylan DPC [Tue, 30 Aug 2022 11:26:10 +0000 (16:56 +0530)]
Rollup merge of #100941 - lyming2007:issue-100584, r=oli-obk

Point at the string inside literal and mention if we need string inte…

…rpolation

modified:   compiler/rustc_passes/src/liveness.rs