Closed
Description
Given the following code:
extern crate regex; // 1.5.4
use std::iter::Enumerate;
pub struct CaptureIndices<'a, 'b> {
name: &'b [u8],
capture_names: Enumerate<regex::CaptureNames<'a>>
}
impl<'a, 'b> CapturesIndicies<'a, 'b> {
pub(crate) fn with_name_and_iter(name: &'b [u8], iter: regex::CaptureNames<'a>) -> Self {
Self {
name,
capture_names: iter.enumerate(),
}
}
}
fn main() {
let r = regex::Regex::new("a").unwrap();
CaptureIndicies::with_name_and_iter(b"", r.capture_names());
}
The current output is:
Compiling playground v0.0.1 (/playground)
error[E0433]: failed to resolve: use of undeclared type `CaptureIndicies`
--> src/main.rs:21:5
|
21 | CaptureIndicies::with_name_and_iter(b"", r.capture_names());
| ^^^^^^^^^^^^^^^ use of undeclared type `CaptureIndicies`
error[E0412]: cannot find type `CapturesIndicies` in this scope
--> src/main.rs:10:14
|
5 | pub struct CaptureIndices<'a, 'b> {
| --------------------------------- similarly named struct `CaptureIndices` defined here
...
10 | impl<'a, 'b> CapturesIndicies<'a, 'b> {
| ^^^^^^^^^^^^^^^^ help: a struct with a similar name exists: `CaptureIndices`
error[E0071]: expected struct, variant or union type, found type error
--> src/main.rs:12:9
|
12 | Self {
| ^^^^ not a struct
Some errors have detailed explanations: E0071, E0412, E0433.
For more information about an error, try `rustc --explain E0071`.
error: could not compile `playground` due to 3 previous errors
Ideally the output should look like:
the Self
type not being a struct is caused by the typo in the impl
target.
Ideally, the diagnostics could recover from "type error" to a suggested fix.