Commit Graph

211619 Commits

Author SHA1 Message Date
hkalbasi
56126fb149 Extract llvm datalayout parsing out of spec module 2022-11-30 21:13:54 +03:30
bors
90711a86e5 Auto merge of #99814 - aliemjay:patch-2, r=jackh726
fix universe map in ifcx.instantiate_canonical_*

Previously, `infcx.instantiate_canonical_*` maps the root universe in `canonical` into `ty::UniverseIndex::Root`, I think because it assumes it works with a fresh `infcx` but this is not true for the use cases in mir typeck. Now the root universe is mapped into `infcx.universe()`.

I catched this accidentally while reviewing the code. I'm not sure if this is the right fix or if it is really a bug!
2022-11-30 14:03:36 +00:00
bors
24606deaf4 Auto merge of #104905 - compiler-errors:normalization-changes, r=spastorino
Some initial normalization method changes

1. Rename `AtExt::normalize` to `QueryNormalizeExt::query_normalize` (using the `QueryNormalizer`)
2. Introduce `NormalizeExt::normalize` to replace `partially_normalize_associated_types_in` (using the `AssocTypeNormalizer`)
3. Rename `FnCtxt::normalize_associated_types_in` to `FnCtxt::normalize`
4. Remove some unused other normalization fns in `Inherited` and `FnCtxt`

Also includes one drive-by where we're no longer creating a `FnCtxt` inside of `check_fn`, but passing it in. This means we don't need such weird `FnCtxt` construction logic.

Stacked on top of #104835 for convenience.

r? types
2022-11-30 11:13:09 +00:00
bors
a569a88f55 Auto merge of #105080 - matthiaskrgr:rollup-7ffj4oe, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #104697 (Restore control flow on error in EUV)
 - #104811 (feat: implement TcpStream shutdown for wasm32-wasi)
 - #105039 (Fix an ICE parsing a malformed literal in `concat_bytes!`.)
 - #105071 (Add Nicholas Nethercote to `.mailmap`.)
 - #105079 (Add bots to `.mailmap`)

Failed merges:

 - #105074 (Add Nicholas Bishop to `.mailmap`)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-30 07:59:24 +00:00
Matthias Krüger
815b6e5ab8
Rollup merge of #105079 - nnethercote:bots-mailmap, r=jyn514
Add bots to `.mailmap`

r? `@compiler-errors`
2022-11-30 07:00:32 +01:00
Matthias Krüger
bc820ecc34
Rollup merge of #105071 - nnethercote:nnethercote-mailmap, r=compiler-errors
Add Nicholas Nethercote to `.mailmap`.

Before:
```
$ git shortlog -se | grep Nethercote
   517	Nicholas Nethercote <n.nethercote@gmail.com>
     2	Nicholas Nethercote <nnethercote@apple.com>
   560	Nicholas Nethercote <nnethercote@mozilla.com>
```
After
```
$ git shortlog -se | grep Nethercote
  1079	Nicholas Nethercote <n.nethercote@gmail.com>
```
2022-11-30 07:00:32 +01:00
Matthias Krüger
084bbcc2ca
Rollup merge of #105039 - nnethercote:fix-104769, r=petrochenkov
Fix an ICE parsing a malformed literal in `concat_bytes!`.

Fixes #104769.

r? `@petrochenkov`
2022-11-30 07:00:31 +01:00
Matthias Krüger
c752eaa7de
Rollup merge of #104811 - haraldh:feat/wasm32_wasi_shutdown, r=joshtriplett
feat: implement TcpStream shutdown for wasm32-wasi

Signed-off-by: Harald Hoyer <harald@profian.com>
2022-11-30 07:00:31 +01:00
Matthias Krüger
0c14551fe5
Rollup merge of #104697 - dingxiangfei2009:fix-euv-control-flow, r=oli-obk
Restore control flow on error in EUV

cc `@Nilstrieb`

Fix #104649

Since #98574 refactored a piece of scrutinee memory categorization out as a subroutine, there is a subtle change in handling match arms especially when the categorization process faults and bails. In the correct case, it is not supposed to continue to process the arms any more. This PR restores the original control flow in EUV.

I promise to add a compile-fail test to demonstrate that this indeed fixes the issue after coming back from a nap.
2022-11-30 07:00:30 +01:00
bors
8de4b13845 Auto merge of #104679 - dvdhrm:rw/dso, r=petrochenkov
codegen-llvm: never combine DSOLocal and DllImport

Prevent DllImport from being attached to DSOLocal definitions in the LLVM IR. The combination makes no sense, since definitions local to the compilation unit will never be imported from external objects.

Additionally, LLVM will refuse the IR if it encounters the combination (introduced in [1]):

```
  if (GV.hasDLLImportStorageClass())
    Assert(!GV.isDSOLocal(),
           "GlobalValue with DLLImport Storage is dso_local!", &GV);
```

Right now, codegen-llvm will only apply DllImport to constants and rely on call-stubs for functions. Hence, we simply extend the codegen of constants to skip DllImport for any local definitions.

This was discovered when switching the EFI targets to the static relocation model [2]. With this fixed, we can start another attempt at this.

[1] 509132b368
[2] https://github.com/rust-lang/rust/issues/101656
2022-11-30 04:18:15 +00:00
Nicholas Nethercote
3593a5d74e Add dependabot to .mailmap.
Before:
```
$ git shortlog -se | grep "depend"
    44	dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
     6	dependabot-preview[bot] <dependabot-preview[bot]@users.noreply.github.com>
     4	dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    74	dependabot[bot] <dependabot[bot]@users.noreply.github.com>
    93	dependabot[bot] <support@dependabot.com>
```
After:
```
$ git shortlog -se | grep "depend"
   221  dependabot[bot] <dependabot[bot]@users.noreply.github.com>
```
2022-11-30 13:15:35 +11:00
Nicholas Nethercote
b2e05f6400 Add bors to .mailmap.
Before:
```
$ git shortlog -se | grep "\<bors\>"
 27755	bors <bors@rust-lang.org>
  5729	bors[bot] <26634292+bors[bot]@users.noreply.github.com>
   995	bors[bot] <bors[bot]@users.noreply.github.com>
```
After:
```
$ git shortlog -se | grep "\<bors\>"
 34479	bors <bors@rust-lang.org>
```
2022-11-30 13:09:47 +11:00
Nicholas Nethercote
bf4a62c381 Fix an ICE parsing a malformed literal in concat_bytes!.
Fixes #104769.
2022-11-30 12:19:07 +11:00
bors
d38a99078c Auto merge of #105070 - matthiaskrgr:rollup-9b25khj, r=matthiaskrgr
Rollup of 14 pull requests

Successful merges:

 - #103876 (type alias impl trait: add tests showing that hidden type only outlives lifetimes that occur in bounds)
 - #104427 (Explain why `rematch_impl` fails to be infallible)
 - #104436 (Add slice to the stack allocated string comment)
 - #104523 (Don't use periods in target names)
 - #104627 (Print all features with --print target-features)
 - #104911 (Make inferred_outlives_crate return Clause)
 - #105002 (Add `PathBuf::as_mut_os_string` and `Path::as_mut_os_str`)
 - #105023 (Statics used in reachable function's inline asm are reachable)
 - #105045 (`rustc_ast_{passes,pretty}`: remove `ref` patterns)
 - #105049 (Hermit: Minor build fixes)
 - #105051 (Replace a macro with a function)
 - #105062 (rustdoc: use shorthand background for rustdoc toggle CSS)
 - #105066 (move `candidate_from_obligation` out of assembly)
 - #105068 (Run patchelf also on rust-analyzer-proc-macro-srv.)

Failed merges:

 - #105050 (Remove useless borrows and derefs)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-30 00:42:43 +00:00
Nicholas Nethercote
b788cb0071 Add Nicholas Nethercote to .mailmap.
Before:
```
$ git shortlog -se | grep Nethercote
   517	Nicholas Nethercote <n.nethercote@gmail.com>
     2	Nicholas Nethercote <nnethercote@apple.com>
   560	Nicholas Nethercote <nnethercote@mozilla.com>
```
After
```
$ git shortlog -se | grep Nethercote
  1079	Nicholas Nethercote <n.nethercote@gmail.com>
```
2022-11-30 08:54:11 +11:00
Matthias Krüger
a5ca67b951
Rollup merge of #105068 - jneem:master, r=jyn514
Run patchelf also on rust-analyzer-proc-macro-srv.

On NixOS, `rust-analyzer-proc-macro-srv` needs to be `patchelf`ed just like all the other libs and binaries.

With this fix, I am able to use the language server configuration recommended in [the guide](https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc).
2022-11-29 22:43:22 +01:00
Matthias Krüger
08a6c939a5
Rollup merge of #105066 - lcnr:mv-candidate_from_obligation, r=compiler-errors
move `candidate_from_obligation` out of assembly

it doesn't belong there as it also does winnowing

r? `@compiler-errors`
2022-11-29 22:43:22 +01:00
Matthias Krüger
5726f1f3ac
Rollup merge of #105062 - notriddle:notriddle/rustdoc-toggle-background, r=GuillaumeGomez
rustdoc: use shorthand background for rustdoc toggle CSS
2022-11-29 22:43:21 +01:00
Matthias Krüger
776e4a36c7
Rollup merge of #105051 - WaffleLapkin:unmacro, r=oli-obk
Replace a macro with a function

