Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve invalid let expression handling #115677

Merged
merged 5 commits into from
Sep 14, 2023

Commits on Sep 11, 2023

  1. 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.
    matthewjasper committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    7b61f7f View commit details
    Browse the repository at this point in the history
  2. 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.
    matthewjasper committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    333388f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2d7a5f5 View commit details
    Browse the repository at this point in the history
  4. Reduce double errors for invalid let expressions

    Previously some invalid let expressions would result in both a feature
    error and a parsing error. Avoid this and ensure that we only emit the
    parsing error when this happens.
    matthewjasper committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    b011a0a View commit details
    Browse the repository at this point in the history

Commits on Sep 13, 2023

  1. Address review comments

    - Add doc comment to new type
    - Restore "only supported directly in conditions of `if` and `while` expressions" note
    - Rename variant with clearer name
    matthewjasper committed Sep 13, 2023
    Configuration menu
    Copy the full SHA
    e324a59 View commit details
    Browse the repository at this point in the history