]> git.lizzy.rs Git - rust.git/log
rust.git
20 months agoAuto merge of #2583 - RalfJung:rustup, r=oli-obk
bors [Sat, 8 Oct 2022 08:53:29 +0000 (08:53 +0000)]
Auto merge of #2583 - RalfJung:rustup, r=oli-obk

initial josh subtree sync

This demonstrates what a josh-based rustup would look like with my patched josh. To create it I did
```
git fetch http://localhost:8000/rust-lang/rust.git:start=75dd959a3a40eb5b4574f8d2e23aa6efbeb33573[:prefix=src/tools/miri]:/src/tools/miri.git master
git merge FETCH_HEAD
./rustup-toolchain HEAD && ./miri fmt
git commit -am rustup
```
Unlike the [previous attempt](https://github.com/rust-lang/miri/pull/2554), this does not add a new root commit to the repo.

Once we merge this, we committed to using josh for subtree syncing, and in particular a version of josh that includes https://github.com/josh-project/josh/pull/961 (or something compatible).

21 months agoStabilize bench_black_box
Urgau [Sat, 24 Sep 2022 10:34:56 +0000 (12:34 +0200)]
Stabilize bench_black_box

21 months agorename Unevaluated to UnevaluatedConst
b-naber [Thu, 22 Sep 2022 10:34:23 +0000 (12:34 +0200)]
rename Unevaluated to UnevaluatedConst

21 months agointroduce mir::Unevaluated
b-naber [Mon, 19 Sep 2022 17:46:53 +0000 (19:46 +0200)]
introduce mir::Unevaluated

21 months agoAuto merge of #99806 - oli-obk:unconstrained_opaque_type, r=estebank
bors [Tue, 20 Sep 2022 12:09:52 +0000 (12:09 +0000)]
Auto merge of #99806 - oli-obk:unconstrained_opaque_type, r=estebank

Allow patterns to constrain the hidden type of opaque types

fixes #96572

reverts a revert as original PR was a perf regression that was fixed by reverting it: https://github.com/rust-lang/rust/pull/99368#issuecomment-1186587864)

TODO:

* check if https://github.com/rust-lang/rust/issues/99685 is avoided

21 months agoAuto merge of #98588 - b-naber:valtrees-cleanup, r=lcnr
bors [Sat, 17 Sep 2022 03:04:22 +0000 (03:04 +0000)]
Auto merge of #98588 - b-naber:valtrees-cleanup, r=lcnr

Use only ty::Unevaluated<'tcx, ()> in type system

r? `@lcnr`

21 months agoRevert "Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank""
Oli Scherer [Wed, 27 Jul 2022 11:58:34 +0000 (11:58 +0000)]
Revert "Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank""

This reverts commit 4a742a691e7dd2522bad68b86fe2fd5a199d5561.

21 months agonits
b-naber [Thu, 15 Sep 2022 20:27:41 +0000 (22:27 +0200)]
nits

21 months agoAuto merge of #101212 - eholk:dyn-star, r=compiler-errors
bors [Wed, 14 Sep 2022 18:10:51 +0000 (18:10 +0000)]
Auto merge of #101212 - eholk:dyn-star, r=compiler-errors

Initial implementation of dyn*

This PR adds extremely basic and incomplete support for [dyn*](https://smallcultfollowing.com/babysteps//blog/2022/03/29/dyn-can-we-make-dyn-sized/). The goal is to get something in tree behind a flag to make collaboration easier, and also to make sure the implementation so far is not unreasonable. This PR does quite a few things:

* Introduce `dyn_star` feature flag
* Adds parsing for `dyn* Trait` types
* Defines `dyn* Trait` as a sized type
* Adds support for explicit casts, like `42usize as dyn* Debug`
  * Including const evaluation of such casts
* Adds codegen for drop glue so things are cleaned up properly when a `dyn* Trait` object goes out of scope
* Adds codegen for method calls, at least for methods that take `&self`

Quite a bit is still missing, but this gives us a starting point. Note that this is never intended to become stable surface syntax for Rust, but rather `dyn*` is planned to be used as an implementation detail for async functions in dyn traits.

Joint work with `@nikomatsakis` and `@compiler-errors.`

r? `@bjorn3`

21 months agoaddress review again
b-naber [Wed, 14 Sep 2022 13:35:24 +0000 (15:35 +0200)]
address review again

21 months agoAddress code review comments
Eric Holk [Tue, 30 Aug 2022 19:44:00 +0000 (12:44 -0700)]
Address code review comments

21 months agocranelift changes
b-naber [Thu, 30 Jun 2022 14:54:10 +0000 (16:54 +0200)]
cranelift changes

21 months agouse ty::Unevaluated<'tcx, ()> in type system
b-naber [Mon, 27 Jun 2022 14:32:47 +0000 (16:32 +0200)]
use ty::Unevaluated<'tcx, ()> in type system

21 months agoAuto merge of #99556 - davidtwco:collapse-debuginfo, r=wesleywiser
bors [Tue, 13 Sep 2022 01:19:05 +0000 (01:19 +0000)]
Auto merge of #99556 - davidtwco:collapse-debuginfo, r=wesleywiser

ssa: implement `#[collapse_debuginfo]`

cc #39153 rust-lang/compiler-team#386

Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour.

When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed.

r? rust-lang/wg-debugging

21 months agoMake x.py check work
Eric Holk [Tue, 30 Aug 2022 19:39:28 +0000 (12:39 -0700)]
Make x.py check work

21 months agoAuto merge of #101483 - oli-obk:guaranteed_opt, r=fee1-dead
bors [Sat, 10 Sep 2022 09:50:21 +0000 (09:50 +0000)]
Auto merge of #101483 - oli-obk:guaranteed_opt, r=fee1-dead

The `<*const T>::guaranteed_*` methods now return an option for the unknown case

cc https://github.com/rust-lang/rust/issues/53020#issuecomment-1236932443

I chose `0` for "not equal" and `1` for "equal" and left `2` for the unknown case so backends can just forward to raw pointer equality and it works ✨

r? `@fee1-dead` or `@lcnr`

cc `@rust-lang/wg-const-eval`

21 months agoThe `<*const T>::guaranteed_*` methods now return an option for the unknown case
Oli Scherer [Tue, 6 Sep 2022 14:08:59 +0000 (14:08 +0000)]
The `<*const T>::guaranteed_*` methods now return an option for the unknown case

21 months agoChange name of "dataful" variant to "untagged"
Michael Benfield [Thu, 25 Aug 2022 01:14:23 +0000 (01:14 +0000)]
Change name of "dataful" variant to "untagged"

This is in anticipation of a new enum layout, in which the niche
optimization may be applied even when multiple variants have data.

21 months agossa: implement `#[collapse_debuginfo]`
David Wood [Thu, 21 Jul 2022 15:19:22 +0000 (16:19 +0100)]
ssa: implement `#[collapse_debuginfo]`

Debuginfo line information for macro invocations are collapsed by
default - line information are replaced by the line of the outermost
expansion site. Using `-Zdebug-macros` disables this behaviour.

When the `collapse_debuginfo` feature is enabled, the default behaviour
is reversed so that debuginfo is not collapsed by default. In addition,
the `#[collapse_debuginfo]` attribute is available and can be applied to
macro definitions which will then have their line information collapsed.

Signed-off-by: David Wood <david.wood@huawei.com>
21 months agoGeneralize the Assume intrinsic statement to a general Intrinsic statement
Oli Scherer [Tue, 12 Jul 2022 10:05:00 +0000 (10:05 +0000)]
Generalize the Assume intrinsic statement to a general Intrinsic statement

21 months agoLower the assume intrinsic to a MIR statement
Oli Scherer [Thu, 30 Jun 2022 08:16:05 +0000 (08:16 +0000)]
Lower the assume intrinsic to a MIR statement

22 months agoAuto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplett
bors [Fri, 2 Sep 2022 21:08:08 +0000 (21:08 +0000)]
Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplett

Support `#[unix_sigpipe = "inherit|sig_dfl"]` on `fn main()` to prevent ignoring `SIGPIPE`

When enabled, programs don't have to explicitly handle `ErrorKind::BrokenPipe` any longer. Currently, the program

```rust
fn main() { loop { println!("hello world"); } }
```

will print an error if used with a short-lived pipe, e.g.

    % ./main | head -n 1
    hello world
    thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1016:9
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

by enabling `#[unix_sigpipe = "sig_dfl"]` like this

```rust
#![feature(unix_sigpipe)]
#[unix_sigpipe = "sig_dfl"]
fn main() { loop { println!("hello world"); } }
```

there is no error, because `SIGPIPE` will not be ignored and thus the program will be killed appropriately:

    % ./main | head -n 1
    hello world

The current libstd behaviour of ignoring `SIGPIPE` before `fn main()` can be explicitly requested by using `#[unix_sigpipe = "sig_ign"]`.

With `#[unix_sigpipe = "inherit"]`, no change at all is made to `SIGPIPE`, which typically means the behaviour will be the same as `#[unix_sigpipe = "sig_dfl"]`.

See https://github.com/rust-lang/rust/issues/62569 and referenced issues for discussions regarding the `SIGPIPE` problem itself

See the [this](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Proposal.3A.20First.20step.20towards.20solving.20the.20SIGPIPE.20problem) Zulip topic for more discussions, including about this PR.

Tracking issue: https://github.com/rust-lang/rust/issues/97889

22 months agoAuto merge of #100707 - dzvon:fix-typo, r=davidtwco
bors [Thu, 1 Sep 2022 05:39:58 +0000 (05:39 +0000)]
Auto merge of #100707 - dzvon:fix-typo, r=davidtwco

Fix a bunch of typo

This PR will fix some typos detected by [typos].

I only picked the ones I was sure were spelling errors to fix, mostly in
the comments.

[typos]: https://github.com/crate-ci/typos

22 months agoRollup merge of #100730 - CleanCut:diagnostics-rustc_monomorphize, r=davidtwco
Ralf Jung [Wed, 31 Aug 2022 12:29:51 +0000 (14:29 +0200)]
Rollup merge of #100730 - CleanCut:diagnostics-rustc_monomorphize, r=davidtwco

Migrate rustc_monomorphize to use SessionDiagnostic

### Description

- Migrates diagnostics in `rustc_monomorphize` to use `SessionDiagnostic`
- Adds an `impl IntoDiagnosticArg for PathBuf`

### TODO / Help!
- [x] I'm having trouble figuring out how to apply an optional note. 😕  Help!?
  - Resolved. It was bad docs. Fixed in https://github.com/rust-lang/rustc-dev-guide/pull/1437/files
- [x] `errors:RecursionLimit` should be `#[fatal ...]`, but that doesn't exist so it's `#[error ...]` at the moment.
  - Maybe I can switch after this is merged in? --> https://github.com/rust-lang/rust/pull/100694
  - Or maybe I need to manually implement `SessionDiagnostic` instead of deriving it?
- [x] How does one go about converting an error inside of [a call to struct_span_lint_hir](https://github.com/rust-lang/rust/blob/8064a495086c2e63c0ef77e8e82fe3b9b5dc535f/compiler/rustc_monomorphize/src/collector.rs#L917-L927)?
- [x] ~What placeholder do you use in the fluent template to refer to the value in a vector? It seems like [this code](https://github.com/rust-lang/rust/blob/0b79f758c9aa6646606662a6d623a0752286cd17/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs#L83-L114) ought to have the answer (or something near it)...but I can't figure it out.~ You can't. Punted.

22 months agoCorrect typo
Dezhi Wu [Thu, 18 Aug 2022 08:36:49 +0000 (16:36 +0800)]
Correct typo

22 months agoFix a bunch of typo
Dezhi Wu [Thu, 18 Aug 2022 02:13:37 +0000 (10:13 +0800)]
Fix a bunch of typo

This PR will fix some typos detected by [typos].

I only picked the ones I was sure were spelling errors to fix, mostly in
the comments.

[typos]: https://github.com/crate-ci/typos

22 months agoRollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obk
Dylan DPC [Tue, 30 Aug 2022 05:56:51 +0000 (11:26 +0530)]
Rollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obk

interpret: make read-pointer-as-bytes a CTFE-only error with extra information

Next step in the reaction to https://github.com/rust-lang/rust/issues/99923. Also teaches Miri to implicitly strip provenance in more situations when transmuting pointers to integers, which fixes https://github.com/rust-lang/miri/issues/2456.

Pointer-to-int transmutation during CTFE now produces a message like this:
```
   = help: this code performed an operation that depends on the underlying bytes representing a pointer
   = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
```

r? ``@oli-obk``

22 months agoRollup merge of #99027 - tmiasko:basic-blocks, r=oli-obk
Matthias Krüger [Mon, 29 Aug 2022 04:34:43 +0000 (06:34 +0200)]
Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obk

Replace `Body::basic_blocks()` with field access

Since the refactoring in #98930, it is possible to borrow the basic blocks
independently from other parts of MIR by accessing the `basic_blocks` field
directly.

Replace unnecessary `Body::basic_blocks()` method with a direct field access,
which has an additional benefit of borrowing the basic blocks only.

22 months agoSupport `#[unix_sigpipe = "inherit|sig_dfl|sig_ign"]` on `fn main()`
Martin Nordholts [Tue, 5 Jul 2022 17:56:22 +0000 (19:56 +0200)]
Support `#[unix_sigpipe = "inherit|sig_dfl|sig_ign"]` on `fn main()`

This makes it possible to instruct libstd to never touch the signal
handler for `SIGPIPE`, which makes programs pipeable by default (e.g.
with `./your-program | head -n 1`) without `ErrorKind::BrokenPipe`
errors.

22 months agoAuto merge of #96946 - WaffleLapkin:ptr_mask, r=scottmcm
bors [Sun, 28 Aug 2022 01:34:47 +0000 (01:34 +0000)]
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

22 months agointerpret: make read-pointer-as-bytes *always* work in Miri
Ralf Jung [Sat, 27 Aug 2022 18:54:02 +0000 (14:54 -0400)]
interpret: make read-pointer-as-bytes *always* work in Miri

and show some extra information when it happens in CTFE

22 months agointerpret: rename relocation → provenance
Ralf Jung [Sat, 27 Aug 2022 18:11:19 +0000 (14:11 -0400)]
interpret: rename relocation → provenance

22 months agoAuto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3
bors [Sat, 27 Aug 2022 14:00:53 +0000 (14:00 +0000)]
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`

22 months agoReplace `Body::basic_blocks()` with field access
Tomasz Miąsko [Tue, 5 Jul 2022 00:00:00 +0000 (00:00 +0000)]
Replace `Body::basic_blocks()` with field access

22 months agoMove `ArgAbi::pad_i32` into `PassMode::Cast`.
Nicholas Nethercote [Thu, 25 Aug 2022 12:19:38 +0000 (22:19 +1000)]
Move `ArgAbi::pad_i32` into `PassMode::Cast`.

Because it's only needed for that variant. This shrinks the types and
clarifies the logic.

22 months agoBox `CastTarget` within `PassMode`.
Nicholas Nethercote [Thu, 25 Aug 2022 07:52:37 +0000 (17:52 +1000)]
Box `CastTarget` within `PassMode`.

Because `PassMode::Cast` is by far the largest variant, but is
relatively rare.

This requires making `PassMode` not impl `Copy`, and `Clone` is no
longer necessary. This causes lots of sigil adjusting, but nothing very
notable.

22 months agoadjust to new error value
Nathan Stocks [Wed, 24 Aug 2022 22:52:46 +0000 (16:52 -0600)]
adjust to new error value

22 months agoRustfmt
bjorn3 [Wed, 24 Aug 2022 17:06:47 +0000 (17:06 +0000)]
Rustfmt

22 months agoMerge commit 'e9d1a0a7b0b28dd422f1a790ccde532acafbf193' into sync_cg_clif-2022-08-24
bjorn3 [Wed, 24 Aug 2022 16:40:58 +0000 (18:40 +0200)]
Merge commit 'e9d1a0a7b0b28dd422f1a790ccde532acafbf193' into sync_cg_clif-2022-08-24

22 months agoRollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=scottmcm
Matthias Krüger [Sun, 21 Aug 2022 14:54:07 +0000 (16:54 +0200)]
Rollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=scottmcm

Replace most uses of `pointer::offset` with `add` and `sub`

As PR title says, it replaces `pointer::offset` in compiler and standard library with `pointer::add` and `pointer::sub`. This generally makes code cleaner, easier to grasp and removes (or, well, hides) integer casts.

This is generally trivially correct, `.offset(-constant)` is just `.sub(constant)`, `.offset(usized as isize)` is just `.add(usized)`, etc. However in some cases we need to be careful with signs of things.

r? ````@scottmcm````

_split off from #100746_

22 months agofix cg cranelift
Waffle Maybe [Sun, 7 Aug 2022 18:32:26 +0000 (22:32 +0400)]
fix cg cranelift

Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
22 months agouse shorter `ptr_mask` impl in cg cranelift
Waffle Maybe [Wed, 11 May 2022 17:43:13 +0000 (21:43 +0400)]
use shorter `ptr_mask` impl in cg cranelift

Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
22 months agoAdd pointer masking convenience functions
Maybe Waffle [Wed, 11 May 2022 13:52:00 +0000 (17:52 +0400)]
Add pointer masking convenience functions

This commit adds the following functions all of which have a signature
`pointer, usize -> pointer`:
- `<*mut T>::mask`
- `<*const T>::mask`
- `intrinsics::ptr_mask`

These functions are equivalent to `.map_addr(|a| a & mask)` but they
utilize `llvm.ptrmask` llvm intrinsic.

*masks your pointers*

22 months agoReplace most uses of `pointer::offset` with `add` and `sub`
Maybe Waffle [Fri, 19 Aug 2022 09:33:06 +0000 (13:33 +0400)]
Replace most uses of `pointer::offset` with `add` and `sub`

22 months agoRollup merge of #100208 - RalfJung:dyn-upcast-nop, r=petrochenkov
Dylan DPC [Fri, 19 Aug 2022 06:56:41 +0000 (12:26 +0530)]
Rollup merge of #100208 - RalfJung:dyn-upcast-nop, r=petrochenkov

make NOP dyn casts not require anything about the vtable

As suggested [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/dyn-upcasting.20stabilization/near/292151439). This matches what the codegen backends already do, and what Miri did do until https://github.com/rust-lang/rust/pull/99420 when I made it super extra paranoid.

22 months agoalso update anyhow in codegen_cranelift
Ralf Jung [Mon, 8 Aug 2022 13:04:26 +0000 (09:04 -0400)]
also update anyhow in codegen_cranelift

22 months agomake NOP dyn casts not require anything about the vtable
Ralf Jung [Sat, 6 Aug 2022 21:18:59 +0000 (17:18 -0400)]
make NOP dyn casts not require anything about the vtable

23 months agoIntroduce an ArchiveBuilderBuilder
bjorn3 [Thu, 28 Jul 2022 09:07:49 +0000 (09:07 +0000)]
Introduce an ArchiveBuilderBuilder

This avoids monomorphizing all linker code for each codegen backend and
will allow passing in extra information to the archive builder from the
codegen backend.

23 months agoInline inject_dll_import_lib
bjorn3 [Thu, 28 Jul 2022 08:43:15 +0000 (08:43 +0000)]
Inline inject_dll_import_lib

23 months agoMove output argument from ArchiveBuilder::new to .build()
bjorn3 [Thu, 28 Jul 2022 08:39:19 +0000 (08:39 +0000)]
Move output argument from ArchiveBuilder::new to .build()

23 months agoMerge commit 'd3a2366ee877075c59b38bd8ced55f224fc7ef51' into sync_cg_clif-2022-07-26
bjorn3 [Tue, 26 Jul 2022 16:53:46 +0000 (18:53 +0200)]
Merge commit 'd3a2366ee877075c59b38bd8ced55f224fc7ef51' into sync_cg_clif-2022-07-26

23 months agoAuto merge of #99745 - JohnTitor:rollup-lvrie64, r=JohnTitor
bors [Tue, 26 Jul 2022 04:28:41 +0000 (04:28 +0000)]
Auto merge of #99745 - JohnTitor:rollup-lvrie64, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #98211 (Implement `fs::get_path` for FreeBSD.)
 - #99353 (Slightly improve mismatched GAT where clause error)
 - #99593 (Suggest removing the tuple struct field for the unwrapped value)
 - #99615 (Remove some explicit `self.infcx` for `FnCtxt`, which already derefs into `InferCtxt`)
 - #99711 (Remove reachable coverage without counters)
 - #99718 (Avoid `&str`/`Symbol` to `String` conversions)
 - #99720 (Sync rustc_codegen_cranelift)

Failed merges:

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

23 months agoAuto merge of #98989 - dpaoliello:rawdylibbin, r=michaelwoerister
bors [Tue, 26 Jul 2022 01:47:34 +0000 (01:47 +0000)]
Auto merge of #98989 - dpaoliello:rawdylibbin, r=michaelwoerister

Enable raw-dylib for bin crates

Fixes #93842

When `raw-dylib` is used in a `bin` crate, we need to collect all of the `raw-dylib` functions, generate the import library and add that to the linker command line.

I also changed the tests so that 1) the C++ dlls are created after the Rust dlls, thus there is no chance of accidentally using them in the Rust linking process and 2) disabled generating import libraries when building with MSVC.

23 months agoMerge commit 'c19edfd71a1d0ddef86c2c67fdb40718d40a72b4' into sync_cg_clif-2022-07-25
bjorn3 [Mon, 25 Jul 2022 14:07:57 +0000 (16:07 +0200)]
Merge commit 'c19edfd71a1d0ddef86c2c67fdb40718d40a72b4' into sync_cg_clif-2022-07-25

23 months agoAuto merge of #99251 - cuviper:hashbrown-0.12, r=Mark-Simulacrum
bors [Sun, 24 Jul 2022 04:03:29 +0000 (04:03 +0000)]
Auto merge of #99251 - cuviper:hashbrown-0.12, r=Mark-Simulacrum

Upgrade indexmap and thorin-dwp to use hashbrown 0.12

This removes the last dependencies on hashbrown 0.11.

This also upgrades to hashbrown 0.12.3 to fix a double-free (#99372).

23 months agoEnable raw-dylib for binaries
Daniel Paoliello [Fri, 1 Jul 2022 20:01:41 +0000 (13:01 -0700)]
Enable raw-dylib for binaries

23 months agovarious nits from review
Ralf Jung [Wed, 20 Jul 2022 14:47:49 +0000 (10:47 -0400)]
various nits from review

23 months agoImplement vtable_size and vtable_align intrinsics for cg_clif
bjorn3 [Wed, 20 Jul 2022 13:36:58 +0000 (13:36 +0000)]
Implement vtable_size and vtable_align intrinsics for cg_clif

23 months agoslightly cleaner, if more verbose, vtable handling in codegen backends
Ralf Jung [Wed, 20 Jul 2022 00:19:15 +0000 (20:19 -0400)]
slightly cleaner, if more verbose, vtable handling in codegen backends

23 months agoconsistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)
Ralf Jung [Tue, 19 Jul 2022 23:57:44 +0000 (19:57 -0400)]
consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)

23 months agorename get_global_alloc to try_get_global_alloc
Ralf Jung [Sun, 17 Jul 2022 15:40:34 +0000 (11:40 -0400)]
rename get_global_alloc to try_get_global_alloc

23 months agoadd a Vtable kind of symbolic allocations
Ralf Jung [Sun, 17 Jul 2022 15:36:37 +0000 (11:36 -0400)]
add a Vtable kind of symbolic allocations

23 months agoRevert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"
Oli Scherer [Wed, 20 Jul 2022 07:55:58 +0000 (07:55 +0000)]
Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"

This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing
changes made to 7210e46dc69a4b197a313d093fe145722c248b7d.

23 months agoAuto merge of #99033 - 5225225:interpreter-validity-checks, r=oli-obk
bors [Sun, 17 Jul 2022 19:28:01 +0000 (19:28 +0000)]
Auto merge of #99033 - 5225225:interpreter-validity-checks, r=oli-obk

Use constant eval to do strict mem::uninit/zeroed validity checks

I'm not sure about the code organisation here, I just dumped the check in rustc_const_eval at the root. Not hard to move it elsewhere, in any case.

Also, this means cranelift codegen intrinsics lose the strict checks, since they don't seem to depend on rustc_const_eval, and I didn't see a point in keeping around two copies.

I also left comments in the is_zero_valid methods about "uhhh help how do i do this", those apply to both methods equally.

Also rustc_codegen_ssa now depends on rustc_const_eval... is this okay?

Pinging `@RalfJung` since you were the one who mentioned this to me, so I'm assuming you're interested.

Haven't had a chance to run full tests on this since it's really warm, and it's 1AM, I'll check out any failures/comments in the morning :)

23 months agoUpgrade hashbrown to 0.12.3
Amanieu d'Antras [Sun, 17 Jul 2022 11:23:26 +0000 (13:23 +0200)]
Upgrade hashbrown to 0.12.3

This fixes a double-free in the `clone_from` function if dropping an
existing element in the table panics. See
https://github.com/rust-lang/hashbrown/pull/348 for more details.

23 months agoUpgrade indexmap and thorin-dwp to use hashbrown 0.12
Josh Stone [Thu, 14 Jul 2022 17:13:52 +0000 (10:13 -0700)]
Upgrade indexmap and thorin-dwp to use hashbrown 0.12

This removes the last dependencies on hashbrown 0.11.

23 months agoIntroduce opaque type to hidden type projection
Oli Scherer [Wed, 22 Jun 2022 15:28:28 +0000 (15:28 +0000)]
Introduce opaque type to hidden type projection

23 months agoUse constant eval to do strict validity checks
5225225 [Thu, 14 Jul 2022 21:42:47 +0000 (22:42 +0100)]
Use constant eval to do strict validity checks

23 months agoRename `debugging_opts` to `unstable_opts`
Joshua Nelson [Wed, 6 Jul 2022 12:44:47 +0000 (07:44 -0500)]
Rename `debugging_opts` to `unstable_opts`

This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`).
Rename it to be more clear.

23 months agoAuto merge of #99210 - Dylan-DPC:rollup-879cp1t, r=Dylan-DPC
bors [Wed, 13 Jul 2022 17:13:27 +0000 (17:13 +0000)]
Auto merge of #99210 - Dylan-DPC:rollup-879cp1t, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #98574 (Lower let-else in MIR)
 - #99011 (`UnsafeCell` blocks niches inside its nested type from being available outside)
 - #99030 (diagnostics: error messages when struct literals fail to parse)
 - #99155 (Keep unstable target features for asm feature checking)
 - #99199 (Refactor: remove an unnecessary `span_to_snippet`)

Failed merges:

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

23 months agoRollup merge of #99155 - Amanieu:unstable-target-features, r=davidtwco
Dylan DPC [Wed, 13 Jul 2022 14:02:36 +0000 (19:32 +0530)]
Rollup merge of #99155 - Amanieu:unstable-target-features, r=davidtwco

Keep unstable target features for asm feature checking

Inline assembly uses the target features to determine which registers
are available on the current target. However it needs to be able to
access unstable target features for this.

Fixes #99071

23 months agoadd new rval, pull deref early
ouz-a [Mon, 13 Jun 2022 13:37:41 +0000 (16:37 +0300)]
add new rval, pull deref early

23 months agoKeep unstable target features for asm feature checking
Amanieu d'Antras [Mon, 11 Jul 2022 13:26:58 +0000 (14:26 +0100)]
Keep unstable target features for asm feature checking

Inline assembly uses the target features to determine which registers
are available on the current target. However it needs to be able to
access unstable target features for this.

Fixes #99071

23 months agoPartially stabilize const_slice_from_raw_parts
Konrad Borowski [Sun, 29 May 2022 16:01:26 +0000 (18:01 +0200)]
Partially stabilize const_slice_from_raw_parts

This doesn't stabilize methods working on mutable pointers.

23 months agotweak names and output and bless
Ralf Jung [Wed, 6 Jul 2022 14:14:46 +0000 (10:14 -0400)]
tweak names and output and bless

23 months agoreview feedback
Ralf Jung [Tue, 5 Jul 2022 21:38:46 +0000 (17:38 -0400)]
review feedback

23 months agofix cranelift and gcc backends
Ralf Jung [Tue, 5 Jul 2022 20:53:48 +0000 (16:53 -0400)]
fix cranelift and gcc backends

23 months agoRollup merge of #99070 - tamird:update-tracking-issue, r=RalfJung
Dylan DPC [Sat, 9 Jul 2022 05:58:09 +0000 (11:28 +0530)]
Rollup merge of #99070 - tamird:update-tracking-issue, r=RalfJung

Update integer_atomics tracking issue

Updates #32976.
Updates #99069.

r? ``@RalfJung``

23 months agoUpdate integer_atomics tracking issue
Tamir Duberstein [Fri, 8 Jul 2022 21:52:04 +0000 (17:52 -0400)]
Update integer_atomics tracking issue

Updates #32976.
Updates #99069.

23 months agoincr: cache dwarf objects in work products
David Wood [Mon, 4 Jul 2022 13:38:42 +0000 (14:38 +0100)]
incr: cache dwarf objects in work products

Cache DWARF objects alongside object files in work products when those
exist so that DWARF object files are available for thorin in packed mode
in incremental scenarios.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agoUpdate TypeVisitor paths
Alan Egerton [Fri, 17 Jun 2022 12:15:00 +0000 (13:15 +0100)]
Update TypeVisitor paths

23 months agoAuto merge of #96862 - oli-obk:enum_cast_mir, r=RalfJung
bors [Tue, 5 Jul 2022 09:36:29 +0000 (09:36 +0000)]
Auto merge of #96862 - oli-obk:enum_cast_mir, r=RalfJung

Change enum->int casts to not go through MIR casts.

follow-up to https://github.com/rust-lang/rust/pull/96814

this simplifies all backends and even gives LLVM more information about the return value of `Rvalue::Discriminant`, enabling optimizations in more cases.

2 years agoRecover when failing to normalize closure signature.
Camille GILLOT [Fri, 4 Feb 2022 22:18:28 +0000 (23:18 +0100)]
Recover when failing to normalize closure signature.

2 years agoChange enum->int casts to not go through MIR casts.
Oli Scherer [Wed, 29 Jun 2022 14:18:55 +0000 (14:18 +0000)]
Change enum->int casts to not go through MIR casts.

Instead we generate a discriminant rvalue and cast the result of that.

2 years agoUpdate `smallvec` to 1.8.1.
Nicholas Nethercote [Sun, 26 Jun 2022 22:48:55 +0000 (08:48 +1000)]
Update `smallvec` to 1.8.1.

This pulls in https://github.com/servo/rust-smallvec/pull/282, which
gives some small wins for rustc.

2 years agoAuto merge of #98098 - bjorn3:archive_refactor, r=michaelwoerister
bors [Tue, 21 Jun 2022 16:24:56 +0000 (16:24 +0000)]
Auto merge of #98098 - bjorn3:archive_refactor, r=michaelwoerister

Remove the source archive functionality of ArchiveWriter

We now build archives through strictly additive means rather than taking an existing archive and potentially substracting parts. This is simpler and makes it easier to swap out the archive writer in https://github.com/rust-lang/rust/pull/97485.

2 years agoRemove the source archive functionality of ArchiveWriter
bjorn3 [Tue, 14 Jun 2022 15:16:51 +0000 (15:16 +0000)]
Remove the source archive functionality of ArchiveWriter

We now build archives through strictly additive means rather than taking
an existing archive and potentially substracting parts.

2 years agoFix "Remove src_files and remove_file"
bjorn3 [Sat, 18 Jun 2022 17:55:24 +0000 (17:55 +0000)]
Fix "Remove src_files and remove_file"

2 years agoRollup merge of #98165 - WaffleLapkin:once_things_renamings, r=m-ou-se
Matthias Krüger [Sat, 18 Jun 2022 22:17:13 +0000 (00:17 +0200)]
Rollup merge of #98165 - WaffleLapkin:once_things_renamings, r=m-ou-se

once cell renamings

This PR does the renamings proposed in https://github.com/rust-lang/rust/issues/74465#issuecomment-1153703128

- Move/rename `lazy::{OnceCell, Lazy}` to `cell::{OnceCell, LazyCell}`
- Move/rename `lazy::{SyncOnceCell, SyncLazy}` to `sync::{OnceLock, LazyLock}`

(I used `Lazy...` instead of `...Lazy` as it seems to be more consistent, easier to pronounce, etc)

```@rustbot``` label +T-libs-api -T-libs

2 years agoRollup merge of #97675 - nvzqz:unsized-needs-drop, r=dtolnay
Yuki Okushi [Thu, 16 Jun 2022 22:16:55 +0000 (07:16 +0900)]
Rollup merge of #97675 - nvzqz:unsized-needs-drop, r=dtolnay

Make `std::mem::needs_drop` accept `?Sized`

This change attempts to make `needs_drop` work with types like `[u8]` and `str`.

This enables code in types like `Arc<T>` that was not possible before, such as https://github.com/rust-lang/rust/pull/97676.

2 years agoMove/rename `lazy::Sync{OnceCell,Lazy}` to `sync::{Once,Lazy}Lock`
Maybe Waffle [Thu, 16 Jun 2022 15:39:39 +0000 (19:39 +0400)]
Move/rename `lazy::Sync{OnceCell,Lazy}` to `sync::{Once,Lazy}Lock`

2 years agoRemove src_files and remove_file
bjorn3 [Tue, 14 Jun 2022 15:11:14 +0000 (15:11 +0000)]
Remove src_files and remove_file

They only apply to the main source archive and their role can be
fulfilled through the skip argument of add_archive too.

2 years agoimplement valtrees as the type-system representation for constant values
b-naber [Wed, 16 Feb 2022 09:56:01 +0000 (10:56 +0100)]
implement valtrees as the type-system representation for constant values

2 years agoRename the `ConstS::val` field as `kind`.
Nicholas Nethercote [Fri, 10 Jun 2022 01:18:06 +0000 (11:18 +1000)]
Rename the `ConstS::val` field as `kind`.

And likewise for the `Const::val` method.

Because its type is called `ConstKind`. Also `val` is a confusing name
because `ConstKind` is an enum with seven variants, one of which is
called `Value`. Also, this gives consistency with `TyS` and `PredicateS`
which have `kind` fields.

The commit also renames a few `Const` variables from `val` to `c`, to
avoid confusion with the `ConstKind::Value` variant.

2 years agoAuto merge of #97825 - Dylan-DPC:rollup-ya51k1k, r=Dylan-DPC
bors [Tue, 7 Jun 2022 11:08:58 +0000 (11:08 +0000)]
Auto merge of #97825 - Dylan-DPC:rollup-ya51k1k, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #97058 (Various refactors to the incr comp workproduct handling)
 - #97301 (Allow unstable items to be re-exported unstably without requiring the feature be enabled)
 - #97738 (Fix ICEs from zsts within unsized types with non-zero offsets)
 - #97771 (Remove SIGIO reference on Haiku)
 - #97808 (Add some unstable target features for the wasm target codegen)

Failed merges:

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

2 years agoAuto merge of #97512 - scottmcm:add-coldcc, r=nagisa,lcnr
bors [Tue, 7 Jun 2022 08:12:45 +0000 (08:12 +0000)]
Auto merge of #97512 - scottmcm:add-coldcc, r=nagisa,lcnr

Add support for emitting functions with `coldcc` to LLVM

The eventual goal is to try using this for things like the internal panicking stuff, to see whether it helps.

2 years agoMake saved_file field of WorkProduct non-optional
bjorn3 [Sun, 15 May 2022 11:31:28 +0000 (11:31 +0000)]
Make saved_file field of WorkProduct non-optional

A WorkProduct without a saved file is useless

2 years agoFactor Option out of copy_cgu_workproduct_to_incr_comp_cache_dir call
bjorn3 [Fri, 13 May 2022 12:20:32 +0000 (12:20 +0000)]
Factor Option out of copy_cgu_workproduct_to_incr_comp_cache_dir call

This improves clarity of the code a bit

2 years agoAvoid an unnecessary clone for copy_cgu_workproduct_to_incr_comp_cache_dir calls
bjorn3 [Fri, 13 May 2022 12:18:13 +0000 (12:18 +0000)]
Avoid an unnecessary clone for copy_cgu_workproduct_to_incr_comp_cache_dir calls

2 years agoRename CodegenUnit::work_product to previous_work_product
bjorn3 [Fri, 13 May 2022 10:32:03 +0000 (10:32 +0000)]
Rename CodegenUnit::work_product to previous_work_product

It returns the previous work product or panics if there is none. This rename
makes the purpose of this method clearer.