about summary refs log tree commit diff
path: root/compiler/rustc_middle
AgeCommit message (Collapse)AuthorLines
2024-04-01Auto merge of #122972 - beetrees:use-align-type, r=fee1-deadbors-3/+3
Use the `Align` type when parsing alignment attributes Use the `Align` type in `rustc_attr::parse_alignment`, removing the need to call `Align::from_bytes(...).unwrap()` later in the compilation process.
2024-04-01Use the `Align` type when parsing alignment attributesbeetrees-3/+3
2024-03-31Remove EvaluatedToErrStackDependentMichael Goulet-48/+4
2024-04-01Fix union handling in exhaustivenessNadrieril-1/+2
2024-03-31Auto merge of #121851 - michaelwoerister:mcp-533-effective-vis, r=cjgillotbors-5/+4
Use FxIndexMap instead FxHashMap to stabilize iteration order in EffectiveVisibilities Part of [MCP 533](https://github.com/rust-lang/compiler-team/issues/533).
2024-03-30Implement "&<pat> everywhere"Jules Bertholet-0/+56
The original proposal allows reference patterns with "compatible" mutability, however it's not clear what that means so for now we require an exact match. I don't know the type system code well, so if something seems to not make sense it's probably because I made a mistake
2024-03-30Auto merge of #123230 - matthiaskrgr:rollup-4twuzj4, r=matthiaskrgrbors-0/+4
Rollup of 5 pull requests Successful merges: - #121573 (unix_sigpipe: Add test for SIGPIPE disposition in child processes) - #123170 (Replace regions in const canonical vars' types with `'static` in next-solver canonicalizer) - #123200 (KCFI: Require -C panic=abort) - #123201 (Improve wording in std::any explanation) - #123224 (compiletest: print reason for failing to read tests) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-30Rollup merge of #123170 - compiler-errors:const-statics, r=lcnrMatthias Krüger-0/+4
Replace regions in const canonical vars' types with `'static` in next-solver canonicalizer We shouldn't ever have non-static regions in consts on stable (or really any regions at all, lol). The test I committed is less minimal than, e.g., https://github.com/rust-lang/rust/issues/123155?notification_referrer_id=NT_kwDOADgQyrMxMDAzNDU4MDI0OTozNjc0MzE0#issuecomment-2025472029 -- however, I believe that it actually portrays the underlying issue here a bit better than that one. In the linked issue, we end up emitting a normalizes-to predicate for a const placeholder because we don't actually unify `false` and `""`. In the test I committed, we emit a normalizes-to predicate as a part of actually solving a negative coherence goal. Fixes #123155 Fixes #118783 r? lcnr
2024-03-29Assert that ADTs have the right number of substsMichael Goulet-0/+7
2024-03-29Auto merge of #122450 - Urgau:simplify-trim-paths-feature, r=michaelwoeristerbors-2/+6
Simplify trim-paths feature by merging all debuginfo options together This PR simplifies the trim-paths feature by merging all debuginfo options together, as described in https://github.com/rust-lang/rust/issues/111540#issuecomment-1994010274. And also do some correctness fixes found during the review. cc `@weihanglo` r? `@michaelwoerister`
2024-03-29Auto merge of #123080 - Jules-Bertholet:mut-ref-mut, r=Nadrierilbors-72/+38
Match ergonomics 2024: implement mutable by-reference bindings Implements the mutable by-reference bindings portion of match ergonomics 2024 (#123076), with the `mut ref`/`mut ref mut` syntax, under feature gate `mut_ref`. r? `@Nadrieril` `@rustbot` label A-patterns A-edition-2024
2024-03-29Auto merge of #122975 - DianQK:simplify_ub_check, r=saethlinbors-2/+2
Eliminate `UbChecks` for non-standard libraries The purpose of this PR is to allow other passes to treat `UbChecks` as constants in MIR for optimization after #122629. r? RalfJung
2024-03-29Auto merge of #122671 - Mark-Simulacrum:const-panic-msg, r=Nilstriebbors-24/+49
Codegen const panic messages as function calls This skips emitting extra arguments at every callsite (of which there can be many). For a librustc_driver build with overflow checks enabled, this cuts 0.7MB from the resulting shared library (see [perf]). A sample improvement from nightly: ``` leaq str.0(%rip), %rdi leaq .Lalloc_d6aeb8e2aa19de39a7f0e861c998af13(%rip), %rdx movl $25, %esi callq *_ZN4core9panicking5panic17h17cabb89c5bcc999E@GOTPCREL(%rip) ``` to this PR: ``` leaq .Lalloc_d6aeb8e2aa19de39a7f0e861c998af13(%rip), %rdi callq *_RNvNtNtCsduqIKoij8JB_4core9panicking11panic_const23panic_const_div_by_zero@GOTPCREL(%rip) ``` [perf]: https://perf.rust-lang.org/compare.html?start=a7e4de13c1785819f4d61da41f6704ed69d5f203&end=64fbb4f0b2d621ff46d559d1e9f5ad89a8d7789b&stat=instructions:u
2024-03-28Replace `RemapFileNameExt::for_codegen` with explicit callsUrgau-2/+6
2024-03-28Rollup merge of #123160 - bvanjoi:cleanup, r=compiler-errorsMatthias Krüger-1/+0
remove `def_id_to_node_id` in ast lowering
2024-03-28Restrict const ty's regions to static when putting them in canonical var listMichael Goulet-0/+4
2024-03-28Auto merge of #115220 - Zoxc:revive-gcx-ptr, r=oli-obkbors-3/+54
Add a `CurrentGcx` type to let the deadlock handler access `TyCtxt` This brings back `GCX_PTR` (previously removed in https://github.com/rust-lang/rust/pull/74969) allowing the deadlock handler access to `GlobalCtxt`. This fixes https://github.com/rust-lang/rust/issues/111522. r? `@cjgillot`
2024-03-28Auto merge of #116891 - aliemjay:opaque-region-infer-rework-2, ↵bors-0/+32
r=compiler-errors,oli-obk rework opaque type region inference User-facing changes are documented in [this comment](https://github.com/rust-lang/rust/pull/116891#issuecomment-1973774412). The design document is in [this comment](https://github.com/rust-lang/rust/pull/116891#issuecomment-1836900102). --- \- Fix Ice in check_unique; ICE -> Error; fixes #122782. \- Ignore uncaptured lifetime args; ICE -> Pass; fixes #111906, fixes #110623, fixes #109059, fixes #122307 \- Except equal parameters from the uniqueness check; Pass -> Error; fixes #113916. \- Check RPITs for invalid args; Pass -> Error; fixes #111935; ICE -> Error; fixes #110726. \- Rework opaque types region inference; Pass -> Error; fixes #113971, fixes #112841. \- Reject external lifetimes as invalid args; Pass -> Error; fixes #105498. r? `@ghost`
2024-03-28remove `def_id_to_node_id` in ast loweringbohan-1/+0
2024-03-28Auto merge of #122832 - oli-obk:no_ord_def_id3, r=michaelwoeristerbors-63/+33
Remove `DefId`'s `Partial/Ord` impls work towards https://github.com/rust-lang/rust/issues/90317 based on https://github.com/rust-lang/rust/pull/122824 and https://github.com/rust-lang/rust/pull/122820 r? `@michaelwoerister`
2024-03-27Int constants must be valtrees in pattern loweringOli Scherer-5/+1
2024-03-27Stop doing expensive work in opt_suggest_box_span eagerlyMichael Goulet-2/+4
2024-03-27Remove `Partial/Ord` from `EarlyParamRegion`Oli Scherer-1/+1
2024-03-27Remove `Partial/Ord` from `AdtDef`Oli Scherer-16/+1
2024-03-27Remove `Partial/Ord` from `BoundRegion`Oli Scherer-12/+10
2024-03-27Remove `Ord` from `BoundTy`Oli Scherer-3/+3
2024-03-27Remove `Ord` from `Binder`Oli Scherer-1/+1
2024-03-27Remove `Ord` from `Ty`, `Const`, and `Region`Oli Scherer-30/+21
2024-03-27Implement `mut ref`/`mut ref mut`Jules Bertholet-72/+38
2024-03-27Eliminate `UbCheck` for non-standard librariesDianQK-2/+2
2024-03-27Use a `dyn Debug` trait object instead of a closure.Oli Scherer-11/+22
Simplifies the API a bit.
2024-03-27Add a `CurrentGcx` type to let the deadlock handler access `TyCtxt`John Kåre Alsaker-3/+54
2024-03-27Rollup merge of #123021 - compiler-errors:coroutine-layout-lol, r=oli-obkGuillaume Gomez-6/+41
Make `TyCtxt::coroutine_layout` take coroutine's kind parameter For coroutines that come from coroutine-closures (i.e. async closures), we may have two kinds of bodies stored in the coroutine; one that takes the closure's captures by reference, and one that takes the captures by move. These currently have identical layouts, but if we do any optimization for these layouts that are related to the upvars, then they will diverge -- e.g. https://github.com/rust-lang/rust/pull/120168#discussion_r1536943728. This PR relaxes the assertion I added in #121122, and instead make the `TyCtxt::coroutine_layout` method take the `coroutine_kind_ty` argument from the coroutine, which will allow us to differentiate these by-move and by-ref bodies.
2024-03-27Make `def_path_hash_to_def_id` a hookOli Scherer-5/+9
2024-03-27Move `CrateStore::expn_hash_to_expn_id` to a hookOli Scherer-7/+8
2024-03-27Start replacing `CStore` trait methods with hooks.Oli Scherer-6/+9
This also avoids the cyclic definition issues with CrateStore being defined after TyCtxt, but needing to be used in TyCtxt.
2024-03-26Rollup merge of #122835 - compiler-errors:deref-pure, r=NadrierilMatthias Krüger-0/+25
Require `DerefMut` and `DerefPure` on `deref!()` patterns when appropriate Waiting on the deref pattern syntax pr to merge r? nadrieril
2024-03-26Remove `CacheSelector` trait now that we can use GATsOli Scherer-59/+56
2024-03-26ignore uncaptured lifetimes when checking opaquesAli MJ Al-Nasrawy-0/+32
2024-03-26Auto merge of #123065 - workingjubilee:rollup-bve45ex, r=workingjubileebors-9/+17
Rollup of 10 pull requests Successful merges: - #122707 (Fix a typo in the alloc::string::String docs) - #122769 (extend comments for reachability set computation) - #122892 (fix(bootstrap/dist): use versioned dirs when vendoring) - #122896 (Update stdarch submodule) - #122923 (In `pretty_print_type()`, print `async fn` futures' paths instead of spans.) - #122950 (Add regression tests for #101903) - #123039 (Update books) - #123042 (Import the 2021 prelude in the core crate) - #123044 (`Instance` is `Copy`) - #123051 (did I mention that tests are super cool? ) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-26Auto merge of #111769 - saethlin:ctfe-backtrace-ctrlc, r=RalfJungbors-0/+2
Print a backtrace in const eval if interrupted Demo: ```rust #![feature(const_eval_limit)] #![const_eval_limit = "0"] const OW: u64 = { let mut res: u64 = 0; let mut i = 0; while i < u64::MAX { res = res.wrapping_add(i); i += 1; } res }; fn main() { println!("{}", OW); } ``` ``` ╭ ➜ ben@archlinux:~/rust ╰ ➤ rustc +stage1 spin.rs ^Cerror[E0080]: evaluation of constant value failed --> spin.rs:8:33 | 8 | res = res.wrapping_add(i); | ^ Compilation was interrupted note: erroneous constant used --> spin.rs:15:20 | 15 | println!("{}", OW); | ^^ note: erroneous constant used --> spin.rs:15:20 | 15 | println!("{}", OW); | ^^ | = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. ```
2024-03-25Extract helper, fix comment on DerefPureMichael Goulet-0/+25
2024-03-25Rollup merge of #123044 - compiler-errors:instance, r=oli-obkJubilee-4/+4
`Instance` is `Copy` No reason to take it by value; it was confusing ``@rcvalle`` to see it being mutated when it's also being passed by ref in some places.
2024-03-25Instance is CopyMichael Goulet-4/+4
2024-03-25In `pretty_print_type()`, print `async fn` futures' paths instead of spans.Kevin Reid-5/+13
This makes `-Zprint-type-sizes`'s output easier to read, because the name of an `async fn` is more immediately recognizable than its span. I also deleted the comment "FIXME(eddyb) should use `def_span`." because it appears to have already been fixed by commit 67727aa7c31a24ea73a91a9134c3653fae8209ab.
2024-03-25Auto merge of #122721 - oli-obk:merge_queries, r=davidtwcobors-11/+11
Replace `mir_built` query with a hook and use mir_const everywhere instead A small perf improvement due to less dep graph handling. Mostly just a cleanup to get rid of one of our many mir queries
2024-03-24Relax validation nowMichael Goulet-2/+0
2024-03-24Require coroutine kind type to be passed to TyCtxt::coroutine_layoutMichael Goulet-6/+43
2024-03-24Address PR feedbackScott McMurray-0/+8
2024-03-24Rollup merge of #122937 - Zalathar:unbox, r=oli-obkMatthias Krüger-12/+7
Unbox and unwrap the contents of `StatementKind::Coverage` The payload of coverage statements was historically a structure with several fields, so it was boxed to avoid bloating `StatementKind`. Now that the payload is a single relatively-small enum, we can replace `Box<Coverage>` with just `CoverageKind`. This patch also adds a size assertion for `StatementKind`, to avoid accidentally bloating it in the future. ``@rustbot`` label +A-code-coverage