Detect * operator on !Sized expression

```
error[E0277]: the size for values of type `str` cannot be known at compilation time
  --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:15:9
   |
LL |     let x = *"";
   |         ^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `str`
   = note: all local variables must have a statically known size
   = help: unsized locals are gated as an unstable feature
help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression
   |
LL -     let x = *"";
LL +     let x = "";
   |
```
This commit is contained in:
Esteban Küber
2024-07-31 22:39:40 +00:00
parent d3a393932e
commit f6767f7a68
10 changed files with 187 additions and 9 deletions

View File

@@ -353,7 +353,7 @@ pub enum ObligationCauseCode<'tcx> {
ReturnValue(HirId),
/// Opaque return type of this function
OpaqueReturnType(Option<(Ty<'tcx>, Span)>),
OpaqueReturnType(Option<(Ty<'tcx>, HirId)>),
/// Block implicit return
BlockTailExpression(HirId, hir::MatchSource),