]> git.lizzy.rs Git - rust.git/log
rust.git
19 months agoAdd documentation for LLVM KCFI support
Ramon de C Valle [Thu, 1 Dec 2022 00:41:35 +0000 (16:41 -0800)]
Add documentation for LLVM KCFI support

This commit adds initial documentation for LLVM Kernel Control Flow
Integrity (KCFI) support to the Rust compiler (see #105109 and #89653).

Co-authored-by: Miguel Ojeda <ojeda@users.noreply.github.com>
19 months agoAdd LLVM KCFI support to the Rust compiler
Ramon de C Valle [Tue, 22 Nov 2022 05:29:00 +0000 (21:29 -0800)]
Add LLVM KCFI support to the Rust compiler

This commit adds LLVM Kernel Control Flow Integrity (KCFI) support to
the Rust compiler. It initially provides forward-edge control flow
protection for operating systems kernels for Rust-compiled code only by
aggregating function pointers in groups identified by their return and
parameter types. (See llvm/llvm-project@cff5bef.)

Forward-edge control flow protection for C or C++ and Rust -compiled
code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code
share the same virtual address space) will be provided in later work as
part of this project by identifying C char and integer type uses at the
time types are encoded (see Type metadata in the design document in the
tracking issue #89653).

LLVM KCFI can be enabled with -Zsanitizer=kcfi.

Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
19 months agoFix build on powerpc-unknown-freebsd
pkubaj [Fri, 18 Nov 2022 12:36:49 +0000 (12:36 +0000)]
Fix build on powerpc-unknown-freebsd

Probably also fixes build on mips*. Related to https://github.com/rust-lang/rust/issues/104220

19 months agorustdoc: remove no-op mobile CSS `#sidebar-toggle { text-align }`
Michael Howell [Fri, 9 Dec 2022 00:38:07 +0000 (17:38 -0700)]
rustdoc: remove no-op mobile CSS `#sidebar-toggle { text-align }`

Since 8b001b4da0716936e0ca32303cc0e3c5e53e42f8 make the sidebar toggle a
flex container, and already centers its content in desktop mode, this
rule doesn't do anything.

19 months agoAuto merge of #105477 - tmiasko:make, r=ehuss
bors [Thu, 8 Dec 2022 23:50:39 +0000 (23:50 +0000)]
Auto merge of #105477 - tmiasko:make, r=ehuss

Ignore errors when including clear_expected_if_blessed

Include is there only for the effect executing the rule. The file is not intended to be remade successfully to be actually included.

I erroneously changed this in #100912.

19 months agoPoint at LHS on binop type err if relevant
Esteban Küber [Fri, 2 Dec 2022 23:56:37 +0000 (15:56 -0800)]
Point at LHS on binop type err if relevant

19 months agoAdd `rustc_on_unimplemented` to `Sum` and `Product` trait.
Nixon Enraght-Moony [Sun, 4 Dec 2022 18:46:57 +0000 (18:46 +0000)]
Add `rustc_on_unimplemented` to `Sum` and `Product` trait.

19 months agoIgnore errors when including clear_expected_if_blessed
Tomasz Miąsko [Thu, 8 Dec 2022 00:00:00 +0000 (00:00 +0000)]
Ignore errors when including clear_expected_if_blessed

Include is there only for the effect executing the rule.
The file is not intended to be remade successfully to be
actually included.

19 months agoAssert size of `rustc_parse_format::Piece<'_>`
Maybe Waffle [Thu, 8 Dec 2022 11:20:01 +0000 (11:20 +0000)]
Assert size of `rustc_parse_format::Piece<'_>`

19 months agoFix Async Generator ABI
Arpad Borsos [Tue, 29 Nov 2022 22:17:08 +0000 (23:17 +0100)]
Fix Async Generator ABI

This change was missed when making async generators implement `Future` directly.
It did not cause any problems in codegen so far, as `GeneratorState<(), Output>`
happens to have the same ABI as `Poll<Output>`.

19 months agolib docs: fix typo
Ralf Jung [Thu, 8 Dec 2022 21:36:57 +0000 (22:36 +0100)]
lib docs: fix typo

19 months agoMangle "main" as "__main_void" on wasm32-wasi
Dan Gohman [Thu, 8 Dec 2022 18:35:46 +0000 (10:35 -0800)]
Mangle "main" as "__main_void" on wasm32-wasi

On wasm, the age-old C trick of having a main function which can either have
no arguments or argc+argv doesn't work, because wasm requires caller and
callee signatures to match. WASI's current strategy is to have compilers
mangle main's name to indicate which signature they're using. Rust uses the
no-argument form, which should be mangled as `__main_void`.

This is needed on wasm32-wasi as of #105395.

19 months agoFix #10021
Samuel Moelius [Sat, 3 Dec 2022 01:41:29 +0000 (20:41 -0500)]
Fix #10021

19 months agorustdoc: add GUI test case for docblock table colors
Michael Howell [Thu, 8 Dec 2022 16:38:27 +0000 (09:38 -0700)]
rustdoc: add GUI test case for docblock table colors

19 months agoBump compiler-builtins to 0.1.85
Martin Kröning [Thu, 8 Dec 2022 14:34:46 +0000 (15:34 +0100)]
Bump compiler-builtins to 0.1.85

19 months agoBuild rust-analyzer proc-macro server by default
Joshua Nelson [Thu, 8 Dec 2022 13:59:05 +0000 (07:59 -0600)]
Build rust-analyzer proc-macro server by default

This allows getting rid of some documentation and an extra step when building a custom toolchain: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html#creating-a-rustup-toolchain
and it seems likely that people will want to do this if they want rustdoc (which is also built by default).

19 months agoUpdate rustdoc test to check its error output
Guillaume Gomez [Wed, 7 Dec 2022 15:08:58 +0000 (16:08 +0100)]
Update rustdoc test to check its error output

19 months agoAdd regression test for #105404
Guillaume Gomez [Thu, 8 Dec 2022 12:46:51 +0000 (13:46 +0100)]
Add regression test for #105404

19 months agoPrevent to try to retrieve auto and blanket implementations if there were errors...
Guillaume Gomez [Thu, 8 Dec 2022 12:41:59 +0000 (13:41 +0100)]
Prevent to try to retrieve auto and blanket implementations if there were errors before this pass

19 months agoRollup merge of #105441 - nnethercote:rm-UnsafetyState, r=lcnr
Matthias Krüger [Thu, 8 Dec 2022 11:57:33 +0000 (12:57 +0100)]
Rollup merge of #105441 - nnethercote:rm-UnsafetyState, r=lcnr

Remove `UnsafetyState`

r? `@lcnr`

19 months agoRollup merge of #105434 - nbdd0121:lib, r=thomcc
Matthias Krüger [Thu, 8 Dec 2022 11:57:33 +0000 (12:57 +0100)]
Rollup merge of #105434 - nbdd0121:lib, r=thomcc

Fix warning when libcore is compiled with no_fp_fmt_parse

Discovered when trying to compile Rust-for-Linux with Rust 1.66 beta.

It'll be helpful if this is backported to beta (should be trivial enough for backporting), so Rust-for-Linux's rust version bump wouldn't need to do `--cap-lints allow` for libcore.

19 months agoRollup merge of #105433 - ComputerDruid:docker_continuation_fix, r=jyn514
Matthias Krüger [Thu, 8 Dec 2022 11:57:32 +0000 (12:57 +0100)]
Rollup merge of #105433 - ComputerDruid:docker_continuation_fix, r=jyn514

CI: add missing line continuation marker

Resolves this docker warning:

```
[WARNING]: Empty continuation line found in:
    RUN apt-get update && apt-get install -y --no-install-recommends   g++   gcc-multilib   make   ninja-build   file   curl   ca-certificates   python2.7   python3.9   git   cmake   sudo   gdb   llvm-13-tools   llvm-13-dev   libedit-dev   libssl-dev   pkg-config   zlib1g-dev   xz-utils   nodejs     apt-transport-https software-properties-common &&     curl -s "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb" > packages-microsoft-prod.deb &&     dpkg -i packages-microsoft-prod.deb &&     apt-get update &&     apt-get install -y powershell     && rm -rf /var/lib/apt/lists/*
Warning: : Empty continuation lines will become errors in a future release.
```

19 months agoRollup merge of #105423 - oli-obk:symbols, r=jackh726
Matthias Krüger [Thu, 8 Dec 2022 11:57:32 +0000 (12:57 +0100)]
Rollup merge of #105423 - oli-obk:symbols, r=jackh726

Use `Symbol` for the crate name instead of `String`/`str`

It always got converted to a symbol anyway

19 months agoRollup merge of #105408 - cuviper:help-rpitirpit, r=compiler-errors
Matthias Krüger [Thu, 8 Dec 2022 11:57:31 +0000 (12:57 +0100)]
Rollup merge of #105408 - cuviper:help-rpitirpit, r=compiler-errors

Add help for `#![feature(impl_trait_in_fn_trait_return)]`

This adds a new variant `ImplTraitContext::FeatureGated`, so we can
generalize the help for `return_position_impl_trait_in_trait` to also
work for `impl_trait_in_fn_trait_return`.

cc #99697

19 months agoRollup merge of #105405 - sunfishcode:sunfishcode/export-dynamic, r=TaKO8Ki
Matthias Krüger [Thu, 8 Dec 2022 11:57:30 +0000 (12:57 +0100)]
Rollup merge of #105405 - sunfishcode:sunfishcode/export-dynamic, r=TaKO8Ki

Stop passing -export-dynamic to wasm-ld.

-export-dynamic was a temporary hack added in the early days of the Rust wasm32 target when Rust didn't have a way to specify wasm exports in the source code. This flag causes all global symbols, and some compiler-internal symbols, to be exported, which is often more than needed.

Rust now does have a way to specify exports in the source code: `#[export_name = "..."]`.

So as the original comment suggests, -export-dynamic can now be removed, allowing users to have smaller binaries and better encapsulation in their wasm32-unknown-unknown modules.

It's possible that this change will require existing wasm32-unknown-unknown users will to add explicit `#[export_name = "..."]` directives to exporrt the symbols that their programs depend on having exported.

19 months agoRollup merge of #105317 - RalfJung:retag-rework, r=oli-obk
Matthias Krüger [Thu, 8 Dec 2022 11:57:30 +0000 (12:57 +0100)]
Rollup merge of #105317 - RalfJung:retag-rework, r=oli-obk

make retagging work even with 'unstable' places

This is based on top of https://github.com/rust-lang/rust/pull/105301. Only the last two commits are new.

While investigating https://github.com/rust-lang/unsafe-code-guidelines/issues/381 I realized that we would have caught this issue much earlier if the add_retag pass wouldn't bail out on assignments of the form `*ptr = ...`.

So this PR changes our retag strategy:
- When a new reference is created via `Rvalue::Ref` (or a raw ptr via `Rvalue::AddressOf`), we do the retagging as part of just executing that address-taking operation.
- For everything else, we still insert retags -- these retags basically serve to ensure that references stored in local variables (and their fields) are always freshly tagged, so skipping this for assignments like `*ptr = ...` is less egregious.
r? ```@oli-obk```

19 months agoRollup merge of #105255 - cjgillot:issue-105197, r=compiler-errors
Matthias Krüger [Thu, 8 Dec 2022 11:57:29 +0000 (12:57 +0100)]
Rollup merge of #105255 - cjgillot:issue-105197, r=compiler-errors

Make nested RPIT inherit the parent opaque's generics.

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

r? ```@compiler-errors```

19 months agoRollup merge of #105120 - solid-rs:patch/kmc-solid/maintainance, r=thomcc
Matthias Krüger [Thu, 8 Dec 2022 11:57:29 +0000 (12:57 +0100)]
Rollup merge of #105120 - solid-rs:patch/kmc-solid/maintainance, r=thomcc

kmc-solid: `std::sys` code maintenance

Includes a set of changes to fix the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets and make some other improvements.

- Address `fuzzy_provenance_casts` by using `expose_addr` and `from_exposed_addr` for pointer-integer casts
- Add a stub implementation of `is_terminal` (#98070)
- Address `unused_imports` and `unused_unsafe`
- Stop doing `Box::from_raw(&*(x: Box<T>) as *const T as *mut T)`

19 months agoRollup merge of #104922 - estebank:fur-elize, r=oli-obk
Matthias Krüger [Thu, 8 Dec 2022 11:57:28 +0000 (12:57 +0100)]
Rollup merge of #104922 - estebank:fur-elize, r=oli-obk

Detect long types in E0308 and write them to disk

On type error with long types, print an abridged type and write the full type to disk.

Print the widest possible short type while still fitting in the terminal.

19 months agoadd regression test for #105009
lcnr [Thu, 8 Dec 2022 11:23:10 +0000 (12:23 +0100)]
add regression test for #105009

19 months agovalidate: use the correct reveal during opts
lcnr [Thu, 8 Dec 2022 10:24:25 +0000 (11:24 +0100)]
validate: use the correct reveal during opts

19 months agoMake `VecDeque::from_iter` O(1) from `vec(_deque)::IntoIter`
Scott McMurray [Thu, 8 Dec 2022 09:42:45 +0000 (01:42 -0800)]
Make `VecDeque::from_iter` O(1) from `vec(_deque)::IntoIter`

19 months agoAuto merge of #105415 - nikic:update-llvm-10, r=cuviper
bors [Thu, 8 Dec 2022 07:46:42 +0000 (07:46 +0000)]
Auto merge of #105415 - nikic:update-llvm-10, r=cuviper

Update LLVM submodule

This is a rebase to LLVM 15.0.6.

Fixes #103380.
Fixes #104099.

19 months agoMove some suggestions from error_reporting to error_reporting::suggest
Michael Goulet [Thu, 8 Dec 2022 05:58:30 +0000 (05:58 +0000)]
Move some suggestions from error_reporting to error_reporting::suggest

19 months agorustdoc: clean up docblock table CSS
Michael Howell [Thu, 8 Dec 2022 04:59:54 +0000 (21:59 -0700)]
rustdoc: clean up docblock table CSS

* The rule `display: block` had no noticeable effect. Technically, because
  markdown tables have a tbody and thead, they get wrapped in an [anonymous
  table box] in the CSS tree, nested within the `<table>` element's block
  layout box.

  This rule was added in #87230 to make the table side-scrolling, but
  this same issue was doubly fixed in #88742 by wrapping it in an explicit
  `<div>` tag. Since accessibility advocates recommend the wrapper div over
  marking the table as `display: block`, we'll stick with that.

  https://adrianroselli.com/2020/11/under-engineered-responsive-tables.html

* The rule `width: calc(100% - 2px)` had no visible effect, because the
  anonymous table box was not affected.

* The style is tweaked to basically be the same style GitHub uses.
  In particular, it adds zebra stripes, and removes dotted borders.

[anonymous table box]: https://www.w3.org/TR/CSS2/tables.html#anonymous-boxes

19 months agoMove codegen_select_candidate to a rustc_traits
Michael Goulet [Thu, 8 Dec 2022 05:16:39 +0000 (05:16 +0000)]
Move codegen_select_candidate to a rustc_traits

19 months agoMove vtable methods into its own module
Michael Goulet [Thu, 8 Dec 2022 04:51:46 +0000 (04:51 +0000)]
Move vtable methods into its own module

19 months agoMove has_structural_eq_impls provider to rustc_ty_utils
Michael Goulet [Thu, 8 Dec 2022 04:02:50 +0000 (04:02 +0000)]
Move has_structural_eq_impls provider to rustc_ty_utils

19 months agoadd a test case for `generic_const_exprs` in trait items
Takayuki Maeda [Thu, 8 Dec 2022 05:11:29 +0000 (14:11 +0900)]
add a test case for `generic_const_exprs` in trait items

19 months agoPull out logic into distinct functions
Michael Goulet [Wed, 7 Dec 2022 20:30:42 +0000 (20:30 +0000)]
Pull out logic into distinct functions

19 months agoFix a typo.
Nicholas Nethercote [Thu, 8 Dec 2022 04:53:31 +0000 (15:53 +1100)]
Fix a typo.

19 months agoRemove `UnsafetyState`.
Nicholas Nethercote [Thu, 8 Dec 2022 04:42:12 +0000 (15:42 +1100)]
Remove `UnsafetyState`.

`FnCtxt::ps` is the only occurrence. It gets updated during HIR
typechecking, but is never looked at.

19 months agoAuto merge of #105425 - matthiaskrgr:rollup-3ngvxmt, r=matthiaskrgr
bors [Thu, 8 Dec 2022 03:04:51 +0000 (03:04 +0000)]
Auto merge of #105425 - matthiaskrgr:rollup-3ngvxmt, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #105267 (Don't ICE in ExprUseVisitor on FRU for non-existent struct)
 - #105343 (Simplify attribute handling in rustc_ast_lowering)
 - #105368 (Remove more `ref` patterns from the compiler)
 - #105400 (normalize before handling simple checks for evaluatability of `ty::Const`)
 - #105403 (rustdoc: simplify CSS selectors for item table `.stab`)
 - #105418 (fix: remove hack from link.rs)

Failed merges:

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

19 months agoFix warning when libcore is compiled with no_fp_fmt_parse
Gary Guo [Thu, 8 Dec 2022 00:07:00 +0000 (00:07 +0000)]
Fix warning when libcore is compiled with no_fp_fmt_parse

19 months agoCI: add missing line continuation marker
Dan Johnson [Wed, 7 Dec 2022 22:15:56 +0000 (14:15 -0800)]
CI: add missing line continuation marker

Resolves this docker warning:

```
[WARNING]: Empty continuation line found in:
    RUN apt-get update && apt-get install -y --no-install-recommends   g++   gcc-multilib   make   ninja-build   file   curl   ca-certificates   python2.7   python3.9   git   cmake   sudo   gdb   llvm-13-tools   llvm-13-dev   libedit-dev   libssl-dev   pkg-config   zlib1g-dev   xz-utils   nodejs     apt-transport-https software-properties-common &&     curl -s "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb" > packages-microsoft-prod.deb &&     dpkg -i packages-microsoft-prod.deb &&     apt-get update &&     apt-get install -y powershell     && rm -rf /var/lib/apt/lists/*
Warning: : Empty continuation lines will become errors in a future release.
```

19 months agoAvoid heap allocation when truncating thread names
Gavin Li [Sun, 4 Dec 2022 05:54:38 +0000 (21:54 -0800)]
Avoid heap allocation when truncating thread names

Ensure that heap allocation does not occur in a thread until std::thread
is ready. This fixes issues with custom allocators that call
std::thread::current(), since doing so prematurely initializes
THREAD_INFO and causes the following thread_info::set() to fail.

19 months agoUse `Symbol` for the crate name instead of `String`/`str`
Oli Scherer [Tue, 6 Dec 2022 12:46:10 +0000 (12:46 +0000)]
Use `Symbol` for the crate name instead of `String`/`str`

19 months agoImprove calculation of scraped example minimized height
Will Crichton [Wed, 7 Dec 2022 18:24:16 +0000 (10:24 -0800)]
Improve calculation of scraped example minimized height

19 months agoProperly print generator interior type sizes
Michael Goulet [Wed, 7 Dec 2022 18:33:26 +0000 (18:33 +0000)]
Properly print generator interior type sizes

19 months agoRevert crate_types change, add new bin_crate field
Will Crichton [Tue, 6 Dec 2022 20:56:02 +0000 (12:56 -0800)]
Revert crate_types change, add new bin_crate field

19 months agoFix rustdoc error with no providec crate-type, fix scrape examples button colors...
Will Crichton [Tue, 6 Dec 2022 19:24:26 +0000 (11:24 -0800)]
Fix rustdoc error with no providec crate-type, fix scrape examples button colors w/ themes

19 months agoFix es-check
Will Crichton [Tue, 6 Dec 2022 18:22:23 +0000 (10:22 -0800)]
Fix es-check

19 months agoUpdate scrape-examples help, fix documentation typos
Will Crichton [Tue, 6 Dec 2022 18:11:55 +0000 (10:11 -0800)]
Update scrape-examples help, fix documentation typos

19 months agoFactor scrape-examples toggle test into a new file
Will Crichton [Tue, 6 Dec 2022 17:59:49 +0000 (09:59 -0800)]
Factor scrape-examples toggle test into a new file

19 months agoInclude additional documentation for scrape-examples changes
Will Crichton [Tue, 6 Dec 2022 17:34:37 +0000 (09:34 -0800)]
Include additional documentation for scrape-examples changes

19 months agoOnly put title over example on large screens
Will Crichton [Tue, 6 Dec 2022 07:48:07 +0000 (23:48 -0800)]
Only put title over example on large screens

19 months agoAdd explanations to scrape-examples integration test
Will Crichton [Tue, 6 Dec 2022 07:34:02 +0000 (23:34 -0800)]
Add explanations to scrape-examples integration test

19 months agoImprove several aspects of the Rustdoc scrape-examples UI.
Will Crichton [Sun, 27 Nov 2022 19:11:21 +0000 (13:11 -0600)]
Improve several aspects of the Rustdoc scrape-examples UI.
* Examples take up less screen height.
* Snippets from binary crates are prioritized.
* toggle-all-docs does not expand "More examples" sections.

19 months agoMove closure/generator type info methods to TyCtxt
Michael Goulet [Wed, 7 Dec 2022 17:00:33 +0000 (17:00 +0000)]
Move closure/generator type info methods to TyCtxt

19 months agoDon't internalize __llvm_profile_counter_bias
Alex Brachet [Mon, 5 Dec 2022 06:37:21 +0000 (06:37 +0000)]
Don't internalize __llvm_profile_counter_bias

Currently, LLVM profiling runtime counter relocation cannot be
used by rust during LTO because symbols are being internalized
before all symbol information is known.

This mode makes LLVM emit a __llvm_profile_counter_bias symbol
which is referenced by the profiling initialization, which itself
is pulled in by the rust driver here [1].

It is enabled with -Cllvm-args=-runtime-counter-relocation for
platforms which are opt-in to this mode like Linux. On these
platforms there will be no link error, rather just surprising
behavior for a user which request runtime counter relocation.
The profiling runtime will not see that symbol go on as if it
were never there. On Fuchsia, the profiling runtime must have
this symbol which will cause a hard link error.

As an aside, I don't have enough context as to why rust's LTO
model is how it is. AFAICT, the internalize pass is only safe
to run at link time when all symbol information is actually
known, this being an example as to why. I think special casing
this symbol as a known one that LLVM can emit which should not
have it's visbility de-escalated should be fine given how
seldom this pattern of defining an undefined symbol to get
initilization code pulled in is. From a quick grep,
__llvm_profile_runtime is the only symbol that rustc does this
for.

[1] https://github.com/rust-lang/rust/blob/0265a3e93bf1b89d97cae113ed214954d5c35e22/compiler/rustc_codegen_ssa/src/back/linker.rs#L598

19 months agoMake some trivial functions `#[inline(always)]`
Eduardo Sánchez Muñoz [Wed, 7 Dec 2022 16:11:17 +0000 (17:11 +0100)]
Make some trivial functions `#[inline(always)]`

19 months agoDon't silently ignore errors that happen during rendering
Guillaume Gomez [Wed, 7 Dec 2022 15:08:13 +0000 (16:08 +0100)]
Don't silently ignore errors that happen during rendering

19 months agoRollup merge of #105418 - BelovDV:fix-libc-hack, r=petrochenkov
Matthias Krüger [Wed, 7 Dec 2022 14:39:09 +0000 (15:39 +0100)]
Rollup merge of #105418 - BelovDV:fix-libc-hack, r=petrochenkov

fix: remove hack from link.rs

This logic implemented in libc.

r? `@petrochenkov`

19 months agoRollup merge of #105403 - notriddle:notriddle/item-stab-css, r=GuillaumeGomez
Matthias Krüger [Wed, 7 Dec 2022 14:39:09 +0000 (15:39 +0100)]
Rollup merge of #105403 - notriddle:notriddle/item-stab-css, r=GuillaumeGomez

rustdoc: simplify CSS selectors for item table `.stab`

The module-item and import-item classes are attached to the item-left. Just target that, instead.

19 months agoRollup merge of #105400 - BoxyUwU:braced_param_evaluatability, r=oli-obk
Matthias Krüger [Wed, 7 Dec 2022 14:39:08 +0000 (15:39 +0100)]
Rollup merge of #105400 - BoxyUwU:braced_param_evaluatability, r=oli-obk

normalize before handling simple checks for evaluatability of `ty::Const`

`{{{{{{{ N }}}}}}}` is desugared into a `ConstKind::Unevaluated` for an anonymous `const` item so when calling `is_const_evaluatable` on it we skip the `ConstKind::Param(_) => Ok(())` arm which is incorrect.

19 months agoRollup merge of #105368 - WaffleLapkin:deref-even-harder, r=TaKO8Ki
Matthias Krüger [Wed, 7 Dec 2022 14:39:07 +0000 (15:39 +0100)]
Rollup merge of #105368 - WaffleLapkin:deref-even-harder, r=TaKO8Ki

Remove more `ref` patterns from the compiler

Previous PR: #105045

19 months agoRollup merge of #105343 - nbdd0121:hir, r=fee1-dead
Matthias Krüger [Wed, 7 Dec 2022 14:39:07 +0000 (15:39 +0100)]
Rollup merge of #105343 - nbdd0121:hir, r=fee1-dead

Simplify attribute handling in rustc_ast_lowering

Given that attributes is stored in a separate BTreeMap, it's not necessary to pass it in when constructing `hir::Expr`. We can just construct `hir::Expr` and then call `self.lower_attrs` later if it needs attributes.

As most desugaring code don't use attributes, this allows some code cleanup.

19 months agoRollup merge of #105267 - compiler-errors:issue-104613, r=oli-obk
Matthias Krüger [Wed, 7 Dec 2022 14:39:06 +0000 (15:39 +0100)]
Rollup merge of #105267 - compiler-errors:issue-104613, r=oli-obk

Don't ICE in ExprUseVisitor on FRU for non-existent struct

Fixes #104613
Fixes #105202

19 months agoAuto merge of #103459 - ChrisDenton:propagate-nulls, r=thomcc
bors [Wed, 7 Dec 2022 13:52:52 +0000 (13:52 +0000)]
Auto merge of #103459 - ChrisDenton:propagate-nulls, r=thomcc

Pass on null handle values to child process

Fixes #101645

In Windows, stdio handles are (semantically speaking) `Option<Handle>` where `Handle` is a non-zero value. When spawning a process with `Stdio::Inherit`, Rust currently turns zero values into `-1` values. This has the unfortunate effect of breaking console subprocesses (which typically need stdio) that are spawned from gui applications (that lack stdio by default) because the console process won't be assigned handles from the newly created console (as they usually would in that situation). Worse, `-1` is actually [a valid handle](https://doc.rust-lang.org/std/os/windows/io/struct.OwnedHandle.html) which means "the current process". So if a console process, for example, waits on stdin and it has a `-1` value then the process will end up waiting on itself.

This PR fixes it by propagating the nulls instead of converting them to `-1`.

While I think the current behaviour is a mistake, changing it (however justified) is an API change so I think this PR should at least have some input from t-libs-api. So choosing at random...

r? `@joshtriplett`

19 months agoMake -Zsimulate-remapped-rust-src-base reproducible on CI
Oli Scherer [Wed, 7 Dec 2022 10:36:08 +0000 (10:36 +0000)]
Make -Zsimulate-remapped-rust-src-base reproducible on CI

19 months agoAuto merge of #104799 - pcc:linkage-fn, r=tmiasko
bors [Wed, 7 Dec 2022 10:24:59 +0000 (10:24 +0000)]
Auto merge of #104799 - pcc:linkage-fn, r=tmiasko

Support Option and similar enums as type of static variable with linkage attribute

Compiler MCP:
rust-lang/compiler-team#565

19 months agofix: remove hack from link.rs (moved to libc)
Daniil Belov [Wed, 7 Dec 2022 10:13:58 +0000 (13:13 +0300)]
fix: remove hack from link.rs (moved to libc)

19 months agoAvoid remapping paths back to `$SRC_DIR` in CI
Oli Scherer [Wed, 7 Dec 2022 09:19:49 +0000 (09:19 +0000)]
Avoid remapping paths back to `$SRC_DIR` in CI

19 months agoSplit `EarlyContextAndPasses::check_id` in two.
Nicholas Nethercote [Wed, 7 Dec 2022 03:58:48 +0000 (14:58 +1100)]
Split `EarlyContextAndPasses::check_id` in two.

19 months agoInline some hot lint pass functions.
Nicholas Nethercote [Wed, 7 Dec 2022 03:52:28 +0000 (14:52 +1100)]
Inline some hot lint pass functions.

These each have a single call site, due to being called from a
"combined" lint pass.

19 months agoRename `$passes` as `$pass` in several macros.
Nicholas Nethercote [Wed, 7 Dec 2022 05:54:02 +0000 (16:54 +1100)]
Rename `$passes` as `$pass` in several macros.

Because it makes more sense that way.

19 months agoAdd some useful comments.
Nicholas Nethercote [Wed, 7 Dec 2022 03:18:19 +0000 (14:18 +1100)]
Add some useful comments.

19 months agoRemove `$hir` argument from `late_lint_methods!`.
Nicholas Nethercote [Wed, 7 Dec 2022 02:27:04 +0000 (13:27 +1100)]
Remove `$hir` argument from `late_lint_methods!`.

Because it's always `'tcx`.

19 months agoUpdate LLVM submodule
Nikita Popov [Wed, 7 Dec 2022 07:40:49 +0000 (08:40 +0100)]
Update LLVM submodule

19 months agoAuto merge of #105395 - sunfishcode:sunfishcode/update-wasi, r=pietroalbini
bors [Wed, 7 Dec 2022 06:16:19 +0000 (06:16 +0000)]
Auto merge of #105395 - sunfishcode:sunfishcode/update-wasi, r=pietroalbini

Update the wasi toolchain.

Update the WASI build to LLVM 15.0 and the wasi-libc version from [wasi-sdk-17].

This will require a ci-mirrors.rust-lang.org file load. Specifically, we need [this LLVM release tarball] uploaded to be downloadable from [this URL].

The biggest change in wasi-sdk-17 is that user exports no longer automatically run constructor functions. More details at: https://github.com/WebAssembly/WASI/issues/493.

[this LLVM release tarball]: https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz
[this URL]: https://ci-mirrors.rust-lang.org/rustc/2022-12-06-clang%2Bllvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz
[wasi-sdk-17]: https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-17

19 months agoconsider `parent_count` for const param defaults
Takayuki Maeda [Wed, 7 Dec 2022 03:55:30 +0000 (12:55 +0900)]
consider `parent_count` for const param defaults

19 months agoAuto merge of #105291 - nnethercote:remove-LintPassObjects, r=cjgillot
bors [Wed, 7 Dec 2022 03:52:19 +0000 (03:52 +0000)]
Auto merge of #105291 - nnethercote:remove-LintPassObjects, r=cjgillot

Remove `{Early,Late}LintPassObjects`.

`EarlyContextAndPass` wraps a single early lint pass. We aggregate multiple passes into that single pass by using `EarlyLintPassObjects`.

This commit removes `EarlyLintPassObjects` by changing `EarlyContextAndPass` into `EarlyContextAndPasses`. I.e. it just removes a level of indirection. This makes the code simpler and slightly faster.

The commit does likewise for late lints.

r? `@cjgillot`

19 months agoCompute generator sizes with -Zprint_type_sizes
Michael Goulet [Sat, 5 Nov 2022 18:25:41 +0000 (18:25 +0000)]
Compute generator sizes with -Zprint_type_sizes

19 months agoAdd help for `#![feature(impl_trait_in_fn_trait_return)]`
Josh Stone [Wed, 7 Dec 2022 01:53:50 +0000 (17:53 -0800)]
Add help for `#![feature(impl_trait_in_fn_trait_return)]`

This adds a new variant `ImplTraitContext::FeatureGated`, so we can
generalize the help for `return_position_impl_trait_in_trait` to also
work for `impl_trait_in_fn_trait_return`.

19 months agoStop passing -export-dynamic to wasm-ld.
Dan Gohman [Wed, 7 Dec 2022 00:50:29 +0000 (16:50 -0800)]
Stop passing -export-dynamic to wasm-ld.

-export-dynamic was a temporary hack added in the early days of the Rust
wasm32 target when Rust didn't have a way to specify wasm exports in the
source code. This flag causes all global symbols, and some compiler-internal
symbols, to be exported, which is often more than needed.

Rust now does have a way to specify exports in the source code:
`#[export_name = "..."]`.

So as the original comment suggests, -export-dynamic can now be removed,
allowing users to have smaller binaries and better encapsulation in
their wasm32-unknown-unknown modules.

It's possible that this change will require existing wasm32-unknown-unknown
users will to add explicit `#[export_name = "..."]` directives to
exporrt the symbols that their programs depend on having exported.

19 months agoAuto merge of #105397 - matthiaskrgr:rollup-xv5imz8, r=matthiaskrgr
bors [Wed, 7 Dec 2022 00:32:57 +0000 (00:32 +0000)]
Auto merge of #105397 - matthiaskrgr:rollup-xv5imz8, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #105298 (llvm-wrapper: adapt for an LLVM API change)
 - #105358 (Add a test for #104260)
 - #105380 (add const generics ping files things for me)
 - #105382 (remove an excess `this`)
 - #105388 (rustdoc: remove redundant CSS `.import-item .stab { font-size }`)
 - #105390 (unstable-book: Add `ignore` to `abi_efiapi` example code)

Failed merges:

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

19 months agorustdoc: simplify CSS selectors for item table `.stab`
Michael Howell [Wed, 7 Dec 2022 00:05:43 +0000 (17:05 -0700)]
rustdoc: simplify CSS selectors for item table `.stab`

The module-item and import-item classes are attached to the item-left.
Just target that, instead.

19 months agonormalize before matching on `ConstKind`
Boxy [Tue, 6 Dec 2022 22:53:08 +0000 (22:53 +0000)]
normalize before matching on `ConstKind`

19 months agoRollup merge of #105390 - nicholasbishop:bishop-example-ignore, r=ehuss
Matthias Krüger [Tue, 6 Dec 2022 22:13:52 +0000 (23:13 +0100)]
Rollup merge of #105390 - nicholasbishop:bishop-example-ignore, r=ehuss

unstable-book: Add `ignore` to `abi_efiapi` example code

This example doesn't compile on targets that don't support UEFI, as reported here:
https://github.com/rust-lang/rust/pull/104793#issuecomment-1339783727

19 months agoRollup merge of #105388 - notriddle:notriddle/item-stab-font-size, r=GuillaumeGomez
Matthias Krüger [Tue, 6 Dec 2022 22:13:51 +0000 (23:13 +0100)]
Rollup merge of #105388 - notriddle:notriddle/item-stab-font-size, r=GuillaumeGomez

rustdoc: remove redundant CSS `.import-item .stab { font-size }`

This sets the exact same font size that `.stab` has by default anyway. It used to be slightly different, but dd5ff428edbc7cd4fa600b81f27bbec28589704f made it identical.

19 months agoRollup merge of #105382 - BoxyUwU:fixme_typo_sadface, r=lcnr
Matthias Krüger [Tue, 6 Dec 2022 22:13:51 +0000 (23:13 +0100)]
Rollup merge of #105382 - BoxyUwU:fixme_typo_sadface, r=lcnr

remove an excess `this`

19 months agoRollup merge of #105380 - BoxyUwU:triagebot_ping_pls, r=lcnr
Matthias Krüger [Tue, 6 Dec 2022 22:13:50 +0000 (23:13 +0100)]
Rollup merge of #105380 - BoxyUwU:triagebot_ping_pls, r=lcnr

add const generics ping files things for me

r? `@lcnr`

19 months agoRollup merge of #105358 - TaKO8Ki:fix-104260, r=estebank
Matthias Krüger [Tue, 6 Dec 2022 22:13:50 +0000 (23:13 +0100)]
Rollup merge of #105358 - TaKO8Ki:fix-104260, r=estebank

Add a test for #104260

Fixes #104260

19 months agoRollup merge of #105298 - krasimirgg:llvm-16-dec-1, r=cuviper
Matthias Krüger [Tue, 6 Dec 2022 22:13:49 +0000 (23:13 +0100)]
Rollup merge of #105298 - krasimirgg:llvm-16-dec-1, r=cuviper

llvm-wrapper: adapt for an LLVM API change

Adapts llvm-wrapper for https://github.com/llvm/llvm-project/commit/8c7c20f033c7036a8bf231ca6f9e02172cb581f0.
No functional changes intended.

Found via our experimental rust + llvm @ HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/15404#0184d95d-5a68-4db6-ad32-51ddbc3ab543/202-571

19 months agoAuto merge of #105271 - eduardosm:inline-always-int-conv, r=scottmcm
bors [Tue, 6 Dec 2022 21:41:04 +0000 (21:41 +0000)]
Auto merge of #105271 - eduardosm:inline-always-int-conv, r=scottmcm

Make integer-to-integer `From` impls `#[inline(always)]`

Splited from https://github.com/rust-lang/rust/pull/105262

19 months agoUpdate the wasi toolchain.
Dan Gohman [Tue, 6 Dec 2022 21:08:30 +0000 (13:08 -0800)]
Update the wasi toolchain.

Update the WASI build to LLVM 15.0 and the wasi-libc version from [wasi-sdk-17].

This will require a ci-mirrors.rust-lang.org file load. Specifically, we
need [this LLVM release tarball] uploaded to be downloadable from
[this URL].

[this LLVM release tarball]: https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz
[this URL]: https://ci-mirrors.rust-lang.org/rustc/2022-12-06-clang%2Bllvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz
[wasi-sdk-17]: https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-17

19 months agounstable-book: Add `ignore` to `abi_efiapi` example code
Nicholas Bishop [Tue, 6 Dec 2022 19:22:56 +0000 (14:22 -0500)]
unstable-book: Add `ignore` to `abi_efiapi` example code

This example doesn't compile on targets that don't support UEFI, as
reported here:
https://github.com/rust-lang/rust/pull/104793#issuecomment-1339783727

19 months agoFilter out precise alloc ids from diagnostics
Oli Scherer [Mon, 5 Dec 2022 10:42:59 +0000 (10:42 +0000)]
Filter out precise alloc ids from diagnostics

19 months agoEmit full spans in miri
Oli Scherer [Thu, 1 Dec 2022 20:25:43 +0000 (20:25 +0000)]
Emit full spans in miri

19 months agoBless 32 bit tests
Oli Scherer [Wed, 30 Nov 2022 12:10:41 +0000 (12:10 +0000)]
Bless 32 bit tests