about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
AgeCommit message (Collapse)AuthorLines
2024-02-17Update comments and variable namesLeón Orell Valerian Liehr-34/+39
2024-02-16Give the (`un`)`likely` intrinsics fallback bodiesOli Scherer-2/+2
2024-02-16Give the `assume` intrinsic a fallback bodyOli Scherer-1/+1
2024-02-16Move trait into attr so it's greppableMichael Goulet-2/+2
2024-02-16Use extension trait deriveMichael Goulet-10/+2
2024-02-16Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkinbors-129/+178
Implement intrinsics with fallback bodies fixes #93145 (though we can port many more intrinsics) cc #63585 The way this works is that the backend logic for generating custom code for intrinsics has been made fallible. The only failure path is "this intrinsic is unknown". The `Instance` (that was `InstanceDef::Intrinsic`) then gets converted to `InstanceDef::Item`, which represents the fallback body. A regular function call to that body is then codegenned. This is currently implemented for * codegen_ssa (so llvm and gcc) * codegen_cranelift other backends will need to adjust, but they can just keep doing what they were doing if they prefer (though adding new intrinsics to the compiler will then require them to implement them, instead of getting the fallback body). cc `@scottmcm` `@WaffleLapkin` ### todo * [ ] miri support * [x] default intrinsic name to name of function instead of requiring it to be specified in attribute * [x] make sure that the bodies are always available (must be collected for metadata)
2024-02-16Auto merge of #120486 - reitermarkus:use-generic-nonzero, r=dtolnaybors-2/+3
Use generic `NonZero` internally. Tracking issue: https://github.com/rust-lang/rust/issues/120257
2024-02-15Auto merge of #121142 - GuillaumeGomez:rollup-5qmksjw, r=GuillaumeGomezbors-2/+3
Rollup of 8 pull requests Successful merges: - #120449 (Document requirements for unsized {Rc,Arc}::from_raw) - #120505 (Fix BTreeMap's Cursor::remove_{next,prev}) - #120672 (std::thread update freebsd stack guard handling.) - #121088 (Implicitly enable evex512 if avx512 is enabled) - #121104 (Ignore unsized types when trying to determine the size of the original type) - #121107 (Fix msg for verbose suggestions with confusable capitalization) - #121113 (Continue compilation even if inherent impl checks fail) - #121120 (Add `ErrorGuaranteed` to `ast::LitKind::Err`, `token::LitKind::Err`.) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-15Auto merge of #120931 - chenyukang:yukang-cleanup-hashmap, r=michaelwoeristerbors-34/+34
Clean up potential_query_instability with FxIndexMap and UnordMap From https://github.com/rust-lang/rust/pull/120485#issuecomment-1916437191 r? `@michaelwoerister`
2024-02-15Use generic `NonZero` internally.Markus Reiter-2/+3
2024-02-14Continue compilation even if inherent impl checks failOli Scherer-2/+3
2024-02-14Auto merge of #120847 - oli-obk:track_errors9, r=compiler-errorsbors-2/+4
Continue compilation after check_mod_type_wf errors The ICEs fixed here were probably reachable through const eval gymnastics before, but now they are easily reachable without that, too. The new errors are often bugfixes, where useful errors were missing, because they were reported after the early abort. In other cases sometimes they are just duplication of already emitted errors, which won't be user-visible due to deduplication. fixes https://github.com/rust-lang/rust/issues/120860
2024-02-14Continue compilation after check_mod_type_wf errorsOli Scherer-2/+4
2024-02-14Rollup merge of #121071 - nnethercote:fewer-delayed-bugs, r=oli-obkOli Scherer-7/+7
Use fewer delayed bugs. For some cases where it's clear that an error has already occurred, e.g.: - there's a comment stating exactly that, or - things like HIR lowering, where we are lowering an error kind The commit also tweaks some comments around delayed bug sites. r? `@oli-obk`
2024-02-14Rollup merge of #120530 - trevyn:issue-116434, r=compiler-errorsOli Scherer-1/+1
Be less confident when `dyn` suggestion is not checked for object safety #120275 no longer checks bare traits for object safety when making a `dyn` suggestion on Rust < 2021. In this case, qualify the suggestion with a note that the trait must be object safe, to prevent user confusion as seen in #116434 r? ```@fmease```
2024-02-14clean up potential_query_instability with FxIndexMap and UnordMapyukang-34/+34
2024-02-14Use fewer delayed bugs.Nicholas Nethercote-7/+7
For some cases where it's clear that an error has already occurred, e.g.: - there's a comment stating exactly that, or - things like HIR lowering, where we are lowering an error kind The commit also tweaks some comments around delayed bug sites.
2024-02-14Auto merge of #121018 - oli-obk:impl_unsafety, r=TaKO8Kibors-69/+79
Fully stop using the HIR in trait impl checks At least I hope I found all happy path usages. I'll need to check if I can figure out a way to make queries declare that they don't access the HIR except in error paths
2024-02-13Bump `indexmap`clubby789-2/+4
`swap` has been deprecated in favour of `swap_remove` - the behaviour is the same though.
2024-02-13Just pass the checker instead of individual fieldsOli Scherer-39/+33
2024-02-13Remove an `impl_polarity` call where the information is already available in ↵Oli Scherer-16/+23
the header
2024-02-13Avoid using the HIR span in the happy pathOli Scherer-5/+8
2024-02-13Don't reinvoke `trait_header` query twiceOli Scherer-11/+11
2024-02-13Invoke `trait_def` query only onceOli Scherer-10/+13
This may be a small performance boost as we have to hash less to lookup the value
2024-02-13Store impl unsafety in impl trait headerOli Scherer-24/+27
2024-02-13Auto merge of #120919 - oli-obk:impl_polarity, r=compiler-errorsbors-56/+54
Merge `impl_polarity` and `impl_trait_ref` queries Hopefully this is perf neutral. I want to finish https://github.com/rust-lang/rust/pull/120835 and stop using the HIR in `coherent_trait`, which should then give us a perf improvement.
2024-02-12Rollup merge of #120958 - ShoyuVanilla:remove-subst, r=oli-obkMatthias Krüger-74/+80
Dejargonize `subst` In favor of #110793, replace almost every occurence of `subst` and `substitution` from rustc codes, but they still remains in subtrees under `src/tools/` like clippy and test codes (I'd like to replace them after this)
2024-02-12Support safe intrinsics with fallback bodiesOli Scherer-3/+8
Turn `is_val_statically_known` into such an intrinsic to demonstrate. It is perfectly safe to call after all.
2024-02-12Give const_deallocate a default bodyOli Scherer-1/+1
2024-02-12Teach llvm backend how to fall back to default bodiesOli Scherer-1/+1
2024-02-12Check signature of intrinsics with fallback bodiesOli Scherer-8/+31
2024-02-12Auto merge of #120980 - matthiaskrgr:rollup-dsjsqql, r=matthiaskrgrbors-22/+17
Rollup of 11 pull requests Successful merges: - #120765 (Reorder diagnostics API) - #120833 (More internal emit diagnostics cleanups) - #120899 (Gracefully handle non-WF alias in `assemble_alias_bound_candidates_recur`) - #120917 (Remove a bunch of dead parameters in functions) - #120928 (Add test for recently fixed issue) - #120933 (check_consts: fix duplicate errors, make importance consistent) - #120936 (improve `btree_cursors` functions documentation) - #120944 (Check that the ABI of the instance we are inlining is correct) - #120956 (Clean inlined type alias with correct param-env) - #120962 (Add myself to library/std review) - #120972 (fix ICE for deref coercions with type errors) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-12Rollup merge of #120972 - lukas-code:autoderef-type-error, r=compiler-errorsMatthias Krüger-7/+11
fix ICE for deref coercions with type errors Follow-up to https://github.com/rust-lang/rust/pull/120895, where I made types with errors go through the full coercion code, which is necessary if we want to build MIR for bodies with errors (https://github.com/rust-lang/rust/pull/120550). The code for coercing `&T` to `&U` currently assumes that autoderef for `&T` will succeed for at least two steps (`&T` and `T`): https://github.com/rust-lang/rust/blob/b17491c8f6d555386104dfd82004c01bfef09c95/compiler/rustc_hir_typeck/src/coercion.rs#L339-L464 But for types with errors, we previously only returned the no-op autoderef step (`&{type error}` -> `&{type error}`) and then stopped early. This PR changes autoderef for types with errors to still go through the built-in derefs (e.g. `&&{type error}` -> `&{type error}` -> `{type error}`) and only stop early when it would have to go looking for `Deref` trait impls. fixes https://github.com/rust-lang/rust/issues/120945 r? ``@compiler-errors`` or compiler
2024-02-12Rollup merge of #120917 - chenyukang:yukang-dead-parameters, r=compiler-errorsMatthias Krüger-12/+3
Remove a bunch of dead parameters in functions Found this kind of issue when working on https://github.com/rust-lang/rust/pull/119650 I wrote a trivial toy lint and manual review to find these.
2024-02-12Rollup merge of #120833 - ↵Matthias Krüger-3/+3
nnethercote:more-internal-emit_diagnostics-cleanups, r=oli-obk More internal emit diagnostics cleanups Miscellaneous improvements. r? ``@oli-obk``
2024-02-12support adding const generic params to intrinsicsOli Scherer-92/+104
but right now all of them have zero const generic params
2024-02-12Make check_intrinsic_type not require ForeignItems anymoreOli Scherer-19/+24
2024-02-12Auto merge of #115367 - frank-king:feature/unnamed-fields-hir, r=davidtwcobors-25/+354
Lowering unnamed fields and anonymous adt This implements #49804. Goals: - [x] lowering anonymous ADTs from AST to HIR - [x] generating definitions of anonymous ADTs - [x] uniqueness check of the unnamed fields - [x] field projection of anonymous ADTs - [x] `#[repr(C)]` check of the anonymous ADTs Non-Goals (will be in the next PRs) - capturing generic params for the anonymous ADTs from the parent ADT - pattern matching of anonymous ADTs - structural expressions of anonymous ADTs - rustdoc support of anonymous ADTs
2024-02-12fix ICE for deref coercions with type errorsLukas Markeffsky-7/+11
2024-02-12Make the signature of equate_intrinsic_type support items other than ↵Oli Scherer-18/+22
`ForeignItem`
2024-02-12Remove impl_polarity queryOli Scherer-6/+0
2024-02-12Stop calling `impl_polarity` when `impl_trait_ref` was also calledOli Scherer-27/+31
2024-02-12Use a struct instead of a tupleOli Scherer-3/+6
2024-02-12Make impl_trait_ref into a query also returning more information about the implOli Scherer-27/+24
2024-02-12Tweak delayed bug mentions.Nicholas Nethercote-3/+3
Now that we have both `delayed_bug` and `span_delayed_bug`, it makes sense to use the generic term "delayed bug" more.
2024-02-12Auto merge of #120835 - oli-obk:no_hir_coherence, r=cjgillotbors-99/+97
Avoid accessing the HIR in the happy path of `coherent_trait` Unfortunately the hir is still used in unsafety checks, and we do not have a way to avoid that. An impl's unsafety is not part of any query other than hir. So this PR does not affect perf, but could still be considered a cleanup
2024-02-12Dejargnonize substShoyu Vanilla-74/+80
2024-02-12Auto merge of #120834 - oli-obk:only_local_coherence, r=lcnrbors-1/+3
A trait's local impls are trivially coherent if there are no impls. This avoids creating a dependency edge on the hir or the specialization graph This may resolve part of the performance issue of https://github.com/rust-lang/rust/pull/120558
2024-02-12Improve some codes according to the reviewsFrank King-107/+151
- improve diagnostics of field uniqueness check and representation check - simplify the implementation of field uniqueness check - remove some useless codes and improvement neatness
2024-02-12Check representation of unnamed fieldsFrank King-1/+84