🌸
2022-11-29 22:43:21 +01:00
Matthias Krüger
aa674eefda
Rollup merge of #105049 - mkroening:hermit-fixes, r=jyn514
Hermit: Minor build fixes

These changes are necessary to build for the hermit targets.

CC: ``@stlankes``
2022-11-29 22:43:20 +01:00
Matthias Krüger
b596d6be7f
Rollup merge of #105045 - WaffleLapkin:deref-ahhhh~, r=compiler-errors
`rustc_ast_{passes,pretty}`: remove `ref` patterns

r? `@compiler-errors`
Previous PR: https://github.com/rust-lang/rust/pull/104721
2022-11-29 22:43:19 +01:00
Matthias Krüger
581ca3e836
Rollup merge of #105023 - tmiasko:asm-sym-static-reachable, r=wesleywiser
Statics used in reachable function's inline asm are reachable

Fixes #104925.
2022-11-29 22:43:19 +01:00
Matthias Krüger
804fa66a02
Rollup merge of #105002 - zertosh:acp-140, r=dtolnay
Add `PathBuf::as_mut_os_string` and `Path::as_mut_os_str`

Implements rust-lang/libs-team#140 (tracking issue #105021).
2022-11-29 22:43:18 +01:00
Matthias Krüger
ca8f4c8d72
Rollup merge of #104911 - spastorino:inferred_outlives_crate-return-clause, r=oli-obk
Make inferred_outlives_crate return Clause

r? ``@oli-obk``
2022-11-29 22:43:18 +01:00
Matthias Krüger
3539cf9344
Rollup merge of #104627 - calebzulawski:print-target-features, r=compiler-errors
Print all features with --print target-features

This fixes `rustc --print target-features` with respect to aliases and tied features.

