Auto merge of #58316 - Centril:rollup, r=Centril
Rollup of 18 pull requests Successful merges: - #58091 (Transition compiletest to Rust 2018) - #58115 (Transition rustdoc to 2018 edition) - #58120 (Transition build_helper to 2018 edition) - #58222 (librustc_allocator => 2018) - #58233 (librustc_save_analysis => 2018) - #58245 (librustc_lint => 2018) - #58247 (librustc_passes => 2018) - #58251 (Transition librustc_traits to 2018 edition) - #58255 (librustc_metadata => 2018) - #58256 (librustc_cratesio_shim => 2018) - #58257 (librustc_target => 2018) - #58259 (librustc_codegen_utils => 2018) - #58260 (librustc_borrowck => 2018) - #58261 (librustc_incremental => 2018) - #58265 (librustc_mir => 2018) - #58275 (libcore, liballoc: disable tests in Miri) - #58285 (error_index_generator => 2018) - #58312 (librustc_data_structures => 2018) Failed merges: r? @ghost
This commit is contained in:
commit
cb6fafbdf3
401 changed files with 1379 additions and 1326 deletions
|
|
@ -2,6 +2,7 @@
|
|||
name = "build_helper"
|
||||
version = "0.1.0"
|
||||
authors = ["The Rust Project Developers"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "build_helper"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![deny(rust_2018_idioms)]
|
||||
|
||||
use std::fs::File;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Command, Stdio};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg(not(miri))]
|
||||
|
||||
use std::any::Any;
|
||||
use std::sync::{Arc, Weak};
|
||||
use std::cell::RefCell;
|
||||
|
|
|
|||
|
|
@ -282,6 +282,7 @@ fn assert_covariance() {
|
|||
//
|
||||
// Destructors must be called exactly once per element.
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn panic_safe() {
|
||||
static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg(not(miri))]
|
||||
|
||||
mod map;
|
||||
mod set;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg(not(miri))]
|
||||
|
||||
use std::alloc::{Global, Alloc, Layout, System};
|
||||
|
||||
/// https://github.com/rust-lang/rust/issues/45955
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg(not(miri))]
|
||||
|
||||
use std::any::Any;
|
||||
use std::rc::{Rc, Weak};
|
||||
use std::cell::RefCell;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg(not(miri))]
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::cmp::Ordering::{self, Equal, Greater, Less};
|
||||
use std::mem;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ fn test_rfind() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_collect() {
|
||||
let empty = "";
|
||||
let s: String = empty.chars().collect();
|
||||
|
|
@ -118,6 +119,7 @@ fn test_concat_for_different_types() {
|
|||
#[test]
|
||||
fn test_concat_for_different_lengths() {
|
||||
let empty: &[&str] = &[];
|
||||
#[cfg(not(miri))]
|
||||
test_concat!("", empty);
|
||||
test_concat!("a", ["a"]);
|
||||
test_concat!("ab", ["a", "b"]);
|
||||
|
|
@ -146,6 +148,7 @@ fn test_join_for_different_types() {
|
|||
#[test]
|
||||
fn test_join_for_different_lengths() {
|
||||
let empty: &[&str] = &[];
|
||||
#[cfg(not(miri))]
|
||||
test_join!("", empty, "-");
|
||||
test_join!("a", ["a"], "-");
|
||||
test_join!("a-b", ["a", "b"], "-");
|
||||
|
|
@ -159,6 +162,7 @@ fn test_join_for_different_lengths_with_long_separator() {
|
|||
assert_eq!("~~~~~".len(), 15);
|
||||
|
||||
let empty: &[&str] = &[];
|
||||
#[cfg(not(miri))]
|
||||
test_join!("", empty, "~~~~~");
|
||||
test_join!("a", ["a"], "~~~~~");
|
||||
test_join!("a~~~~~b", ["a", "b"], "~~~~~");
|
||||
|
|
@ -166,6 +170,7 @@ fn test_join_for_different_lengths_with_long_separator() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_unsafe_slice() {
|
||||
assert_eq!("ab", unsafe {"abc".get_unchecked(0..2)});
|
||||
assert_eq!("bc", unsafe {"abc".get_unchecked(1..3)});
|
||||
|
|
@ -238,6 +243,7 @@ fn test_replacen() {
|
|||
#[test]
|
||||
fn test_replace() {
|
||||
let a = "a";
|
||||
#[cfg(not(miri))]
|
||||
assert_eq!("".replace(a, "b"), "");
|
||||
assert_eq!("a".replace(a, "b"), "b");
|
||||
assert_eq!("ab".replace(a, "b"), "bb");
|
||||
|
|
@ -297,6 +303,7 @@ fn test_replace_pattern() {
|
|||
// The current implementation of SliceIndex fails to handle methods
|
||||
// orthogonally from range types; therefore, it is worth testing
|
||||
// all of the indexing operations on each input.
|
||||
#[cfg(not(miri))]
|
||||
mod slice_index {
|
||||
// Test a slicing operation **that should succeed,**
|
||||
// testing it on all of the indexing methods.
|
||||
|
|
@ -679,6 +686,7 @@ fn test_str_slice_rangetoinclusive_ok() {
|
|||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
#[cfg(not(miri))]
|
||||
fn test_str_slice_rangetoinclusive_notok() {
|
||||
let s = "abcαβγ";
|
||||
&s[..=3];
|
||||
|
|
@ -694,6 +702,7 @@ fn test_str_slicemut_rangetoinclusive_ok() {
|
|||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
#[cfg(not(miri))]
|
||||
fn test_str_slicemut_rangetoinclusive_notok() {
|
||||
let mut s = "abcαβγ".to_owned();
|
||||
let s: &mut str = &mut s;
|
||||
|
|
@ -883,6 +892,7 @@ fn test_as_bytes() {
|
|||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
#[cfg(not(miri))]
|
||||
fn test_as_bytes_fail() {
|
||||
// Don't double free. (I'm not sure if this exercises the
|
||||
// original problem code path anymore.)
|
||||
|
|
@ -972,6 +982,7 @@ fn test_split_at_mut() {
|
|||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
#[cfg(not(miri))]
|
||||
fn test_split_at_boundscheck() {
|
||||
let s = "ศไทย中华Việt Nam";
|
||||
s.split_at(1);
|
||||
|
|
@ -1066,6 +1077,7 @@ fn test_rev_iterator() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_chars_decoding() {
|
||||
let mut bytes = [0; 4];
|
||||
for c in (0..0x110000).filter_map(std::char::from_u32) {
|
||||
|
|
@ -1077,6 +1089,7 @@ fn test_chars_decoding() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_chars_rev_decoding() {
|
||||
let mut bytes = [0; 4];
|
||||
for c in (0..0x110000).filter_map(std::char::from_u32) {
|
||||
|
|
@ -1306,6 +1319,7 @@ fn test_splitator() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_str_default() {
|
||||
use std::default::Default;
|
||||
|
||||
|
|
@ -1365,6 +1379,7 @@ fn test_bool_from_str() {
|
|||
assert_eq!("not even a boolean".parse::<bool>().ok(), None);
|
||||
}
|
||||
|
||||
#[cfg(not(miri))]
|
||||
fn check_contains_all_substrings(s: &str) {
|
||||
assert!(s.contains(""));
|
||||
for i in 0..s.len() {
|
||||
|
|
@ -1375,6 +1390,7 @@ fn check_contains_all_substrings(s: &str) {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn strslice_issue_16589() {
|
||||
assert!("bananas".contains("nana"));
|
||||
|
||||
|
|
@ -1384,6 +1400,7 @@ fn strslice_issue_16589() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn strslice_issue_16878() {
|
||||
assert!(!"1234567ah012345678901ah".contains("hah"));
|
||||
assert!(!"00abc01234567890123456789abc".contains("bcabc"));
|
||||
|
|
@ -1391,6 +1408,7 @@ fn strslice_issue_16878() {
|
|||
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_strslice_contains() {
|
||||
let x = "There are moments, Jeeves, when one asks oneself, 'Do trousers matter?'";
|
||||
check_contains_all_substrings(x);
|
||||
|
|
@ -1528,6 +1546,7 @@ fn trim_ws() {
|
|||
|
||||
#[test]
|
||||
fn to_lowercase() {
|
||||
#[cfg(not(miri))]
|
||||
assert_eq!("".to_lowercase(), "");
|
||||
assert_eq!("AÉDžaé ".to_lowercase(), "aédžaé ");
|
||||
|
||||
|
|
@ -1561,6 +1580,7 @@ fn to_lowercase() {
|
|||
|
||||
#[test]
|
||||
fn to_uppercase() {
|
||||
#[cfg(not(miri))]
|
||||
assert_eq!("".to_uppercase(), "");
|
||||
assert_eq!("aéDžßfiᾀ".to_uppercase(), "AÉDŽSSFIἈΙ");
|
||||
}
|
||||
|
|
@ -1592,6 +1612,7 @@ fn test_cow_from() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_repeat() {
|
||||
assert_eq!("".repeat(3), "");
|
||||
assert_eq!("abc".repeat(0), "");
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg(not(miri))]
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::collections::CollectionAllocErr::*;
|
||||
use std::mem::size_of;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg(not(miri))]
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::mem::size_of;
|
||||
use std::{usize, isize};
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ fn test_index() {
|
|||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
#[cfg(not(miri))]
|
||||
fn test_index_out_of_bounds() {
|
||||
let mut deq = VecDeque::new();
|
||||
for i in 1..4 {
|
||||
|
|
@ -906,20 +907,24 @@ fn test_append() {
|
|||
// normal append
|
||||
a.append(&mut b);
|
||||
assert_eq!(a.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
|
||||
#[cfg(not(miri))]
|
||||
assert_eq!(b.iter().cloned().collect::<Vec<_>>(), []);
|
||||
|
||||
// append nothing to something
|
||||
a.append(&mut b);
|
||||
assert_eq!(a.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
|
||||
#[cfg(not(miri))]
|
||||
assert_eq!(b.iter().cloned().collect::<Vec<_>>(), []);
|
||||
|
||||
// append something to nothing
|
||||
b.append(&mut a);
|
||||
assert_eq!(b.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
|
||||
#[cfg(not(miri))]
|
||||
assert_eq!(a.iter().cloned().collect::<Vec<_>>(), []);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_append_permutations() {
|
||||
fn construct_vec_deque(
|
||||
push_back: usize,
|
||||
|
|
@ -1120,6 +1125,7 @@ fn test_reserve_exact_2() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_try_reserve() {
|
||||
|
||||
// These are the interesting cases:
|
||||
|
|
@ -1221,6 +1227,7 @@ fn test_try_reserve() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_try_reserve_exact() {
|
||||
|
||||
// This is exactly the same as test_try_reserve with the method changed.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg(not(miri))]
|
||||
|
||||
use core::cell::*;
|
||||
use core::default::Default;
|
||||
use std::mem::drop;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg(not(miri))]
|
||||
|
||||
mod builders;
|
||||
mod float;
|
||||
mod num;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg(not(miri))]
|
||||
|
||||
mod sip;
|
||||
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
|
|
|||
|
|
@ -190,6 +190,7 @@ fn test_iterator_step_by() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_iterator_step_by_nth() {
|
||||
let mut it = (0..16).step_by(5);
|
||||
assert_eq!(it.nth(0), Some(0));
|
||||
|
|
@ -208,6 +209,7 @@ fn test_iterator_step_by_nth() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_iterator_step_by_nth_overflow() {
|
||||
#[cfg(target_pointer_width = "8")]
|
||||
type Bigger = u16;
|
||||
|
|
@ -253,12 +255,14 @@ fn test_iterator_step_by_nth_overflow() {
|
|||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
#[cfg(not(miri))]
|
||||
fn test_iterator_step_by_zero() {
|
||||
let mut it = (0..).step_by(0);
|
||||
it.next();
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_iterator_step_by_size_hint() {
|
||||
struct StubSizeHint(usize, Option<usize>);
|
||||
impl Iterator for StubSizeHint {
|
||||
|
|
@ -1413,6 +1417,7 @@ fn test_rposition() {
|
|||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
#[cfg(not(miri))]
|
||||
fn test_rposition_panic() {
|
||||
let v: [(Box<_>, Box<_>); 4] =
|
||||
[(box 0, box 0), (box 0, box 0),
|
||||
|
|
@ -1652,6 +1657,7 @@ fn test_range_inclusive_nth() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_range_step() {
|
||||
#![allow(deprecated)]
|
||||
|
||||
|
|
@ -1675,6 +1681,7 @@ fn test_range_step() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_step_by_skip() {
|
||||
assert_eq!((0..640).step_by(128).skip(1).collect::<Vec<_>>(), [128, 256, 384, 512]);
|
||||
assert_eq!((0..=50).step_by(10).nth(3), Some(30));
|
||||
|
|
@ -1682,6 +1689,7 @@ fn test_step_by_skip() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_range_inclusive_step() {
|
||||
assert_eq!((0..=50).step_by(10).collect::<Vec<_>>(), [0, 10, 20, 30, 40, 50]);
|
||||
assert_eq!((0..=5).step_by(1).collect::<Vec<_>>(), [0, 1, 2, 3, 4, 5]);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg(not(miri))]
|
||||
|
||||
use core::convert::{TryFrom, TryInto};
|
||||
use core::cmp::PartialEq;
|
||||
use core::fmt::Debug;
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ fn test_option_dance() {
|
|||
}
|
||||
|
||||
#[test] #[should_panic]
|
||||
#[cfg(not(miri))]
|
||||
fn test_option_too_much_dance() {
|
||||
struct A;
|
||||
let mut y = Some(A);
|
||||
|
|
@ -129,6 +130,7 @@ fn test_unwrap() {
|
|||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
#[cfg(not(miri))]
|
||||
fn test_unwrap_panic1() {
|
||||
let x: Option<isize> = None;
|
||||
x.unwrap();
|
||||
|
|
@ -136,6 +138,7 @@ fn test_unwrap_panic1() {
|
|||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
#[cfg(not(miri))]
|
||||
fn test_unwrap_panic2() {
|
||||
let x: Option<String> = None;
|
||||
x.unwrap();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg(not(miri))]
|
||||
|
||||
use core::ptr::*;
|
||||
use core::cell::RefCell;
|
||||
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ fn test_unwrap_or_else() {
|
|||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
#[cfg(not(miri))]
|
||||
pub fn test_unwrap_or_else_panic() {
|
||||
fn handler(msg: &'static str) -> isize {
|
||||
if msg == "I got this." {
|
||||
|
|
@ -138,6 +139,7 @@ pub fn test_expect_ok() {
|
|||
}
|
||||
#[test]
|
||||
#[should_panic(expected="Got expected error: \"All good\"")]
|
||||
#[cfg(not(miri))]
|
||||
pub fn test_expect_err() {
|
||||
let err: Result<isize, &'static str> = Err("All good");
|
||||
err.expect("Got expected error");
|
||||
|
|
@ -151,6 +153,7 @@ pub fn test_expect_err_err() {
|
|||
}
|
||||
#[test]
|
||||
#[should_panic(expected="Got expected ok: \"All good\"")]
|
||||
#[cfg(not(miri))]
|
||||
pub fn test_expect_err_ok() {
|
||||
let err: Result<&'static str, isize> = Ok("All good");
|
||||
err.expect_err("Got expected ok");
|
||||
|
|
|
|||
|
|
@ -782,6 +782,7 @@ mod slice_index {
|
|||
// to be used in `should_panic`)
|
||||
#[test]
|
||||
#[should_panic(expected = "out of range")]
|
||||
#[cfg(not(miri))]
|
||||
fn assert_range_eq_can_fail_by_panic() {
|
||||
assert_range_eq!([0, 1, 2], 0..5, [0, 1, 2]);
|
||||
}
|
||||
|
|
@ -791,6 +792,7 @@ mod slice_index {
|
|||
// to be used in `should_panic`)
|
||||
#[test]
|
||||
#[should_panic(expected = "==")]
|
||||
#[cfg(not(miri))]
|
||||
fn assert_range_eq_can_fail_by_inequality() {
|
||||
assert_range_eq!([0, 1, 2], 0..2, [0, 1, 2]);
|
||||
}
|
||||
|
|
@ -840,6 +842,7 @@ mod slice_index {
|
|||
|
||||
#[test]
|
||||
#[should_panic(expected = $expect_msg)]
|
||||
#[cfg(not(miri))]
|
||||
fn index_fail() {
|
||||
let v = $data;
|
||||
let v: &[_] = &v;
|
||||
|
|
@ -848,6 +851,7 @@ mod slice_index {
|
|||
|
||||
#[test]
|
||||
#[should_panic(expected = $expect_msg)]
|
||||
#[cfg(not(miri))]
|
||||
fn index_mut_fail() {
|
||||
let mut v = $data;
|
||||
let v: &mut [_] = &mut v;
|
||||
|
|
@ -1011,6 +1015,7 @@ fn test_rotate_right() {
|
|||
|
||||
#[test]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[cfg(not(miri))]
|
||||
fn sort_unstable() {
|
||||
use core::cmp::Ordering::{Equal, Greater, Less};
|
||||
use core::slice::heapsort;
|
||||
|
|
@ -1166,6 +1171,7 @@ pub mod memchr {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_align_to_simple() {
|
||||
let bytes = [1u8, 2, 3, 4, 5, 6, 7];
|
||||
let (prefix, aligned, suffix) = unsafe { bytes.align_to::<u16>() };
|
||||
|
|
@ -1181,6 +1187,7 @@ fn test_align_to_simple() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_align_to_zst() {
|
||||
let bytes = [1, 2, 3, 4, 5, 6, 7];
|
||||
let (prefix, aligned, suffix) = unsafe { bytes.align_to::<()>() };
|
||||
|
|
@ -1189,6 +1196,7 @@ fn test_align_to_zst() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_align_to_non_trivial() {
|
||||
#[repr(align(8))] struct U64(u64, u64);
|
||||
#[repr(align(8))] struct U64U64U32(u64, u64, u32);
|
||||
|
|
@ -1200,6 +1208,7 @@ fn test_align_to_non_trivial() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(miri))]
|
||||
fn test_align_to_empty_mid() {
|
||||
use core::mem;
|
||||
|
||||
|
|
@ -1297,6 +1306,7 @@ fn test_copy_within() {
|
|||
|
||||
#[test]
|
||||
#[should_panic(expected = "src is out of bounds")]
|
||||
#[cfg(not(miri))]
|
||||
fn test_copy_within_panics_src_too_long() {
|
||||
let mut bytes = *b"Hello, World!";
|
||||
// The length is only 13, so 14 is out of bounds.
|
||||
|
|
@ -1305,6 +1315,7 @@ fn test_copy_within_panics_src_too_long() {
|
|||
|
||||
#[test]
|
||||
#[should_panic(expected = "dest is out of bounds")]
|
||||
#[cfg(not(miri))]
|
||||
fn test_copy_within_panics_dest_too_long() {
|
||||
let mut bytes = *b"Hello, World!";
|
||||
// The length is only 13, so a slice of length 4 starting at index 10 is out of bounds.
|
||||
|
|
@ -1312,6 +1323,7 @@ fn test_copy_within_panics_dest_too_long() {
|
|||
}
|
||||
#[test]
|
||||
#[should_panic(expected = "src end is before src start")]
|
||||
#[cfg(not(miri))]
|
||||
fn test_copy_within_panics_src_inverted() {
|
||||
let mut bytes = *b"Hello, World!";
|
||||
// 2 is greater than 1, so this range is invalid.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg(not(miri))]
|
||||
|
||||
use core::time::Duration;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
authors = ["The Rust Project Developers"]
|
||||
name = "rustc_allocator"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use log::debug;
|
||||
use rustc::middle::allocator::AllocatorKind;
|
||||
use rustc_errors;
|
||||
use smallvec::SmallVec;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use syntax::{
|
||||
ast::{
|
||||
self, Arg, Attribute, Crate, Expr, FnHeader, Generics, Ident, Item, ItemKind,
|
||||
|
|
@ -23,7 +23,7 @@ use syntax::{
|
|||
};
|
||||
use syntax_pos::Span;
|
||||
|
||||
use {AllocatorMethod, AllocatorTy, ALLOCATOR_METHODS};
|
||||
use crate::{AllocatorMethod, AllocatorTy, ALLOCATOR_METHODS};
|
||||
|
||||
pub fn modify(
|
||||
sess: &ParseSess,
|
||||
|
|
@ -54,7 +54,7 @@ struct ExpandAllocatorDirectives<'a> {
|
|||
in_submod: isize,
|
||||
}
|
||||
|
||||
impl<'a> MutVisitor for ExpandAllocatorDirectives<'a> {
|
||||
impl MutVisitor for ExpandAllocatorDirectives<'_> {
|
||||
fn flat_map_item(&mut self, item: P<Item>) -> SmallVec<[P<Item>; 1]> {
|
||||
debug!("in submodule {}", self.in_submod);
|
||||
|
||||
|
|
@ -168,7 +168,7 @@ struct AllocFnFactory<'a> {
|
|||
cx: ExtCtxt<'a>,
|
||||
}
|
||||
|
||||
impl<'a> AllocFnFactory<'a> {
|
||||
impl AllocFnFactory<'_> {
|
||||
fn allocator_fn(&self, method: &AllocatorMethod) -> P<Item> {
|
||||
let mut abi_args = Vec::new();
|
||||
let mut i = 0;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
#![feature(nll)]
|
||||
#![feature(rustc_private)]
|
||||
|
||||
#[macro_use] extern crate log;
|
||||
extern crate rustc;
|
||||
extern crate rustc_data_structures;
|
||||
extern crate rustc_errors;
|
||||
extern crate rustc_target;
|
||||
extern crate syntax;
|
||||
extern crate syntax_pos;
|
||||
#[macro_use]
|
||||
extern crate smallvec;
|
||||
#![deny(rust_2018_idioms)]
|
||||
|
||||
pub mod expand;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
authors = ["The Rust Project Developers"]
|
||||
name = "rustc_borrowck"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "rustc_borrowck"
|
||||
|
|
@ -13,8 +14,10 @@ test = false
|
|||
log = "0.4"
|
||||
syntax = { path = "../libsyntax" }
|
||||
syntax_pos = { path = "../libsyntax_pos" }
|
||||
graphviz = { path = "../libgraphviz" }
|
||||
# for "clarity", rename the graphviz crate to dot; graphviz within `borrowck`
|
||||
# refers to the borrowck-specific graphviz adapter traits.
|
||||
dot = { path = "../libgraphviz", package = "graphviz" }
|
||||
rustc = { path = "../librustc" }
|
||||
rustc_mir = { path = "../librustc_mir" }
|
||||
rustc_errors = { path = "../librustc_errors" }
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
errors = { path = "../librustc_errors", package = "rustc_errors" }
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
// 3. assignments do not affect things loaned out as immutable
|
||||
// 4. moves do not affect things loaned out in any way
|
||||
|
||||
use self::UseError::*;
|
||||
use UseError::*;
|
||||
|
||||
use borrowck::*;
|
||||
use borrowck::InteriorKind::{InteriorElement, InteriorField};
|
||||
use crate::borrowck::*;
|
||||
use crate::borrowck::InteriorKind::{InteriorElement, InteriorField};
|
||||
use rustc::middle::expr_use_visitor as euv;
|
||||
use rustc::middle::expr_use_visitor::MutateMode;
|
||||
use rustc::middle::mem_categorization as mc;
|
||||
|
|
@ -22,6 +22,7 @@ use syntax_pos::Span;
|
|||
use rustc::hir;
|
||||
use rustc::hir::Node;
|
||||
use rustc_mir::util::borrowck_errors::{BorrowckErrors, Origin};
|
||||
use log::debug;
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
|
|
@ -101,7 +102,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> {
|
|||
|
||||
fn matched_pat(&mut self,
|
||||
_matched_pat: &hir::Pat,
|
||||
_cmt: &mc::cmt_,
|
||||
_cmt: &mc::cmt_<'_>,
|
||||
_mode: euv::MatchMode) { }
|
||||
|
||||
fn consume_pat(&mut self,
|
||||
|
|
@ -910,7 +911,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
|
|||
pub fn report_illegal_mutation(&self,
|
||||
span: Span,
|
||||
loan_path: &LoanPath<'tcx>,
|
||||
loan: &Loan) {
|
||||
loan: &Loan<'_>) {
|
||||
self.bccx.cannot_assign_to_borrowed(
|
||||
span, loan.span, &self.bccx.loan_path_to_string(loan_path), Origin::Ast)
|
||||
.emit();
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
//! Computes moves.
|
||||
|
||||
use borrowck::*;
|
||||
use borrowck::gather_loans::move_error::MovePlace;
|
||||
use borrowck::gather_loans::move_error::{MoveError, MoveErrorCollector};
|
||||
use borrowck::move_data::*;
|
||||
use crate::borrowck::*;
|
||||
use crate::borrowck::gather_loans::move_error::MovePlace;
|
||||
use crate::borrowck::gather_loans::move_error::{MoveError, MoveErrorCollector};
|
||||
use crate::borrowck::move_data::*;
|
||||
use rustc::middle::expr_use_visitor as euv;
|
||||
use rustc::middle::mem_categorization as mc;
|
||||
use rustc::middle::mem_categorization::Categorization;
|
||||
|
|
@ -15,6 +15,7 @@ use syntax::ast;
|
|||
use syntax_pos::Span;
|
||||
use rustc::hir::*;
|
||||
use rustc::hir::Node;
|
||||
use log::debug;
|
||||
|
||||
struct GatherMoveInfo<'c, 'tcx: 'c> {
|
||||
id: hir::ItemLocalId,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//! This module implements the check that the lifetime of a borrow
|
||||
//! does not exceed the lifetime of the value being borrowed.
|
||||
|
||||
use borrowck::*;
|
||||
use crate::borrowck::*;
|
||||
use rustc::middle::expr_use_visitor as euv;
|
||||
use rustc::middle::mem_categorization as mc;
|
||||
use rustc::middle::mem_categorization::Categorization;
|
||||
|
|
@ -10,6 +10,7 @@ use rustc::ty;
|
|||
|
||||
use syntax::ast;
|
||||
use syntax_pos::Span;
|
||||
use log::debug;
|
||||
|
||||
type R = Result<(),()>;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
// their associated scopes. In phase two, checking loans, we will then make
|
||||
// sure that all of these loans are honored.
|
||||
|
||||
use borrowck::*;
|
||||
use borrowck::move_data::MoveData;
|
||||
use crate::borrowck::*;
|
||||
use crate::borrowck::move_data::MoveData;
|
||||
use rustc::middle::expr_use_visitor as euv;
|
||||
use rustc::middle::mem_categorization as mc;
|
||||
use rustc::middle::mem_categorization::Categorization;
|
||||
|
|
@ -17,8 +17,9 @@ use rustc::ty::{self, TyCtxt};
|
|||
use syntax::ast;
|
||||
use syntax_pos::Span;
|
||||
use rustc::hir;
|
||||
use log::debug;
|
||||
|
||||
use self::restrictions::RestrictionResult;
|
||||
use restrictions::RestrictionResult;
|
||||
|
||||
mod lifetime;
|
||||
mod restrictions;
|
||||
|
|
@ -427,7 +428,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
|
|||
// }
|
||||
}
|
||||
|
||||
pub fn mark_loan_path_as_mutated(&self, loan_path: &LoanPath) {
|
||||
pub fn mark_loan_path_as_mutated(&self, loan_path: &LoanPath<'_>) {
|
||||
//! For mutable loans of content whose mutability derives
|
||||
//! from a local variable, mark the mutability decl as necessary.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use borrowck::BorrowckCtxt;
|
||||
use crate::borrowck::BorrowckCtxt;
|
||||
use rustc::middle::mem_categorization as mc;
|
||||
use rustc::middle::mem_categorization::Categorization;
|
||||
use rustc::middle::mem_categorization::NoteClosureEnv;
|
||||
|
|
@ -8,7 +8,8 @@ use rustc_mir::util::borrowck_errors::{BorrowckErrors, Origin};
|
|||
use syntax::ast;
|
||||
use syntax_pos;
|
||||
use errors::{DiagnosticBuilder, Applicability};
|
||||
use borrowck::gather_loans::gather_moves::PatternSource;
|
||||
use crate::borrowck::gather_loans::gather_moves::PatternSource;
|
||||
use log::debug;
|
||||
|
||||
pub struct MoveErrorCollector<'tcx> {
|
||||
errors: Vec<MoveError<'tcx>>
|
||||
|
|
@ -167,10 +168,10 @@ fn report_cannot_move_out_of<'a, 'tcx>(bccx: &'a BorrowckCtxt<'a, 'tcx>,
|
|||
}
|
||||
}
|
||||
|
||||
fn note_move_destination(mut err: DiagnosticBuilder,
|
||||
fn note_move_destination(mut err: DiagnosticBuilder<'_>,
|
||||
move_to_span: syntax_pos::Span,
|
||||
pat_name: ast::Name,
|
||||
is_first_note: bool) -> DiagnosticBuilder {
|
||||
is_first_note: bool) -> DiagnosticBuilder<'_> {
|
||||
if is_first_note {
|
||||
err.span_label(
|
||||
move_to_span,
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
//! Computes the restrictions that result from a borrow.
|
||||
|
||||
use borrowck::*;
|
||||
use crate::borrowck::*;
|
||||
use rustc::middle::expr_use_visitor as euv;
|
||||
use rustc::middle::mem_categorization as mc;
|
||||
use rustc::middle::mem_categorization::Categorization;
|
||||
use rustc::ty;
|
||||
use syntax_pos::Span;
|
||||
use log::debug;
|
||||
|
||||
use borrowck::ToInteriorKind;
|
||||
use crate::borrowck::ToInteriorKind;
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
pub use self::LoanPathKind::*;
|
||||
pub use self::LoanPathElem::*;
|
||||
pub use self::bckerr_code::*;
|
||||
pub use self::AliasableViolationKind::*;
|
||||
pub use self::MovedValueUseKind::*;
|
||||
pub use LoanPathKind::*;
|
||||
pub use LoanPathElem::*;
|
||||
pub use bckerr_code::*;
|
||||
pub use AliasableViolationKind::*;
|
||||
pub use MovedValueUseKind::*;
|
||||
|
||||
use self::InteriorKind::*;
|
||||
use InteriorKind::*;
|
||||
|
||||
use rustc::hir::HirId;
|
||||
use rustc::hir::Node;
|
||||
|
|
@ -37,10 +37,11 @@ use std::hash::{Hash, Hasher};
|
|||
use syntax::ast;
|
||||
use syntax_pos::{MultiSpan, Span};
|
||||
use errors::{Applicability, DiagnosticBuilder, DiagnosticId};
|
||||
use log::debug;
|
||||
|
||||
use rustc::hir;
|
||||
|
||||
use dataflow::{DataFlowContext, BitwiseOperator, DataFlowOperator, KillFrom};
|
||||
use crate::dataflow::{DataFlowContext, BitwiseOperator, DataFlowOperator, KillFrom};
|
||||
|
||||
pub mod check_loans;
|
||||
|
||||
|
|
@ -61,7 +62,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
|||
});
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
pub fn provide(providers: &mut Providers<'_>) {
|
||||
*providers = Providers {
|
||||
borrowck,
|
||||
..*providers
|
||||
|
|
@ -398,7 +399,7 @@ pub enum LoanPathElem<'tcx> {
|
|||
}
|
||||
|
||||
fn closure_to_block(closure_id: LocalDefId,
|
||||
tcx: TyCtxt) -> ast::NodeId {
|
||||
tcx: TyCtxt<'_, '_, '_>) -> ast::NodeId {
|
||||
let closure_id = tcx.hir().local_def_id_to_node_id(closure_id);
|
||||
match tcx.hir().get(closure_id) {
|
||||
Node::Expr(expr) => match expr.node {
|
||||
|
|
@ -1214,8 +1215,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
|
|||
}
|
||||
|
||||
fn note_immutability_blame(&self,
|
||||
db: &mut DiagnosticBuilder,
|
||||
blame: Option<ImmutabilityBlame>,
|
||||
db: &mut DiagnosticBuilder<'_>,
|
||||
blame: Option<ImmutabilityBlame<'_>>,
|
||||
error_node_id: ast::NodeId) {
|
||||
match blame {
|
||||
None => {}
|
||||
|
|
@ -1271,7 +1272,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
|
|||
// binding: either to make the binding mutable (if its type is
|
||||
// not a mutable reference) or to avoid borrowing altogether
|
||||
fn note_immutable_local(&self,
|
||||
db: &mut DiagnosticBuilder,
|
||||
db: &mut DiagnosticBuilder<'_>,
|
||||
borrowed_node_id: ast::NodeId,
|
||||
binding_node_id: ast::NodeId) {
|
||||
let let_span = self.tcx.hir().span(binding_node_id);
|
||||
|
|
@ -1349,7 +1350,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn note_and_explain_mutbl_error(&self, db: &mut DiagnosticBuilder, err: &BckError<'a, 'tcx>,
|
||||
fn note_and_explain_mutbl_error(&self, db: &mut DiagnosticBuilder<'_>, err: &BckError<'a, 'tcx>,
|
||||
error_span: &Span) {
|
||||
match err.cmt.note {
|
||||
mc::NoteClosureEnv(upvar_id) | mc::NoteUpvarRef(upvar_id) => {
|
||||
|
|
@ -1487,7 +1488,7 @@ impl DataFlowOperator for LoanDataFlowOperator {
|
|||
}
|
||||
|
||||
impl<'tcx> fmt::Debug for InteriorKind {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {
|
||||
InteriorField(mc::FieldIndex(_, info)) => write!(f, "{}", info),
|
||||
InteriorElement => write!(f, "[]"),
|
||||
|
|
@ -1496,7 +1497,7 @@ impl<'tcx> fmt::Debug for InteriorKind {
|
|||
}
|
||||
|
||||
impl<'tcx> fmt::Debug for Loan<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "Loan_{}({:?}, {:?}, {:?}-{:?}, {:?})",
|
||||
self.index,
|
||||
self.loan_path,
|
||||
|
|
@ -1508,7 +1509,7 @@ impl<'tcx> fmt::Debug for Loan<'tcx> {
|
|||
}
|
||||
|
||||
impl<'tcx> fmt::Debug for LoanPath<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.kind {
|
||||
LpVar(id) => {
|
||||
write!(f, "$({})", ty::tls::with(|tcx| tcx.hir().node_to_string(id)))
|
||||
|
|
@ -1543,7 +1544,7 @@ impl<'tcx> fmt::Debug for LoanPath<'tcx> {
|
|||
}
|
||||
|
||||
impl<'tcx> fmt::Display for LoanPath<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.kind {
|
||||
LpVar(id) => {
|
||||
write!(f, "$({})", ty::tls::with(|tcx| tcx.hir().node_to_user_string(id)))
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
//! Data structures used for tracking moves. Please see the extensive
|
||||
//! comments in the section "Moves and initialization" in `README.md`.
|
||||
|
||||
pub use self::MoveKind::*;
|
||||
pub use MoveKind::*;
|
||||
|
||||
use dataflow::{DataFlowContext, BitwiseOperator, DataFlowOperator, KillFrom};
|
||||
use crate::dataflow::{DataFlowContext, BitwiseOperator, DataFlowOperator, KillFrom};
|
||||
|
||||
use borrowck::*;
|
||||
use crate::borrowck::*;
|
||||
use rustc::cfg;
|
||||
use rustc::ty::{self, TyCtxt};
|
||||
use rustc::util::nodemap::FxHashMap;
|
||||
|
|
@ -15,6 +15,7 @@ use std::rc::Rc;
|
|||
use std::usize;
|
||||
use syntax_pos::Span;
|
||||
use rustc::hir;
|
||||
use log::debug;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct MoveData<'tcx> {
|
||||
|
|
@ -145,7 +146,7 @@ pub struct AssignDataFlowOperator;
|
|||
|
||||
pub type AssignDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, AssignDataFlowOperator>;
|
||||
|
||||
fn loan_path_is_precise(loan_path: &LoanPath) -> bool {
|
||||
fn loan_path_is_precise(loan_path: &LoanPath<'_>) -> bool {
|
||||
match loan_path.kind {
|
||||
LpVar(_) | LpUpvar(_) => {
|
||||
true
|
||||
|
|
@ -428,8 +429,8 @@ impl<'a, 'tcx> MoveData<'tcx> {
|
|||
/// killed by scoping. See `README.md` for more details.
|
||||
fn add_gen_kills(&self,
|
||||
bccx: &BorrowckCtxt<'a, 'tcx>,
|
||||
dfcx_moves: &mut MoveDataFlow,
|
||||
dfcx_assign: &mut AssignDataFlow) {
|
||||
dfcx_moves: &mut MoveDataFlow<'_, '_>,
|
||||
dfcx_assign: &mut AssignDataFlow<'_, '_>) {
|
||||
for (i, the_move) in self.moves.borrow().iter().enumerate() {
|
||||
dfcx_moves.add_gen(the_move.id, i);
|
||||
}
|
||||
|
|
@ -537,7 +538,7 @@ impl<'a, 'tcx> MoveData<'tcx> {
|
|||
path: MovePathIndex,
|
||||
kill_id: hir::ItemLocalId,
|
||||
kill_kind: KillFrom,
|
||||
dfcx_moves: &mut MoveDataFlow) {
|
||||
dfcx_moves: &mut MoveDataFlow<'_, '_>) {
|
||||
// We can only perform kills for paths that refer to a unique location,
|
||||
// since otherwise we may kill a move from one location with an
|
||||
// assignment referring to another location.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use errors::Applicability;
|
|||
use std::slice;
|
||||
use syntax::ptr::P;
|
||||
|
||||
use borrowck::BorrowckCtxt;
|
||||
use crate::borrowck::BorrowckCtxt;
|
||||
|
||||
pub fn check<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, body: &'tcx hir::Body) {
|
||||
let mut used_mut = bccx.used_mut_nodes.borrow().clone();
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use std::io;
|
|||
use std::mem;
|
||||
use std::usize;
|
||||
use syntax::print::pprust::PrintState;
|
||||
use log::debug;
|
||||
|
||||
use rustc_data_structures::graph::implementation::OUTGOING;
|
||||
|
||||
|
|
@ -80,7 +81,7 @@ pub trait DataFlowOperator : BitwiseOperator {
|
|||
fn initial_value(&self) -> bool;
|
||||
}
|
||||
|
||||
struct PropagationContext<'a, 'b: 'a, 'tcx: 'b, O: 'a> {
|
||||
struct PropagationContext<'a, 'b: 'a, 'tcx: 'b, O> {
|
||||
dfcx: &'a mut DataFlowContext<'b, 'tcx, O>,
|
||||
changed: bool
|
||||
}
|
||||
|
|
@ -99,12 +100,12 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O> {
|
||||
fn nested(&self, state: &mut pprust::State, nested: pprust::Nested) -> io::Result<()> {
|
||||
fn nested(&self, state: &mut pprust::State<'_>, nested: pprust::Nested) -> io::Result<()> {
|
||||
pprust::PpAnn::nested(self.tcx.hir(), state, nested)
|
||||
}
|
||||
fn pre(&self,
|
||||
ps: &mut pprust::State,
|
||||
node: pprust::AnnNode) -> io::Result<()> {
|
||||
ps: &mut pprust::State<'_>,
|
||||
node: pprust::AnnNode<'_>) -> io::Result<()> {
|
||||
let id = match node {
|
||||
pprust::AnnNode::Name(_) => return Ok(()),
|
||||
pprust::AnnNode::Expr(expr) => expr.hir_id.local_id,
|
||||
|
|
|
|||
|
|
@ -2,16 +2,15 @@
|
|||
//! libgraphviz traits, specialized to attaching borrowck analysis
|
||||
//! data to rendered labels.
|
||||
|
||||
pub use self::Variant::*;
|
||||
pub use Variant::*;
|
||||
|
||||
pub use rustc::cfg::graphviz::{Node, Edge};
|
||||
use rustc::cfg::graphviz as cfg_dot;
|
||||
|
||||
use borrowck;
|
||||
use borrowck::{BorrowckCtxt, LoanPath};
|
||||
use dot;
|
||||
use crate::borrowck::{self, BorrowckCtxt, LoanPath};
|
||||
use crate::dataflow::{DataFlowOperator, DataFlowContext, EntryOrExit};
|
||||
use log::debug;
|
||||
use rustc::cfg::CFGIndex;
|
||||
use dataflow::{DataFlowOperator, DataFlowContext, EntryOrExit};
|
||||
use std::rc::Rc;
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
|
|
@ -53,7 +52,7 @@ impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> {
|
|||
sets
|
||||
}
|
||||
|
||||
fn dataflow_for_variant(&self, e: EntryOrExit, n: &Node, v: Variant) -> String {
|
||||
fn dataflow_for_variant(&self, e: EntryOrExit, n: &Node<'_>, v: Variant) -> String {
|
||||
let cfgidx = n.0;
|
||||
match v {
|
||||
Loans => self.dataflow_loans_for(e, cfgidx),
|
||||
|
|
@ -89,7 +88,7 @@ impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> {
|
|||
let dfcx = &self.analysis_data.loans;
|
||||
let loan_index_to_path = |loan_index| {
|
||||
let all_loans = &self.analysis_data.all_loans;
|
||||
let l: &borrowck::Loan = &all_loans[loan_index];
|
||||
let l: &borrowck::Loan<'_> = &all_loans[loan_index];
|
||||
l.loan_path()
|
||||
};
|
||||
self.build_set(e, cfgidx, dfcx, loan_index_to_path)
|
||||
|
|
|
|||
|
|
@ -1,23 +1,14 @@
|
|||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
#![deny(rust_2018_idioms)]
|
||||
|
||||
#![feature(nll)]
|
||||
|
||||
#![recursion_limit="256"]
|
||||
|
||||
#[macro_use] extern crate log;
|
||||
extern crate syntax;
|
||||
extern crate syntax_pos;
|
||||
extern crate rustc_errors as errors;
|
||||
extern crate rustc_data_structures;
|
||||
|
||||
// for "clarity", rename the graphviz crate to dot; graphviz within `borrowck`
|
||||
// refers to the borrowck-specific graphviz adapter traits.
|
||||
extern crate graphviz as dot;
|
||||
#[macro_use]
|
||||
extern crate rustc;
|
||||
extern crate rustc_mir;
|
||||
|
||||
pub use borrowck::check_crate;
|
||||
pub use borrowck::build_borrowck_dataflow_data_for_fn;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
authors = ["The Rust Project Developers"]
|
||||
name = "rustc_codegen_utils"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "rustc_codegen_utils"
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ use rustc::middle::cstore::EncodedMetadata;
|
|||
use rustc::middle::cstore::MetadataLoader;
|
||||
use rustc::dep_graph::DepGraph;
|
||||
use rustc_target::spec::Target;
|
||||
use link::out_filename;
|
||||
use crate::link::out_filename;
|
||||
|
||||
pub use rustc_data_structures::sync::MetadataRef;
|
||||
|
||||
|
|
@ -42,8 +42,8 @@ pub trait CodegenBackend {
|
|||
fn diagnostics(&self) -> &[(&'static str, &'static str)] { &[] }
|
||||
|
||||
fn metadata_loader(&self) -> Box<dyn MetadataLoader + Sync>;
|
||||
fn provide(&self, _providers: &mut Providers);
|
||||
fn provide_extern(&self, _providers: &mut Providers);
|
||||
fn provide(&self, _providers: &mut Providers<'_>);
|
||||
fn provide_extern(&self, _providers: &mut Providers<'_>);
|
||||
fn codegen_crate<'a, 'tcx>(
|
||||
&self,
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
|
|
@ -109,8 +109,8 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
|
|||
box NoLlvmMetadataLoader
|
||||
}
|
||||
|
||||
fn provide(&self, providers: &mut Providers) {
|
||||
::symbol_names::provide(providers);
|
||||
fn provide(&self, providers: &mut Providers<'_>) {
|
||||
crate::symbol_names::provide(providers);
|
||||
|
||||
providers.target_features_whitelist = |_tcx, _cnum| {
|
||||
Default::default() // Just a dummy
|
||||
|
|
@ -118,7 +118,7 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
|
|||
providers.is_reachable_non_generic = |_tcx, _defid| true;
|
||||
providers.exported_symbols = |_tcx, _crate| Arc::new(Vec::new());
|
||||
}
|
||||
fn provide_extern(&self, providers: &mut Providers) {
|
||||
fn provide_extern(&self, providers: &mut Providers<'_>) {
|
||||
providers.is_reachable_non_generic = |_tcx, _defid| true;
|
||||
}
|
||||
|
||||
|
|
@ -129,12 +129,12 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
|
|||
) -> Box<dyn Any> {
|
||||
use rustc_mir::monomorphize::item::MonoItem;
|
||||
|
||||
::check_for_rustc_errors_attr(tcx);
|
||||
::symbol_names_test::report_symbol_names(tcx);
|
||||
::rustc_incremental::assert_dep_graph(tcx);
|
||||
::rustc_incremental::assert_module_sources::assert_module_sources(tcx);
|
||||
crate::check_for_rustc_errors_attr(tcx);
|
||||
crate::symbol_names_test::report_symbol_names(tcx);
|
||||
rustc_incremental::assert_dep_graph(tcx);
|
||||
rustc_incremental::assert_module_sources::assert_module_sources(tcx);
|
||||
// FIXME: Fix this
|
||||
// ::rustc::middle::dependency_format::calculate(tcx);
|
||||
// rustc::middle::dependency_format::calculate(tcx);
|
||||
let _ = tcx.link_args(LOCAL_CRATE);
|
||||
let _ = tcx.native_libraries(LOCAL_CRATE);
|
||||
let (_, cgus) = tcx.collect_and_partition_mono_items(LOCAL_CRATE);
|
||||
|
|
|
|||
|
|
@ -14,18 +14,10 @@
|
|||
|
||||
#![recursion_limit="256"]
|
||||
|
||||
extern crate flate2;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#![deny(rust_2018_idioms)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate rustc;
|
||||
extern crate rustc_target;
|
||||
extern crate rustc_metadata;
|
||||
extern crate rustc_mir;
|
||||
extern crate rustc_incremental;
|
||||
extern crate syntax;
|
||||
extern crate syntax_pos;
|
||||
#[macro_use] extern crate rustc_data_structures;
|
||||
|
||||
use rustc::ty::TyCtxt;
|
||||
|
|
@ -40,7 +32,7 @@ pub mod symbol_names_test;
|
|||
/// error in codegen. This is used to write compile-fail tests
|
||||
/// that actually test that compilation succeeds without
|
||||
/// reporting an error.
|
||||
pub fn check_for_rustc_errors_attr(tcx: TyCtxt) {
|
||||
pub fn check_for_rustc_errors_attr(tcx: TyCtxt<'_, '_, '_>) {
|
||||
if let Some((def_id, _)) = tcx.entry_fn(LOCAL_CRATE) {
|
||||
if tcx.has_attr(def_id, "rustc_error") {
|
||||
tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful");
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ pub fn find_crate_name(sess: Option<&Session>,
|
|||
attrs: &[ast::Attribute],
|
||||
input: &Input) -> String {
|
||||
let validate = |s: String, span: Option<Span>| {
|
||||
::rustc_metadata::validate_crate_name(sess, &s, span);
|
||||
rustc_metadata::validate_crate_name(sess, &s, span);
|
||||
s
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -103,10 +103,12 @@ use rustc_mir::monomorphize::Instance;
|
|||
|
||||
use syntax_pos::symbol::Symbol;
|
||||
|
||||
use log::debug;
|
||||
|
||||
use std::fmt::Write;
|
||||
use std::mem::discriminant;
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
pub fn provide(providers: &mut Providers<'_>) {
|
||||
*providers = Providers {
|
||||
def_symbol_name,
|
||||
symbol_name,
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
authors = ["The Rust Project Developers"]
|
||||
name = "rustc_cratesio_shim"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
crate-type = ["dylib"]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![deny(rust_2018_idioms)]
|
||||
|
||||
// See Cargo.toml for a comment explaining this crate.
|
||||
#![allow(unused_extern_crates)]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
authors = ["The Rust Project Developers"]
|
||||
name = "rustc_data_structures"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "rustc_data_structures"
|
||||
|
|
@ -16,8 +17,8 @@ serialize = { path = "../libserialize" }
|
|||
graphviz = { path = "../libgraphviz" }
|
||||
cfg-if = "0.1.2"
|
||||
stable_deref_trait = "1.0.0"
|
||||
rustc-rayon = "0.1.1"
|
||||
rustc-rayon-core = "0.1.1"
|
||||
rayon = { version = "0.1.1", package = "rustc-rayon" }
|
||||
rayon-core = { version = "0.1.1", package = "rustc-rayon-core" }
|
||||
rustc-hash = "1.0.1"
|
||||
smallvec = { version = "0.6.7", features = ["union", "may_dangle"] }
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use indexed_vec::{Idx, IndexVec};
|
||||
use crate::indexed_vec::{Idx, IndexVec};
|
||||
use smallvec::SmallVec;
|
||||
use std::fmt;
|
||||
use std::iter;
|
||||
|
|
@ -208,7 +208,7 @@ impl<T: Idx> SubtractFromBitSet<T> for BitSet<T> {
|
|||
}
|
||||
|
||||
impl<T: Idx> fmt::Debug for BitSet<T> {
|
||||
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
w.debug_list()
|
||||
.entries(self.iter())
|
||||
.finish()
|
||||
|
|
@ -366,7 +366,7 @@ impl<T: Idx> SparseBitSet<T> {
|
|||
dense
|
||||
}
|
||||
|
||||
fn iter(&self) -> slice::Iter<T> {
|
||||
fn iter(&self) -> slice::Iter<'_, T> {
|
||||
self.elems.iter()
|
||||
}
|
||||
}
|
||||
|
|
@ -536,7 +536,7 @@ impl<T: Idx> HybridBitSet<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> HybridIter<T> {
|
||||
pub fn iter(&self) -> HybridIter<'_, T> {
|
||||
match self {
|
||||
HybridBitSet::Sparse(sparse) => HybridIter::Sparse(sparse.iter()),
|
||||
HybridBitSet::Dense(dense) => HybridIter::Dense(dense.iter()),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::stable_hasher;
|
||||
use std::mem;
|
||||
use stable_hasher;
|
||||
use serialize;
|
||||
use serialize::opaque::{EncodeResult, Encoder, Decoder};
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ impl Fingerprint {
|
|||
}
|
||||
|
||||
impl ::std::fmt::Display for Fingerprint {
|
||||
fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
fn fmt(&self, formatter: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||
write!(formatter, "{:x}-{:x}", self.0, self.1)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,12 +14,9 @@ cfg_if! {
|
|||
if #[cfg(unix)] {
|
||||
use std::ffi::{CString, OsStr};
|
||||
use std::os::unix::prelude::*;
|
||||
use libc;
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
mod os {
|
||||
use libc;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct flock {
|
||||
pub l_type: libc::c_short,
|
||||
|
|
@ -35,8 +32,6 @@ cfg_if! {
|
|||
|
||||
#[cfg(target_os = "freebsd")]
|
||||
mod os {
|
||||
use libc;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct flock {
|
||||
pub l_start: libc::off_t,
|
||||
|
|
@ -53,8 +48,6 @@ cfg_if! {
|
|||
target_os = "netbsd",
|
||||
target_os = "openbsd"))]
|
||||
mod os {
|
||||
use libc;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct flock {
|
||||
pub l_start: libc::off_t,
|
||||
|
|
@ -70,8 +63,6 @@ cfg_if! {
|
|||
|
||||
#[cfg(target_os = "haiku")]
|
||||
mod os {
|
||||
use libc;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct flock {
|
||||
pub l_type: libc::c_short,
|
||||
|
|
@ -87,8 +78,6 @@ cfg_if! {
|
|||
|
||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||
mod os {
|
||||
use libc;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct flock {
|
||||
pub l_start: libc::off_t,
|
||||
|
|
@ -104,8 +93,6 @@ cfg_if! {
|
|||
|
||||
#[cfg(target_os = "solaris")]
|
||||
mod os {
|
||||
use libc;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct flock {
|
||||
pub l_type: libc::c_short,
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ impl<Node: Idx> Dominators<Node> {
|
|||
self.immediate_dominators[node].unwrap()
|
||||
}
|
||||
|
||||
pub fn dominators(&self, node: Node) -> Iter<Node> {
|
||||
pub fn dominators(&self, node: Node) -> Iter<'_, Node> {
|
||||
assert!(self.is_reachable(node), "node {:?} is not reachable", node);
|
||||
Iter {
|
||||
dominators: self,
|
||||
|
|
@ -136,7 +136,7 @@ impl<Node: Idx> Dominators<Node> {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct Iter<'dom, Node: Idx + 'dom> {
|
||||
pub struct Iter<'dom, Node: Idx> {
|
||||
dominators: &'dom Dominators<Node>,
|
||||
node: Option<Node>,
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ impl<Node: Idx> DominatorTree<Node> {
|
|||
}
|
||||
|
||||
impl<Node: Idx> fmt::Debug for DominatorTree<Node> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Debug::fmt(
|
||||
&DominatorTreeNode {
|
||||
tree: self,
|
||||
|
|
@ -188,7 +188,7 @@ struct DominatorTreeNode<'tree, Node: Idx> {
|
|||
}
|
||||
|
||||
impl<'tree, Node: Idx> fmt::Debug for DominatorTreeNode<'tree, Node> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let subtrees: Vec<_> = self.tree
|
||||
.children(self.node)
|
||||
.iter()
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@
|
|||
//! the field `next_edge`). Each of those fields is an array that should
|
||||
//! be indexed by the direction (see the type `Direction`).
|
||||
|
||||
use bit_set::BitSet;
|
||||
use crate::bit_set::BitSet;
|
||||
use crate::snapshot_vec::{SnapshotVec, SnapshotVecDelegate};
|
||||
use std::fmt::Debug;
|
||||
use std::usize;
|
||||
use snapshot_vec::{SnapshotVec, SnapshotVecDelegate};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
|
@ -212,15 +212,19 @@ impl<N: Debug, E: Debug> Graph<N, E> {
|
|||
.all(|(edge_idx, edge)| f(edge_idx, edge))
|
||||
}
|
||||
|
||||
pub fn outgoing_edges(&self, source: NodeIndex) -> AdjacentEdges<N, E> {
|
||||
pub fn outgoing_edges(&self, source: NodeIndex) -> AdjacentEdges<'_, N, E> {
|
||||
self.adjacent_edges(source, OUTGOING)
|
||||
}
|
||||
|
||||
pub fn incoming_edges(&self, source: NodeIndex) -> AdjacentEdges<N, E> {
|
||||
pub fn incoming_edges(&self, source: NodeIndex) -> AdjacentEdges<'_, N, E> {
|
||||
self.adjacent_edges(source, INCOMING)
|
||||
}
|
||||
|
||||
pub fn adjacent_edges(&self, source: NodeIndex, direction: Direction) -> AdjacentEdges<N, E> {
|
||||
pub fn adjacent_edges(
|
||||
&self,
|
||||
source: NodeIndex,
|
||||
direction: Direction
|
||||
) -> AdjacentEdges<'_, N, E> {
|
||||
let first_edge = self.node(source).first_edge[direction.repr];
|
||||
AdjacentEdges {
|
||||
graph: self,
|
||||
|
|
@ -291,11 +295,7 @@ impl<N: Debug, E: Debug> Graph<N, E> {
|
|||
|
||||
// # Iterators
|
||||
|
||||
pub struct AdjacentEdges<'g, N, E>
|
||||
where
|
||||
N: 'g,
|
||||
E: 'g,
|
||||
{
|
||||
pub struct AdjacentEdges<'g, N, E> {
|
||||
graph: &'g Graph<N, E>,
|
||||
direction: Direction,
|
||||
next: EdgeIndex,
|
||||
|
|
@ -331,11 +331,7 @@ impl<'g, N: Debug, E: Debug> Iterator for AdjacentEdges<'g, N, E> {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct DepthFirstTraversal<'g, N, E>
|
||||
where
|
||||
N: 'g,
|
||||
E: 'g,
|
||||
{
|
||||
pub struct DepthFirstTraversal<'g, N, E> {
|
||||
graph: &'g Graph<N, E>,
|
||||
stack: Vec<NodeIndex>,
|
||||
visited: BitSet<usize>,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use graph::implementation::*;
|
||||
use crate::graph::implementation::*;
|
||||
use std::fmt::Debug;
|
||||
|
||||
type TestGraph = Graph<&'static str, &'static str>;
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
//! node in the graph. This uses Tarjan's algorithm that completes in
|
||||
//! O(n) time.
|
||||
|
||||
use fx::FxHashSet;
|
||||
use graph::{DirectedGraph, WithNumNodes, WithSuccessors};
|
||||
use indexed_vec::{Idx, IndexVec};
|
||||
use crate::fx::FxHashSet;
|
||||
use crate::graph::{DirectedGraph, WithNumNodes, WithSuccessors};
|
||||
use crate::indexed_vec::{Idx, IndexVec};
|
||||
use std::ops::Range;
|
||||
|
||||
mod test;
|
||||
|
|
@ -93,7 +93,7 @@ impl<S: Idx> SccData<S> {
|
|||
}
|
||||
}
|
||||
|
||||
struct SccsConstruction<'c, G: DirectedGraph + WithNumNodes + WithSuccessors + 'c, S: Idx> {
|
||||
struct SccsConstruction<'c, G: DirectedGraph + WithNumNodes + WithSuccessors, S: Idx> {
|
||||
graph: &'c G,
|
||||
|
||||
/// The state of each node; used during walk to record the stack
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#![cfg(test)]
|
||||
|
||||
use graph::test::TestGraph;
|
||||
use crate::graph::test::TestGraph;
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use fx::FxHashMap;
|
||||
use crate::fx::FxHashMap;
|
||||
use std::cmp::max;
|
||||
use std::slice;
|
||||
use std::iter;
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ macro_rules! newtype_index {
|
|||
@type [$type:ident]
|
||||
@debug_format [$debug_format:tt]) => (
|
||||
impl ::std::fmt::Debug for $type {
|
||||
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||
write!(fmt, $debug_format, self.as_u32())
|
||||
}
|
||||
}
|
||||
|
|
@ -495,7 +495,7 @@ impl<I: Idx, T: serialize::Decodable> serialize::Decodable for IndexVec<I, T> {
|
|||
}
|
||||
|
||||
impl<I: Idx, T: fmt::Debug> fmt::Debug for IndexVec<I, T> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Debug::fmt(&self.raw, fmt)
|
||||
}
|
||||
}
|
||||
|
|
@ -573,7 +573,7 @@ impl<I: Idx, T> IndexVec<I, T> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn iter(&self) -> slice::Iter<T> {
|
||||
pub fn iter(&self) -> slice::Iter<'_, T> {
|
||||
self.raw.iter()
|
||||
}
|
||||
|
||||
|
|
@ -589,7 +589,7 @@ impl<I: Idx, T> IndexVec<I, T> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn iter_mut(&mut self) -> slice::IterMut<T> {
|
||||
pub fn iter_mut(&mut self) -> slice::IterMut<'_, T> {
|
||||
self.raw.iter_mut()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,23 +24,16 @@
|
|||
#![cfg_attr(unix, feature(libc))]
|
||||
#![cfg_attr(test, feature(test))]
|
||||
|
||||
extern crate core;
|
||||
extern crate ena;
|
||||
#![deny(rust_2018_idioms)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate serialize as rustc_serialize; // used by deriving
|
||||
#[cfg(unix)]
|
||||
extern crate libc;
|
||||
extern crate parking_lot;
|
||||
#[macro_use]
|
||||
extern crate cfg_if;
|
||||
extern crate stable_deref_trait;
|
||||
extern crate rustc_rayon as rayon;
|
||||
extern crate rustc_rayon_core as rayon_core;
|
||||
extern crate rustc_hash;
|
||||
extern crate serialize;
|
||||
extern crate graphviz;
|
||||
extern crate smallvec;
|
||||
|
||||
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
|
||||
#[allow(unused_extern_crates)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::obligation_forest::{ForestObligation, ObligationForest};
|
||||
use graphviz as dot;
|
||||
use obligation_forest::{ForestObligation, ObligationForest};
|
||||
use std::env::var_os;
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
|
|
@ -41,22 +41,22 @@ impl<'a, O: ForestObligation + 'a> dot::Labeller<'a> for &'a ObligationForest<O>
|
|||
type Node = usize;
|
||||
type Edge = (usize, usize);
|
||||
|
||||
fn graph_id(&self) -> dot::Id {
|
||||
fn graph_id(&self) -> dot::Id<'_> {
|
||||
dot::Id::new("trait_obligation_forest").unwrap()
|
||||
}
|
||||
|
||||
fn node_id(&self, index: &Self::Node) -> dot::Id {
|
||||
fn node_id(&self, index: &Self::Node) -> dot::Id<'_> {
|
||||
dot::Id::new(format!("obligation_{}", index)).unwrap()
|
||||
}
|
||||
|
||||
fn node_label(&self, index: &Self::Node) -> dot::LabelText {
|
||||
fn node_label(&self, index: &Self::Node) -> dot::LabelText<'_> {
|
||||
let node = &self.nodes[*index];
|
||||
let label = format!("{:?} ({:?})", node.obligation.as_predicate(), node.state.get());
|
||||
|
||||
dot::LabelText::LabelStr(label.into())
|
||||
}
|
||||
|
||||
fn edge_label(&self, (_index_source, _index_target): &Self::Edge) -> dot::LabelText {
|
||||
fn edge_label(&self, (_index_source, _index_target): &Self::Edge) -> dot::LabelText<'_> {
|
||||
dot::LabelText::LabelStr("".into())
|
||||
}
|
||||
}
|
||||
|
|
@ -65,11 +65,11 @@ impl<'a, O: ForestObligation + 'a> dot::GraphWalk<'a> for &'a ObligationForest<O
|
|||
type Node = usize;
|
||||
type Edge = (usize, usize);
|
||||
|
||||
fn nodes(&self) -> dot::Nodes<Self::Node> {
|
||||
fn nodes(&self) -> dot::Nodes<'_, Self::Node> {
|
||||
(0..self.nodes.len()).collect()
|
||||
}
|
||||
|
||||
fn edges(&self) -> dot::Edges<Self::Edge> {
|
||||
fn edges(&self) -> dot::Edges<'_, Self::Edge> {
|
||||
(0..self.nodes.len())
|
||||
.flat_map(|i| {
|
||||
let node = &self.nodes[i];
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@
|
|||
//! processing step, we compress the vector to remove completed and error
|
||||
//! nodes, which aren't needed anymore.
|
||||
|
||||
use fx::{FxHashMap, FxHashSet};
|
||||
use crate::fx::{FxHashMap, FxHashSet};
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::collections::hash_map::Entry;
|
||||
|
|
@ -733,7 +733,7 @@ impl<O> Node<O> {
|
|||
|
||||
// I need a Clone closure
|
||||
#[derive(Clone)]
|
||||
struct GetObligation<'a, O: 'a>(&'a [Node<O>]);
|
||||
struct GetObligation<'a, O>(&'a [Node<O>]);
|
||||
|
||||
impl<'a, 'b, O> FnOnce<(&'b usize,)> for GetObligation<'a, O> {
|
||||
type Output = &'a O;
|
||||
|
|
|
|||
|
|
@ -1002,7 +1002,7 @@ impl<O, T: ?Sized> Debug for OwningRef<O, T>
|
|||
where O: Debug,
|
||||
T: Debug,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f,
|
||||
"OwningRef {{ owner: {:?}, reference: {:?} }}",
|
||||
self.owner(),
|
||||
|
|
@ -1014,7 +1014,7 @@ impl<O, T: ?Sized> Debug for OwningRefMut<O, T>
|
|||
where O: Debug,
|
||||
T: Debug,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f,
|
||||
"OwningRefMut {{ owner: {:?}, reference: {:?} }}",
|
||||
self.owner(),
|
||||
|
|
@ -1047,7 +1047,7 @@ unsafe impl<O, T: ?Sized> Sync for OwningRefMut<O, T>
|
|||
where O: Sync, for<'a> (&'a mut T): Sync {}
|
||||
|
||||
impl Debug for dyn Erased {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "<Erased>",)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use std::ops::Deref;
|
|||
/// A wrapper around reference that compares and hashes like a pointer.
|
||||
/// Can be used as a key in sets/maps indexed by pointers to avoid `unsafe`.
|
||||
#[derive(Debug)]
|
||||
pub struct PtrKey<'a, T: 'a>(pub &'a T);
|
||||
pub struct PtrKey<'a, T>(pub &'a T);
|
||||
|
||||
impl<'a, T> Clone for PtrKey<'a, T> {
|
||||
fn clone(&self) -> Self { *self }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use fx::FxHashMap;
|
||||
use crate::fx::FxHashMap;
|
||||
use std::hash::Hash;
|
||||
use std::ops;
|
||||
use std::mem;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ impl<K: Ord, V> SortedMap<K, V> {
|
|||
|
||||
/// Iterate over elements, sorted by key
|
||||
#[inline]
|
||||
pub fn iter(&self) -> ::std::slice::Iter<(K, V)> {
|
||||
pub fn iter(&self) -> ::std::slice::Iter<'_, (K, V)> {
|
||||
self.data.iter()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
use std::hash::{Hash, Hasher, BuildHasher};
|
||||
use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
use sip128::SipHasher128;
|
||||
use crate::sip128::SipHasher128;
|
||||
use crate::indexed_vec;
|
||||
use crate::bit_set;
|
||||
|
||||
/// When hashing something that ends up affecting properties like symbol names,
|
||||
/// we want these symbol names to be calculated independently of other factors
|
||||
|
|
@ -17,7 +19,7 @@ pub struct StableHasher<W> {
|
|||
}
|
||||
|
||||
impl<W: StableHasherResult> ::std::fmt::Debug for StableHasher<W> {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||
write!(f, "{:?}", self.state)
|
||||
}
|
||||
}
|
||||
|
|
@ -433,7 +435,7 @@ impl<T, CTX> HashStable<CTX> for ::std::mem::Discriminant<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<I: ::indexed_vec::Idx, T, CTX> HashStable<CTX> for ::indexed_vec::IndexVec<I, T>
|
||||
impl<I: indexed_vec::Idx, T, CTX> HashStable<CTX> for indexed_vec::IndexVec<I, T>
|
||||
where T: HashStable<CTX>,
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
|
|
@ -447,7 +449,7 @@ impl<I: ::indexed_vec::Idx, T, CTX> HashStable<CTX> for ::indexed_vec::IndexVec<
|
|||
}
|
||||
|
||||
|
||||
impl<I: ::indexed_vec::Idx, CTX> HashStable<CTX> for ::bit_set::BitSet<I>
|
||||
impl<I: indexed_vec::Idx, CTX> HashStable<CTX> for bit_set::BitSet<I>
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
ctx: &mut CTX,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use std::fmt;
|
|||
use std::hash::{Hash, Hasher};
|
||||
use serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
|
||||
use stable_hasher;
|
||||
use crate::stable_hasher;
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
pub struct Svh {
|
||||
|
|
@ -40,7 +40,7 @@ impl Hash for Svh {
|
|||
}
|
||||
|
||||
impl fmt::Display for Svh {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.pad(&self.to_string())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use std::collections::HashMap;
|
|||
use std::hash::{Hash, BuildHasher};
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use owning_ref::{Erased, OwningRef};
|
||||
use crate::owning_ref::{Erased, OwningRef};
|
||||
|
||||
pub fn serial_join<A, B, RA, RB>(oper_a: A, oper_b: B) -> (RA, RB)
|
||||
where A: FnOnce() -> RA,
|
||||
|
|
@ -261,12 +261,12 @@ cfg_if! {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn lock(&self) -> LockGuard<T> {
|
||||
pub fn lock(&self) -> LockGuard<'_, T> {
|
||||
self.0.lock()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn lock_mut(&self) -> LockGuard<T> {
|
||||
pub fn lock_mut(&self) -> LockGuard<'_, T> {
|
||||
self.lock()
|
||||
}
|
||||
}
|
||||
|
|
@ -490,19 +490,19 @@ impl<T> Lock<T> {
|
|||
|
||||
#[cfg(parallel_compiler)]
|
||||
#[inline(always)]
|
||||
pub fn try_lock(&self) -> Option<LockGuard<T>> {
|
||||
pub fn try_lock(&self) -> Option<LockGuard<'_, T>> {
|
||||
self.0.try_lock()
|
||||
}
|
||||
|
||||
#[cfg(not(parallel_compiler))]
|
||||
#[inline(always)]
|
||||
pub fn try_lock(&self) -> Option<LockGuard<T>> {
|
||||
pub fn try_lock(&self) -> Option<LockGuard<'_, T>> {
|
||||
self.0.try_borrow_mut().ok()
|
||||
}
|
||||
|
||||
#[cfg(parallel_compiler)]
|
||||
#[inline(always)]
|
||||
pub fn lock(&self) -> LockGuard<T> {
|
||||
pub fn lock(&self) -> LockGuard<'_, T> {
|
||||
if ERROR_CHECKING {
|
||||
self.0.try_lock().expect("lock was already held")
|
||||
} else {
|
||||
|
|
@ -512,7 +512,7 @@ impl<T> Lock<T> {
|
|||
|
||||
#[cfg(not(parallel_compiler))]
|
||||
#[inline(always)]
|
||||
pub fn lock(&self) -> LockGuard<T> {
|
||||
pub fn lock(&self) -> LockGuard<'_, T> {
|
||||
self.0.borrow_mut()
|
||||
}
|
||||
|
||||
|
|
@ -522,12 +522,12 @@ impl<T> Lock<T> {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn borrow(&self) -> LockGuard<T> {
|
||||
pub fn borrow(&self) -> LockGuard<'_, T> {
|
||||
self.lock()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn borrow_mut(&self) -> LockGuard<T> {
|
||||
pub fn borrow_mut(&self) -> LockGuard<'_, T> {
|
||||
self.lock()
|
||||
}
|
||||
}
|
||||
|
|
@ -568,13 +568,13 @@ impl<T> RwLock<T> {
|
|||
|
||||
#[cfg(not(parallel_compiler))]
|
||||
#[inline(always)]
|
||||
pub fn read(&self) -> ReadGuard<T> {
|
||||
pub fn read(&self) -> ReadGuard<'_, T> {
|
||||
self.0.borrow()
|
||||
}
|
||||
|
||||
#[cfg(parallel_compiler)]
|
||||
#[inline(always)]
|
||||
pub fn read(&self) -> ReadGuard<T> {
|
||||
pub fn read(&self) -> ReadGuard<'_, T> {
|
||||
if ERROR_CHECKING {
|
||||
self.0.try_read().expect("lock was already held")
|
||||
} else {
|
||||
|
|
@ -589,25 +589,25 @@ impl<T> RwLock<T> {
|
|||
|
||||
#[cfg(not(parallel_compiler))]
|
||||
#[inline(always)]
|
||||
pub fn try_write(&self) -> Result<WriteGuard<T>, ()> {
|
||||
pub fn try_write(&self) -> Result<WriteGuard<'_, T>, ()> {
|
||||
self.0.try_borrow_mut().map_err(|_| ())
|
||||
}
|
||||
|
||||
#[cfg(parallel_compiler)]
|
||||
#[inline(always)]
|
||||
pub fn try_write(&self) -> Result<WriteGuard<T>, ()> {
|
||||
pub fn try_write(&self) -> Result<WriteGuard<'_, T>, ()> {
|
||||
self.0.try_write().ok_or(())
|
||||
}
|
||||
|
||||
#[cfg(not(parallel_compiler))]
|
||||
#[inline(always)]
|
||||
pub fn write(&self) -> WriteGuard<T> {
|
||||
pub fn write(&self) -> WriteGuard<'_, T> {
|
||||
self.0.borrow_mut()
|
||||
}
|
||||
|
||||
#[cfg(parallel_compiler)]
|
||||
#[inline(always)]
|
||||
pub fn write(&self) -> WriteGuard<T> {
|
||||
pub fn write(&self) -> WriteGuard<'_, T> {
|
||||
if ERROR_CHECKING {
|
||||
self.0.try_write().expect("lock was already held")
|
||||
} else {
|
||||
|
|
@ -621,12 +621,12 @@ impl<T> RwLock<T> {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn borrow(&self) -> ReadGuard<T> {
|
||||
pub fn borrow(&self) -> ReadGuard<'_, T> {
|
||||
self.read()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn borrow_mut(&self) -> WriteGuard<T> {
|
||||
pub fn borrow_mut(&self) -> WriteGuard<'_, T> {
|
||||
self.write()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ impl<T: PartialEq> Element<T> {
|
|||
mod test {
|
||||
use super::*;
|
||||
extern crate test;
|
||||
use self::test::Bencher;
|
||||
use test::Bencher;
|
||||
|
||||
#[test]
|
||||
fn test_contains_and_insert() {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use bit_set::BitMatrix;
|
||||
use fx::FxHashMap;
|
||||
use sync::Lock;
|
||||
use crate::bit_set::BitMatrix;
|
||||
use crate::fx::FxHashMap;
|
||||
use crate::stable_hasher::{HashStable, StableHasher, StableHasherResult};
|
||||
use crate::sync::Lock;
|
||||
use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
|
||||
use stable_hasher::{HashStable, StableHasher, StableHasherResult};
|
||||
use std::fmt::Debug;
|
||||
use std::hash::Hash;
|
||||
use std::mem;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use indexed_vec::{Idx, IndexVec};
|
||||
use crate::indexed_vec::{Idx, IndexVec};
|
||||
|
||||
pub fn iter<Ls>(
|
||||
first: Option<Ls::LinkIndex>,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use bit_set::BitSet;
|
||||
use indexed_vec::Idx;
|
||||
use crate::bit_set::BitSet;
|
||||
use crate::indexed_vec::Idx;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
/// A work queue is a handy data structure for tracking work left to
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
authors = ["The Rust Project Developers"]
|
||||
name = "rustc_incremental"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "rustc_incremental"
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ fn check_paths<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
}
|
||||
}
|
||||
|
||||
fn dump_graph(tcx: TyCtxt) {
|
||||
fn dump_graph(tcx: TyCtxt<'_, '_, '_>) {
|
||||
let path: String = env::var("RUST_DEP_GRAPH").unwrap_or_else(|_| "dep_graph".to_string());
|
||||
let query = tcx.dep_graph.query();
|
||||
|
||||
|
|
@ -261,11 +261,11 @@ pub struct GraphvizDepGraph<'q>(FxHashSet<&'q DepNode>,
|
|||
impl<'a, 'tcx, 'q> dot::GraphWalk<'a> for GraphvizDepGraph<'q> {
|
||||
type Node = &'q DepNode;
|
||||
type Edge = (&'q DepNode, &'q DepNode);
|
||||
fn nodes(&self) -> dot::Nodes<&'q DepNode> {
|
||||
fn nodes(&self) -> dot::Nodes<'_, &'q DepNode> {
|
||||
let nodes: Vec<_> = self.0.iter().cloned().collect();
|
||||
nodes.into()
|
||||
}
|
||||
fn edges(&self) -> dot::Edges<(&'q DepNode, &'q DepNode)> {
|
||||
fn edges(&self) -> dot::Edges<'_, (&'q DepNode, &'q DepNode)> {
|
||||
self.1[..].into()
|
||||
}
|
||||
fn source(&self, edge: &(&'q DepNode, &'q DepNode)) -> &'q DepNode {
|
||||
|
|
@ -279,10 +279,10 @@ impl<'a, 'tcx, 'q> dot::GraphWalk<'a> for GraphvizDepGraph<'q> {
|
|||
impl<'a, 'tcx, 'q> dot::Labeller<'a> for GraphvizDepGraph<'q> {
|
||||
type Node = &'q DepNode;
|
||||
type Edge = (&'q DepNode, &'q DepNode);
|
||||
fn graph_id(&self) -> dot::Id {
|
||||
fn graph_id(&self) -> dot::Id<'_> {
|
||||
dot::Id::new("DependencyGraph").unwrap()
|
||||
}
|
||||
fn node_id(&self, n: &&'q DepNode) -> dot::Id {
|
||||
fn node_id(&self, n: &&'q DepNode) -> dot::Id<'_> {
|
||||
let s: String =
|
||||
format!("{:?}", n).chars()
|
||||
.map(|c| if c == '_' || c.is_alphanumeric() { c } else { '_' })
|
||||
|
|
@ -290,7 +290,7 @@ impl<'a, 'tcx, 'q> dot::Labeller<'a> for GraphvizDepGraph<'q> {
|
|||
debug!("n={:?} s={:?}", n, s);
|
||||
dot::Id::new(s).unwrap()
|
||||
}
|
||||
fn node_label(&self, n: &&'q DepNode) -> dot::LabelText {
|
||||
fn node_label(&self, n: &&'q DepNode) -> dot::LabelText<'_> {
|
||||
dot::LabelText::label(format!("{:?}", n))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,16 +7,13 @@
|
|||
|
||||
#![recursion_limit="256"]
|
||||
|
||||
extern crate graphviz;
|
||||
#![deny(rust_2018_idioms)]
|
||||
|
||||
#[macro_use] extern crate rustc;
|
||||
extern crate rustc_data_structures;
|
||||
extern crate serialize as rustc_serialize;
|
||||
extern crate rand;
|
||||
extern crate rustc_fs_util;
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate serialize as rustc_serialize; // used by deriving
|
||||
|
||||
#[macro_use] extern crate log;
|
||||
extern crate syntax;
|
||||
extern crate syntax_pos;
|
||||
|
||||
mod assert_dep_graph;
|
||||
pub mod assert_module_sources;
|
||||
|
|
|
|||
|
|
@ -538,7 +538,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'a, 'tcx> {
|
|||
///
|
||||
/// Also make sure that the `label` and `except` fields do not
|
||||
/// both exist.
|
||||
fn check_config(tcx: TyCtxt, attr: &Attribute) -> bool {
|
||||
fn check_config(tcx: TyCtxt<'_, '_, '_>, attr: &Attribute) -> bool {
|
||||
debug!("check_config(attr={:?})", attr);
|
||||
let config = &tcx.sess.parse_sess.config;
|
||||
debug!("check_config: config={:?}", config);
|
||||
|
|
@ -573,7 +573,7 @@ fn check_config(tcx: TyCtxt, attr: &Attribute) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
fn expect_associated_value(tcx: TyCtxt, item: &NestedMetaItem) -> ast::Name {
|
||||
fn expect_associated_value(tcx: TyCtxt<'_, '_, '_>, item: &NestedMetaItem) -> ast::Name {
|
||||
if let Some(value) = item.value_str() {
|
||||
value
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ use rustc::util::common::time_ext;
|
|||
use rustc_serialize::Decodable as RustcDecodable;
|
||||
use rustc_serialize::opaque::Decoder;
|
||||
use std::path::Path;
|
||||
use std;
|
||||
|
||||
use super::data::*;
|
||||
use super::fs::*;
|
||||
|
|
|
|||
|
|
@ -10,16 +10,16 @@ mod save;
|
|||
mod work_product;
|
||||
mod file_format;
|
||||
|
||||
pub use self::fs::finalize_session_directory;
|
||||
pub use self::fs::garbage_collect_session_directories;
|
||||
pub use self::fs::in_incr_comp_dir;
|
||||
pub use self::fs::in_incr_comp_dir_sess;
|
||||
pub use self::fs::prepare_session_directory;
|
||||
pub use self::load::dep_graph_tcx_init;
|
||||
pub use self::load::load_dep_graph;
|
||||
pub use self::load::load_query_result_cache;
|
||||
pub use self::load::LoadResult;
|
||||
pub use self::save::save_dep_graph;
|
||||
pub use self::save::save_work_product_index;
|
||||
pub use self::work_product::copy_cgu_workproducts_to_incr_comp_cache_dir;
|
||||
pub use self::work_product::delete_workproduct_files;
|
||||
pub use fs::finalize_session_directory;
|
||||
pub use fs::garbage_collect_session_directories;
|
||||
pub use fs::in_incr_comp_dir;
|
||||
pub use fs::in_incr_comp_dir_sess;
|
||||
pub use fs::prepare_session_directory;
|
||||
pub use load::dep_graph_tcx_init;
|
||||
pub use load::load_dep_graph;
|
||||
pub use load::load_query_result_cache;
|
||||
pub use load::LoadResult;
|
||||
pub use save::save_dep_graph;
|
||||
pub use save::save_work_product_index;
|
||||
pub use work_product::copy_cgu_workproducts_to_incr_comp_cache_dir;
|
||||
pub use work_product::delete_workproduct_files;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ fn save_in<F>(sess: &Session, path_buf: PathBuf, encode: F)
|
|||
}
|
||||
}
|
||||
|
||||
fn encode_dep_graph(tcx: TyCtxt,
|
||||
fn encode_dep_graph(tcx: TyCtxt<'_, '_, '_>,
|
||||
encoder: &mut Encoder) {
|
||||
// First encode the commandline arguments hash
|
||||
tcx.sess.opts.dep_tracking_hash().encode(encoder).unwrap();
|
||||
|
|
@ -234,7 +234,7 @@ fn encode_work_product_index(work_products: &FxHashMap<WorkProductId, WorkProduc
|
|||
serialized_products.encode(encoder).unwrap();
|
||||
}
|
||||
|
||||
fn encode_query_cache(tcx: TyCtxt,
|
||||
fn encode_query_cache(tcx: TyCtxt<'_, '_, '_>,
|
||||
encoder: &mut Encoder) {
|
||||
time(tcx.sess, "serialize query result cache", || {
|
||||
tcx.serialize_query_result_cache(encoder).unwrap();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//! This module contains files for saving intermediate work-products.
|
||||
|
||||
use persist::fs::*;
|
||||
use crate::persist::fs::*;
|
||||
use rustc::dep_graph::{WorkProduct, WorkProductId, WorkProductFileKind};
|
||||
use rustc::session::Session;
|
||||
use rustc_fs_util::link_or_copy;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
authors = ["The Rust Project Developers"]
|
||||
name = "rustc_lint"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "rustc_lint"
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
use rustc::hir::def::Def;
|
||||
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc::{lint, util};
|
||||
use hir::Node;
|
||||
use util::nodemap::NodeSet;
|
||||
use lint::{LateContext, LintContext, LintArray};
|
||||
|
|
@ -42,10 +43,13 @@ use syntax::symbol::keywords;
|
|||
use syntax::errors::{Applicability, DiagnosticBuilder};
|
||||
use syntax::print::pprust::expr_to_string;
|
||||
use syntax::visit::FnKind;
|
||||
use syntax::struct_span_err;
|
||||
|
||||
use rustc::hir::{self, GenericParamKind, PatKind};
|
||||
|
||||
use nonstandard_style::{MethodLateContext, method_context};
|
||||
use crate::nonstandard_style::{MethodLateContext, method_context};
|
||||
|
||||
use log::debug;
|
||||
|
||||
// hardwired lints from librustc
|
||||
pub use lint::builtin::*;
|
||||
|
|
@ -70,7 +74,7 @@ impl LintPass for WhileTrue {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for WhileTrue {
|
||||
fn check_expr(&mut self, cx: &LateContext, e: &hir::Expr) {
|
||||
fn check_expr(&mut self, cx: &LateContext<'_, '_>, e: &hir::Expr) {
|
||||
if let hir::ExprKind::While(ref cond, ..) = e.node {
|
||||
if let hir::ExprKind::Lit(ref lit) = cond.node {
|
||||
if let ast::LitKind::Bool(true) = lit.node {
|
||||
|
|
@ -102,7 +106,7 @@ declare_lint! {
|
|||
pub struct BoxPointers;
|
||||
|
||||
impl BoxPointers {
|
||||
fn check_heap_type<'a, 'tcx>(&self, cx: &LateContext, span: Span, ty: Ty) {
|
||||
fn check_heap_type<'a, 'tcx>(&self, cx: &LateContext<'_, '_>, span: Span, ty: Ty<'_>) {
|
||||
for leaf_ty in ty.walk() {
|
||||
if leaf_ty.is_box() {
|
||||
let m = format!("type uses owned (Box type) pointers: {}", ty);
|
||||
|
|
@ -123,7 +127,7 @@ impl LintPass for BoxPointers {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxPointers {
|
||||
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
|
||||
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
|
||||
match it.node {
|
||||
hir::ItemKind::Fn(..) |
|
||||
hir::ItemKind::Ty(..) |
|
||||
|
|
@ -150,7 +154,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxPointers {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_expr(&mut self, cx: &LateContext, e: &hir::Expr) {
|
||||
fn check_expr(&mut self, cx: &LateContext<'_, '_>, e: &hir::Expr) {
|
||||
let ty = cx.tables.node_id_to_type(e.hir_id);
|
||||
self.check_heap_type(cx, e.span, ty);
|
||||
}
|
||||
|
|
@ -176,7 +180,7 @@ impl LintPass for NonShorthandFieldPatterns {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
|
||||
fn check_pat(&mut self, cx: &LateContext, pat: &hir::Pat) {
|
||||
fn check_pat(&mut self, cx: &LateContext<'_, '_>, pat: &hir::Pat) {
|
||||
if let PatKind::Struct(ref qpath, ref field_pats, _) = pat.node {
|
||||
let variant = cx.tables.pat_ty(pat).ty_adt_def()
|
||||
.expect("struct pattern type is not an ADT")
|
||||
|
|
@ -233,7 +237,7 @@ impl LintPass for UnsafeCode {
|
|||
}
|
||||
|
||||
impl UnsafeCode {
|
||||
fn report_unsafe(&self, cx: &EarlyContext, span: Span, desc: &'static str) {
|
||||
fn report_unsafe(&self, cx: &EarlyContext<'_>, span: Span, desc: &'static str) {
|
||||
// This comes from a macro that has #[allow_internal_unsafe].
|
||||
if span.allows_unsafe() {
|
||||
return;
|
||||
|
|
@ -244,7 +248,7 @@ impl UnsafeCode {
|
|||
}
|
||||
|
||||
impl EarlyLintPass for UnsafeCode {
|
||||
fn check_attribute(&mut self, cx: &EarlyContext, attr: &ast::Attribute) {
|
||||
fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &ast::Attribute) {
|
||||
if attr.check_name("allow_internal_unsafe") {
|
||||
self.report_unsafe(cx, attr.span, "`allow_internal_unsafe` allows defining \
|
||||
macros using unsafe without triggering \
|
||||
|
|
@ -252,7 +256,7 @@ impl EarlyLintPass for UnsafeCode {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_expr(&mut self, cx: &EarlyContext, e: &ast::Expr) {
|
||||
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
|
||||
if let ast::ExprKind::Block(ref blk, _) = e.node {
|
||||
// Don't warn about generated blocks, that'll just pollute the output.
|
||||
if blk.rules == ast::BlockCheckMode::Unsafe(ast::UserProvided) {
|
||||
|
|
@ -261,7 +265,7 @@ impl EarlyLintPass for UnsafeCode {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
|
||||
fn check_item(&mut self, cx: &EarlyContext<'_>, it: &ast::Item) {
|
||||
match it.node {
|
||||
ast::ItemKind::Trait(_, ast::Unsafety::Unsafe, ..) => {
|
||||
self.report_unsafe(cx, it.span, "declaration of an `unsafe` trait")
|
||||
|
|
@ -276,8 +280,8 @@ impl EarlyLintPass for UnsafeCode {
|
|||
}
|
||||
|
||||
fn check_fn(&mut self,
|
||||
cx: &EarlyContext,
|
||||
fk: FnKind,
|
||||
cx: &EarlyContext<'_>,
|
||||
fk: FnKind<'_>,
|
||||
_: &ast::FnDecl,
|
||||
span: Span,
|
||||
_: ast::NodeId) {
|
||||
|
|
@ -296,7 +300,7 @@ impl EarlyLintPass for UnsafeCode {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_trait_item(&mut self, cx: &EarlyContext, item: &ast::TraitItem) {
|
||||
fn check_trait_item(&mut self, cx: &EarlyContext<'_>, item: &ast::TraitItem) {
|
||||
if let ast::TraitItemKind::Method(ref sig, None) = item.node {
|
||||
if sig.header.unsafety == ast::Unsafety::Unsafe {
|
||||
self.report_unsafe(cx, item.span, "declaration of an `unsafe` method")
|
||||
|
|
@ -354,7 +358,7 @@ impl MissingDoc {
|
|||
}
|
||||
|
||||
fn check_missing_docs_attrs(&self,
|
||||
cx: &LateContext,
|
||||
cx: &LateContext<'_, '_>,
|
||||
id: Option<ast::NodeId>,
|
||||
attrs: &[ast::Attribute],
|
||||
sp: Span,
|
||||
|
|
@ -399,7 +403,7 @@ impl LintPass for MissingDoc {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
|
||||
fn enter_lint_attrs(&mut self, _: &LateContext, attrs: &[ast::Attribute]) {
|
||||
fn enter_lint_attrs(&mut self, _: &LateContext<'_, '_>, attrs: &[ast::Attribute]) {
|
||||
let doc_hidden = self.doc_hidden() ||
|
||||
attrs.iter().any(|attr| {
|
||||
attr.check_name("doc") &&
|
||||
|
|
@ -411,11 +415,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
|
|||
self.doc_hidden_stack.push(doc_hidden);
|
||||
}
|
||||
|
||||
fn exit_lint_attrs(&mut self, _: &LateContext, _attrs: &[ast::Attribute]) {
|
||||
fn exit_lint_attrs(&mut self, _: &LateContext<'_, '_>, _attrs: &[ast::Attribute]) {
|
||||
self.doc_hidden_stack.pop().expect("empty doc_hidden_stack");
|
||||
}
|
||||
|
||||
fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) {
|
||||
fn check_crate(&mut self, cx: &LateContext<'_, '_>, krate: &hir::Crate) {
|
||||
self.check_missing_docs_attrs(cx, None, &krate.attrs, krate.span, "crate");
|
||||
|
||||
for macro_def in &krate.exported_macros {
|
||||
|
|
@ -428,7 +432,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
|
||||
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
|
||||
let desc = match it.node {
|
||||
hir::ItemKind::Fn(..) => "a function",
|
||||
hir::ItemKind::Mod(..) => "a module",
|
||||
|
|
@ -473,7 +477,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
|
|||
self.check_missing_docs_attrs(cx, Some(it.id), &it.attrs, it.span, desc);
|
||||
}
|
||||
|
||||
fn check_trait_item(&mut self, cx: &LateContext, trait_item: &hir::TraitItem) {
|
||||
fn check_trait_item(&mut self, cx: &LateContext<'_, '_>, trait_item: &hir::TraitItem) {
|
||||
if self.private_traits.contains(&trait_item.id) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -491,7 +495,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
|
|||
desc);
|
||||
}
|
||||
|
||||
fn check_impl_item(&mut self, cx: &LateContext, impl_item: &hir::ImplItem) {
|
||||
fn check_impl_item(&mut self, cx: &LateContext<'_, '_>, impl_item: &hir::ImplItem) {
|
||||
// If the method is an impl for a trait, don't doc.
|
||||
if method_context(cx, impl_item.id) == MethodLateContext::TraitImpl {
|
||||
return;
|
||||
|
|
@ -510,7 +514,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
|
|||
desc);
|
||||
}
|
||||
|
||||
fn check_struct_field(&mut self, cx: &LateContext, sf: &hir::StructField) {
|
||||
fn check_struct_field(&mut self, cx: &LateContext<'_, '_>, sf: &hir::StructField) {
|
||||
if !sf.is_positional() {
|
||||
self.check_missing_docs_attrs(cx,
|
||||
Some(sf.id),
|
||||
|
|
@ -520,7 +524,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_variant(&mut self, cx: &LateContext, v: &hir::Variant, _: &hir::Generics) {
|
||||
fn check_variant(&mut self, cx: &LateContext<'_, '_>, v: &hir::Variant, _: &hir::Generics) {
|
||||
self.check_missing_docs_attrs(cx,
|
||||
Some(v.node.data.id()),
|
||||
&v.node.attrs,
|
||||
|
|
@ -549,7 +553,7 @@ impl LintPass for MissingCopyImplementations {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingCopyImplementations {
|
||||
fn check_item(&mut self, cx: &LateContext, item: &hir::Item) {
|
||||
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
|
||||
if !cx.access_levels.is_reachable(item.id) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -620,7 +624,7 @@ impl LintPass for MissingDebugImplementations {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDebugImplementations {
|
||||
fn check_item(&mut self, cx: &LateContext, item: &hir::Item) {
|
||||
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
|
||||
if !cx.access_levels.is_reachable(item.id) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -681,7 +685,7 @@ impl LintPass for AnonymousParameters {
|
|||
}
|
||||
|
||||
impl EarlyLintPass for AnonymousParameters {
|
||||
fn check_trait_item(&mut self, cx: &EarlyContext, it: &ast::TraitItem) {
|
||||
fn check_trait_item(&mut self, cx: &EarlyContext<'_>, it: &ast::TraitItem) {
|
||||
match it.node {
|
||||
ast::TraitItemKind::Method(ref sig, _) => {
|
||||
for arg in sig.decl.inputs.iter() {
|
||||
|
|
@ -749,7 +753,7 @@ impl LintPass for DeprecatedAttr {
|
|||
}
|
||||
|
||||
impl EarlyLintPass for DeprecatedAttr {
|
||||
fn check_attribute(&mut self, cx: &EarlyContext, attr: &ast::Attribute) {
|
||||
fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &ast::Attribute) {
|
||||
for &&(n, _, _, ref g) in &self.depr_attrs {
|
||||
if attr.name() == n {
|
||||
if let &AttributeGate::Gated(Stability::Deprecated(link, suggestion),
|
||||
|
|
@ -804,15 +808,15 @@ impl UnusedDocComment {
|
|||
}
|
||||
|
||||
impl EarlyLintPass for UnusedDocComment {
|
||||
fn check_local(&mut self, cx: &EarlyContext, decl: &ast::Local) {
|
||||
fn check_local(&mut self, cx: &EarlyContext<'_>, decl: &ast::Local) {
|
||||
self.warn_if_doc(decl.attrs.iter(), cx);
|
||||
}
|
||||
|
||||
fn check_arm(&mut self, cx: &EarlyContext, arm: &ast::Arm) {
|
||||
fn check_arm(&mut self, cx: &EarlyContext<'_>, arm: &ast::Arm) {
|
||||
self.warn_if_doc(arm.attrs.iter(), cx);
|
||||
}
|
||||
|
||||
fn check_expr(&mut self, cx: &EarlyContext, expr: &ast::Expr) {
|
||||
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr) {
|
||||
self.warn_if_doc(expr.attrs.iter(), cx);
|
||||
}
|
||||
}
|
||||
|
|
@ -837,7 +841,7 @@ impl LintPass for PluginAsLibrary {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PluginAsLibrary {
|
||||
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
|
||||
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
|
||||
if cx.tcx.plugin_registrar_fn(LOCAL_CRATE).is_some() {
|
||||
// We're compiling a plugin; it's fine to link other plugins.
|
||||
return;
|
||||
|
|
@ -894,7 +898,7 @@ impl LintPass for InvalidNoMangleItems {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidNoMangleItems {
|
||||
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
|
||||
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
|
||||
match it.node {
|
||||
hir::ItemKind::Fn(.., ref generics, _) => {
|
||||
if let Some(no_mangle_attr) = attr::find_by_name(&it.attrs, "no_mangle") {
|
||||
|
|
@ -968,7 +972,7 @@ impl LintPass for MutableTransmutes {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes {
|
||||
fn check_expr(&mut self, cx: &LateContext, expr: &hir::Expr) {
|
||||
fn check_expr(&mut self, cx: &LateContext<'_, '_>, expr: &hir::Expr) {
|
||||
use rustc_target::spec::abi::Abi::RustIntrinsic;
|
||||
|
||||
let msg = "mutating transmuted &mut T from &T may cause undefined behavior, \
|
||||
|
|
@ -1004,7 +1008,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes {
|
|||
None
|
||||
}
|
||||
|
||||
fn def_id_is_transmute(cx: &LateContext, def_id: DefId) -> bool {
|
||||
fn def_id_is_transmute(cx: &LateContext<'_, '_>, def_id: DefId) -> bool {
|
||||
cx.tcx.fn_sig(def_id).abi() == RustIntrinsic &&
|
||||
cx.tcx.item_name(def_id) == "transmute"
|
||||
}
|
||||
|
|
@ -1032,7 +1036,7 @@ impl LintPass for UnstableFeatures {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnstableFeatures {
|
||||
fn check_attribute(&mut self, ctx: &LateContext, attr: &ast::Attribute) {
|
||||
fn check_attribute(&mut self, ctx: &LateContext<'_, '_>, attr: &ast::Attribute) {
|
||||
if attr.check_name("feature") {
|
||||
if let Some(items) = attr.meta_item_list() {
|
||||
for item in items {
|
||||
|
|
@ -1063,7 +1067,7 @@ impl LintPass for UnionsWithDropFields {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnionsWithDropFields {
|
||||
fn check_item(&mut self, ctx: &LateContext, item: &hir::Item) {
|
||||
fn check_item(&mut self, ctx: &LateContext<'_, '_>, item: &hir::Item) {
|
||||
if let hir::ItemKind::Union(ref vdata, _) = item.node {
|
||||
for field in vdata.fields() {
|
||||
let field_ty = ctx.tcx.type_of(ctx.tcx.hir().local_def_id(field.id));
|
||||
|
|
@ -1099,7 +1103,7 @@ impl LintPass for UnreachablePub {
|
|||
}
|
||||
|
||||
impl UnreachablePub {
|
||||
fn perform_lint(&self, cx: &LateContext, what: &str, id: ast::NodeId,
|
||||
fn perform_lint(&self, cx: &LateContext<'_, '_>, what: &str, id: ast::NodeId,
|
||||
vis: &hir::Visibility, span: Span, exportable: bool) {
|
||||
let mut applicability = Applicability::MachineApplicable;
|
||||
match vis.node {
|
||||
|
|
@ -1134,20 +1138,20 @@ impl UnreachablePub {
|
|||
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnreachablePub {
|
||||
fn check_item(&mut self, cx: &LateContext, item: &hir::Item) {
|
||||
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
|
||||
self.perform_lint(cx, "item", item.id, &item.vis, item.span, true);
|
||||
}
|
||||
|
||||
fn check_foreign_item(&mut self, cx: &LateContext, foreign_item: &hir::ForeignItem) {
|
||||
fn check_foreign_item(&mut self, cx: &LateContext<'_, '_>, foreign_item: &hir::ForeignItem) {
|
||||
self.perform_lint(cx, "item", foreign_item.id, &foreign_item.vis,
|
||||
foreign_item.span, true);
|
||||
}
|
||||
|
||||
fn check_struct_field(&mut self, cx: &LateContext, field: &hir::StructField) {
|
||||
fn check_struct_field(&mut self, cx: &LateContext<'_, '_>, field: &hir::StructField) {
|
||||
self.perform_lint(cx, "field", field.id, &field.vis, field.span, false);
|
||||
}
|
||||
|
||||
fn check_impl_item(&mut self, cx: &LateContext, impl_item: &hir::ImplItem) {
|
||||
fn check_impl_item(&mut self, cx: &LateContext<'_, '_>, impl_item: &hir::ImplItem) {
|
||||
self.perform_lint(cx, "item", impl_item.id, &impl_item.vis, impl_item.span, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -1193,7 +1197,7 @@ impl TypeAliasBounds {
|
|||
}
|
||||
}
|
||||
|
||||
fn suggest_changing_assoc_types(ty: &hir::Ty, err: &mut DiagnosticBuilder) {
|
||||
fn suggest_changing_assoc_types(ty: &hir::Ty, err: &mut DiagnosticBuilder<'_>) {
|
||||
// Access to associates types should use `<T as Bound>::Assoc`, which does not need a
|
||||
// bound. Let's see if this type does that.
|
||||
|
||||
|
|
@ -1225,7 +1229,7 @@ impl TypeAliasBounds {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeAliasBounds {
|
||||
fn check_item(&mut self, cx: &LateContext, item: &hir::Item) {
|
||||
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
|
||||
let (ty, type_alias_generics) = match item.node {
|
||||
hir::ItemKind::Ty(ref ty, ref generics) => (&*ty, generics),
|
||||
_ => return,
|
||||
|
|
@ -1281,7 +1285,7 @@ impl LintPass for UnusedBrokenConst {
|
|||
lint_array!()
|
||||
}
|
||||
}
|
||||
fn check_const(cx: &LateContext, body_id: hir::BodyId) {
|
||||
fn check_const(cx: &LateContext<'_, '_>, body_id: hir::BodyId) {
|
||||
let def_id = cx.tcx.hir().body_owner_def_id(body_id);
|
||||
let is_static = cx.tcx.is_static(def_id).is_some();
|
||||
let param_env = if is_static {
|
||||
|
|
@ -1299,7 +1303,7 @@ fn check_const(cx: &LateContext, body_id: hir::BodyId) {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedBrokenConst {
|
||||
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
|
||||
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
|
||||
match it.node {
|
||||
hir::ItemKind::Const(_, body_id) => {
|
||||
check_const(cx, body_id);
|
||||
|
|
@ -1429,7 +1433,7 @@ impl LintPass for EllipsisInclusiveRangePatterns {
|
|||
}
|
||||
|
||||
impl EarlyLintPass for EllipsisInclusiveRangePatterns {
|
||||
fn check_pat(&mut self, cx: &EarlyContext, pat: &ast::Pat, visit_subpats: &mut bool) {
|
||||
fn check_pat(&mut self, cx: &EarlyContext<'_>, pat: &ast::Pat, visit_subpats: &mut bool) {
|
||||
use self::ast::{PatKind, RangeEnd, RangeSyntax::DotDotDot};
|
||||
|
||||
/// If `pat` is a `...` pattern, return the start and end of the range, as well as the span
|
||||
|
|
@ -1507,7 +1511,7 @@ impl LintPass for UnnameableTestItems {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnnameableTestItems {
|
||||
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
|
||||
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
|
||||
if self.items_nameable {
|
||||
if let hir::ItemKind::Mod(..) = it.node {}
|
||||
else {
|
||||
|
|
@ -1526,7 +1530,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnnameableTestItems {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_item_post(&mut self, _cx: &LateContext, it: &hir::Item) {
|
||||
fn check_item_post(&mut self, _cx: &LateContext<'_, '_>, it: &hir::Item) {
|
||||
if !self.items_nameable && self.boundary == it.id {
|
||||
self.items_nameable = true;
|
||||
}
|
||||
|
|
@ -1554,7 +1558,7 @@ impl LintPass for KeywordIdents {
|
|||
}
|
||||
|
||||
impl KeywordIdents {
|
||||
fn check_tokens(&mut self, cx: &EarlyContext, tokens: TokenStream) {
|
||||
fn check_tokens(&mut self, cx: &EarlyContext<'_>, tokens: TokenStream) {
|
||||
for tt in tokens.into_trees() {
|
||||
match tt {
|
||||
TokenTree::Token(span, tok) => match tok.ident() {
|
||||
|
|
@ -1576,13 +1580,13 @@ impl KeywordIdents {
|
|||
}
|
||||
|
||||
impl EarlyLintPass for KeywordIdents {
|
||||
fn check_mac_def(&mut self, cx: &EarlyContext, mac_def: &ast::MacroDef, _id: ast::NodeId) {
|
||||
fn check_mac_def(&mut self, cx: &EarlyContext<'_>, mac_def: &ast::MacroDef, _id: ast::NodeId) {
|
||||
self.check_tokens(cx, mac_def.stream());
|
||||
}
|
||||
fn check_mac(&mut self, cx: &EarlyContext, mac: &ast::Mac) {
|
||||
fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &ast::Mac) {
|
||||
self.check_tokens(cx, mac.node.tts.clone().into());
|
||||
}
|
||||
fn check_ident(&mut self, cx: &EarlyContext, ident: ast::Ident) {
|
||||
fn check_ident(&mut self, cx: &EarlyContext<'_>, ident: ast::Ident) {
|
||||
let ident_str = &ident.as_str()[..];
|
||||
let cur_edition = cx.sess.edition();
|
||||
let is_raw_ident = |ident: ast::Ident| {
|
||||
|
|
@ -1665,7 +1669,7 @@ impl LintPass for ExplicitOutlivesRequirements {
|
|||
impl ExplicitOutlivesRequirements {
|
||||
fn collect_outlives_bound_spans(
|
||||
&self,
|
||||
cx: &LateContext,
|
||||
cx: &LateContext<'_, '_>,
|
||||
item_def_id: DefId,
|
||||
param_name: &str,
|
||||
bounds: &hir::GenericBounds,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
use syntax::{register_diagnostic, register_diagnostics};
|
||||
|
||||
register_diagnostics! {
|
||||
E0721, // `await` keyword
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,15 +19,10 @@
|
|||
|
||||
#![recursion_limit="256"]
|
||||
|
||||
#[macro_use]
|
||||
extern crate syntax;
|
||||
#![deny(rust_2018_idioms)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate rustc;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate rustc_target;
|
||||
extern crate syntax_pos;
|
||||
extern crate rustc_data_structures;
|
||||
|
||||
mod diagnostics;
|
||||
mod nonstandard_style;
|
||||
|
|
@ -49,7 +44,6 @@ use rustc::lint::builtin::{
|
|||
parser::ILL_FORMED_ATTRIBUTE_INPUT,
|
||||
};
|
||||
use rustc::session;
|
||||
use rustc::util;
|
||||
use rustc::hir;
|
||||
|
||||
use syntax::ast;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use rustc::hir::{self, GenericParamKind, PatKind};
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::hir::intravisit::FnKind;
|
||||
use rustc::lint;
|
||||
use rustc::ty;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use lint::{EarlyContext, LateContext, LintContext, LintArray};
|
||||
|
|
@ -17,7 +18,7 @@ pub enum MethodLateContext {
|
|||
PlainImpl,
|
||||
}
|
||||
|
||||
pub fn method_context(cx: &LateContext, id: ast::NodeId) -> MethodLateContext {
|
||||
pub fn method_context(cx: &LateContext<'_, '_>, id: ast::NodeId) -> MethodLateContext {
|
||||
let def_id = cx.tcx.hir().local_def_id(id);
|
||||
let item = cx.tcx.associated_item(def_id);
|
||||
match item.container {
|
||||
|
|
@ -41,7 +42,7 @@ declare_lint! {
|
|||
pub struct NonCamelCaseTypes;
|
||||
|
||||
impl NonCamelCaseTypes {
|
||||
fn check_case(&self, cx: &EarlyContext, sort: &str, ident: &Ident) {
|
||||
fn check_case(&self, cx: &EarlyContext<'_>, sort: &str, ident: &Ident) {
|
||||
fn char_has_case(c: char) -> bool {
|
||||
c.is_lowercase() || c.is_uppercase()
|
||||
}
|
||||
|
|
@ -115,7 +116,7 @@ impl LintPass for NonCamelCaseTypes {
|
|||
}
|
||||
|
||||
impl EarlyLintPass for NonCamelCaseTypes {
|
||||
fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
|
||||
fn check_item(&mut self, cx: &EarlyContext<'_>, it: &ast::Item) {
|
||||
let has_repr_c = it.attrs
|
||||
.iter()
|
||||
.any(|attr| {
|
||||
|
|
@ -138,11 +139,11 @@ impl EarlyLintPass for NonCamelCaseTypes {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_variant(&mut self, cx: &EarlyContext, v: &ast::Variant, _: &ast::Generics) {
|
||||
fn check_variant(&mut self, cx: &EarlyContext<'_>, v: &ast::Variant, _: &ast::Generics) {
|
||||
self.check_case(cx, "variant", &v.node.ident);
|
||||
}
|
||||
|
||||
fn check_generic_param(&mut self, cx: &EarlyContext, param: &ast::GenericParam) {
|
||||
fn check_generic_param(&mut self, cx: &EarlyContext<'_>, param: &ast::GenericParam) {
|
||||
if let ast::GenericParamKind::Type { .. } = param.kind {
|
||||
self.check_case(cx, "type parameter", ¶m.ident);
|
||||
}
|
||||
|
|
@ -190,7 +191,7 @@ impl NonSnakeCase {
|
|||
}
|
||||
|
||||
/// Checks if a given identifier is snake case, and reports a diagnostic if not.
|
||||
fn check_snake_case(&self, cx: &LateContext, sort: &str, ident: &Ident) {
|
||||
fn check_snake_case(&self, cx: &LateContext<'_, '_>, sort: &str, ident: &Ident) {
|
||||
fn is_snake_case(ident: &str) -> bool {
|
||||
if ident.is_empty() {
|
||||
return true;
|
||||
|
|
@ -249,7 +250,7 @@ impl LintPass for NonSnakeCase {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
|
||||
fn check_crate(&mut self, cx: &LateContext, cr: &hir::Crate) {
|
||||
fn check_crate(&mut self, cx: &LateContext<'_, '_>, cr: &hir::Crate) {
|
||||
let crate_ident = if let Some(name) = &cx.tcx.sess.opts.crate_name {
|
||||
Some(Ident::from_str(name))
|
||||
} else {
|
||||
|
|
@ -286,7 +287,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_generic_param(&mut self, cx: &LateContext, param: &hir::GenericParam) {
|
||||
fn check_generic_param(&mut self, cx: &LateContext<'_, '_>, param: &hir::GenericParam) {
|
||||
if let GenericParamKind::Lifetime { .. } = param.kind {
|
||||
self.check_snake_case(cx, "lifetime", ¶m.name.ident());
|
||||
}
|
||||
|
|
@ -294,8 +295,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
|
|||
|
||||
fn check_fn(
|
||||
&mut self,
|
||||
cx: &LateContext,
|
||||
fk: FnKind,
|
||||
cx: &LateContext<'_, '_>,
|
||||
fk: FnKind<'_>,
|
||||
_: &hir::FnDecl,
|
||||
_: &hir::Body,
|
||||
_: Span,
|
||||
|
|
@ -324,13 +325,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
|
||||
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
|
||||
if let hir::ItemKind::Mod(_) = it.node {
|
||||
self.check_snake_case(cx, "module", &it.ident);
|
||||
}
|
||||
}
|
||||
|
||||
fn check_trait_item(&mut self, cx: &LateContext, item: &hir::TraitItem) {
|
||||
fn check_trait_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::TraitItem) {
|
||||
if let hir::TraitItemKind::Method(_, hir::TraitMethod::Required(pnames)) = &item.node {
|
||||
self.check_snake_case(cx, "trait method", &item.ident);
|
||||
for param_name in pnames {
|
||||
|
|
@ -339,7 +340,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_pat(&mut self, cx: &LateContext, p: &hir::Pat) {
|
||||
fn check_pat(&mut self, cx: &LateContext<'_, '_>, p: &hir::Pat) {
|
||||
if let &PatKind::Binding(_, _, _, ident, _) = &p.node {
|
||||
self.check_snake_case(cx, "variable", &ident);
|
||||
}
|
||||
|
|
@ -347,7 +348,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
|
|||
|
||||
fn check_struct_def(
|
||||
&mut self,
|
||||
cx: &LateContext,
|
||||
cx: &LateContext<'_, '_>,
|
||||
s: &hir::VariantData,
|
||||
_: ast::Name,
|
||||
_: &hir::Generics,
|
||||
|
|
@ -369,7 +370,7 @@ declare_lint! {
|
|||
pub struct NonUpperCaseGlobals;
|
||||
|
||||
impl NonUpperCaseGlobals {
|
||||
fn check_upper_case(cx: &LateContext, sort: &str, ident: &Ident) {
|
||||
fn check_upper_case(cx: &LateContext<'_, '_>, sort: &str, ident: &Ident) {
|
||||
let name = &ident.name.as_str();
|
||||
|
||||
if name.chars().any(|c| c.is_lowercase()) {
|
||||
|
|
@ -399,7 +400,7 @@ impl LintPass for NonUpperCaseGlobals {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals {
|
||||
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
|
||||
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
|
||||
match it.node {
|
||||
hir::ItemKind::Static(..) if !attr::contains_name(&it.attrs, "no_mangle") => {
|
||||
NonUpperCaseGlobals::check_upper_case(cx, "static variable", &it.ident);
|
||||
|
|
@ -411,19 +412,19 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_trait_item(&mut self, cx: &LateContext, ti: &hir::TraitItem) {
|
||||
fn check_trait_item(&mut self, cx: &LateContext<'_, '_>, ti: &hir::TraitItem) {
|
||||
if let hir::TraitItemKind::Const(..) = ti.node {
|
||||
NonUpperCaseGlobals::check_upper_case(cx, "associated constant", &ti.ident);
|
||||
}
|
||||
}
|
||||
|
||||
fn check_impl_item(&mut self, cx: &LateContext, ii: &hir::ImplItem) {
|
||||
fn check_impl_item(&mut self, cx: &LateContext<'_, '_>, ii: &hir::ImplItem) {
|
||||
if let hir::ImplItemKind::Const(..) = ii.node {
|
||||
NonUpperCaseGlobals::check_upper_case(cx, "associated constant", &ii.ident);
|
||||
}
|
||||
}
|
||||
|
||||
fn check_pat(&mut self, cx: &LateContext, p: &hir::Pat) {
|
||||
fn check_pat(&mut self, cx: &LateContext<'_, '_>, p: &hir::Pat) {
|
||||
// Lint for constants that look like binding identifiers (#7526)
|
||||
if let PatKind::Path(hir::QPath::Resolved(None, ref path)) = p.node {
|
||||
if let Def::Const(..) = path.def {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use rustc::hir::Node;
|
|||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt};
|
||||
use rustc::ty::layout::{self, IntegerExt, LayoutOf, VariantIdx};
|
||||
use rustc::{lint, util};
|
||||
use rustc_data_structures::indexed_vec::Idx;
|
||||
use util::nodemap::FxHashSet;
|
||||
use lint::{LateContext, LintContext, LintArray};
|
||||
|
|
@ -23,6 +24,8 @@ use rustc::hir;
|
|||
|
||||
use rustc::mir::interpret::{sign_extend, truncate};
|
||||
|
||||
use log::debug;
|
||||
|
||||
declare_lint! {
|
||||
UNUSED_COMPARISONS,
|
||||
Warn,
|
||||
|
|
@ -241,7 +244,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_limits(cx: &LateContext,
|
||||
fn check_limits(cx: &LateContext<'_, '_>,
|
||||
binop: hir::BinOp,
|
||||
l: &hir::Expr,
|
||||
r: &hir::Expr)
|
||||
|
|
@ -298,7 +301,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_bin_hex_repr(cx: &LateContext, lit: &ast::Lit) -> Option<String> {
|
||||
fn get_bin_hex_repr(cx: &LateContext<'_, '_>, lit: &ast::Lit) -> Option<String> {
|
||||
let src = cx.sess().source_map().span_to_snippet(lit.span).ok()?;
|
||||
let firstch = src.chars().next()?;
|
||||
|
||||
|
|
@ -320,7 +323,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
|
|||
//
|
||||
// No suggestion for: `isize`, `usize`.
|
||||
fn get_type_suggestion<'a>(
|
||||
t: &ty::TyKind,
|
||||
t: &ty::TyKind<'_>,
|
||||
val: u128,
|
||||
negative: bool,
|
||||
) -> Option<String> {
|
||||
|
|
@ -364,9 +367,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
|
|||
}
|
||||
|
||||
fn report_bin_hex_error(
|
||||
cx: &LateContext,
|
||||
cx: &LateContext<'_, '_>,
|
||||
expr: &hir::Expr,
|
||||
ty: ty::TyKind,
|
||||
ty: ty::TyKind<'_>,
|
||||
repr_str: String,
|
||||
val: u128,
|
||||
negative: bool,
|
||||
|
|
@ -481,7 +484,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
|||
fn check_type_for_ffi(&self,
|
||||
cache: &mut FxHashSet<Ty<'tcx>>,
|
||||
ty: Ty<'tcx>) -> FfiResult<'tcx> {
|
||||
use self::FfiResult::*;
|
||||
use FfiResult::*;
|
||||
|
||||
let cx = self.cx.tcx;
|
||||
|
||||
|
|
@ -799,7 +802,7 @@ impl LintPass for ImproperCTypes {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImproperCTypes {
|
||||
fn check_foreign_item(&mut self, cx: &LateContext, it: &hir::ForeignItem) {
|
||||
fn check_foreign_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::ForeignItem) {
|
||||
let mut vis = ImproperCTypesVisitor { cx };
|
||||
let abi = cx.tcx.hir().get_foreign_abi(it.id);
|
||||
if abi != Abi::RustIntrinsic && abi != Abi::PlatformIntrinsic {
|
||||
|
|
@ -829,7 +832,7 @@ impl LintPass for VariantSizeDifferences {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for VariantSizeDifferences {
|
||||
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
|
||||
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
|
||||
if let hir::ItemKind::Enum(ref enum_definition, _) = it.node {
|
||||
let item_def_id = cx.tcx.hir().local_def_id(it.id);
|
||||
let t = cx.tcx.type_of(item_def_id);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use rustc::hir::def::Def;
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::lint;
|
||||
use rustc::ty;
|
||||
use rustc::ty::adjustment;
|
||||
use lint::{LateContext, EarlyContext, LintContext, LintArray};
|
||||
|
|
@ -16,6 +17,8 @@ use syntax_pos::Span;
|
|||
|
||||
use rustc::hir;
|
||||
|
||||
use log::debug;
|
||||
|
||||
declare_lint! {
|
||||
pub UNUSED_MUST_USE,
|
||||
Warn,
|
||||
|
|
@ -43,7 +46,7 @@ impl LintPass for UnusedResults {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
|
||||
fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) {
|
||||
fn check_stmt(&mut self, cx: &LateContext<'_, '_>, s: &hir::Stmt) {
|
||||
let expr = match s.node {
|
||||
hir::StmtKind::Semi(ref expr) => &**expr,
|
||||
_ => return,
|
||||
|
|
@ -168,7 +171,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
|
|||
}
|
||||
|
||||
fn check_must_use(
|
||||
cx: &LateContext,
|
||||
cx: &LateContext<'_, '_>,
|
||||
def_id: DefId,
|
||||
sp: Span,
|
||||
descr_pre_path: &str,
|
||||
|
|
@ -212,7 +215,7 @@ impl LintPass for PathStatements {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PathStatements {
|
||||
fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) {
|
||||
fn check_stmt(&mut self, cx: &LateContext<'_, '_>, s: &hir::Stmt) {
|
||||
if let hir::StmtKind::Semi(ref expr) = s.node {
|
||||
if let hir::ExprKind::Path(_) = expr.node {
|
||||
cx.span_lint(PATH_STATEMENTS, s.span, "path statement with no effect");
|
||||
|
|
@ -241,7 +244,7 @@ impl LintPass for UnusedAttributes {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedAttributes {
|
||||
fn check_attribute(&mut self, cx: &LateContext, attr: &ast::Attribute) {
|
||||
fn check_attribute(&mut self, cx: &LateContext<'_, '_>, attr: &ast::Attribute) {
|
||||
debug!("checking attribute: {:?}", attr);
|
||||
// Note that check_name() marks the attribute as used if it matches.
|
||||
for &(name, ty, ..) in BUILTIN_ATTRIBUTES {
|
||||
|
|
@ -303,7 +306,7 @@ pub struct UnusedParens;
|
|||
|
||||
impl UnusedParens {
|
||||
fn check_unused_parens_expr(&self,
|
||||
cx: &EarlyContext,
|
||||
cx: &EarlyContext<'_>,
|
||||
value: &ast::Expr,
|
||||
msg: &str,
|
||||
followed_by_block: bool) {
|
||||
|
|
@ -325,7 +328,7 @@ impl UnusedParens {
|
|||
}
|
||||
|
||||
fn check_unused_parens_pat(&self,
|
||||
cx: &EarlyContext,
|
||||
cx: &EarlyContext<'_>,
|
||||
value: &ast::Pat,
|
||||
msg: &str) {
|
||||
if let ast::PatKind::Paren(_) = value.node {
|
||||
|
|
@ -339,7 +342,7 @@ impl UnusedParens {
|
|||
}
|
||||
}
|
||||
|
||||
fn remove_outer_parens(cx: &EarlyContext, span: Span, pattern: &str, msg: &str) {
|
||||
fn remove_outer_parens(cx: &EarlyContext<'_>, span: Span, pattern: &str, msg: &str) {
|
||||
let span_msg = format!("unnecessary parentheses around {}", msg);
|
||||
let mut err = cx.struct_span_lint(UNUSED_PARENS, span, &span_msg);
|
||||
let mut ate_left_paren = false;
|
||||
|
|
@ -387,7 +390,7 @@ impl LintPass for UnusedParens {
|
|||
}
|
||||
|
||||
impl EarlyLintPass for UnusedParens {
|
||||
fn check_expr(&mut self, cx: &EarlyContext, e: &ast::Expr) {
|
||||
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
|
||||
use syntax::ast::ExprKind::*;
|
||||
let (value, msg, followed_by_block) = match e.node {
|
||||
If(ref cond, ..) => (cond, "`if` condition", true),
|
||||
|
|
@ -429,7 +432,7 @@ impl EarlyLintPass for UnusedParens {
|
|||
self.check_unused_parens_expr(cx, &value, msg, followed_by_block);
|
||||
}
|
||||
|
||||
fn check_pat(&mut self, cx: &EarlyContext, p: &ast::Pat, _: &mut bool) {
|
||||
fn check_pat(&mut self, cx: &EarlyContext<'_>, p: &ast::Pat, _: &mut bool) {
|
||||
use ast::PatKind::{Paren, Range};
|
||||
// The lint visitor will visit each subpattern of `p`. We do not want to lint any range
|
||||
// pattern no matter where it occurs in the pattern. For something like `&(a..=b)`, there
|
||||
|
|
@ -443,7 +446,7 @@ impl EarlyLintPass for UnusedParens {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_stmt(&mut self, cx: &EarlyContext, s: &ast::Stmt) {
|
||||
fn check_stmt(&mut self, cx: &EarlyContext<'_>, s: &ast::Stmt) {
|
||||
if let ast::StmtKind::Local(ref local) = s.node {
|
||||
if let Some(ref value) = local.init {
|
||||
self.check_unused_parens_expr(cx, &value, "assigned value", false);
|
||||
|
|
@ -462,7 +465,7 @@ declare_lint! {
|
|||
pub struct UnusedImportBraces;
|
||||
|
||||
impl UnusedImportBraces {
|
||||
fn check_use_tree(&self, cx: &EarlyContext, use_tree: &ast::UseTree, item: &ast::Item) {
|
||||
fn check_use_tree(&self, cx: &EarlyContext<'_>, use_tree: &ast::UseTree, item: &ast::Item) {
|
||||
if let ast::UseTreeKind::Nested(ref items) = use_tree.kind {
|
||||
// Recursively check nested UseTrees
|
||||
for &(ref tree, _) in items {
|
||||
|
|
@ -509,7 +512,7 @@ impl LintPass for UnusedImportBraces {
|
|||
}
|
||||
|
||||
impl EarlyLintPass for UnusedImportBraces {
|
||||
fn check_item(&mut self, cx: &EarlyContext, item: &ast::Item) {
|
||||
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &ast::Item) {
|
||||
if let ast::ItemKind::Use(ref use_tree) = item.node {
|
||||
self.check_use_tree(cx, use_tree, item);
|
||||
}
|
||||
|
|
@ -536,7 +539,7 @@ impl LintPass for UnusedAllocation {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedAllocation {
|
||||
fn check_expr(&mut self, cx: &LateContext, e: &hir::Expr) {
|
||||
fn check_expr(&mut self, cx: &LateContext<'_, '_>, e: &hir::Expr) {
|
||||
match e.node {
|
||||
hir::ExprKind::Box(_) => {}
|
||||
_ => return,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
authors = ["The Rust Project Developers"]
|
||||
name = "rustc_metadata"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "rustc_metadata"
|
||||
|
|
@ -14,7 +15,7 @@ log = "0.4"
|
|||
memmap = "0.6"
|
||||
rustc = { path = "../librustc" }
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
rustc_errors = { path = "../librustc_errors" }
|
||||
errors = { path = "../librustc_errors", package = "rustc_errors" }
|
||||
rustc_target = { path = "../librustc_target" }
|
||||
serialize = { path = "../libserialize" }
|
||||
stable_deref_trait = "1.0.0"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
//! Validates all used crates and extern libraries and loads their metadata
|
||||
|
||||
use cstore::{self, CStore, CrateSource, MetadataBlob};
|
||||
use locator::{self, CratePaths};
|
||||
use decoder::proc_macro_def_path_table;
|
||||
use schema::CrateRoot;
|
||||
use crate::cstore::{self, CStore, CrateSource, MetadataBlob};
|
||||
use crate::locator::{self, CratePaths};
|
||||
use crate::decoder::proc_macro_def_path_table;
|
||||
use crate::schema::CrateRoot;
|
||||
use rustc_data_structures::sync::{Lrc, RwLock, Lock};
|
||||
|
||||
use rustc::hir::def_id::CrateNum;
|
||||
|
|
@ -29,8 +29,9 @@ use syntax::attr;
|
|||
use syntax::ext::base::SyntaxExtension;
|
||||
use syntax::symbol::Symbol;
|
||||
use syntax::visit;
|
||||
use syntax::{span_err, span_fatal};
|
||||
use syntax_pos::{Span, DUMMY_SP};
|
||||
use log;
|
||||
use log::{debug, info, log_enabled};
|
||||
|
||||
pub struct Library {
|
||||
pub dylib: Option<(PathBuf, PathKind)>,
|
||||
|
|
@ -342,7 +343,7 @@ impl<'a> CrateLoader<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
fn load(&mut self, locate_ctxt: &mut locator::Context) -> Option<LoadResult> {
|
||||
fn load(&mut self, locate_ctxt: &mut locator::Context<'_>) -> Option<LoadResult> {
|
||||
let library = locate_ctxt.maybe_load_library_crate()?;
|
||||
|
||||
// In the case that we're loading a crate, but not matching
|
||||
|
|
@ -427,7 +428,7 @@ impl<'a> CrateLoader<'a> {
|
|||
// The map from crate numbers in the crate we're resolving to local crate numbers.
|
||||
// We map 0 and all other holes in the map to our parent crate. The "additional"
|
||||
// self-dependencies should be harmless.
|
||||
::std::iter::once(krate).chain(crate_root.crate_deps
|
||||
std::iter::once(krate).chain(crate_root.crate_deps
|
||||
.decode(metadata)
|
||||
.map(|dep| {
|
||||
info!("resolving dep crate {} hash: `{}` extra filename: `{}`", dep.name, dep.hash,
|
||||
|
|
@ -522,7 +523,7 @@ impl<'a> CrateLoader<'a> {
|
|||
fn load_derive_macros(&mut self, root: &CrateRoot, dylib: Option<PathBuf>, span: Span)
|
||||
-> Vec<(ast::Name, Lrc<SyntaxExtension>)> {
|
||||
use std::{env, mem};
|
||||
use dynamic_lib::DynamicLibrary;
|
||||
use crate::dynamic_lib::DynamicLibrary;
|
||||
use proc_macro::bridge::client::ProcMacro;
|
||||
use syntax_ext::deriving::custom::ProcMacroDerive;
|
||||
use syntax_ext::proc_macro_impl::{AttrProcMacro, BangProcMacro};
|
||||
|
|
@ -996,7 +997,7 @@ impl<'a> CrateLoader<'a> {
|
|||
item.ident, orig_name);
|
||||
let orig_name = match orig_name {
|
||||
Some(orig_name) => {
|
||||
::validate_crate_name(Some(self.sess), &orig_name.as_str(),
|
||||
crate::validate_crate_name(Some(self.sess), &orig_name.as_str(),
|
||||
Some(item.span));
|
||||
orig_name
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// The crate store - a central repo for information collected about external
|
||||
// crates and libraries
|
||||
|
||||
use schema;
|
||||
use crate::schema;
|
||||
use rustc::hir::def_id::{CrateNum, DefIndex};
|
||||
use rustc::hir::map::definitions::DefPathTable;
|
||||
use rustc::middle::cstore::{DepKind, ExternCrate, MetadataLoader};
|
||||
|
|
@ -19,7 +19,7 @@ pub use rustc::middle::cstore::{NativeLibrary, NativeLibraryKind, LinkagePrefere
|
|||
pub use rustc::middle::cstore::NativeLibraryKind::*;
|
||||
pub use rustc::middle::cstore::{CrateSource, LibSource, ForeignModule};
|
||||
|
||||
pub use cstore_impl::{provide, provide_extern};
|
||||
pub use crate::cstore_impl::{provide, provide_extern};
|
||||
|
||||
// A map from external crate numbers (as decoded from some crate file) to
|
||||
// local crate numbers (as generated during this session). Each external
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use cstore::{self, LoadedMacro};
|
||||
use encoder;
|
||||
use link_args;
|
||||
use native_libs;
|
||||
use foreign_modules;
|
||||
use schema;
|
||||
use crate::cstore::{self, LoadedMacro};
|
||||
use crate::encoder;
|
||||
use crate::link_args;
|
||||
use crate::native_libs;
|
||||
use crate::foreign_modules;
|
||||
use crate::schema;
|
||||
|
||||
use rustc::ty::query::QueryConfig;
|
||||
use rustc::middle::cstore::{CrateStore, DepKind,
|
||||
|
|
@ -51,7 +51,7 @@ macro_rules! provide {
|
|||
index: CRATE_DEF_INDEX
|
||||
});
|
||||
let dep_node = def_path_hash
|
||||
.to_dep_node(::rustc::dep_graph::DepKind::CrateMetadata);
|
||||
.to_dep_node(rustc::dep_graph::DepKind::CrateMetadata);
|
||||
// The DepNodeIndex of the DepNode::CrateMetadata should be
|
||||
// cached somewhere, so that we can use read_index().
|
||||
$tcx.dep_graph.read(dep_node);
|
||||
|
|
@ -421,7 +421,7 @@ impl cstore::CStore {
|
|||
use syntax::ext::base::SyntaxExtension;
|
||||
use syntax_ext::proc_macro_impl::BangProcMacro;
|
||||
|
||||
let client = ::proc_macro::bridge::client::Client::expand1(::proc_macro::quote);
|
||||
let client = proc_macro::bridge::client::Client::expand1(proc_macro::quote);
|
||||
let ext = SyntaxExtension::ProcMacro {
|
||||
expander: Box::new(BangProcMacro { client }),
|
||||
allow_internal_unstable: true,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Decoding metadata from a single crate's metadata
|
||||
|
||||
use cstore::{self, CrateMetadata, MetadataBlob, NativeLibrary, ForeignModule};
|
||||
use schema::*;
|
||||
use crate::cstore::{self, CrateMetadata, MetadataBlob, NativeLibrary, ForeignModule};
|
||||
use crate::schema::*;
|
||||
|
||||
use rustc_data_structures::sync::{Lrc, ReadGuard};
|
||||
use rustc::hir::map::{DefKey, DefPath, DefPathData, DefPathHash, Definitions};
|
||||
|
|
@ -34,6 +34,7 @@ use syntax::symbol::InternedString;
|
|||
use syntax::ext::base::{MacroKind, SyntaxExtension};
|
||||
use syntax::ext::hygiene::Mark;
|
||||
use syntax_pos::{self, Span, BytePos, Pos, DUMMY_SP, NO_EXPANSION};
|
||||
use log::debug;
|
||||
|
||||
pub struct DecodeContext<'a, 'tcx: 'a> {
|
||||
opaque: opaque::Decoder<'a>,
|
||||
|
|
@ -545,7 +546,7 @@ impl<'a, 'tcx> CrateMetadata {
|
|||
|
||||
fn get_variant(&self,
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
item: &Entry,
|
||||
item: &Entry<'_>,
|
||||
index: DefIndex,
|
||||
adt_kind: ty::AdtKind)
|
||||
-> ty::VariantDef
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#![allow(non_snake_case)]
|
||||
|
||||
use syntax::{register_diagnostic, register_diagnostics, register_long_diagnostics};
|
||||
|
||||
register_long_diagnostics! {
|
||||
E0454: r##"
|
||||
A link name was given with an empty name. Erroneous code example:
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ impl DynamicLibrary {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use libc;
|
||||
use std::mem;
|
||||
|
||||
#[test]
|
||||
|
|
@ -127,7 +126,6 @@ mod tests {
|
|||
|
||||
#[cfg(unix)]
|
||||
mod dl {
|
||||
use libc;
|
||||
use std::ffi::{CStr, OsStr, CString};
|
||||
use std::os::unix::prelude::*;
|
||||
use std::ptr;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use index::Index;
|
||||
use index_builder::{FromId, IndexBuilder, Untracked};
|
||||
use isolated_encoder::IsolatedEncoder;
|
||||
use schema::*;
|
||||
use crate::index::Index;
|
||||
use crate::index_builder::{FromId, IndexBuilder, Untracked};
|
||||
use crate::isolated_encoder::IsolatedEncoder;
|
||||
use crate::schema::*;
|
||||
|
||||
use rustc::middle::cstore::{LinkagePreference, NativeLibrary,
|
||||
EncodedMetadata, ForeignModule};
|
||||
|
|
@ -34,6 +34,7 @@ use syntax::attr;
|
|||
use syntax::source_map::Spanned;
|
||||
use syntax::symbol::keywords;
|
||||
use syntax_pos::{self, hygiene, FileName, SourceFile, Span};
|
||||
use log::{debug, trace};
|
||||
|
||||
use rustc::hir::{self, PatKind};
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
|
|
@ -1521,7 +1522,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
|||
// symbol associated with them (they weren't translated) or if they're an FFI
|
||||
// definition (as that's not defined in this crate).
|
||||
fn encode_exported_symbols(&mut self,
|
||||
exported_symbols: &[(ExportedSymbol, SymbolExportLevel)])
|
||||
exported_symbols: &[(ExportedSymbol<'_>, SymbolExportLevel)])
|
||||
-> EncodedExportedSymbols {
|
||||
// The metadata symbol name is special. It should not show up in
|
||||
// downstream crates.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
use schema::*;
|
||||
use crate::schema::*;
|
||||
|
||||
use rustc::hir::def_id::{DefId, DefIndex, DefIndexAddressSpace};
|
||||
use rustc_serialize::opaque::Encoder;
|
||||
use std::slice;
|
||||
use std::u32;
|
||||
use log::debug;
|
||||
|
||||
/// While we are generating the metadata, we also track the position
|
||||
/// of each DefIndex. It is not required that all definitions appear
|
||||
|
|
@ -24,12 +25,12 @@ impl Index {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn record(&mut self, def_id: DefId, entry: Lazy<Entry>) {
|
||||
pub fn record(&mut self, def_id: DefId, entry: Lazy<Entry<'_>>) {
|
||||
assert!(def_id.is_local());
|
||||
self.record_index(def_id.index, entry);
|
||||
}
|
||||
|
||||
pub fn record_index(&mut self, item: DefIndex, entry: Lazy<Entry>) {
|
||||
pub fn record_index(&mut self, item: DefIndex, entry: Lazy<Entry<'_>>) {
|
||||
assert!(entry.position < (u32::MAX as usize));
|
||||
let position = entry.position as u32;
|
||||
let space_index = item.address_space().index();
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@
|
|||
//! give a callback fn, rather than taking a closure: it allows us to
|
||||
//! easily control precisely what data is given to that fn.
|
||||
|
||||
use encoder::EncodeContext;
|
||||
use index::Index;
|
||||
use schema::*;
|
||||
use isolated_encoder::IsolatedEncoder;
|
||||
use crate::encoder::EncodeContext;
|
||||
use crate::index::Index;
|
||||
use crate::schema::*;
|
||||
use crate::isolated_encoder::IsolatedEncoder;
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::DefId;
|
||||
|
|
@ -133,21 +133,21 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> {
|
|||
/// `DefId` index, or implement the `read` method so that it can add
|
||||
/// a read of whatever dep-graph nodes are appropriate.
|
||||
pub trait DepGraphRead {
|
||||
fn read(&self, tcx: TyCtxt);
|
||||
fn read(&self, tcx: TyCtxt<'_, '_, '_>);
|
||||
}
|
||||
|
||||
impl DepGraphRead for DefId {
|
||||
fn read(&self, _tcx: TyCtxt) {}
|
||||
fn read(&self, _tcx: TyCtxt<'_, '_, '_>) {}
|
||||
}
|
||||
|
||||
impl DepGraphRead for ast::NodeId {
|
||||
fn read(&self, _tcx: TyCtxt) {}
|
||||
fn read(&self, _tcx: TyCtxt<'_, '_, '_>) {}
|
||||
}
|
||||
|
||||
impl<T> DepGraphRead for Option<T>
|
||||
where T: DepGraphRead
|
||||
{
|
||||
fn read(&self, tcx: TyCtxt) {
|
||||
fn read(&self, tcx: TyCtxt<'_, '_, '_>) {
|
||||
match *self {
|
||||
Some(ref v) => v.read(tcx),
|
||||
None => (),
|
||||
|
|
@ -158,7 +158,7 @@ impl<T> DepGraphRead for Option<T>
|
|||
impl<T> DepGraphRead for [T]
|
||||
where T: DepGraphRead
|
||||
{
|
||||
fn read(&self, tcx: TyCtxt) {
|
||||
fn read(&self, tcx: TyCtxt<'_, '_, '_>) {
|
||||
for i in self {
|
||||
i.read(tcx);
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ macro_rules! read_tuple {
|
|||
where $($name: DepGraphRead),*
|
||||
{
|
||||
#[allow(non_snake_case)]
|
||||
fn read(&self, tcx: TyCtxt) {
|
||||
fn read(&self, tcx: TyCtxt<'_, '_, '_>) {
|
||||
let &($(ref $name),*) = self;
|
||||
$($name.read(tcx);)*
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ read_tuple!(A, B, C);
|
|||
macro_rules! read_hir {
|
||||
($t:ty) => {
|
||||
impl<'tcx> DepGraphRead for &'tcx $t {
|
||||
fn read(&self, tcx: TyCtxt) {
|
||||
fn read(&self, tcx: TyCtxt<'_, '_, '_>) {
|
||||
tcx.hir().read(self.id);
|
||||
}
|
||||
}
|
||||
|
|
@ -208,7 +208,7 @@ read_hir!(hir::MacroDef);
|
|||
pub struct Untracked<T>(pub T);
|
||||
|
||||
impl<T> DepGraphRead for Untracked<T> {
|
||||
fn read(&self, _tcx: TyCtxt) {}
|
||||
fn read(&self, _tcx: TyCtxt<'_, '_, '_>) {}
|
||||
}
|
||||
|
||||
/// Newtype that can be used to package up misc data extracted from a
|
||||
|
|
@ -218,7 +218,7 @@ impl<T> DepGraphRead for Untracked<T> {
|
|||
pub struct FromId<T>(pub ast::NodeId, pub T);
|
||||
|
||||
impl<T> DepGraphRead for FromId<T> {
|
||||
fn read(&self, tcx: TyCtxt) {
|
||||
fn read(&self, tcx: TyCtxt<'_, '_, '_>) {
|
||||
tcx.hir().read(self.0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use encoder::EncodeContext;
|
||||
use schema::{Lazy, LazySeq};
|
||||
use crate::encoder::EncodeContext;
|
||||
use crate::schema::{Lazy, LazySeq};
|
||||
use rustc::ty::TyCtxt;
|
||||
use rustc_serialize::Encodable;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,23 +13,15 @@
|
|||
|
||||
#![recursion_limit="256"]
|
||||
|
||||
#![deny(rust_2018_idioms)]
|
||||
|
||||
extern crate libc;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate memmap;
|
||||
extern crate stable_deref_trait;
|
||||
#[macro_use]
|
||||
extern crate syntax;
|
||||
extern crate syntax_pos;
|
||||
extern crate flate2;
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate serialize as rustc_serialize; // used by deriving
|
||||
extern crate rustc_errors as errors;
|
||||
extern crate syntax_ext;
|
||||
extern crate proc_macro;
|
||||
|
||||
#[macro_use]
|
||||
extern crate rustc;
|
||||
extern crate rustc_target;
|
||||
#[macro_use]
|
||||
extern crate rustc_data_structures;
|
||||
|
||||
|
|
|
|||
|
|
@ -212,9 +212,9 @@
|
|||
//! no means all of the necessary details. Take a look at the rest of
|
||||
//! metadata::locator or metadata::creader for all the juicy details!
|
||||
|
||||
use cstore::{MetadataRef, MetadataBlob};
|
||||
use creader::Library;
|
||||
use schema::{METADATA_HEADER, rustc_version};
|
||||
use crate::cstore::{MetadataRef, MetadataBlob};
|
||||
use crate::creader::Library;
|
||||
use crate::schema::{METADATA_HEADER, rustc_version};
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::svh::Svh;
|
||||
|
|
@ -226,6 +226,7 @@ use rustc::util::nodemap::FxHashMap;
|
|||
|
||||
use errors::DiagnosticBuilder;
|
||||
use syntax::symbol::Symbol;
|
||||
use syntax::struct_span_err;
|
||||
use syntax_pos::Span;
|
||||
use rustc_target::spec::{Target, TargetTriple};
|
||||
|
||||
|
|
@ -241,6 +242,8 @@ use flate2::read::DeflateDecoder;
|
|||
|
||||
use rustc_data_structures::owning_ref::OwningRef;
|
||||
|
||||
use log::{debug, info, warn};
|
||||
|
||||
pub struct CrateMismatch {
|
||||
path: PathBuf,
|
||||
got: String,
|
||||
|
|
@ -283,7 +286,7 @@ enum CrateFlavor {
|
|||
}
|
||||
|
||||
impl fmt::Display for CrateFlavor {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_str(match *self {
|
||||
CrateFlavor::Rlib => "rlib",
|
||||
CrateFlavor::Rmeta => "rmeta",
|
||||
|
|
@ -600,7 +603,7 @@ impl<'a> Context<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
let mut err: Option<DiagnosticBuilder> = None;
|
||||
let mut err: Option<DiagnosticBuilder<'_>> = None;
|
||||
for (lib, kind) in m {
|
||||
info!("{} reading metadata from: {}", flavor, lib.display());
|
||||
let (hash, metadata) =
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use syntax::attr;
|
|||
use syntax::source_map::Span;
|
||||
use syntax::feature_gate::{self, GateIssue};
|
||||
use syntax::symbol::Symbol;
|
||||
use syntax::{span_err, struct_span_err};
|
||||
|
||||
pub fn collect<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Vec<NativeLibrary> {
|
||||
let mut collector = Collector {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use index;
|
||||
use crate::index;
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::hir::def::{self, CtorKind};
|
||||
|
|
@ -518,7 +518,7 @@ pub enum AssociatedContainer {
|
|||
ImplFinal,
|
||||
}
|
||||
|
||||
impl_stable_hash_for!(enum ::schema::AssociatedContainer {
|
||||
impl_stable_hash_for!(enum crate::schema::AssociatedContainer {
|
||||
TraitRequired,
|
||||
TraitWithDefault,
|
||||
ImplDefault,
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue