Skip to content

Rust definition is a bit out of date #2937

@icorderi

Description

@icorderi

There are a few things that causes the the code to get all wonky with CodeMirror and some new stuff missing.
The following are some things I've found so far:

// Nested generic types break the highlighting inside the function block
fn foo(&self, bar: str) -> S<T<Q>> {
    let x = 2; 
    let y = some.func(&bar);
}
// the grammar is not liking the () around proc
spawn(proc() {
      let x = 12; // the code inside proc is not parsed correctly and breaks the rest
});
let mut x = 2; // it doesn't know mut is a keyword not pat of the name
fn drop(&mut self) { // &mut is a keyword too
}
match x { // match is not being treated as a keyword
}
pub fn foo()  {} // access modifiers are absent from the grammar
#[unstable] // we might want to treat this #[] as a special thing
pub fn foo() -> (){ }
// 'static is a keyword too
 pub fn foo() -> &'static T {
 }
// not sure why, but this reads better in github.
// They all get ignored until the last call before the (), 
// it's very easy to identify what you are calling without getting lost 
 some.func.call(&bar); 
// this is another case where it reads more clear in Github, 
// with the current CodeMirror it all comes out in the same color
Ok(foo.bar);
Err(foo.bar.call());
// I would place mut, &, &mut, ref and * (deref) 
// on their own little group

I noticed @marijnh did the initial contribution and maintained it over the years.
Can you help update the language definition?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions