Rollup merge of #40815 - estebank:issue-40006, r=GuillaumeGomez
Identify missing item category in `impl`s ```rust struct S; impl S { pub hello_method(&self) { println!("Hello"); } } fn main() { S.hello_method(); } ``` ```rust error: missing `fn` for method declaration --> file.rs:3:4 | 3 | pub hello_method(&self) { | ^ missing `fn` ``` Fix #40006. r? @pnkfelix CC @jonathandturner @GuillaumeGomez
This commit is contained in:
commit
cee0508021
4 changed files with 95 additions and 15 deletions
|
@ -189,6 +189,30 @@ impl Span {
|
|||
Span { hi: end.hi, ..self }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn between(self, end: Span) -> Span {
|
||||
Span {
|
||||
lo: self.hi,
|
||||
hi: end.lo,
|
||||
ctxt: if end.ctxt == SyntaxContext::empty() {
|
||||
end.ctxt
|
||||
} else {
|
||||
self.ctxt
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn until(self, end: Span) -> Span {
|
||||
Span {
|
||||
lo: self.lo,
|
||||
hi: end.lo,
|
||||
ctxt: if end.ctxt == SyntaxContext::empty() {
|
||||
end.ctxt
|
||||
} else {
|
||||
self.ctxt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue