#compiler-error #title #extract #experimental #general #api #sentence

extractor

Experimental API to extract the general error title of the compiler

1 unstable release

Uses old Rust 2015

0.1.0 Jul 1, 2018

#912 in Programming languages


Used in resa

Unlicense

7KB
63 lines

extractor Build Status

Experimental API to extract the general error title.

Installation

Apply changes on your Cargo.toml

[dependencies]
extractor = "0.1.0"

Example

error[E0382]: use of moved value: 'v'
--> examples/fail.rs:4:29
|
3 |     let v2 = v;
|         -- value moved here
4 |     println!("v[0] is: {}\", v[0]);
  |                             ^ value used here after move
|
= note: move occurs because `v` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait"

Based on this compiler error the general error title would be e.g use of moved value. The purpose of this crate is to make the use of resa more easier by outsourcing different semantic code.

Because a search for error[E0382]: use of moved value: 'v' would lead to empty results, we need to extract the general issue of this.


lib.rs:

Extractor

This is a experimental crate for extracting possible inline titles for error searching with resa.

The following example will demonstrate the purpose:

error[E0382]: use of moved value: 'v'
--> examples/fail.rs:4:29
|
3 |     let v2 = v;
|         -- value moved here
4 |     println!("v[0] is: {}\", v[0]);
  |                             ^ value used here after move
|
= note: move occurs because `v` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait"

A compiler error. The extractor crate will search for the inline title use of moved value. To get this sentence the crate need to filter, split and match regular expressions.

Based on this title we're able to search e.g on StackOverflow for similar issues.

Dependencies

~2.2–3MB
~53K SLoC