Commit Graph

28 Commits

Author SHA1 Message Date
Esteban Küber
7f5548fa8b On function and method calls in patterns, link to the book
```
error: expected a pattern, found an expression
 --> f889.rs:3:13
  |
3 |     let (x, y.drop()) = (1, 2); //~ ERROR
  |             ^^^^^^^^ not a pattern
  |
  = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>

error[E0532]: expected a pattern, found a function call
 --> f889.rs:2:13
  |
2 |     let (x, drop(y)) = (1, 2); //~ ERROR
  |             ^^^^ not a tuple struct or tuple variant
  |
  = note: function calls are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html>
```

Fix #97200.
2024-10-06 01:44:59 +00:00
Esteban Küber
f6767f7a68 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 = "";
   |
```
2024-08-08 17:35:40 +00:00
Ralf Jung
6c803ffefb remove unnecessary ignore-endian-big from stack-overflow-trait-infer test 2024-07-02 16:31:40 +02:00
Ralf Jung
763e3131cc don't ICE when encountering an extern type field during validation 2024-06-22 17:39:01 +02:00
Oli Scherer
a183989e88 Only check locally for reported errors 2024-06-18 15:43:27 +00:00
Nilstrieb
7b1527ff5f hir pretty: fix block indent 2024-05-20 20:30:44 +02:00
Michael Goulet
619e044178 Fix pretty hir for anon consts in diagnostics 2024-04-15 18:48:12 -04:00
surechen
1012218ba8 t plit astconv's error report code in check functions to mod errors.
Move some error report codes to mod `astconv/errors.rs`
2024-04-02 20:10:35 +08:00
Esteban Küber
d54e9833e3 Do not attempt to write ty::Err on binding that isn't from current HIR Owner
Fix #123009.
2024-03-29 19:05:54 +00:00
Matthias Krüger
114d012a0e add issue numbers via // issue: rust-lang/rust#ISSUE_NUM directive 2024-03-24 09:34:11 +01:00
Matthias Krüger
57f500512b add test for stack overflow with recursive type #98842
Fixes #98842
2024-03-24 09:23:13 +01:00
Esteban Küber
b1575b71d4 Silence unecessary !Sized binding error
When gathering locals, we introduce a `Sized` obligation for each
binding in the pattern. *After* doing so, we typecheck the init
expression. If this has a type failure, we store `{type error}`, for
both the expression and the pattern. But later we store an inference
variable for the pattern.

We now avoid any override of an existing type on a hir node when they've
already been marked as `{type error}`, and on E0277, when it comes from
`VariableType` we silence the error in support of the type error.

Fix #117846.
2024-03-19 21:26:11 +00:00
Esteban Küber
3f2159fda5 Add test for #117846 2024-03-19 20:56:45 +00:00
许杰友 Jieyou Xu (Joe)
ec2cc761bc
[AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
r0cky
c7519d42c2 Update tests 2024-02-07 10:42:01 +08:00
Lukas Markeffsky
29036045c3 add test for coercing never to infinite type 2023-12-26 17:57:33 +01:00
Lukas Markeffsky
cb2fc0967f rename tests 2023-12-26 17:50:30 +01:00
Nilstrieb
41e8d152dc Show number in error message even for one error
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
Esteban Küber
2f79681fb9 Only emit one error per unsized binding, instead of one per usage
Fix #56607.
2023-10-09 23:00:15 +00:00
Esteban Küber
3d86b8acda Add test for #56607 2023-10-09 22:51:16 +00:00
David Tolnay
5bbf0a8306
Revert "Auto merge of #113166 - moulins:ref-niches-initial, r=oli-obk"
This reverts commit 557359f925, reversing
changes made to 1e6c09a803.
2023-07-21 22:35:57 -07:00
Moulins
cb8b1d1bc9 add naive_layout_of query 2023-07-21 03:31:45 +02:00
nxya
a54a66830d moved note as unspanned note, moved note to the bottom of the msg 2023-07-18 21:53:34 -04:00
nxya
e6e8892051 added links as a note 2023-07-18 09:27:35 -04:00
nxya
f92a9f6808 add links to query documentation for E0391 2023-07-18 09:27:26 -04:00
nxya
bef91ee687 added links as a note 2023-07-18 09:20:25 -04:00
nxya
c429a72db9 add links to query documentation for E0391 2023-07-18 09:20:25 -04:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00