rust/tests/ui/mir
bors 8a3765582c Auto merge of #117758 - Urgau:lint_pointer_trait_comparisons, r=davidtwco
Add lint against ambiguous wide pointer comparisons

This PR is the resolution of https://github.com/rust-lang/rust/issues/106447 decided in https://github.com/rust-lang/rust/issues/117717 by T-lang.

## `ambiguous_wide_pointer_comparisons`

*warn-by-default*

The `ambiguous_wide_pointer_comparisons` lint checks comparison of `*const/*mut ?Sized` as the operands.

### Example

```rust
let ab = (A, B);
let a = &ab.0 as *const dyn T;
let b = &ab.1 as *const dyn T;

let _ = a == b;
```

### Explanation

The comparison includes metadata which may not be expected.

-------

This PR also drops `clippy::vtable_address_comparisons` which is superseded by this one.

~~One thing: is the current naming right? `invalid` seems a bit too much.~~

Fixes https://github.com/rust-lang/rust/issues/117717
2023-12-11 14:33:16 +00:00
..
alignment Check alignment of pointers only when read/written through 2023-11-04 13:01:32 -04:00
auxiliary
mir-inlining Fix inlining with -Zalways-encode-mir 2023-08-27 23:52:27 +02:00
validate Validate there are no critical call edges in optimized MIR 2023-11-22 01:56:31 +01:00
build-async-error-body-correctly.rs Build pre-coroutine-transform coroutine body 2023-11-07 21:14:43 +00:00
build-async-error-body-correctly.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
checks_without_panic_impl.rs Only emit alignment checks if we have a panic_impl 2023-04-13 10:58:00 -04:00
debug-ref-undef.rs Add test. 2023-08-17 17:02:04 +00:00
drop-elaboration-after-borrowck-error.rs
drop-elaboration-after-borrowck-error.stderr
field-projection-invariant.rs only require sub type relation on field projection types 2023-02-12 23:18:15 +01:00
field-projection-mutating-context2.rs only require sub type relation on field projection types 2023-02-12 23:18:15 +01:00
field-projection-mutating-context2.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
field-projection-mutating-context.rs only require sub type relation on field projection types 2023-02-12 23:18:15 +01:00
field-projection-mutating-context.stderr recurse into refs when comparing tys for diagnostics 2023-12-07 23:00:46 -05:00
field-ty-ascription-enums.rs only require sub type relation on field projection types 2023-02-12 23:18:15 +01:00
field-ty-ascription.rs only require sub type relation on field projection types 2023-02-12 23:18:15 +01:00
important-higher-ranked-regions.rs
issue66339.rs Adjust UI tests for unit_bindings 2023-06-12 20:24:48 +08:00
issue-29227.rs
issue-46845.rs
issue-60390.rs
issue-66851.rs
issue-66930.rs
issue-67639-normalization-ice.rs
issue-67710-inline-projection.rs
issue-67947.rs
issue-67947.stderr
issue-68841.rs
issue-71793-inline-args-storage.rs s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
issue-73914.rs
issue-74739.rs
issue-75053.rs
issue-75053.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-75419-validation-impl-trait.rs
issue-76248.rs
issue-76375.rs
issue-76740-copy-propagation.rs
issue-76803-branches-not-same.rs
issue-77002.rs
issue-77359-simplify-arm-identity.rs
issue-77911.rs
issue-78496.rs
issue-80949.rs Adjust UI tests for unit_bindings 2023-06-12 20:24:48 +08:00
issue-83499-input-output-iteration-ice.rs
issue-83499-input-output-iteration-ice.stderr
issue-89485.rs
issue-91745.rs
issue-92893.rs Move let expression checking to parsing 2023-09-11 15:51:18 +00:00
issue-92893.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-99852.rs
issue-99866.rs
issue-101844.rs Adjust UI tests for unit_bindings 2023-06-12 20:24:48 +08:00
issue-102389.rs
issue-102389.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-105809.rs
issue-106062.rs
issue-106062.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-107678-projection-with-lifetime.rs ReErased regions are local 2023-02-05 15:29:07 +01:00
issue-107691.rs yet another ui test 2023-02-05 22:51:37 +01:00
issue-109004-drop-large-array.rs Drop subslices of arrays 2023-03-17 12:26:04 +00:00
issue-109743.rs Move a const-prop-lint specific hack from mir interpret to const-prop-lint and make it fallible 2023-04-04 10:39:26 +00:00
issue-112269.rs Show note for type ascription interpreted as a constant pattern, not a new variable 2023-06-04 20:49:30 +08:00
issue-112269.stderr Show note for type ascription interpreted as a constant pattern, not a new variable 2023-06-04 20:49:30 +08:00
mir_adt_construction.rs
mir_ascription_coercion.rs
mir_assign_eval_order.rs
mir_augmented_assignments.rs
mir_autoderef.rs
mir_build_match_comparisons.rs
mir_call_with_associated_type.rs
mir_calls_to_shims.rs
mir_cast_fn_ret.rs
mir_codegen_array_2.rs
mir_codegen_array.rs
mir_codegen_call_converging.rs
mir_codegen_calls_converging_drops_2.rs
mir_codegen_calls_converging_drops.rs
mir_codegen_calls_diverging_drops.rs
mir_codegen_calls_diverging.rs
mir_codegen_calls.rs
mir_codegen_critical_edge.rs
mir_codegen_spike1.rs
mir_codegen_ssa.rs
mir_codegen_switch.rs
mir_codegen_switchint.rs
mir_coercion_casts.rs
mir_coercions.rs
mir_const_prop_identity.rs
mir_const_prop_tuple_field_reorder.rs
mir_constval_adts.rs
mir_detects_invalid_ops.rs
mir_detects_invalid_ops.stderr
mir_drop_order.rs
mir_drop_panics.rs
mir_dynamic_drops_1.rs
mir_dynamic_drops_2.rs
mir_dynamic_drops_3.rs
mir_early_return_scope.rs
mir_fat_ptr_drop.rs
mir_fat_ptr.rs
mir_heavy_promoted.rs
mir_indexing_oob_1.rs
mir_indexing_oob_2.rs
mir_indexing_oob_3.rs
mir_let_chains_drop_order.rs
mir_match_arm_guard.rs
mir_match_test.rs Lint overlapping ranges as a separate pass 2023-10-27 05:16:26 +02:00
mir_misc_casts.rs
mir_overflow_off.rs
mir_raw_fat_ptr.rs Adjust tests for newly added ambiguous_wide_pointer_comparisons lint 2023-12-06 09:03:48 +01:00
mir_refs_correct.rs
mir_small_agg_arg.rs
mir_static_subtype.rs
mir_struct_with_assoc_ty.rs
mir_temp_promotions.rs
mir_void_return_2.rs
mir_void_return.rs
mir-typeck-normalize-fn-sig.rs
remove-zsts-query-cycle.rs s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
simplify-branch-same.rs
ssa_call_ret.rs Fix def-use check for call terminators 2023-11-14 17:07:34 +01:00
ssa-analysis-regression-50041.rs remove box_free and replace with drop impl 2023-06-16 13:41:06 -07:00
thir-constparam-temp.rs Implement custom diagnostic for ConstParamTy 2023-06-01 18:21:42 +00:00
thir-constparam-temp.stderr Implement custom diagnostic for ConstParamTy 2023-06-01 18:21:42 +00:00
unsize-trait.rs Add test. 2023-03-05 20:55:29 +00:00