1
Fork 0

Auto merge of #30064 - fhartwig:macro-suggestions, r=sanxiyn

Fixes #13677
This does the same sort of suggestion for misspelt macros that we already do for misspelt identifiers.
Example. Compiling this program:

```rust
macro_rules! foo {
    ($e:expr) => ( $e )
}

fn main() {
    fob!("hello!");
}
```

gives the following error message:

```
/Users/mcp/temp/test.rs:7:5: 7:8 error: macro undefined: 'fob!'
/Users/mcp/temp/test.rs:7     fob!("hello!");
                              ^~~
/Users/mcp/temp/test.rs:7:5: 7:8 help: did you mean `foo`?
/Users/mcp/temp/test.rs:7     fob!("hello!");
```

I had to move the levenshtein distance function into libsyntax for this. Maybe this should live somewhere else (some utility crate?), but I couldn't find a crate to put it in that is imported by libsyntax and the other rustc crates.
This commit is contained in:
bors 2015-11-27 18:41:53 +00:00
commit 5dc91a74b1
8 changed files with 42 additions and 8 deletions

View file

@ -65,6 +65,7 @@ macro_rules! panictry {
pub mod util {
pub mod interner;
pub mod lev_distance;
pub mod node_count;
pub mod parser;
#[cfg(test)]