Skip to content

Commit

Permalink
removing miri submodule updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellen Arteca committed Aug 15, 2022
1 parent 04f29dc commit 2fd7606
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 82 deletions.
1 change: 0 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3554,7 +3554,6 @@ dependencies = [
"crossbeam-utils",
"libc",
"libz-sys",
"memchr",
"proc-macro2",
"quote",
"rand_core 0.5.1",
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_lints/src/crate_in_macro_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ fn contains_unhygienic_crate_reference(tts: &TokenStream) -> Option<Span> {

fn is_crate_keyword(tt: &TokenTree) -> Option<Span> {
if_chain! {
if let TokenTree::Token(Token { kind: TokenKind::Ident(symbol, _), span }, _) = tt;
if let TokenTree::Token(Token { kind: TokenKind::Ident(symbol, _), span }) = tt;
if symbol.as_str() == "crate";
then { Some(*span) } else { None }
}
}

fn is_token(tt: &TokenTree, kind: &TokenKind) -> bool {
if let TokenTree::Token(Token { kind: other, .. }, _) = tt {
if let TokenTree::Token(Token { kind: other, .. }) = tt {
kind == other
} else {
false
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ fn span_contains_cfg(cx: &LateContext<'_>, s: Span) -> bool {
let mut pos = 0usize;
let mut iter = tokenize(&snip).map(|t| {
let start = pos;
pos += t.len as usize;
pos += t.len;
(t.kind, start..pos)
});

Expand Down
3 changes: 1 addition & 2 deletions src/tools/clippy/clippy_lints/src/methods/suspicious_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ pub fn check<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, count_recv: &hi
if_chain! {
if is_trait_method(cx, count_recv, sym::Iterator);
let closure = expr_or_init(cx, map_arg);
if let Some(def_id) = cx.tcx.hir().opt_local_def_id(closure.hir_id);
if let Some(body_id) = cx.tcx.hir().maybe_body_owned_by(def_id);
if let Some(body_id) = cx.tcx.hir().maybe_body_owned_by(closure.hir_id);
let closure_body = cx.tcx.hir().body(body_id);
if !cx.typeck_results().expr_ty(&closure_body.value).is_unit();
then {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ fn text_has_safety_comment(src: &str, line_starts: &[BytePos], offset: usize) ->
if line.starts_with("/*") {
let src = src[line_start..line_starts.last().unwrap().to_usize() - offset].trim_start();
let mut tokens = tokenize(src);
return src[..tokens.next().unwrap().len as usize]
return src[..tokens.next().unwrap().len]
.to_ascii_uppercase()
.contains("SAFETY:")
&& tokens.all(|t| t.kind == TokenKind::Whitespace);
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/utils/author.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl<'tcx> LateLintPass<'tcx> for Author {

fn check_item(cx: &LateContext<'_>, hir_id: HirId) {
let hir = cx.tcx.hir();
if let Some(body_id) = hir.maybe_body_owned_by(hir_id.expect_owner()) {
if let Some(body_id) = hir.maybe_body_owned_by(hir_id) {
check_node(cx, hir_id, |v| {
v.expr(&v.bind("expr", &hir.body(body_id).value));
});
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_utils/src/hir_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl HirEqInterExpr<'_, '_, '_> {
let mut left_pos = 0;
let left = tokenize(&left)
.map(|t| {
let end = left_pos + t.len as usize;
let end = left_pos + t.len;
let s = &left[left_pos..end];
left_pos = end;
(t, s)
Expand All @@ -156,7 +156,7 @@ impl HirEqInterExpr<'_, '_, '_> {
let mut right_pos = 0;
let right = tokenize(&right)
.map(|t| {
let end = right_pos + t.len as usize;
let end = right_pos + t.len;
let s = &right[right_pos..end];
right_pos = end;
(t, s)
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ pub fn can_move_expr_to_closure<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'
}
},
ExprKind::Closure { .. } => {
let closure_id = self.cx.tcx.hir().local_def_id(e.hir_id);
let closure_id = self.cx.tcx.hir().local_def_id(e.hir_id).to_def_id();
for capture in self.cx.typeck_results().closure_min_captures_flattened(closure_id) {
let local_id = match capture.place.base {
PlaceBase::Local(id) => id,
Expand Down Expand Up @@ -1353,7 +1353,7 @@ pub fn is_integer_const(cx: &LateContext<'_>, e: &Expr<'_>, value: u128) -> bool
if is_integer_literal(e, value) {
return true;
}
let enclosing_body = cx.tcx.hir().enclosing_body_owner(e.hir_id);
let enclosing_body = cx.tcx.hir().local_def_id(cx.tcx.hir().enclosing_body_owner(e.hir_id));
if let Some((Constant::Int(v), _)) = constant(cx, cx.tcx.typeck(enclosing_body), e) {
return value == v;
}
Expand Down
8 changes: 2 additions & 6 deletions src/tools/rustc-workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,16 @@ features = [
]

[dependencies]
bstr = { version = "0.2.17", features = ["default"] }
bstr = { version = "0.2.13", features = ["default"] }
byteorder = { version = "1", features = ['default', 'std'] }
clap = { version = "3.1.1", features = ["derive", "clap_derive"]}
curl-sys = { version = "0.4.13", features = ["http2", "libnghttp2-sys"], optional = true }
crossbeam-utils = { version = "0.8.0", features = ["nightly"] }
libc = { version = "0.2.79", features = ["align"] }
# Ensure default features of libz-sys, which are disabled in some scenarios.
libz-sys = { version = "1.1.2" }

# looks like the only user of deprecated `use_std` feature is `combine`, so this
# can be removed if/when https://github.com/Marwes/combine/pull/348 be merged and released.
memchr = { version = "2.5", features = ["std", "use_std"] }
# same for regex
regex = { version = "1.5.6" }
regex = { version = "1.5.5" }
proc-macro2 = { version = "1", features = ["default"] }
quote = { version = "1", features = ["default"] }
rand_core_0_5 = { package = "rand_core", version = "0.5.1", features = ["getrandom", "alloc", "std"] }
Expand Down
98 changes: 37 additions & 61 deletions src/tools/rustfmt/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::collections::HashMap;
use std::panic::{catch_unwind, AssertUnwindSafe};

use rustc_ast::token::{BinOpToken, Delimiter, Token, TokenKind};
use rustc_ast::tokenstream::{Cursor, TokenStream, TokenTree};
use rustc_ast::tokenstream::{Cursor, Spacing, TokenStream, TokenTree};
use rustc_ast::{ast, ptr};
use rustc_ast_pretty::pprust;
use rustc_span::{
Expand Down Expand Up @@ -682,7 +682,7 @@ struct MacroArgParser {

fn last_tok(tt: &TokenTree) -> Token {
match *tt {
TokenTree::Token(ref t, _) => t.clone(),
TokenTree::Token(ref t) => t.clone(),
TokenTree::Delimited(delim_span, delim, _) => Token {
kind: TokenKind::CloseDelim(delim),
span: delim_span.close,
Expand Down Expand Up @@ -737,13 +737,10 @@ impl MacroArgParser {

fn add_meta_variable(&mut self, iter: &mut Cursor) -> Option<()> {
match iter.next() {
Some(TokenTree::Token(
Token {
kind: TokenKind::Ident(name, _),
..
},
_,
)) => {
Some(TokenTree::Token(Token {
kind: TokenKind::Ident(name, _),
..
})) => {
self.result.push(ParsedMacroArg {
kind: MacroArgKind::MetaVariable(name, self.buf.clone()),
});
Expand Down Expand Up @@ -780,30 +777,21 @@ impl MacroArgParser {
}

match tok {
TokenTree::Token(
Token {
kind: TokenKind::BinOp(BinOpToken::Plus),
..
},
_,
)
| TokenTree::Token(
Token {
kind: TokenKind::Question,
..
},
_,
)
| TokenTree::Token(
Token {
kind: TokenKind::BinOp(BinOpToken::Star),
..
},
_,
) => {
TokenTree::Token(Token {
kind: TokenKind::BinOp(BinOpToken::Plus),
..
})
| TokenTree::Token(Token {
kind: TokenKind::Question,
..
})
| TokenTree::Token(Token {
kind: TokenKind::BinOp(BinOpToken::Star),
..
}) => {
break;
}
TokenTree::Token(ref t, _) => {
TokenTree::Token(ref t) => {
buffer.push_str(&pprust::token_to_string(t));
}
_ => return None,
Expand Down Expand Up @@ -871,13 +859,10 @@ impl MacroArgParser {

while let Some(tok) = iter.next() {
match tok {
TokenTree::Token(
Token {
kind: TokenKind::Dollar,
span,
},
_,
) => {
TokenTree::Token(Token {
kind: TokenKind::Dollar,
span,
}) => {
// We always want to add a separator before meta variables.
if !self.buf.is_empty() {
self.add_separator();
Expand All @@ -890,16 +875,13 @@ impl MacroArgParser {
span,
};
}
TokenTree::Token(
Token {
kind: TokenKind::Colon,
..
},
_,
) if self.is_meta_var => {
TokenTree::Token(Token {
kind: TokenKind::Colon,
..
}) if self.is_meta_var => {
self.add_meta_variable(&mut iter)?;
}
TokenTree::Token(ref t, _) => self.update_buffer(t),
TokenTree::Token(ref t) => self.update_buffer(t),
TokenTree::Delimited(_delimited_span, delimited, ref tts) => {
if !self.buf.is_empty() {
if next_space(&self.last_tok.kind) == SpaceState::Always {
Expand Down Expand Up @@ -1141,15 +1123,12 @@ impl MacroParser {
TokenTree::Token(..) => return None,
TokenTree::Delimited(delimited_span, d, _) => (delimited_span.open.lo(), d),
};
let args = TokenStream::new(vec![tok]);
let args = TokenStream::new(vec![(tok, Spacing::Joint)]);
match self.toks.next()? {
TokenTree::Token(
Token {
kind: TokenKind::FatArrow,
..
},
_,
) => {}
TokenTree::Token(Token {
kind: TokenKind::FatArrow,
..
}) => {}
_ => return None,
}
let (mut hi, body, whole_body) = match self.toks.next()? {
Expand All @@ -1168,13 +1147,10 @@ impl MacroParser {
)
}
};
if let Some(TokenTree::Token(
Token {
kind: TokenKind::Semi,
span,
},
_,
)) = self.toks.look_ahead(0)
if let Some(TokenTree::Token(Token {
kind: TokenKind::Semi,
span,
})) = self.toks.look_ahead(0)
{
hi = span.hi();
self.toks.next();
Expand Down
6 changes: 3 additions & 3 deletions src/tools/x/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ fn python() -> &'static str {
} else if python2 {
PYTHON2
} else {
// Python was not found on path, so exit
eprintln!("Unable to find python in your PATH. Please check it is installed.");
process::exit(1);
// We would have returned early if we found that python is installed ...
// maybe this should panic with an error instead?
PYTHON
}
}

Expand Down

0 comments on commit 2fd7606

Please sign in to comment.