Before this change, the print command assumed that each LLVM feature corresponds exactly to one rustc feature.  In the case of aliases and tied features, this assumption failed and some features (such as aarch64's "pacg") were missing.  With this change, every target feature is listed.
2022-11-29 22:43:17 +01:00
Matthias Krüger
3e9a2233d0
Rollup merge of #104523 - flba-eb:fix_nto_target_name, r=wesleywiser
Don't use periods in target names

Using a period in the target name can cause issues in e.g. cargo, see also https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Running.20tests.20on.20remote.20target
2022-11-29 22:43:17 +01:00
Matthias Krüger
e4d1fe7b15
Rollup merge of #104436 - ismailmaj:add-slice-to-stack-allocated-string-comment, r=Mark-Simulacrum
Add slice to the stack allocated string comment

Precise that the "stack allocated string" is not a string but a string slice.

``@rustbot`` label +A-docs
2022-11-29 22:43:16 +01:00
Matthias Krüger
d88699f9f5
Rollup merge of #104427 - compiler-errors:rematch-impl-may-fail-actually, r=lcnr
Explain why `rematch_impl` fails to be infallible

Fixes #104395

r? `@lcnr`
2022-11-29 22:43:16 +01:00
Matthias Krüger
3617adfaee
Rollup merge of #103876 - oli-obk:tait_implications, r=lcnr
type alias impl trait: add tests showing that hidden type only outlives lifetimes that occur in bounds

fixes #103642

https://github.com/rust-lang/rust/pull/102417 only made sure that hidden types cannot outlive lifetimes other than the ones mentioned on bounds, but didn't allow us to actually infer anything from that.

cc `@aliemjay`
2022-11-29 22:43:15 +01:00
bors
bddad597fe Auto merge of #94487 - oli-obk:stable_hash_ty, r=fee1-dead
Also cache the stable hash of interned Predicates

continuation of https://github.com/rust-lang/rust/pull/94299

This is a small perf improvement and shares more code between `Ty` and `Predicate`
2022-11-29 21:35:02 +00:00
Joe Neeman
66180dfad8 Run patchelf also on rust-analyzer-proc-macro-srv. 2022-11-29 14:36:52 -06:00
lcnr
bb982df771 move candidate_from_obligation out of assembly
it doesn't belong there as it also does winnowing
2022-11-29 20:32:48 +00:00
Michael Goulet
9512446a00 Explain why rematch_impl fails to be infallible 2022-11-29 19:02:40 +00:00
Michael Howell
edf5cce5a4 rustdoc: use shorthand background for rustdoc toggle CSS 2022-11-29 11:13:44 -07:00
Waffle Maybe
1b4012e304
add FIXME: where it belongs
suggestion from a friend!! 🐸

Co-authored-by: Michael Goulet <michael@errs.io>
2022-11-29 22:01:49 +04:00
Maybe Waffle
8c0951511b rename {max=>largest}_max_leb128_len 2022-11-29 17:58:09 +00:00
Santiago Pastorino
537488efd6
Make inferred_outlives_crate return Clause 2022-11-29 12:01:58 -03:00
bors
e0098a5cc3 Auto merge of #105012 - WaffleLapkin:into, r=oli-obk
Make `tcx.mk_const` more permissive wrt `kind` argument (`impl Into`)

r? `@oli-obk` you've asked for this >:)
2022-11-29 13:28:44 +00:00
Maybe Waffle
050cee48f8 Replace a macro with a function 2022-11-29 11:52:48 +00:00
Martin Kröning
0a4e5efe6f hermit: Remove unused exports 2022-11-29 12:25:35 +01:00
Martin Kröning
c8f3203c46 hermit: Fix fuzzy_provenance_casts 2022-11-29 12:25:35 +01:00
bors
c372b14701 Auto merge of #104947 - cjgillot:verify-hir-nest, r=oli-obk
Verify that HIR parenting and Def parenting match.

This relationship is relied upon for `tcx.hir_owner_parent` query to return an accurate result.
2022-11-29 10:34:19 +00:00
David Rheinsberg
7b9e1a95f0 test/codegen: test inter-crate linkage with static relocation
Add a codegen-test that verifies inter-crate linkage with the static
relocation model. We expect all symbols that are part of a rust
compilation to end up in the same DSO, thus we expect `dso_local`
annotations.
2022-11-29 11:21:16 +01:00
David Rheinsberg
a0771bdabb codegen-llvm: never combine DSOLocal and DllImport
Prevent DllImport from being attached to DSOLocal definitions in the
LLVM IR. The combination makes no sense, since definitions local to the
compilation unit will never be imported from external objects.

Additionally, LLVM will refuse the IR if it encounters the
combination (introduced in [1]):

  if (GV.hasDLLImportStorageClass())
    Assert(!GV.isDSOLocal(),
           "GlobalValue with DLLImport Storage is dso_local!", &GV);

Right now, codegen-llvm will only apply DllImport to constants and rely
on call-stubs for functions. Hence, we simply extend the codegen of
constants to skip DllImport for any local definitions.

This was discovered when switching the EFI targets to the static
relocation model [2]. With this fixed, we can start another attempt at
this.

[1] 509132b368
[2] https://github.com/rust-lang/rust/issues/101656
2022-11-29 10:57:25 +01:00
Maybe Waffle
56ae9a1746 rustc_ast_pretty: remove ref patterns 2022-11-29 08:10:59 +00:00
Maybe Waffle
07b86a94c7 rustc_ast_passes: remove ref patterns 2022-11-29 08:09:57 +00:00
bors
0c6b88dbba Auto merge of #105041 - matthiaskrgr:rollup-7ffry90, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #104465 (Document more settings for building rustc for Fuchsia)
 - #104951 (Simplify checking for `GeneratorKind::Async`)
 - #104959 (Revert #104269 (to avoid spurious hang/test failure in CI))
 - #104978 (notify the rust-analyzer team on changes to the rust-analyzer subtree)
 - #105010 (Fix documentation of asymptotic complexity for rustc_data_structures::SortedMap)
 - #105016 (Add sentence when rustdoc search is running)
 - #105020 (rustdoc: merge background-image rules in rustdoc-toggle CSS)
 - #105024 (rustdoc: remove `fnname` CSS class that's styled exactly like `fn`)
 - #105027 (Rustdoc-Json: Add tests for linking to foreign variants.)
 - #105038 (Clean up pr 104954)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-29 07:04:01 +00:00
Matthias Krüger
789b70dc2a
Rollup merge of #105038 - Rageking8:clean-up-pr-104954, r=compiler-errors
Clean up pr 104954

UI test filename typo fix and a simple comment rewording. Thanks.

CC `@vincenzopalazzo` (you spelled your name wrongly in the FIXME)

r? `@estebank`
2022-11-29 05:24:25 +01:00
Matthias Krüger
f6e5448361
Rollup merge of #105027 - aDotInTheVoid:rdj-foreign-variant-test, r=GuillaumeGomez
Rustdoc-Json: Add tests for linking to foreign variants.

I initially taught these would be bugs, but it turn out they work perfectly, and the variant is added to paths.

Most of the work is done by jsondoclint checking all the ID's resolve (although this wont happen for links until #105015, which in turn is blocked on removing foreign traits), but we do check that neither the enum nor the variant is inlined, so it must be resolved correctly through paths.

r? ``@GuillaumeGomez``
2022-11-29 05:24:25 +01:00
Matthias Krüger
0e7f15947e
Rollup merge of #105024 - notriddle:notriddle/fnname, r=jyn514
rustdoc: remove `fnname` CSS class that's styled exactly like `fn`

It's not obvious why this was ever a separate class name, since even in c4219a4783 when it was first added, it was styled identically to regular `fn` links.
2022-11-29 05:24:24 +01:00