summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src
AgeCommit message (Collapse)AuthorLines
2022-10-27Update toolingMaybe Waffle-7/+2
2022-10-24Support raw-dylib functions being used inside inlined functionsDaniel Paoliello-0/+1
2022-10-23Merge commit '266e96785ab71834b917bf474f130a6d8fdecd4b' into ↵bjorn3-175/+463
sync_cg_clif-2022-10-23
2022-10-14more dupe word typosRageking8-1/+1
2022-10-06Remove `mir::CastKind::Misc`ouz-a-2/+16
2022-09-23rename Unevaluated to UnevaluatedConstb-naber-1/+1
2022-09-22introduce mir::Unevaluatedb-naber-11/+2
2022-09-20Auto merge of #99806 - oli-obk:unconstrained_opaque_type, r=estebankbors-0/+9
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
2022-09-17Auto merge of #98588 - b-naber:valtrees-cleanup, r=lcnrbors-42/+31
Use only ty::Unevaluated<'tcx, ()> in type system r? `@lcnr`
2022-09-16Revert "Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, ↵Oli Scherer-0/+9
r=estebank"" This reverts commit 4a742a691e7dd2522bad68b86fe2fd5a199d5561.
2022-09-15nitsb-naber-11/+1
2022-09-14Auto merge of #101212 - eholk:dyn-star, r=compiler-errorsbors-1/+6
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`
2022-09-14address review againb-naber-19/+1
2022-09-13Address code review commentsEric Holk-0/+1
2022-09-13cranelift changesb-naber-49/+59
2022-09-13use ty::Unevaluated<'tcx, ()> in type systemb-naber-6/+13
2022-09-13Auto merge of #99556 - davidtwco:collapse-debuginfo, r=wesleywiserbors-3/+3
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
2022-09-12Make x.py check workEric Holk-1/+5
2022-09-10Auto merge of #101483 - oli-obk:guaranteed_opt, r=fee1-deadbors-8/+1
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`
2022-09-09The `<*const T>::guaranteed_*` methods now return an option for the unknown caseOli Scherer-8/+1
2022-09-07Change name of "dataful" variant to "untagged"Michael Benfield-5/+6
This is in anticipation of a new enum layout, in which the niche optimization may be applied even when multiple variants have data.
2022-09-07ssa: implement `#[collapse_debuginfo]`David Wood-3/+3
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>
2022-09-06Generalize the Assume intrinsic statement to a general Intrinsic statementOli Scherer-20/+30
2022-09-06Lower the assume intrinsic to a MIR statementOli Scherer-3/+3
2022-09-02Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplettbors-6/+9
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
2022-09-01Auto merge of #100707 - dzvon:fix-typo, r=davidtwcobors-3/+3
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
2022-08-31Rollup merge of #100730 - CleanCut:diagnostics-rustc_monomorphize, r=davidtwcoRalf Jung-2/+5
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.
2022-08-31Correct typoDezhi Wu-1/+1
2022-08-31Fix a bunch of typoDezhi Wu-3/+3
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
2022-08-30Rollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obkDylan DPC-2/+5
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``
2022-08-29Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obkMatthias Krüger-4/+4
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.
2022-08-28Support `#[unix_sigpipe = "inherit|sig_dfl|sig_ign"]` on `fn main()`Martin Nordholts-6/+9
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.
2022-08-28Auto merge of #96946 - WaffleLapkin:ptr_mask, r=scottmcmbors-0/+7
Add pointer masking convenience functions This PR adds the following public API: ```rust impl<T: ?Sized> *const T { fn mask(self, mask: usize) -> *const T; } impl<T: ?Sized> *mut T { fn mask(self, mask: usize) -> *const T; } // mod intrinsics fn mask<T>(ptr: *const T, mask: usize) -> *const T ``` This is equivalent to `ptr.map_addr(|a| a & mask)` but also uses a cool llvm intrinsic. Proposed in https://github.com/rust-lang/rust/pull/95643#issuecomment-1121562352 cc `@Gankra` `@scottmcm` `@RalfJung` r? rust-lang/libs-api
2022-08-27interpret: make read-pointer-as-bytes *always* work in MiriRalf Jung-1/+4
and show some extra information when it happens in CTFE
2022-08-27interpret: rename relocation → provenanceRalf Jung-1/+1
2022-08-27Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3bors-14/+21
Shrink `FnAbi` Because they can take up a lot of memory in debug and release builds. r? `@bjorn3`
2022-08-26Replace `Body::basic_blocks()` with field accessTomasz Miąsko-4/+4
2022-08-26Move `ArgAbi::pad_i32` into `PassMode::Cast`.Nicholas Nethercote-8/+11
Because it's only needed for that variant. This shrinks the types and clarifies the logic.
2022-08-26Box `CastTarget` within `PassMode`.Nicholas Nethercote-12/+16
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.
2022-08-25adjust to new error valueNathan Stocks-2/+5
2022-08-24Merge commit 'e9d1a0a7b0b28dd422f1a790ccde532acafbf193' into ↵bjorn3-926/+1194
sync_cg_clif-2022-08-24
2022-08-21fix cg craneliftWaffle Maybe-0/+2
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2022-08-21use shorter `ptr_mask` impl in cg craneliftWaffle Maybe-3/+1
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2022-08-21Add pointer masking convenience functionsMaybe Waffle-0/+7
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*
2022-08-06make NOP dyn casts not require anything about the vtableRalf Jung-0/+1
2022-07-28Introduce an ArchiveBuilderBuilderbjorn3-28/+34
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.
2022-07-28Inline inject_dll_import_libbjorn3-4/+0
2022-07-28Move output argument from ArchiveBuilder::new to .build()bjorn3-7/+5
2022-07-26Merge commit 'd3a2366ee877075c59b38bd8ced55f224fc7ef51' into ↵bjorn3-461/+705
sync_cg_clif-2022-07-26
2022-07-26Auto merge of #99745 - JohnTitor:rollup-lvrie64, r=JohnTitorbors-153/+271
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