Add note to non-exhaustive match on reference to empty
Rust prints "type `&A` is non-empty" even is A is empty.
This is the intended behavior, but can be confusing.
This commit adds a note to non-exhaustive pattern errors if they are a
reference to something uninhabited.
I did not add tests to check that the note is not shown for
non-references or inhabited references, because this is already done
in other tests.
Maybe the added test is superfluous, because
`always-inhabited-union-ref` already checks for this case.
This does not handle &&Void or &&&void etc. I could add those as special
cases as well and ignore people who need quadruple
references.
Fixes#78123
Allow references to interior mutable data behind a feature gate
supercedes #80373 by simply not checking for interior mutability on borrows of locals that have `StorageDead` and thus can never be leaked to the final value of the constant
tracking issue: https://github.com/rust-lang/rust/issues/80384
r? `@RalfJung`
Rust prints "type `&A` is non-empty" even is A is empty.
This is the intended behavior, but can be confusing.
This commit adds a note to non-exhaustive pattern errors if they are a
reference to something uninhabited.
I did not add tests to check that the note is not shown for
non-references or inhabited references, because this is already done
in other tests.
Maybe the added test is superfluous, because
`always-inhabited-union-ref` already checks for this case.
This does not handle &&Void or &&&void etc. I could add those as special
cases as well and ignore people who need quadruple
references.
Fixes#78123
Clean up in `each_child_of_item`
This PR hopes to eliminate some of the surprising elements I encountered while reading the function.
- `macros_only` is checked against inside the loop body, but if it is `true`, the loop is skipped anyway
- only query `span` when relevant
- no need to allocate attribute vector
`const_generics_defaults`: don't ICE in the unimplemented parts
The thought was that we could use `todo!`s to ensure we wouldn't forget to implement parts of the experimental gate.
However, that can also lead to a suboptimal experience for users as shown in #80589 having both the error/warning about the experimental feature, and the ICE.
Fixes#80589
r? `@varkor`
improve unconditional_panic description
The fact that the lint is triggered by the ConstProp pass is an implementation detail, I do not think that this should be mentioned in the description.
Cc `@oli-obk` `@ehuss`
rustc_serialize: specialize opaque encoding and decoding of some u8 sequences
This specializes encoding and decoding of some contiguous u8 sequences to use a more efficient implementation. The default implementations process each u8 individually, but that isn't necessary for the opaque encoder and decoder. The opaque encoding for u8s is a no-op, so we can just copy entire sequences as-is, rather than process them byte by byte.
This also changes some encode and decode implementations for contiguous sequences to forward to the slice and vector implementations, so that they can take advantage of the new specialization when applicable.
Enable ASan, TSan, UBSan for aarch64-apple-darwin.
I confirmed ASan, TSan, UBSan all work for me locally with `clang` on my new Macbook Air.
~This requires https://github.com/rust-lang/llvm-project/pull/86~