Commit Graph

212411 Commits

Author SHA1 Message Date
Matthias Krüger
f1f7560598
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```
2022-12-08 12:57:30 +01:00
Matthias Krüger
e826a9acb4
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```
2022-12-08 12:57:29 +01:00
Matthias Krüger
cd936cc812
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)`
2022-12-08 12:57:29 +01:00
Matthias Krüger
086bdbbd73
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.
2022-12-08 12:57:28 +01:00
lcnr
e73ef59cb6 add regression test for #105009 2022-12-08 12:57:22 +01:00
lcnr
dd9d05cec4 validate: use the correct reveal during opts 2022-12-08 11:24:25 +01:00
Scott McMurray
58e60ac211 Make VecDeque::from_iter O(1) from vec(_deque)::IntoIter 2022-12-08 01:42:45 -08:00
bors
7632db0e87 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.
2022-12-08 07:46:42 +00:00
Michael Goulet
3b9daac6a2 Move some suggestions from error_reporting to error_reporting::suggest 2022-12-08 05:58:30 +00:00
Michael Howell
a09e8c55c6 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
2022-12-07 22:49:10 -07:00
Michael Goulet
25a6daccab Move codegen_select_candidate to a rustc_traits 2022-12-08 05:16:57 +00:00
Michael Goulet
b36035c20f Move vtable methods into its own module 2022-12-08 05:16:57 +00:00
Michael Goulet
48270044b0 Move has_structural_eq_impls provider to rustc_ty_utils 2022-12-08 05:16:48 +00:00
Takayuki Maeda
85d7d9b6b7 add a test case for generic_const_exprs in trait items 2022-12-08 14:11:29 +09:00
Michael Goulet
7d23e29f9f Pull out logic into distinct functions 2022-12-08 04:59:10 +00:00
Nicholas Nethercote
9af48e5ab6 Fix a typo. 2022-12-08 15:53:31 +11:00
Nicholas Nethercote
7a4669285a Remove UnsafetyState.
`FnCtxt::ps` is the only occurrence. It gets updated during HIR
typechecking, but is never looked at.
2022-12-08 15:42:57 +11:00
bors
f5418b09e8 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
2022-12-08 03:04:51 +00:00
Gary Guo
a3c4c2ee1d Fix warning when libcore is compiled with no_fp_fmt_parse 2022-12-08 00:16:49 +00:00
Dan Johnson
8bc30cb0f1 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.
```
2022-12-07 14:17:47 -08:00
Gavin Li
3c55af5b09 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:🧵:current(), since doing so prematurely initializes
THREAD_INFO and causes the following thread_info::set() to fail.
2022-12-07 13:12:29 -08:00
Oli Scherer
d30848b30a Use Symbol for the crate name instead of String/str 2022-12-07 20:30:02 +00:00
Will Crichton
9499d2cce3 Improve calculation of scraped example minimized height 2022-12-07 10:42:09 -08:00
Michael Goulet
57b722688d Properly print generator interior type sizes 2022-12-07 18:33:26 +00:00
Will Crichton
8a459384ad Revert crate_types change, add new bin_crate field 2022-12-07 09:08:43 -08:00
Will Crichton
0709e534df Fix rustdoc error with no providec crate-type, fix scrape examples button colors w/ themes 2022-12-07 09:08:43 -08:00
Will Crichton
bcdab876c8 Fix es-check 2022-12-07 09:08:43 -08:00
Will Crichton
ae270f1b99 Update scrape-examples help, fix documentation typos 2022-12-07 09:08:43 -08:00
Will Crichton
212d03dadc Factor scrape-examples toggle test into a new file 2022-12-07 09:08:43 -08:00
Will Crichton
679d7ea064 Include additional documentation for scrape-examples changes 2022-12-07 09:08:43 -08:00
Will Crichton
4574217074 Only put title over example on large screens 2022-12-07 09:08:43 -08:00
Will Crichton
acd70e674d Add explanations to scrape-examples integration test 2022-12-07 09:08:43 -08:00
Will Crichton
6ccd14a782 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.
2022-12-07 09:08:43 -08:00
Michael Goulet
b0dcadfc45 Move closure/generator type info methods to TyCtxt 2022-12-07 17:00:33 +00:00
Alex Brachet
5d88d36053 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] 0265a3e93b/compiler/rustc_codegen_ssa/src/back/linker.rs (L598)
2022-12-07 16:32:59 +00:00
Eduardo Sánchez Muñoz
00e7b54d46 Make some trivial functions #[inline(always)] 2022-12-07 17:11:17 +01:00
Guillaume Gomez
06693790ce Don't silently ignore errors that happen during rendering 2022-12-07 16:08:13 +01:00
Matthias Krüger
4968af0ee8
Rollup merge of #105418 - BelovDV:fix-libc-hack, r=petrochenkov
fix: remove hack from link.rs

This logic implemented in libc.

r? `@petrochenkov`
2022-12-07 15:39:09 +01:00
Matthias Krüger
c75478b246
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.
2022-12-07 15:39:09 +01:00
Matthias Krüger
b23419b03d
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.
2022-12-07 15:39:08 +01:00
Matthias Krüger
52cec8c99f
Rollup merge of #105368 - WaffleLapkin:deref-even-harder, r=TaKO8Ki
Remove more `ref` patterns from the compiler

Previous PR: #105045
2022-12-07 15:39:07 +01:00
Matthias Krüger
95da525982
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.
2022-12-07 15:39:07 +01:00
Matthias Krüger
3bcfa4c459
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
2022-12-07 15:39:06 +01:00
bors
01fbc5ae78 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`
2022-12-07 13:52:52 +00:00
Oli Scherer
717fdb5817 Make -Zsimulate-remapped-rust-src-base reproducible on CI 2022-12-07 10:36:08 +00:00
bors
91b8f34ac2 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
2022-12-07 10:24:59 +00:00
Daniil Belov
a9cf163c08 fix: remove hack from link.rs (moved to libc) 2022-12-07 13:13:58 +03:00
Oli Scherer
8aff39130f Avoid remapping paths back to $SRC_DIR in CI 2022-12-07 09:19:49 +00:00
Nicholas Nethercote
d049be30cf Split EarlyContextAndPasses::check_id in two. 2022-12-07 19:29:31 +11:00
Nicholas Nethercote
b08fd6e8ef Inline some hot lint pass functions.
These each have a single call site, due to being called from a
"combined" lint pass.
2022-12-07 19:29:31 +11:00