Skip to content

Commit

Permalink
x fmt
Browse files Browse the repository at this point in the history
remove some debugs

remove format

remove debugs

remove useless change

remove useless change
  • Loading branch information
spanishpear committed Oct 25, 2022
1 parent 5b5fb4c commit 97c17e2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 17 deletions.
1 change: 0 additions & 1 deletion compiler/rustc_interface/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ impl<'tcx> Queries<'tcx> {
}

pub fn parse(&self) -> Result<&Query<ast::Crate>> {
debug!("HELLO THERE");
self.parse.compute(|| {
passes::parse(self.session(), &self.compiler.input)
.map_err(|mut parse_error| parse_error.emit())
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_parse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ macro_rules! panictry_buffer {
}
}};
}

pub fn parse_crate_from_file<'a>(input: &Path, sess: &'a ParseSess) -> PResult<'a, ast::Crate> {
let mut parser = new_parser_from_file(sess, input, None);
parser.parse_crate_mod()
Expand Down
12 changes: 4 additions & 8 deletions compiler/rustc_parse/src/parser/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ impl<'a> Parser<'a> {
self.sess.source_map().span_to_snippet(span)
}

#[instrument(level = "debug", skip(self))]
pub(super) fn expected_ident_found(&mut self) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
let valid_follow = &[
TokenKind::Eq,
Expand Down Expand Up @@ -343,7 +342,7 @@ impl<'a> Parser<'a> {
// FIXME: shreys what does this look like with invalid generic
// FIXME: shreys - what to do if no snippet? probably just HELP not suggestion
debug!(?generic.span);

match self.sess.source_map().span_to_snippet(generic.span) {
Ok(_snippet) => match self.sess.source_map().span_to_snippet(self.token.span) {
Ok(ident) => {
Expand All @@ -353,14 +352,11 @@ impl<'a> Parser<'a> {
format!(" {ident}{_snippet}"),
Applicability::MachineApplicable,
);
}
Err(_) => todo!() //FIXME: shreys - what to do here?
}
}
Err(_) => todo!(), //FIXME: shreys - what to do here?
},
Err(_) => todo!(), //FIXME: shreys - what to do here?

};


});
}

Expand Down
7 changes: 2 additions & 5 deletions compiler/rustc_parse/src/parser/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ impl<'a> Parser<'a> {

let post_attr_lo = self.token.span;
let mut items = vec![];
debug!("fails to parse an item!");
while let Some(item) = self.parse_item(ForceCollect::No)? {
items.push(item);
self.maybe_consume_incorrect_semicolon(&items);
}
debug!("Does not make it here!");

if !self.eat(term) {
let token_str = super::token_descr(&self.token);
if !self.maybe_consume_incorrect_semicolon(&items) {
Expand Down Expand Up @@ -111,7 +110,6 @@ impl<'a> Parser<'a> {
fn_parse_mode: FnParseMode,
force_collect: ForceCollect,
) -> PResult<'a, Option<Item>> {
debug!("fn parse_item_common");
// Don't use `maybe_whole` so that we have precise control
// over when we bump the parser
if let token::Interpolated(nt) = &self.token.kind && let token::NtItem(item) = &**nt {
Expand All @@ -127,10 +125,10 @@ impl<'a> Parser<'a> {
self.collect_tokens_trailing_token(attrs, force_collect, |this: &mut Self, attrs| {
let item =
this.parse_item_common_(attrs, mac_allowed, attrs_allowed, fn_parse_mode);
debug!(?item);
unclosed_delims.append(&mut this.unclosed_delims);
Ok((item?, TrailingToken::None))
})?;

self.unclosed_delims.append(&mut unclosed_delims);
Ok(item)
}
Expand Down Expand Up @@ -215,7 +213,6 @@ impl<'a> Parser<'a> {
self.parse_use_item()?
} else if self.check_fn_front_matter(def_final) {
// FUNCTION ITEM
debug!("parse_item_kind: inside fn item");
let (ident, sig, generics, body) = self.parse_fn(attrs, fn_parse_mode, lo, vis)?;
(ident, ItemKind::Fn(Box::new(Fn { defaultness: def(), sig, generics, body })))
} else if self.eat_keyword(kw::Extern) {
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_parse/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,6 @@ impl<'a> Parser<'a> {
}

fn ident_or_err(&mut self) -> PResult<'a, (Ident, /* is_raw */ bool)> {
debug!("fn ident_or_err");
debug!(?self.token);
debug!(prev = ?self.prev_token);
self.token.ident().ok_or_else(|| match self.prev_token.kind {
TokenKind::DocComment(..) => DocCommentDoesNotDocumentAnything {
span: self.prev_token.span,
Expand Down

0 comments on commit 97c17e2

Please sign in to comment.