Commit Graph

198284 Commits

Author SHA1 Message Date
Eric Huss
4a7e2fbb7b Sunset RLS 2022-08-27 21:36:08 -07:00
bors
1e978a3627 Auto merge of #96946 - WaffleLapkin:ptr_mask, r=scottmcm
Add pointer masking convenience functions

This PR adds the following public API:
```rust
impl<T: ?Sized> *const T {
    fn mask(self, mask: usize) -> *const T;
}

impl<T: ?Sized> *mut T {
    fn mask(self, mask: usize) -> *const T;
}

// mod intrinsics
fn mask<T>(ptr: *const T, mask: usize) -> *const T
```
This is equivalent to `ptr.map_addr(|a| a & mask)` but also uses a cool llvm intrinsic.

Proposed in https://github.com/rust-lang/rust/pull/95643#issuecomment-1121562352

cc `@Gankra` `@scottmcm` `@RalfJung`

r? rust-lang/libs-api
2022-08-28 01:34:47 +00:00
bors
eaadb8947b Auto merge of #100591 - est31:stabilization_placeholder, r=Mark-Simulacrum
Require stabilizations to use a placeholder instead of writing out stabilization version

Implements the idea from [this](https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/libs.20stabilization.20placeholder) zulip stream.

It's a common phenomenon that feature stabilizations don't make it into a particular release, but the version is still inaccurate. Often this is caught in the PR, but it can also require subsequent changes to adjust/correct the version. A list with examples of such PRs is given in #100577, but it's far from complete.

This PR requires stabilization PRs to use the placeholder `CURRENT_RUSTC_VERSION`, enforced via tidy tooling. The PR also adds a tool that replaces the placeholder with the version number. It can be invoked via `./x.py run src/tools/replace-version-placeholder` and is supposed to be ran upon beta branching as well as version bumping and any backports to the beta branch.  I filed PRs to the dev guide and forge to document these changes in the release and stabilization workflows:

