about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/check
AgeCommit message (Collapse)AuthorLines
2024-02-22`report_mismatch` did not actually report anymoreOli Scherer-1/+1
2024-02-22Avoid emitting type mismatches against `{type error}`Oli Scherer-1/+1
2024-02-21remove simd_reduce_{min,max}_nanlessRalf Jung-3/+1
2024-02-21Auto merge of #121383 - Dylan-DPC:rollup-735p4u4, r=Dylan-DPCbors-27/+34
Rollup of 7 pull requests Successful merges: - #121208 (Convert `delayed_bug`s to `bug`s.) - #121288 (make rustc_expand translatable) - #121304 (Add docs for extension proc-macro) - #121328 (Make --verbose imply -Z write-long-types-to-disk=no) - #121338 (Downgrade ambiguous_wide_pointer_comparisons suggestions to MaybeIncorrect) - #121361 (diagnostic items for legacy numeric modules) - #121375 (Print proper relative path for descriptive name check) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-21Auto merge of #120718 - saethlin:reasonable-fast-math, r=nnethercotebors-1/+11
Add "algebraic" fast-math intrinsics, based on fast-math ops that cannot return poison Setting all of LLVM's fast-math flags makes our fast-math intrinsics very dangerous, because some inputs are UB. This set of flags permits common algebraic transformations, but according to the [LangRef](https://llvm.org/docs/LangRef.html#fastmath), only the flags `nnan` (no nans) and `ninf` (no infs) can produce poison. And this uses the algebraic float ops to fix https://github.com/rust-lang/rust/issues/120720 cc `@orlp`
2024-02-21Convert `bug`s back to `delayed_bug`s.Nicholas Nethercote-8/+26
This commit undoes some of the previous commit's mechanical changes, based on human judgment.
2024-02-21Convert `delayed_bug`s to `bug`s.Nicholas Nethercote-25/+14
I have a suspicion that quite a few delayed bug paths are impossible to reach, so I did an experiment. I converted every `delayed_bug` to a `bug`, ran the full test suite, then converted back every `bug` that was hit. A surprising number were never hit. The next commit will convert some more back, based on human judgment.
2024-02-20Add "algebraic" versions of the fast-math intrinsicsBen Kimock-1/+11
2024-02-20Propagate temporary lifetime extension into if and match.Mara Bos-0/+13
2024-02-19Prefer `DiagnosticBuilder` over `Diagnostic` in diagnostic modifiers.Nicholas Nethercote-2/+2
There are lots of functions that modify a diagnostic. This can be via a `&mut Diagnostic` or a `&mut DiagnosticBuilder`, because the latter type wraps the former and impls `DerefMut`. This commit converts all the `&mut Diagnostic` occurrences to `&mut DiagnosticBuilder`. This is a step towards greatly simplifying `Diagnostic`. Some of the relevant function are made generic, because they deal with both errors and warnings. No function bodies are changed, because all the modifier methods are available on both `Diagnostic` and `DiagnosticBuilder`.
2024-02-18Auto merge of #117772 - surechen:for_117448, r=petrochenkovbors-2/+1
Tracking import use types for more accurate redundant import checking fixes #117448 By tracking import use types to check whether it is scope uses or the other situations like module-relative uses, we can do more accurate redundant import checking. For example unnecessary imports in std::prelude that can be eliminated: ```rust use std::option::Option::Some;//~ WARNING the item `Some` is imported redundantly use std::option::Option::None; //~ WARNING the item `None` is imported redundantly ```
2024-02-18By tracking import use types to check whether it is scope uses or the other ↵surechen-2/+1
situations like module-relative uses, we can do more accurate redundant import checking. fixes #117448 For example unnecessary imports in std::prelude that can be eliminated: ```rust use std::option::Option::Some;//~ WARNING the item `Some` is imported redundantly use std::option::Option::None; //~ WARNING the item `None` is imported redundantly ```
2024-02-18Auto merge of #121034 - obeis:improve-static-mut-ref, r=RalfJungbors-18/+10
Improve wording of `static_mut_ref` Close #120964
2024-02-18Improve wording of static_mut_refObei Sideg-18/+10
Rename `static_mut_ref` lint to `static_mut_refs`.
2024-02-17Add more checks for `unnamed_field` during HIR analysisclubby789-10/+13
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-16Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkinbors-128/+177
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/+2
Use generic `NonZero` internally. Tracking issue: https://github.com/rust-lang/rust/issues/120257
2024-02-15Auto merge of #120931 - chenyukang:yukang-cleanup-hashmap, r=michaelwoeristerbors-10/+10
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/+2
2024-02-14clean up potential_query_instability with FxIndexMap and UnordMapyukang-10/+10
2024-02-14Use fewer delayed bugs.Nicholas Nethercote-4/+4
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-13Auto merge of #120919 - oli-obk:impl_polarity, r=compiler-errorsbors-17/+22
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-35/+37
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-13/+12
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-3/+7
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-7/+2
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-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-12fix ICE for deref coercions with type errorsLukas Markeffsky-3/+7
2024-02-12Make the signature of equate_intrinsic_type support items other than ↵Oli Scherer-17/+21
`ForeignItem`
2024-02-12Stop calling `impl_polarity` when `impl_trait_ref` was also calledOli Scherer-17/+22
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-12Dejargnonize substShoyu Vanilla-35/+37
2024-02-12Improve some codes according to the reviewsFrank King-1/+5
- 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-0/+49
2024-02-12remove a bunch of dead parameters in fnyukang-7/+2
2024-02-11Auto merge of #120619 - compiler-errors:param, r=lcnrbors-4/+21
Assert that params with the same *index* have the same *name* Found this bug when trying to build libcore with the new solver, since it will canonicalize two params with the same index into *different* placeholders if those params differ by name.
2024-02-10Loosen an assertion to account for stashed errors.Nicholas Nethercote-1/+2
The meaning of this assertion changed in #120828 when the meaning of `has_errors` changed to exclude stashed errors. Evidently the new meaning is too restrictive. Fixes #120856.
2024-02-08Add a new debug_assertions instrinsic (compiler)Ben Kimock-1/+4
And in clippy
2024-02-08Rollup merge of #120206 - petrochenkov:somehir, r=compiler-errorsMatthias Krüger-7/+7
hir: Make sure all `HirId`s have corresponding HIR `Node`s And then remove `tcx.opt_hir_node(hir_id)` in favor of `tcx.hir_node(hir_id)`.
2024-02-08Rollup merge of #120103 - compiler-errors:concrete-afits, r=oli-obkMatthias Krüger-35/+53
Make it so that async-fn-in-trait is compatible with a concrete future in implementation There's no technical reason why an AFIT like `async fn foo()` cannot be satisfied with an implementation signature like `fn foo() -> Pin<Box<dyn Future<Output = ()> + 'static>>`. We rejected this previously because we were uncertain about how AFITs worked with refinement, but I don't believe this needs to be a restriction any longer. r? oli-obk
2024-02-07Do not create param types that differ only by name when comparing intrinsic ↵Michael Goulet-4/+21
signatures
2024-02-07hir: Remove `fn opt_hir_id` and `fn opt_span`Vadim Petrochenkov-7/+7
2024-02-05Make the error message betterMichael Goulet-4/+53