Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
51b51b51d7931da85280382a81c4dd80c73ca754
rust/tests/ui/rfcs/rfc-2497-if-let-chains/avoid-invalid-mir.rs

15 lines
192 B
Rust
Raw Normal View History

Don't create drop scopes after item statements These scopes would not exist in MIR and can cause ICEs with invalid uses of let expressions.
2023-09-06 12:52:34 +00:00
// Regression test for #104172
const N: usize = {
struct U;
!let y = 42;
//~^ ERROR expected expression, found `let` statement
3
};
struct S {
x: [(); N]
}
Move let expression checking to parsing There was an incomplete version of the check in parsing and a second version in AST validation. This meant that some, but not all, invalid uses were allowed inside macros/disabled cfgs. It also means that later passes have a hard time knowing when the let expression is in a valid location, sometimes causing ICEs. - Add a field to ExprKind::Let in AST/HIR to mark whether it's in a valid location. - Suppress later errors and MIR construction for invalid let expressions.
2023-09-08 10:14:36 +00:00
fn main() {}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 746ms Template: 4ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API