Skip to content

Incomplete syntax highlighting for the union keyword. #399

Open
@tomasz-rozanski

Description

@tomasz-rozanski

Everything is working as intended, when using union as a struct, but as soon as you start to use it as variable name, or call a union() function on a set, the highlighting for the rest of the code, starts to go crazy.

Examples:

    // This is fine
    #[repr(C)]
    union MyUnion {
        f1: u32,
        f2: f32,
    }
    // If you create a variable called `union`, things starts to break down:
    let union: Vec<i32> = vec![1, 2, 3];
    assert_eq!(union, (1..=3).collect::<Vec<i32>>());
    use std::collections::HashSet;

    let mut a: HashSet<i32> = (0..4).collect();
    let mut b: HashSet<i32> = (4..8).collect();

    // But when you combine `union()` function with a print macro,
    // the results are more than weird ...
    for x in a.union(&b) {
        print!("{} ", x);
    }
    // ... and the rest of the code is highlighted like one big string literal.

Here's a screenshot to better illustrate the problem:

union_highlighting
Color theme is Cobalt

Sublime Text Version

Sublime Text 3.2.1 (Build 3207)

Rust Enhanced Version

2.20.00

Operating system

OS: Windows 10 Pro
Version: 10.0.18362 build 18362

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-syntaxArea: Syntax highlighting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions