Commit Graph

199142 Commits

Author SHA1 Message Date
Donough Liu
3f66efde75 Fix uintended diagnostic caused by drain(..) 2022-08-31 04:12:46 +01:00
bors
7f442f8ba1 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 (⬆️ rust-analyzer)
 - #101200 (Add test for issue #85872)
 - #101219 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-31 02:24:44 +00:00
Yuki Okushi
0cbc58978b
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)
2022-08-31 08:47:24 +09:00
Yuki Okushi
d7ba1f81c9
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.
2022-08-31 08:47:23 +09:00
Yuki Okushi
804029e083
Rollup merge of #101197 - lnicola:rust-analyzer-2022-08-30, r=lnicola
⬆️ rust-analyzer

r? ``@ghost``
2022-08-31 08:47:22 +09:00
Yuki Okushi
f19783dbb8
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)*
2022-08-31 08:47:21 +09:00
Yuki Okushi
42a1901cf4
Rollup merge of #101192 - TaKO8Ki:remove-path-string, r=compiler-errors
Remove path string
2022-08-31 08:47:20 +09:00
Yuki Okushi
60e8550faf
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.
2022-08-31 08:47:19 +09:00
Yuki Okushi
9642e4840b
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
2022-08-31 08:47:18 +09:00
Yuki Okushi
3de558dd2d
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`
2022-08-31 08:47:17 +09:00
Yuki Okushi
3a764e9396
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.
2022-08-31 08:47:15 +09:00
Yuki Okushi
682644251d
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``
2022-08-31 08:47:14 +09:00
bors
f07d6e8c0a 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.
2022-08-30 23:43:33 +00:00
Eric Huss
437879f20e Update books 2022-08-30 16:18:42 -07:00
andrewpollack
c52d99f6e2
Update src/doc/rustc/src/platform-support/fuchsia.md
Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2022-08-30 16:06:36 -07:00
andrewpollack
18340bd52b
Update src/doc/rustc/src/platform-support/fuchsia.md
Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2022-08-30 16:06:27 -07:00
Eric Holk
b9d3f65412 [drop tracking] Use parent expression for scope
Previously we were just using the parent node as the scope for a
temporary value, but it turns out this is too narrow. For example, in
an expression like

    Foo {
        b: &42,
        a: async { 0 }.await,
    }

the scope for the &42 was set to the ExprField node for `b: &42`, when
we actually want to use the Foo struct expression.

We fix this by recursively searching through parent nodes until we find
a Node::Expr. It may be that we don't find one, and if so that's okay,
we will just fall back on the enclosing temporary scope which is always
sufficient.
2022-08-30 15:17:45 -07:00
Eric Huss
8588374d29 Use in-page links for sanitizer docs. 2022-08-30 14:54:37 -07:00
Andrew Pollack
10a42dfa32 Adding new Fuchsia rustup docs... reworking walkthrough 2022-08-30 20:47:06 +00:00
bors
02654a0844 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.
2022-08-30 20:39:01 +00:00
Jhonny Bill Mena
3ee6946316 UPDATE - to support diag introduced in PR #100765 2022-08-30 14:27:43 -04:00
Jhonny Bill Mena
ef2f6ab55e ADD - diagnostics lints to symbol_mangling module 2022-08-30 14:27:42 -04:00
Jhonny Bill Mena
8f5fada86d ADD - migrate InvalidDefPath to new diagnostics infra 2022-08-30 14:27:42 -04:00
Jhonny Bill Mena
bd83bbc93a UPDATE - accept String instead of unused 'str 2022-08-30 14:27:42 -04:00
Jhonny Bill Mena
359002bbeb 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.
2022-08-30 14:27:42 -04:00
Jhonny Bill Mena
86f8c4e8e3 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)
2022-08-30 14:27:42 -04:00
Guillaume Gomez
6c585fcce5 Clean up render_assoc_items_inner a bit 2022-08-30 20:22:05 +02:00
bors
09e4659a86 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
2022-08-30 18:20:45 +00:00
bors
350cca3b6a 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.
2022-08-30 17:33:24 +00:00
Nixon Enraght-Moony
6099d17afe rustdoc: Resugar async fn return type in clean, not html
This way it also happens for json output.

Fixes #101199
2022-08-30 18:09:04 +01:00
Camille GILLOT
60a052f4d3 Handle MIR in a single place. 2022-08-30 19:07:22 +02:00
Camille GILLOT
b94d421d08 Remove fn_has_self_parameter table. 2022-08-30 19:06:30 +02:00
Camille GILLOT
b0b46c0a10 Separate macro_rules and macro_definition. 2022-08-30 19:06:12 +02:00
Camille GILLOT
c485fccd81 Remove EntryKind. 2022-08-30 19:05:59 +02:00
Camille GILLOT
affb12210d Create a module-reexports table. 2022-08-30 19:05:50 +02:00
Camille GILLOT
d330dc8c11 Fix the panic message. 2022-08-30 19:05:42 +02:00
Camille GILLOT
30ae64e51f Create a table for fn_has_self_parameter. 2022-08-30 19:05:33 +02:00
Camille GILLOT
1ddb944311 Use tables for macros. 2022-08-30 19:05:15 +02:00
Camille GILLOT
ca9f5645f3 Move AssocContainer to a metadata table. 2022-08-30 19:04:58 +02:00
Camille GILLOT
927e58d633 Move VariantData to a metadata table. 2022-08-30 19:04:49 +02:00
Camille GILLOT
edd25c37c5 Simplify recursion scheme. 2022-08-30 19:04:41 +02:00
Camille GILLOT
73e9f37eaa Encode consts in metadata main loop. 2022-08-30 19:04:37 +02:00
Camille GILLOT
45ad22be8f Encode type in the main loop. 2022-08-30 19:04:04 +02:00
Lukas Lueg
66a97055b2 Initial implementation of result_large_err 2022-08-30 17:39:40 +02:00
bors
fce6a7d66e 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
2022-08-30 14:52:02 +00:00
Raoul Strackx
96b4ca0f85 Avoid bootstrap from updating rls submodule 2022-08-30 15:43:25 +02:00
Thom Chiovoloni
1b8b2dc2ff
Avoid MaybeUninit::uninit_array() 2022-08-30 06:10:55 -07:00
Nikita Popov
5663bb3f1c Add test for issue #85872
This has been fixed by the LLVM 15 upgrade, add a codegen test.

Fixes #85872.
2022-08-30 15:03:22 +02:00
JeanCASPAR
79d4f09942
Change fatal diagnostic to an error.
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2022-08-30 14:26:09 +02:00
Thom Chiovoloni
c41f21b3e4
Fix UB in Windows DirBuffIter (provenance and alignment) 2022-08-30 05:03:22 -07:00