* The [dev guide](https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#determining-the-stabilization-version) PR: https://github.com/rust-lang/rustc-dev-guide/pull/1443
* The [std dev guide](https://std-dev-guide.rust-lang.org/) PR: https://github.com/rust-lang/std-dev-guide/pull/43
* The [forge](https://github.com/rust-lang/rust-forge) PR: https://github.com/rust-lang/rust-forge/pull/643

Alternative to #100577 which added checking.
2022-08-27 16:57:19 +00:00
est31
d32ff14b86 Add replace-version-placeholder tool
This tool is to be ran at specific points in the release process to replace
the version place holder made by stabilizations with the version number.
2022-08-27 17:39:11 +02:00
est31
a2e2d76768 tidy: move directory traversal utility functions into dedicated module 2022-08-27 17:39:11 +02:00
est31
4caedbae86 Adjust label break value stabilization version to CURRENT_RUSTC_VERSION 2022-08-27 17:36:13 +02:00
est31
6e4e3e84b5 Adjust backtrace stabilization version to CURRENT_RUSTC_VERSION 2022-08-27 17:08:53 +02:00
est31
e576a9b554 Adjust ptr_const_cast stabilization version to CURRENT_RUSTC_VERSION 2022-08-27 17:08:53 +02:00
est31
7a5b1d7939 Expand the version placeholder to the current version in stability attribute parsing
That way, the current version is shown in rustdoc etc.
2022-08-27 17:08:52 +02:00
est31
d06e0e53eb tidy: forbid since values for features that point to the current release or future ones
It's a common phenomenon that feature stabilizations don't make it into
a particular release, but the version is still inaccurate. Often this
leads to subsequent changes to adjust/correct the version.

Instead, require people to put a placeholder that gets replaced during
beta branching time with the current rust version. That way, there is
no chance that an error can be introduced.

Usage of the placeholder is required on the nightly channel, and forbidden
on the stable and beta channels.
2022-08-27 17:08:52 +02:00
bors
332cc8fb75 Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3
Shrink `FnAbi`

Because they can take up a lot of memory in debug and release builds.

r? `@bjorn3`
2022-08-27 14:00:53 +00:00
bors
3b3f3b72c5 Auto merge of #100989 - lcnr:implied-bounds-uwu, r=spastorino
no unnormalized types for implied bounds outside borrowck

fixes #100910 - introduced in https://github.com/rust-lang/rust/pull/100676 - by only considering normalized types for wf.

r? types
2022-08-27 11:37:06 +00:00
bors
4065b89b1e Auto merge of #100946 - jyn514:query-system-3, r=cjgillot
Simplify the arguments to macros generated by the `rustc_queries` proc macro

Very small cleanup. Based on https://github.com/rust-lang/rust/pull/100436 which modifies some of the same code.

r? `@cjgillot`
2022-08-27 08:53:24 +00:00
bors
d0e1491ecd Auto merge of #101074 - JohnTitor:rollup-zwznihq, r=JohnTitor
Rollup of 11 pull requests

Successful merges:

 - #96240 (Stabilize `const_ptr_offset_from`.)
 - #99784 (Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default)
 - #100811 (Fix wrong compiletest filters on Windows)
 - #100924 (Smaller improvements of tidy and the unicode generator)
 - #100953 (Update documentation for `write!` and `writeln!`)
 - #101018 (rustdoc: omit start/end tags for empty item description blocks)
 - #101044 (rustdoc: remove unused CSS for `hidden-by-*-hider`)
 - #101046 (rustdoc: remove incorrect CSS selector `.impl-items table td`)
 - #101057 (Merge implementations of HIR fn_decl and fn_sig.)
 - #101062 (rustdoc: remove empty extern_crates and type="text/javascript" on script)
 - #101063 (Merge duplicated CSS rules)

Failed merges:

 - #101055 (Use smaller span for suggestions)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-27 06:12:17 +00:00
Yuki Okushi
bd89372563
Rollup merge of #101063 - GuillaumeGomez:merge-duplicated-css, r=notriddle
Merge duplicated CSS rules

I used the [stylelint](https://stylelint.io/user-guide/configure) tool to check for duplicated CSS rules in order to merge them.

r? `@notriddle`
2022-08-27 13:14:26 +09:00
Yuki Okushi
bdbbbe687e
Rollup merge of #101062 - notriddle:notriddle/text-javascript, r=GuillaumeGomez
rustdoc: remove empty extern_crates and type="text/javascript" on script

Like #101023, this removes an attribute with a default value.
2022-08-27 13:14:25 +09:00
Yuki Okushi
aa6b750854
Rollup merge of #101057 - cjgillot:one-fn-sig, r=compiler-errors
Merge implementations of HIR fn_decl and fn_sig.
2022-08-27 13:14:24 +09:00
Yuki Okushi
0cad2746be
Rollup merge of #101046 - notriddle:notriddle/table-css, r=jsha
rustdoc: remove incorrect CSS selector `.impl-items table td`

Fixes #100994

This selector was added in c7312fbae4. The bug can be seen at <https://doc.rust-lang.org/1.27.0/alloc/slice/trait.SliceIndex.html#foreign-impls>.

This rule was added to help with a `<table>` that was used for displaying the function signature [src] lockup. That lockup was changed in 34bd2b845b to use flexbox instead, leaving this selector unused (at least, for its original purpose).
2022-08-27 13:14:23 +09:00
Yuki Okushi
84f5ccd917
Rollup merge of #101044 - notriddle:notriddle/css-hidden-by, r=jsha
rustdoc: remove unused CSS for `hidden-by-*-hider`

This CSS seems to have become obsolete with the move to `<details>` tags,
and its corresponding JavaScript was removed in aee054d05d
2022-08-27 13:14:22 +09:00
Yuki Okushi
6ccad25359
Rollup merge of #101018 - notriddle:notriddle/item-right-docblock-short, r=GuillaumeGomez
rustdoc: omit start/end tags for empty item description blocks

Related to #100952

This is definitely not a complete solution, but it does shrink keysyms/index.html on smithay from 620K to 516K.
2022-08-27 13:14:21 +09:00
Yuki Okushi
f4d4a40a7c
Rollup merge of #100953 - joshtriplett:write-docs, r=Mark-Simulacrum
Update documentation for `write!` and `writeln!`

https://github.com/rust-lang/rust/pull/37472 added this documentation, but it
needs updating:

- Remove some documentation duplicated between `writeln!` and `write!`
- Update `write!` docs: can now import traits as `_` to avoid conflicts
- Expand example to show how to implement qualified trait names
2022-08-27 13:14:20 +09:00
Yuki Okushi
e31bedc9cf
Rollup merge of #100924 - est31:closure_to_fn_ptr, r=Mark-Simulacrum
Smaller improvements of tidy and the unicode generator
2022-08-27 13:14:19 +09:00
Yuki Okushi
7214f0cfc4
Rollup merge of #100811 - czzrr:master, r=Mark-Simulacrum
Fix wrong compiletest filters on Windows

As discussed in [#79334](https://github.com/rust-lang/rust/issues/79334), when calling e.g.
```
python x.py test src/test/ui/expr/compound-assignment/eval-order.rs
```
on Windows, compiletest passes the filter `expr/compound-assignment/eval-order.rs` to libtest, which instead should be `expr\compound-assignment\eval-order.rs`, as that is the file found when collecting tests. This is what I fixed.

I'm not sure how to organize a test for this. Any suggestions?
2022-08-27 13:14:18 +09:00
Yuki Okushi
134cc2d6be
Rollup merge of #99784 - est31:deny_cfg_attr_crate_type_name, r=Mark-Simulacrum
Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default

Turns the forward compatibility lint added by #83744 to deprecate `cfg_attr` usage with `#![crate_type]` and `#![crate_name]` attributes into deny by default. Copying the example from #83744:

```Rust
#![crate_type = "lib"] // remains working
#![cfg_attr(foo, crate_type = "bin")] // will stop working
```

Over 8 months have passed since #83744 was merged so I'd say this gives ample time for people to have been warned, so we can make the warning stronger. No usage was found via grep.app except for one, which was in an unmaintained code base that didn't seem to be used in the open source eco system. The crater run conducted in #83744 also didn't show up anything.

cc #91632 - tracking issue for the lint
2022-08-27 13:14:16 +09:00
Yuki Okushi
539e408e1e
Rollup merge of #96240 - fee1-dead-contrib:stabilize_const_offset_from, r=Mark-Simulacrum
Stabilize `const_ptr_offset_from`.

Stabilization has been completed [here](https://github.com/rust-lang/rust/issues/92980#issuecomment-1065644848) with a FCP.

Closes #92980.
2022-08-27 13:14:15 +09:00
bors
9845f4c47e Auto merge of #100732 - dpaoliello:import_name_type, r=wesleywiser
Implementation of import_name_type

Fixes #96534 by implementing https://github.com/rust-lang/compiler-team/issues/525

Symbols that are exported or imported from a binary on 32bit x86 Windows can be named in four separate ways, corresponding to the [import name types](https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-name-type) from the PE-COFF spec. The exporting and importing binaries must use the same name encoding, otherwise mismatches can lead to link failures due to "missing symbols" or to 0xc0000139 (`STATUS_ENTRYPOINT_NOT_FOUND`) errors when the executable/library is loaded. For details, see the comments on the raw-dylib feature's https://github.com/rust-lang/rust/issues/58713. To generate the correct import libraries for these DLLs, therefore, rustc must know the import name type for each `extern` function, and there is currently no way for users to provide this information.

This change adds a new `MetaNameValueStr` key to the `#[link]` attribute called `import_name_type`, and which accepts one of three values: `decorated`, `noprefix`, and `undecorated`.

A single DLL is likely to export all its functions using the same import type name, hence `import_name_type` is a parameter of `#[link]` rather than being its own attribute that is applied per-function. It is possible to have a single DLL that exports different functions using different import name types, but users could express such cases by providing multiple export blocks for the same DLL, each with a different import name type.

Note: there is a fourth import name type defined in the PE-COFF spec, `IMPORT_ORDINAL`. This case is already handled by the `#[link_ordinal]` attribute. While it could be merged into `import_type_name`, that would not make sense as `#[link_ordinal]` provides per-function information (namely the ordinal itself).

Design decisions (these match the MCP linked above):
* For GNU, `decorated` matches the PE Spec and MSVC rather than the default behavior of `dlltool` (i.e., there will be a leading `_` for `stdcall`).
* If `import_name_type` is not present, we will keep our current behavior of matching the environment (MSVC vs GNU) default for decorating.
* Using `import_name_type` on architectures other than 32bit x86 will result in an error.
* Using `import_name_type` with link kinds other than `"raw-dylib"` will result in an error.
2022-08-27 03:19:12 +00:00
bors
bb8a08f011 Auto merge of #101064 - compiler-errors:rollup-fwm5m5f, r=compiler-errors
Rollup of 9 pull requests

Successful merges:

 - #100724 (Migrate ast lowering to session diagnostic)
 - #100735 (Migrate `rustc_ty_utils` to `SessionDiagnostic`)
 - #100738 (Diagnostics migr const eval)
 - #100744 (Migrate rustc_mir_dataflow to diagnostic structs)
 - #100776 (Migrate `rustc_lint` errors to `SessionDiagnostic`)
 - #100817 (sugg: suggest the usage of boolean value when there is a typo in the keyword)
 - #100836 (Migrate `rustc_attr` crate diagnostics)
 - #100890 (Migrate rustc_driver to SessionDiagnostic)
 - #100900 (on `region_errors.rs`)

Failed merges:

 - #100831 (Migrate `symbol_mangling` module to new diagnostics structs)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-27 00:38:06 +00:00
Michael Goulet
96ceadde76
Rollup merge of #100900 - AndyJado:diag-migrate, r=davidtwco
on `region_errors.rs`

`@rustbot` label +A-translation
2022-08-26 15:56:30 -07:00
Michael Goulet
e7d870b188
Rollup merge of #100890 - adriantombu:migrate_diagnostic_rustc_driver, r=davidtwco
Migrate rustc_driver to SessionDiagnostic

First timer noob here 👋🏽 I'm having a problem understanding how I can retrieve the span, and how to properly construct the error structs to avoid the current compilation errors.

Any help pointing me in the right direction would be much appreciated 🙌🏽
2022-08-26 15:56:29 -07:00
Michael Goulet
d97e616e21
Rollup merge of #100836 - hampuslidin:migrate-attr-crate-diagnostics, r=davidtwco
Migrate `rustc_attr` crate diagnostics

Hi!

This is my first PR to the rustc project, excited to be part of the development! This PR is part of the diagnostics effort, to make diagnostics translatable.

`@rustbot` label +A-translation
2022-08-26 15:56:28 -07:00
Michael Goulet
54744601bf
Rollup merge of #100817 - vincenzopalazzo:macros/bool_spelling_sugg, r=davidtwco
sugg: suggest the usage of boolean value when there is a typo in the keyword

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

This adds a new suggestion when there is a well-known typo

With the following program

```rust
fn main() {
    let x = True;
}
```

Now we have the following suggestion

```
error[E0425]: cannot find value `True` in this scope
 --> test.rs:2:13
  |
2 |     let x = True;
  |             ^^^^ not found in this scope
  |
help: you may want to use a bool value instead
  |
2 |     let x = true;
  |             ~~~~

error: aborting due to previous error
```

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-08-26 15:56:26 -07:00
Michael Goulet
389dda149c
Rollup merge of #100776 - Rejyr:diagnostic-migration-rustc-lint, r=davidtwco
Migrate `rustc_lint` errors to `SessionDiagnostic`

Draft PR for migrating `rustc_lint` to `SessionDiagnostic`, as part of the [recent blog post](https://blog.rust-lang.org/inside-rust/2022/08/16/diagnostic-effort.html)
2022-08-26 15:56:25 -07:00
Michael Goulet
93b2acd88a
Rollup merge of #100744 - 5225225:migrate-rustc-mir-dataflow, r=davidtwco
Migrate rustc_mir_dataflow to diagnostic structs
2022-08-26 15:56:24 -07:00
Michael Goulet
b54344401a
Rollup merge of #100738 - nidnogg:diagnostics_migr_const_eval, r=davidtwco
Diagnostics migr const eval

This PR should eventually contain all diagnostic migrations for the `rustc_const_eval` crate.

r? `@davidtwco`
`@rustbot` label +A-translation
2022-08-26 15:56:23 -07:00
Michael Goulet
181b0410ec
Rollup merge of #100735 - Facel3ss1:ty-utils-translation, r=davidtwco
Migrate `rustc_ty_utils` to `SessionDiagnostic`

I have migrated the `rustc_ty_utils` crate to use `SessionDiagnostic`, motivated by the [recent blog post about the diagnostic translation effort](https://blog.rust-lang.org/inside-rust/2022/08/16/diagnostic-effort.html).

This is my first PR to the Rust repository, so if I have missed anything, or anything needs to be changed, please let me know! 😄

`@rustbot` label +A-translation
2022-08-26 15:56:22 -07:00
Michael Goulet
bc1d205e4c
Rollup merge of #100724 - JeanCASPAR:migrate-ast_lowering-to-session-diagnostic, r=davidtwco
Migrate ast lowering to session diagnostic

I migrated the whole rustc_ast_lowering crate to session diagnostic *except* the for the use of `span_fatal` at /compiler/rustc_ast_lowering/src/expr.rs#L1268 because `#[fatal(...)]` is not yet supported (see https://github.com/rust-lang/rust/pull/100694).
2022-08-26 15:56:21 -07:00
Guillaume Gomez
a74f453833 Merge duplicated CSS rules 2022-08-27 00:37:04 +02:00
Michael Howell
52582d301d rustdoc: remove empty extern_crates and type="text/javascript" on script
Like #101023, this removes an attribute with a default value.
2022-08-26 15:00:20 -07:00
bors
2b443a8d97 Auto merge of #100043 - RalfJung:scalar-always-init, r=RalfJung
interpret: remove support for uninitialized scalars

With Miri no longer supporting `-Zmiri-allow-uninit-numbers`, we no longer need to support storing uninit data in a `Scalar`. We anyway already only use this representation for types with *initialized* `Scalar` layout (and we have to, due to partial initialization), so let's get rid of the `ScalarMaybeUninit` type entirely.

I tried to stage this into meaningful commits, but the one that changes `read_immediate` to always trigger UB on uninit is the largest chunk of the PR and I don't see how it could be subdivided.

Fixes https://github.com/rust-lang/miri/issues/2187
r? `@oli-obk`
2022-08-26 21:50:09 +00:00
Camille GILLOT
20012ea4eb Merge implementations of HIR fn_decl and fn_sig. 2022-08-26 21:38:20 +02:00
bors
c07a8b4e09 Auto merge of #101039 - ouz-a:issue-100991, r=compiler-errors
Don't catch overflow when running with cargo doc

Fixes #100991

r? `@compiler-errors`
2022-08-26 18:53:16 +00:00
ouz-a
36faf8fc7e Don't catch overflow when running with cargo doc 2022-08-26 21:02:35 +03:00
Ralf Jung
62b6a8b7b8 remove now-unused ScalarMaybeUninit 2022-08-26 13:20:57 -04:00
Ralf Jung
30fa931f92 make read_immediate error immediately on uninit, so ImmTy can carry initialized Scalar 2022-08-26 13:20:57 -04:00
Ralf Jung
2e52fe01cf remove some now-unnecessary parameters from check_bytes 2022-08-26 13:20:56 -04:00
Ralf Jung
da13935ecc remove enforce_number_init machine hook that Miri no longer needs 2022-08-26 13:20:56 -04:00
Ralf Jung
9d604f301b fix an outdated machine hook name 2022-08-26 13:20:56 -04:00
Daniel Paoliello
cc49c3e582 Implementation of import_name_type 2022-08-26 09:15:35 -07:00
Michael Howell
25eb52ff69 rustdoc: remove incorrect CSS selector .impl-items table td
Fixes #100994

This selector was added in c7312fbae4.
The bug can be seen at <https://doc.rust-lang.org/1.27.0/alloc/slice/trait.SliceIndex.html#foreign-impls>.

This rule was added to help with a `<table>` that was used for displaying the
function signature [src] lockup. That lockup was changed in
34bd2b845b to use flexbox instead, leaving this
selector unused (at least, for its original purpose).
2022-08-26 08:48:50 -07:00
bors
450e99f937 Auto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiser
session: stabilize split debuginfo on linux

Stabilize the `-Csplit-debuginfo` flag...

- ...on Linux for all values of the flag. Split DWARF has been implemented for a few months, hasn't had any bug reports and has had some promising benchmarking for incremental debug build performance.
- ..on other platforms for the default value. It doesn't make any sense that `-Csplit-debuginfo=packed` is unstable on Windows MSVC when that's the default behaviour, but keep the other values unstable.
2022-08-26 15:47:26 +00:00