mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
Auto merge of #43710 - zackmdavis:field_init_shorthand_power_slam, r=Mark-Simulacrum
use field init shorthand EVERYWHERE
Like #43008 (f668999
), but [(lacking reasons to be more timid)](https://github.com/rust-lang/rust/pull/43008#issuecomment-312463564) _much more aggressive_.
r? @Mark-Simulacrum
This commit is contained in:
commit
6f4ab9458a
@ -193,7 +193,7 @@ pub struct ShouldRun<'a> {
|
||||
impl<'a> ShouldRun<'a> {
|
||||
fn new(builder: &'a Builder) -> ShouldRun<'a> {
|
||||
ShouldRun {
|
||||
builder: builder,
|
||||
builder,
|
||||
paths: BTreeSet::new(),
|
||||
is_really_default: true, // by default no additional conditions
|
||||
}
|
||||
@ -278,9 +278,9 @@ impl<'a> Builder<'a> {
|
||||
};
|
||||
|
||||
let builder = Builder {
|
||||
build: build,
|
||||
build,
|
||||
top_stage: build.config.stage.unwrap_or(2),
|
||||
kind: kind,
|
||||
kind,
|
||||
cache: Cache::new(),
|
||||
stack: RefCell::new(Vec::new()),
|
||||
};
|
||||
@ -309,9 +309,9 @@ impl<'a> Builder<'a> {
|
||||
};
|
||||
|
||||
let builder = Builder {
|
||||
build: build,
|
||||
build,
|
||||
top_stage: build.config.stage.unwrap_or(2),
|
||||
kind: kind,
|
||||
kind,
|
||||
cache: Cache::new(),
|
||||
stack: RefCell::new(Vec::new()),
|
||||
};
|
||||
|
@ -872,7 +872,7 @@ impl Step for CrateLibrustc {
|
||||
builder.ensure(CrateLibrustc {
|
||||
compiler,
|
||||
target: run.target,
|
||||
test_kind: test_kind,
|
||||
test_kind,
|
||||
krate: name,
|
||||
});
|
||||
};
|
||||
@ -934,8 +934,8 @@ impl Step for Crate {
|
||||
builder.ensure(Crate {
|
||||
compiler,
|
||||
target: run.target,
|
||||
mode: mode,
|
||||
test_kind: test_kind,
|
||||
mode,
|
||||
test_kind,
|
||||
krate: name,
|
||||
});
|
||||
};
|
||||
|
@ -74,13 +74,13 @@ impl Step for Std {
|
||||
let from = builder.compiler(1, build.build);
|
||||
builder.ensure(Std {
|
||||
compiler: from,
|
||||
target: target,
|
||||
target,
|
||||
});
|
||||
println!("Uplifting stage1 std ({} -> {})", from.host, target);
|
||||
builder.ensure(StdLink {
|
||||
compiler: from,
|
||||
target_compiler: compiler,
|
||||
target: target,
|
||||
target,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -100,7 +100,7 @@ impl Step for Std {
|
||||
builder.ensure(StdLink {
|
||||
compiler: builder.compiler(compiler.stage, build.build),
|
||||
target_compiler: compiler,
|
||||
target: target,
|
||||
target,
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -202,7 +202,7 @@ impl Step for StdLink {
|
||||
|
||||
builder.ensure(tool::CleanTools {
|
||||
compiler: target_compiler,
|
||||
target: target,
|
||||
target,
|
||||
mode: Mode::Libstd,
|
||||
});
|
||||
}
|
||||
@ -326,13 +326,13 @@ impl Step for Test {
|
||||
if build.force_use_stage1(compiler, target) {
|
||||
builder.ensure(Test {
|
||||
compiler: builder.compiler(1, build.build),
|
||||
target: target,
|
||||
target,
|
||||
});
|
||||
println!("Uplifting stage1 test ({} -> {})", &build.build, target);
|
||||
builder.ensure(TestLink {
|
||||
compiler: builder.compiler(1, build.build),
|
||||
target_compiler: compiler,
|
||||
target: target,
|
||||
target,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -351,7 +351,7 @@ impl Step for Test {
|
||||
builder.ensure(TestLink {
|
||||
compiler: builder.compiler(compiler.stage, build.build),
|
||||
target_compiler: compiler,
|
||||
target: target,
|
||||
target,
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -398,7 +398,7 @@ impl Step for TestLink {
|
||||
&libtest_stamp(build, compiler, target));
|
||||
builder.ensure(tool::CleanTools {
|
||||
compiler: target_compiler,
|
||||
target: target,
|
||||
target,
|
||||
mode: Mode::Libtest,
|
||||
});
|
||||
}
|
||||
@ -445,7 +445,7 @@ impl Step for Rustc {
|
||||
if build.force_use_stage1(compiler, target) {
|
||||
builder.ensure(Rustc {
|
||||
compiler: builder.compiler(1, build.build),
|
||||
target: target,
|
||||
target,
|
||||
});
|
||||
println!("Uplifting stage1 rustc ({} -> {})", &build.build, target);
|
||||
builder.ensure(RustcLink {
|
||||
@ -581,7 +581,7 @@ impl Step for RustcLink {
|
||||
&librustc_stamp(build, compiler, target));
|
||||
builder.ensure(tool::CleanTools {
|
||||
compiler: target_compiler,
|
||||
target: target,
|
||||
target,
|
||||
mode: Mode::Librustc,
|
||||
});
|
||||
}
|
||||
|
@ -213,13 +213,13 @@ impl Step for TheBook {
|
||||
let name = self.name;
|
||||
// build book first edition
|
||||
builder.ensure(Rustbook {
|
||||
target: target,
|
||||
target,
|
||||
name: INTERNER.intern_string(format!("{}/first-edition", name)),
|
||||
});
|
||||
|
||||
// build book second edition
|
||||
builder.ensure(Rustbook {
|
||||
target: target,
|
||||
target,
|
||||
name: INTERNER.intern_string(format!("{}/second-edition", name)),
|
||||
});
|
||||
|
||||
|
@ -274,14 +274,14 @@ Arguments:
|
||||
}
|
||||
"test" => {
|
||||
Subcommand::Test {
|
||||
paths: paths,
|
||||
paths,
|
||||
test_args: matches.opt_strs("test-args"),
|
||||
fail_fast: !matches.opt_present("no-fail-fast"),
|
||||
}
|
||||
}
|
||||
"bench" => {
|
||||
Subcommand::Bench {
|
||||
paths: paths,
|
||||
paths,
|
||||
test_args: matches.opt_strs("test-args"),
|
||||
}
|
||||
}
|
||||
@ -297,12 +297,12 @@ Arguments:
|
||||
}
|
||||
"dist" => {
|
||||
Subcommand::Dist {
|
||||
paths: paths,
|
||||
paths,
|
||||
}
|
||||
}
|
||||
"install" => {
|
||||
Subcommand::Install {
|
||||
paths: paths,
|
||||
paths,
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
@ -324,7 +324,7 @@ Arguments:
|
||||
|
||||
Flags {
|
||||
verbose: matches.opt_count("verbose"),
|
||||
stage: stage,
|
||||
stage,
|
||||
on_fail: matches.opt_str("on-fail"),
|
||||
keep_stage: matches.opt_str("keep-stage").map(|j| j.parse().unwrap()),
|
||||
build: matches.opt_str("build").map(|s| INTERNER.intern_string(s)),
|
||||
@ -333,9 +333,9 @@ Arguments:
|
||||
target: split(matches.opt_strs("target"))
|
||||
.into_iter().map(|x| INTERNER.intern_string(x)).collect::<Vec<_>>(),
|
||||
config: cfg_file,
|
||||
src: src,
|
||||
src,
|
||||
jobs: matches.opt_str("jobs").map(|j| j.parse().unwrap()),
|
||||
cmd: cmd,
|
||||
cmd,
|
||||
incremental: matches.opt_present("incremental"),
|
||||
}
|
||||
}
|
||||
|
@ -314,19 +314,19 @@ impl Build {
|
||||
hosts: config.hosts.clone(),
|
||||
targets: config.targets.clone(),
|
||||
|
||||
config: config,
|
||||
src: src,
|
||||
out: out,
|
||||
config,
|
||||
src,
|
||||
out,
|
||||
|
||||
rust_info: rust_info,
|
||||
cargo_info: cargo_info,
|
||||
rls_info: rls_info,
|
||||
rust_info,
|
||||
cargo_info,
|
||||
rls_info,
|
||||
cc: HashMap::new(),
|
||||
cxx: HashMap::new(),
|
||||
crates: HashMap::new(),
|
||||
lldb_version: None,
|
||||
lldb_python_dir: None,
|
||||
is_sudo: is_sudo,
|
||||
is_sudo,
|
||||
ci_env: CiEnv::current(),
|
||||
delayed_failures: Cell::new(0),
|
||||
}
|
||||
|
@ -75,10 +75,10 @@ fn build_krate(build: &mut Build, krate: &str) {
|
||||
doc_step: format!("doc-crate-{}", name),
|
||||
test_step: format!("test-crate-{}", name),
|
||||
bench_step: format!("bench-crate-{}", name),
|
||||
name: name,
|
||||
name,
|
||||
version: package.version,
|
||||
deps: Vec::new(),
|
||||
path: path,
|
||||
path,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ impl<T> Arc<T> {
|
||||
let x: Box<_> = box ArcInner {
|
||||
strong: atomic::AtomicUsize::new(1),
|
||||
weak: atomic::AtomicUsize::new(1),
|
||||
data: data,
|
||||
data,
|
||||
};
|
||||
Arc { ptr: Shared::from(Box::into_unique(x)) }
|
||||
}
|
||||
|
@ -853,9 +853,9 @@ impl<'a, T> Hole<'a, T> {
|
||||
debug_assert!(pos < data.len());
|
||||
let elt = ptr::read(&data[pos]);
|
||||
Hole {
|
||||
data: data,
|
||||
data,
|
||||
elt: Some(elt),
|
||||
pos: pos,
|
||||
pos,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1203,7 +1203,7 @@ where T: Clone + Ord {
|
||||
let place = Placer::make_place(self.data.place_back());
|
||||
BinaryHeapPlace {
|
||||
heap: ptr,
|
||||
place: place,
|
||||
place,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ fn make_place<T>() -> IntermediateBox<T> {
|
||||
|
||||
IntermediateBox {
|
||||
ptr: p,
|
||||
layout: layout,
|
||||
layout,
|
||||
marker: marker::PhantomData,
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ impl<K, Q: ?Sized> super::Recover<Q> for BTreeMap<K, ()>
|
||||
match search::search_tree(self.root.as_mut(), key) {
|
||||
Found(handle) => {
|
||||
Some(OccupiedEntry {
|
||||
handle: handle,
|
||||
handle,
|
||||
length: &mut self.length,
|
||||
_marker: PhantomData,
|
||||
}
|
||||
@ -250,8 +250,8 @@ impl<K, Q: ?Sized> super::Recover<Q> for BTreeMap<K, ()>
|
||||
Found(handle) => Some(mem::replace(handle.into_kv_mut().0, key)),
|
||||
GoDown(handle) => {
|
||||
VacantEntry {
|
||||
key: key,
|
||||
handle: handle,
|
||||
key,
|
||||
handle,
|
||||
length: &mut self.length,
|
||||
_marker: PhantomData,
|
||||
}
|
||||
@ -695,7 +695,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
|
||||
match search::search_tree(self.root.as_mut(), key) {
|
||||
Found(handle) => {
|
||||
Some(OccupiedEntry {
|
||||
handle: handle,
|
||||
handle,
|
||||
length: &mut self.length,
|
||||
_marker: PhantomData,
|
||||
}
|
||||
@ -866,15 +866,15 @@ impl<K: Ord, V> BTreeMap<K, V> {
|
||||
match search::search_tree(self.root.as_mut(), &key) {
|
||||
Found(handle) => {
|
||||
Occupied(OccupiedEntry {
|
||||
handle: handle,
|
||||
handle,
|
||||
length: &mut self.length,
|
||||
_marker: PhantomData,
|
||||
})
|
||||
}
|
||||
GoDown(handle) => {
|
||||
Vacant(VacantEntry {
|
||||
key: key,
|
||||
handle: handle,
|
||||
key,
|
||||
handle,
|
||||
length: &mut self.length,
|
||||
_marker: PhantomData,
|
||||
})
|
||||
|
@ -776,8 +776,8 @@ impl<BorrowType, K, V, NodeType> Handle<NodeRef<BorrowType, K, V, NodeType>, mar
|
||||
debug_assert!(idx < node.len());
|
||||
|
||||
Handle {
|
||||
node: node,
|
||||
idx: idx,
|
||||
node,
|
||||
idx,
|
||||
_marker: PhantomData
|
||||
}
|
||||
}
|
||||
@ -850,8 +850,8 @@ impl<BorrowType, K, V, NodeType>
|
||||
debug_assert!(idx <= node.len());
|
||||
|
||||
Handle {
|
||||
node: node,
|
||||
idx: idx,
|
||||
node,
|
||||
idx,
|
||||
_marker: PhantomData
|
||||
}
|
||||
}
|
||||
@ -1149,7 +1149,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
|
||||
|
||||
let mut new_root = Root {
|
||||
node: BoxedNode::from_internal(new_node),
|
||||
height: height
|
||||
height,
|
||||
};
|
||||
|
||||
for i in 0..(new_len+1) {
|
||||
@ -1449,12 +1449,12 @@ impl<BorrowType, K, V, HandleType>
|
||||
> {
|
||||
match self.node.force() {
|
||||
ForceResult::Leaf(node) => ForceResult::Leaf(Handle {
|
||||
node: node,
|
||||
node,
|
||||
idx: self.idx,
|
||||
_marker: PhantomData
|
||||
}),
|
||||
ForceResult::Internal(node) => ForceResult::Internal(Handle {
|
||||
node: node,
|
||||
node,
|
||||
idx: self.idx,
|
||||
_marker: PhantomData
|
||||
})
|
||||
|
@ -140,7 +140,7 @@ impl<T> Node<T> {
|
||||
Node {
|
||||
next: None,
|
||||
prev: None,
|
||||
element: element,
|
||||
element,
|
||||
}
|
||||
}
|
||||
|
||||
@ -924,7 +924,7 @@ impl<'a, T> IterMut<'a, T> {
|
||||
let node = Some(Shared::from(Box::into_unique(box Node {
|
||||
next: Some(head),
|
||||
prev: Some(prev),
|
||||
element: element,
|
||||
element,
|
||||
})));
|
||||
|
||||
prev.as_mut().next = node;
|
||||
|
@ -60,8 +60,8 @@ impl<T, A: Alloc> RawVec<T, A> {
|
||||
// Unique::empty() doubles as "unallocated" and "zero-sized allocation"
|
||||
RawVec {
|
||||
ptr: Unique::empty(),
|
||||
cap: cap,
|
||||
a: a,
|
||||
cap,
|
||||
a,
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,8 +104,8 @@ impl<T, A: Alloc> RawVec<T, A> {
|
||||
|
||||
RawVec {
|
||||
ptr: Unique::new_unchecked(ptr as *mut _),
|
||||
cap: cap,
|
||||
a: a,
|
||||
cap,
|
||||
a,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -159,8 +159,8 @@ impl<T, A: Alloc> RawVec<T, A> {
|
||||
pub unsafe fn from_raw_parts_in(ptr: *mut T, cap: usize, a: A) -> Self {
|
||||
RawVec {
|
||||
ptr: Unique::new_unchecked(ptr),
|
||||
cap: cap,
|
||||
a: a,
|
||||
cap,
|
||||
a,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -176,7 +176,7 @@ impl<T> RawVec<T, Heap> {
|
||||
pub unsafe fn from_raw_parts(ptr: *mut T, cap: usize) -> Self {
|
||||
RawVec {
|
||||
ptr: Unique::new_unchecked(ptr),
|
||||
cap: cap,
|
||||
cap,
|
||||
a: Heap,
|
||||
}
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ impl<T> Rc<T> {
|
||||
ptr: Shared::from(Box::into_unique(box RcBox {
|
||||
strong: Cell::new(1),
|
||||
weak: Cell::new(1),
|
||||
value: value,
|
||||
value,
|
||||
})),
|
||||
}
|
||||
}
|
||||
|
@ -1886,7 +1886,7 @@ fn merge_sort<T, F>(v: &mut [T], mut is_less: F)
|
||||
|
||||
// Push this run onto the stack.
|
||||
runs.push(Run {
|
||||
start: start,
|
||||
start,
|
||||
len: end - start,
|
||||
});
|
||||
end = start;
|
||||
|
@ -1378,8 +1378,8 @@ impl String {
|
||||
let chars_iter = self[start..end].chars();
|
||||
|
||||
Drain {
|
||||
start: start,
|
||||
end: end,
|
||||
start,
|
||||
end,
|
||||
iter: chars_iter,
|
||||
string: self_ptr,
|
||||
}
|
||||
@ -1442,11 +1442,11 @@ impl String {
|
||||
let chars_iter = self[start..end].chars();
|
||||
|
||||
Splice {
|
||||
start: start,
|
||||
end: end,
|
||||
start,
|
||||
end,
|
||||
iter: chars_iter,
|
||||
string: self_ptr,
|
||||
replace_with: replace_with
|
||||
replace_with,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1728,9 +1728,9 @@ impl<T> IntoIterator for Vec<T> {
|
||||
mem::forget(self);
|
||||
IntoIter {
|
||||
buf: Shared::new_unchecked(begin),
|
||||
cap: cap,
|
||||
cap,
|
||||
ptr: begin,
|
||||
end: end,
|
||||
end,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2442,7 +2442,7 @@ impl<T> From<Vec<T>> for VecDeque<T> {
|
||||
VecDeque {
|
||||
tail: 0,
|
||||
head: len,
|
||||
buf: buf,
|
||||
buf,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ struct PadAdapter<'a, 'b: 'a> {
|
||||
impl<'a, 'b: 'a> PadAdapter<'a, 'b> {
|
||||
fn new(fmt: &'a mut fmt::Formatter<'b>) -> PadAdapter<'a, 'b> {
|
||||
PadAdapter {
|
||||
fmt: fmt,
|
||||
fmt,
|
||||
on_newline: false,
|
||||
}
|
||||
}
|
||||
@ -94,8 +94,8 @@ pub fn debug_struct_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>,
|
||||
-> DebugStruct<'a, 'b> {
|
||||
let result = fmt.write_str(name);
|
||||
DebugStruct {
|
||||
fmt: fmt,
|
||||
result: result,
|
||||
fmt,
|
||||
result,
|
||||
has_fields: false,
|
||||
}
|
||||
}
|
||||
@ -185,8 +185,8 @@ pub struct DebugTuple<'a, 'b: 'a> {
|
||||
pub fn debug_tuple_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>, name: &str) -> DebugTuple<'a, 'b> {
|
||||
let result = fmt.write_str(name);
|
||||
DebugTuple {
|
||||
fmt: fmt,
|
||||
result: result,
|
||||
fmt,
|
||||
result,
|
||||
fields: 0,
|
||||
empty_name: name.is_empty(),
|
||||
}
|
||||
@ -317,8 +317,8 @@ pub fn debug_set_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugSet<'a, 'b
|
||||
let result = write!(fmt, "{{");
|
||||
DebugSet {
|
||||
inner: DebugInner {
|
||||
fmt: fmt,
|
||||
result: result,
|
||||
fmt,
|
||||
result,
|
||||
has_fields: false,
|
||||
},
|
||||
}
|
||||
@ -388,8 +388,8 @@ pub fn debug_list_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugList<'a,
|
||||
let result = write!(fmt, "[");
|
||||
DebugList {
|
||||
inner: DebugInner {
|
||||
fmt: fmt,
|
||||
result: result,
|
||||
fmt,
|
||||
result,
|
||||
has_fields: false,
|
||||
},
|
||||
}
|
||||
@ -460,8 +460,8 @@ pub struct DebugMap<'a, 'b: 'a> {
|
||||
pub fn debug_map_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugMap<'a, 'b> {
|
||||
let result = write!(fmt, "{{");
|
||||
DebugMap {
|
||||
fmt: fmt,
|
||||
result: result,
|
||||
fmt,
|
||||
result,
|
||||
has_fields: false,
|
||||
}
|
||||
}
|
||||
|
@ -334,9 +334,9 @@ impl<'a> Arguments<'a> {
|
||||
pub fn new_v1(pieces: &'a [&'a str],
|
||||
args: &'a [ArgumentV1<'a>]) -> Arguments<'a> {
|
||||
Arguments {
|
||||
pieces: pieces,
|
||||
pieces,
|
||||
fmt: None,
|
||||
args: args
|
||||
args,
|
||||
}
|
||||
}
|
||||
|
||||
@ -353,9 +353,9 @@ impl<'a> Arguments<'a> {
|
||||
args: &'a [ArgumentV1<'a>],
|
||||
fmt: &'a [rt::v1::Argument]) -> Arguments<'a> {
|
||||
Arguments {
|
||||
pieces: pieces,
|
||||
pieces,
|
||||
fmt: Some(fmt),
|
||||
args: args
|
||||
args,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -840,8 +840,8 @@ impl<A, B> ZipImpl<A, B> for Zip<A, B>
|
||||
type Item = (A::Item, B::Item);
|
||||
default fn new(a: A, b: B) -> Self {
|
||||
Zip {
|
||||
a: a,
|
||||
b: b,
|
||||
a,
|
||||
b,
|
||||
index: 0, // unused
|
||||
len: 0, // unused
|
||||
}
|
||||
@ -903,10 +903,10 @@ impl<A, B> ZipImpl<A, B> for Zip<A, B>
|
||||
fn new(a: A, b: B) -> Self {
|
||||
let len = cmp::min(a.len(), b.len());
|
||||
Zip {
|
||||
a: a,
|
||||
b: b,
|
||||
a,
|
||||
b,
|
||||
index: 0,
|
||||
len: len,
|
||||
len,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -744,7 +744,7 @@ impl<I, T, E> ResultShunt<I, E>
|
||||
|
||||
fn new(iter: I) -> Self {
|
||||
ResultShunt {
|
||||
iter: iter,
|
||||
iter,
|
||||
error: None,
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ impl Fp {
|
||||
assert_eq!(self.f << edelta >> edelta, self.f);
|
||||
Fp {
|
||||
f: self.f << edelta,
|
||||
e: e,
|
||||
e,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ pub fn to_shortest_str<'a, T, F>(mut format_shortest: F, v: T,
|
||||
}
|
||||
FullDecoded::Finite(ref decoded) => {
|
||||
let (len, exp) = format_shortest(decoded, buf);
|
||||
Formatted { sign: sign,
|
||||
Formatted { sign,
|
||||
parts: digits_to_dec_str(&buf[..len], exp, frac_digits, parts) }
|
||||
}
|
||||
}
|
||||
@ -581,7 +581,7 @@ pub fn to_exact_exp_str<'a, T, F>(mut format_exact: F, v: T,
|
||||
|
||||
let trunc = if ndigits < maxlen { ndigits } else { maxlen };
|
||||
let (len, exp) = format_exact(decoded, &mut buf[..trunc], i16::MIN);
|
||||
Formatted { sign: sign,
|
||||
Formatted { sign,
|
||||
parts: digits_to_exp_str(&buf[..len], exp, ndigits, upper, parts) }
|
||||
}
|
||||
}
|
||||
@ -652,7 +652,7 @@ pub fn to_exact_fixed_str<'a, T, F>(mut format_exact: F, v: T,
|
||||
Formatted { sign: sign, parts: &parts[..1] }
|
||||
}
|
||||
} else {
|
||||
Formatted { sign: sign,
|
||||
Formatted { sign,
|
||||
parts: digits_to_dec_str(&buf[..len], exp, frac_digits, parts) }
|
||||
}
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ impl<T> SliceExt for [T] {
|
||||
{
|
||||
Split {
|
||||
v: self,
|
||||
pred: pred,
|
||||
pred,
|
||||
finished: false
|
||||
}
|
||||
}
|
||||
|
@ -2233,7 +2233,7 @@ impl StrExt for str {
|
||||
fn splitn<'a, P: Pattern<'a>>(&'a self, count: usize, pat: P) -> SplitN<'a, P> {
|
||||
SplitN(SplitNInternal {
|
||||
iter: self.split(pat).0,
|
||||
count: count,
|
||||
count,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ impl<'a, C: CharEq> Pattern<'a> for CharEqPattern<C> {
|
||||
fn into_searcher(self, haystack: &'a str) -> CharEqSearcher<'a, C> {
|
||||
CharEqSearcher {
|
||||
ascii_only: self.0.only_ascii(),
|
||||
haystack: haystack,
|
||||
haystack,
|
||||
char_eq: self.0,
|
||||
char_indices: haystack.char_indices(),
|
||||
}
|
||||
@ -596,8 +596,8 @@ impl<'a, 'b> StrSearcher<'a, 'b> {
|
||||
fn new(haystack: &'a str, needle: &'b str) -> StrSearcher<'a, 'b> {
|
||||
if needle.is_empty() {
|
||||
StrSearcher {
|
||||
haystack: haystack,
|
||||
needle: needle,
|
||||
haystack,
|
||||
needle,
|
||||
searcher: StrSearcherImpl::Empty(EmptyNeedle {
|
||||
position: 0,
|
||||
end: haystack.len(),
|
||||
@ -607,8 +607,8 @@ impl<'a, 'b> StrSearcher<'a, 'b> {
|
||||
}
|
||||
} else {
|
||||
StrSearcher {
|
||||
haystack: haystack,
|
||||
needle: needle,
|
||||
haystack,
|
||||
needle,
|
||||
searcher: StrSearcherImpl::TwoWay(
|
||||
TwoWaySearcher::new(needle.as_bytes(), haystack.len())
|
||||
),
|
||||
@ -899,13 +899,13 @@ impl TwoWaySearcher {
|
||||
TwoWaySearcher::reverse_maximal_suffix(needle, period, true));
|
||||
|
||||
TwoWaySearcher {
|
||||
crit_pos: crit_pos,
|
||||
crit_pos_back: crit_pos_back,
|
||||
period: period,
|
||||
crit_pos,
|
||||
crit_pos_back,
|
||||
period,
|
||||
byteset: Self::byteset_create(&needle[..period]),
|
||||
|
||||
position: 0,
|
||||
end: end,
|
||||
end,
|
||||
memory: 0,
|
||||
memory_back: needle.len(),
|
||||
}
|
||||
@ -918,13 +918,13 @@ impl TwoWaySearcher {
|
||||
// reverse search.
|
||||
|
||||
TwoWaySearcher {
|
||||
crit_pos: crit_pos,
|
||||
crit_pos,
|
||||
crit_pos_back: crit_pos,
|
||||
period: cmp::max(crit_pos, needle.len() - crit_pos) + 1,
|
||||
byteset: Self::byteset_create(needle),
|
||||
|
||||
position: 0,
|
||||
end: end,
|
||||
end,
|
||||
memory: usize::MAX, // Dummy value to signify that the period is long
|
||||
memory_back: usize::MAX,
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ pub struct CycleIter<'a, T: 'a> {
|
||||
pub fn cycle<T>(data: &[T]) -> CycleIter<T> {
|
||||
CycleIter {
|
||||
index: 0,
|
||||
data: data,
|
||||
data,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ fn test_get_resource() {
|
||||
|
||||
fn r(i: Rc<RefCell<isize>>) -> R {
|
||||
R {
|
||||
i: i
|
||||
i,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ impl<'a> Parser<'a> {
|
||||
|
||||
Argument {
|
||||
position: pos,
|
||||
format: format,
|
||||
format,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,28 +250,28 @@ impl OptGroup {
|
||||
(0, _) => {
|
||||
Opt {
|
||||
name: Long((long_name)),
|
||||
hasarg: hasarg,
|
||||
occur: occur,
|
||||
hasarg,
|
||||
occur,
|
||||
aliases: Vec::new(),
|
||||
}
|
||||
}
|
||||
(1, 0) => {
|
||||
Opt {
|
||||
name: Short(short_name.chars().next().unwrap()),
|
||||
hasarg: hasarg,
|
||||
occur: occur,
|
||||
hasarg,
|
||||
occur,
|
||||
aliases: Vec::new(),
|
||||
}
|
||||
}
|
||||
(1, _) => {
|
||||
Opt {
|
||||
name: Long((long_name)),
|
||||
hasarg: hasarg,
|
||||
occur: occur,
|
||||
hasarg,
|
||||
occur,
|
||||
aliases: vec![Opt {
|
||||
name: Short(short_name.chars().next().unwrap()),
|
||||
hasarg: hasarg,
|
||||
occur: occur,
|
||||
hasarg,
|
||||
occur,
|
||||
aliases: Vec::new(),
|
||||
}],
|
||||
}
|
||||
@ -530,8 +530,8 @@ pub fn opt(short_name: &str,
|
||||
long_name: long_name.to_owned(),
|
||||
hint: hint.to_owned(),
|
||||
desc: desc.to_owned(),
|
||||
hasarg: hasarg,
|
||||
occur: occur,
|
||||
hasarg,
|
||||
occur,
|
||||
}
|
||||
}
|
||||
|
||||
@ -681,9 +681,9 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result {
|
||||
}
|
||||
}
|
||||
Ok(Matches {
|
||||
opts: opts,
|
||||
vals: vals,
|
||||
free: free,
|
||||
opts,
|
||||
vals,
|
||||
free,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -781,10 +781,10 @@ mod tests {
|
||||
|
||||
fn edge(from: usize, to: usize, label: &'static str, style: Style) -> Edge {
|
||||
Edge {
|
||||
from: from,
|
||||
to: to,
|
||||
label: label,
|
||||
style: style,
|
||||
from,
|
||||
to,
|
||||
label,
|
||||
style,
|
||||
}
|
||||
}
|
||||
|
||||
@ -848,9 +848,9 @@ mod tests {
|
||||
-> LabelledGraph {
|
||||
let count = node_labels.len();
|
||||
LabelledGraph {
|
||||
name: name,
|
||||
name,
|
||||
node_labels: node_labels.to_opt_strs(),
|
||||
edges: edges,
|
||||
edges,
|
||||
node_styles: match node_styles {
|
||||
Some(nodes) => nodes,
|
||||
None => vec![Style::None; count],
|
||||
|
@ -74,7 +74,7 @@ pub unsafe fn panic(data: Box<Any + Send>) -> u32 {
|
||||
let exception = Box::new(Exception {
|
||||
_uwe: uw::_Unwind_Exception {
|
||||
exception_class: rust_exception_class(),
|
||||
exception_cleanup: exception_cleanup,
|
||||
exception_cleanup,
|
||||
private: [0; uw::unwinder_private_data_size],
|
||||
},
|
||||
cause: Some(data),
|
||||
|
@ -127,9 +127,9 @@ impl GammaLargeShape {
|
||||
fn new_raw(shape: f64, scale: f64) -> GammaLargeShape {
|
||||
let d = shape - 1. / 3.;
|
||||
GammaLargeShape {
|
||||
scale: scale,
|
||||
scale,
|
||||
c: 1. / (9. * d).sqrt(),
|
||||
d: d,
|
||||
d,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ impl<'a, T: Clone> WeightedChoice<'a, T> {
|
||||
"WeightedChoice::new called with a total weight of 0");
|
||||
|
||||
WeightedChoice {
|
||||
items: items,
|
||||
items,
|
||||
// we're likely to be generating numbers in this range
|
||||
// relatively often, so might as well cache it
|
||||
weight_range: Range::new(0, running_total),
|
||||
|
@ -103,8 +103,8 @@ impl Normal {
|
||||
pub fn new(mean: f64, std_dev: f64) -> Normal {
|
||||
assert!(std_dev >= 0.0, "Normal::new called with `std_dev` < 0");
|
||||
Normal {
|
||||
mean: mean,
|
||||
std_dev: std_dev,
|
||||
mean,
|
||||
std_dev,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ macro_rules! integer_impl {
|
||||
let zone = unsigned_max - unsigned_max % range;
|
||||
|
||||
Range {
|
||||
low: low,
|
||||
low,
|
||||
range: range as $ty,
|
||||
accept_zone: zone as $ty
|
||||
}
|
||||
@ -143,7 +143,7 @@ macro_rules! float_impl {
|
||||
impl SampleRange for $ty {
|
||||
fn construct_range(low: $ty, high: $ty) -> Range<$ty> {
|
||||
Range {
|
||||
low: low,
|
||||
low,
|
||||
range: high - low,
|
||||
accept_zone: 0.0 // unused
|
||||
}
|
||||
|
@ -418,10 +418,10 @@ impl Rand for XorShiftRng {
|
||||
}
|
||||
let (x, y, z, w) = tuple;
|
||||
XorShiftRng {
|
||||
x: x,
|
||||
y: y,
|
||||
z: z,
|
||||
w: w,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
w,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,10 +38,10 @@ impl<R: Rng, Rsdr: Reseeder<R>> ReseedingRng<R, Rsdr> {
|
||||
/// * `reseeder`: the reseeding object to use.
|
||||
pub fn new(rng: R, generation_threshold: usize, reseeder: Rsdr) -> ReseedingRng<R, Rsdr> {
|
||||
ReseedingRng {
|
||||
rng: rng,
|
||||
generation_threshold: generation_threshold,
|
||||
rng,
|
||||
generation_threshold,
|
||||
bytes_generated: 0,
|
||||
reseeder: reseeder,
|
||||
reseeder,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -630,8 +630,8 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
||||
let krate = tcx.hir.krate();
|
||||
let live_symbols = find_live(tcx, access_levels, krate);
|
||||
let mut visitor = DeadVisitor {
|
||||
tcx: tcx,
|
||||
live_symbols: live_symbols,
|
||||
tcx,
|
||||
live_symbols,
|
||||
};
|
||||
intravisit::walk_crate(&mut visitor, krate);
|
||||
}
|
||||
|
@ -1695,8 +1695,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||
substs: &'tcx Substs<'tcx>)
|
||||
-> Ty<'tcx> {
|
||||
self.mk_ty(TyProjection(ProjectionTy {
|
||||
item_def_id: item_def_id,
|
||||
substs: substs,
|
||||
item_def_id,
|
||||
substs,
|
||||
}))
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ impl<'tcx> Relate<'tcx> for ty::ExistentialProjection<'tcx> {
|
||||
let substs = relation.relate(&a.substs, &b.substs)?;
|
||||
Ok(ty::ExistentialProjection {
|
||||
item_def_id: a.item_def_id,
|
||||
substs: substs,
|
||||
substs,
|
||||
ty,
|
||||
})
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionTy<'a> {
|
||||
tcx.lift(&self.substs).map(|substs| {
|
||||
ty::ProjectionTy {
|
||||
item_def_id: self.item_def_id,
|
||||
substs: substs,
|
||||
substs,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ impl<'a, 'tcx> ProjectionTy<'tcx> {
|
||||
pub fn trait_ref(&self, tcx: TyCtxt) -> ty::TraitRef<'tcx> {
|
||||
let def_id = tcx.associated_item(self.item_def_id).container.id();
|
||||
ty::TraitRef {
|
||||
def_id: def_id,
|
||||
def_id,
|
||||
substs: self.substs,
|
||||
}
|
||||
}
|
||||
@ -874,7 +874,7 @@ impl<'a, 'tcx, 'gcx> ExistentialProjection<'tcx> {
|
||||
pub fn trait_ref(&self, tcx: TyCtxt) -> ty::ExistentialTraitRef<'tcx> {
|
||||
let def_id = tcx.associated_item(self.item_def_id).container.id();
|
||||
ty::ExistentialTraitRef{
|
||||
def_id: def_id,
|
||||
def_id,
|
||||
substs: self.substs,
|
||||
}
|
||||
}
|
||||
|
@ -36,9 +36,9 @@ pub fn modify(sess: &ParseSess,
|
||||
krate: Crate,
|
||||
handler: &rustc_errors::Handler) -> ast::Crate {
|
||||
ExpandAllocatorDirectives {
|
||||
handler: handler,
|
||||
sess: sess,
|
||||
resolver: resolver,
|
||||
handler,
|
||||
sess,
|
||||
resolver,
|
||||
found: false,
|
||||
}.fold_crate(krate)
|
||||
}
|
||||
@ -88,7 +88,7 @@ impl<'a> Folder for ExpandAllocatorDirectives<'a> {
|
||||
};
|
||||
let ecfg = ExpansionConfig::default(name.to_string());
|
||||
let mut f = AllocFnFactory {
|
||||
span: span,
|
||||
span,
|
||||
kind: AllocatorKind::Global,
|
||||
global: item.ident,
|
||||
alloc: Ident::from_str("alloc"),
|
||||
|
@ -97,7 +97,7 @@ pub fn opts(arch: Arch) -> Result<TargetOptions, String> {
|
||||
cpu: target_cpu(arch),
|
||||
dynamic_linking: false,
|
||||
executables: true,
|
||||
pre_link_args: pre_link_args,
|
||||
pre_link_args,
|
||||
has_elf_tls: false,
|
||||
.. super::apple_base::opts()
|
||||
})
|
||||
|
@ -25,7 +25,7 @@ pub fn opts() -> TargetOptions {
|
||||
exe_allocation_crate: Some("alloc_system".to_string()),
|
||||
panic_strategy: PanicStrategy::Abort,
|
||||
linker: "ld".to_string(),
|
||||
pre_link_args: pre_link_args,
|
||||
pre_link_args,
|
||||
target_family: Some("unix".to_string()),
|
||||
.. Default::default()
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ pub fn target() -> TargetResult {
|
||||
linker: "pnacl-clang".to_string(),
|
||||
ar: "pnacl-ar".to_string(),
|
||||
|
||||
pre_link_args: pre_link_args,
|
||||
post_link_args: post_link_args,
|
||||
pre_link_args,
|
||||
post_link_args,
|
||||
dynamic_linking: false,
|
||||
executables: true,
|
||||
exe_suffix: ".pexe".to_string(),
|
||||
|
@ -38,7 +38,7 @@ pub fn target() -> Result<Target, String> {
|
||||
obj_is_bitcode: true,
|
||||
is_like_emscripten: true,
|
||||
max_atomic_width: Some(32),
|
||||
post_link_args: post_link_args,
|
||||
post_link_args,
|
||||
target_family: Some("unix".to_string()),
|
||||
.. Default::default()
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ pub fn target() -> Result<Target, String> {
|
||||
obj_is_bitcode: true,
|
||||
is_like_emscripten: true,
|
||||
max_atomic_width: Some(32),
|
||||
post_link_args: post_link_args,
|
||||
post_link_args,
|
||||
target_family: Some("unix".to_string()),
|
||||
.. Default::default()
|
||||
};
|
||||
|
@ -78,7 +78,7 @@ pub fn opts() -> TargetOptions {
|
||||
target_family: Some("windows".to_string()),
|
||||
is_like_windows: true,
|
||||
allows_weak_linkage: false,
|
||||
pre_link_args: pre_link_args,
|
||||
pre_link_args,
|
||||
pre_link_objects_exe: vec![
|
||||
"crt2.o".to_string(), // mingw C runtime initialization for executables
|
||||
"rsbegin.o".to_string(), // Rust compiler runtime initialization, see rsbegin.rs
|
||||
@ -87,7 +87,7 @@ pub fn opts() -> TargetOptions {
|
||||
"dllcrt2.o".to_string(), // mingw C runtime initialization for dlls
|
||||
"rsbegin.o".to_string(),
|
||||
],
|
||||
late_link_args: late_link_args,
|
||||
late_link_args,
|
||||
post_link_objects: vec![
|
||||
"rsend.o".to_string()
|
||||
],
|
||||
|
@ -194,10 +194,10 @@ pub fn check_loans<'a, 'b, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
|
||||
let def_id = bccx.tcx.hir.body_owner_def_id(body.id());
|
||||
let param_env = bccx.tcx.param_env(def_id);
|
||||
let mut clcx = CheckLoanCtxt {
|
||||
bccx: bccx,
|
||||
dfcx_loans: dfcx_loans,
|
||||
move_data: move_data,
|
||||
all_loans: all_loans,
|
||||
bccx,
|
||||
dfcx_loans,
|
||||
move_data,
|
||||
all_loans,
|
||||
param_env,
|
||||
};
|
||||
euv::ExprUseVisitor::new(&mut clcx, bccx.tcx, param_env, &bccx.region_maps, bccx.tables)
|
||||
|
@ -106,8 +106,8 @@ pub fn gather_move_from_expr<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
|
||||
};
|
||||
let move_info = GatherMoveInfo {
|
||||
id: move_expr_id,
|
||||
kind: kind,
|
||||
cmt: cmt,
|
||||
kind,
|
||||
cmt,
|
||||
span_path_opt: None,
|
||||
};
|
||||
gather_move(bccx, move_data, move_error_collector, move_info);
|
||||
@ -163,7 +163,7 @@ pub fn gather_move_from_pat<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
|
||||
let move_info = GatherMoveInfo {
|
||||
id: move_pat.id,
|
||||
kind: MovePat,
|
||||
cmt: cmt,
|
||||
cmt,
|
||||
span_path_opt: pat_span_path_opt,
|
||||
};
|
||||
|
||||
|
@ -37,10 +37,10 @@ pub fn guarantee_lifetime<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
|
||||
debug!("guarantee_lifetime(cmt={:?}, loan_region={:?})",
|
||||
cmt, loan_region);
|
||||
let ctxt = GuaranteeLifetimeContext {bccx: bccx,
|
||||
item_scope: item_scope,
|
||||
span: span,
|
||||
cause: cause,
|
||||
loan_region: loan_region,
|
||||
item_scope,
|
||||
span,
|
||||
cause,
|
||||
loan_region,
|
||||
cmt_original: cmt.clone()};
|
||||
ctxt.check(&cmt, None)
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ pub fn gather_loans_in_fn<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
|
||||
let def_id = bccx.tcx.hir.body_owner_def_id(body);
|
||||
let param_env = bccx.tcx.param_env(def_id);
|
||||
let mut glcx = GatherLoanCtxt {
|
||||
bccx: bccx,
|
||||
bccx,
|
||||
all_loans: Vec::new(),
|
||||
item_ub: region::CodeExtent::Misc(body.node_id),
|
||||
move_data: MoveData::new(),
|
||||
@ -230,8 +230,8 @@ fn check_mutability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
|
||||
// Only mutable data can be lent as mutable.
|
||||
if !cmt.mutbl.is_mutable() {
|
||||
Err(bccx.report(BckError { span: borrow_span,
|
||||
cause: cause,
|
||||
cmt: cmt,
|
||||
cause,
|
||||
cmt,
|
||||
code: err_mutbl }))
|
||||
} else {
|
||||
Ok(())
|
||||
@ -389,13 +389,13 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
|
||||
|
||||
Loan {
|
||||
index: self.all_loans.len(),
|
||||
loan_path: loan_path,
|
||||
loan_path,
|
||||
kind: req_kind,
|
||||
gen_scope: gen_scope,
|
||||
kill_scope: kill_scope,
|
||||
gen_scope,
|
||||
kill_scope,
|
||||
span: borrow_span,
|
||||
restricted_paths: restricted_paths,
|
||||
cause: cause,
|
||||
restricted_paths,
|
||||
cause,
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -423,13 +423,13 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
|
||||
// let all_loans = &mut *self.all_loans; // FIXME(#5074)
|
||||
// Loan {
|
||||
// index: all_loans.len(),
|
||||
// loan_path: loan_path,
|
||||
// cmt: cmt,
|
||||
// loan_path,
|
||||
// cmt,
|
||||
// mutbl: ConstMutability,
|
||||
// gen_scope: borrow_id,
|
||||
// kill_scope: kill_scope,
|
||||
// kill_scope,
|
||||
// span: borrow_span,
|
||||
// restrictions: restrictions
|
||||
// restrictions,
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -49,8 +49,8 @@ impl<'tcx> MoveError<'tcx> {
|
||||
move_to: Option<MovePlace<'tcx>>)
|
||||
-> MoveError<'tcx> {
|
||||
MoveError {
|
||||
move_from: move_from,
|
||||
move_to: move_to,
|
||||
move_from,
|
||||
move_to,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,10 +34,10 @@ pub fn compute_restrictions<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
|
||||
loan_region: ty::Region<'tcx>)
|
||||
-> RestrictionResult<'tcx> {
|
||||
let ctxt = RestrictionsContext {
|
||||
bccx: bccx,
|
||||
span: span,
|
||||
cause: cause,
|
||||
loan_region: loan_region,
|
||||
bccx,
|
||||
span,
|
||||
cause,
|
||||
loan_region,
|
||||
};
|
||||
|
||||
ctxt.restrict(cmt)
|
||||
|
@ -180,7 +180,7 @@ fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tc
|
||||
id_range,
|
||||
body);
|
||||
|
||||
Some(AnalysisData { all_loans: all_loans,
|
||||
Some(AnalysisData { all_loans,
|
||||
loans: loan_dfcx,
|
||||
move_data:flowed_moves })
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ impl<'a, 'tcx> MoveData<'tcx> {
|
||||
parent: parent_index,
|
||||
first_move: InvalidMoveIndex,
|
||||
first_child: InvalidMovePathIndex,
|
||||
next_sibling: next_sibling,
|
||||
next_sibling,
|
||||
});
|
||||
|
||||
index
|
||||
@ -408,9 +408,9 @@ impl<'a, 'tcx> MoveData<'tcx> {
|
||||
|
||||
self.moves.borrow_mut().push(Move {
|
||||
path: path_index,
|
||||
id: id,
|
||||
kind: kind,
|
||||
next_move: next_move
|
||||
id,
|
||||
kind,
|
||||
next_move,
|
||||
});
|
||||
}
|
||||
|
||||
@ -468,8 +468,8 @@ impl<'a, 'tcx> MoveData<'tcx> {
|
||||
let assignment = Assignment {
|
||||
path: path_index,
|
||||
id: assign_id,
|
||||
span: span,
|
||||
assignee_id: assignee_id,
|
||||
span,
|
||||
assignee_id,
|
||||
};
|
||||
|
||||
if self.is_var_path(path_index) {
|
||||
@ -504,7 +504,7 @@ impl<'a, 'tcx> MoveData<'tcx> {
|
||||
path: path_index,
|
||||
base_path: base_path_index,
|
||||
id: pattern_id,
|
||||
mode: mode,
|
||||
mode,
|
||||
};
|
||||
|
||||
self.variant_matches.borrow_mut().push(variant_match);
|
||||
@ -680,9 +680,9 @@ impl<'a, 'tcx> FlowedMoveData<'a, 'tcx> {
|
||||
dfcx_assign.propagate(cfg, body);
|
||||
|
||||
FlowedMoveData {
|
||||
move_data: move_data,
|
||||
dfcx_moves: dfcx_moves,
|
||||
dfcx_assign: dfcx_assign,
|
||||
move_data,
|
||||
dfcx_moves,
|
||||
dfcx_assign,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,8 +166,8 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> {
|
||||
let pattern_arena = TypedArena::new();
|
||||
|
||||
f(MatchCheckCtxt {
|
||||
tcx: tcx,
|
||||
module: module,
|
||||
tcx,
|
||||
module,
|
||||
pattern_arena: &pattern_arena,
|
||||
byte_array_map: FxHashMap(),
|
||||
})
|
||||
@ -296,7 +296,7 @@ impl<'tcx> Witness<'tcx> {
|
||||
let sub_pattern_tys = constructor_sub_pattern_tys(cx, ctor, ty);
|
||||
self.0.extend(sub_pattern_tys.into_iter().map(|ty| {
|
||||
Pattern {
|
||||
ty: ty,
|
||||
ty,
|
||||
span: DUMMY_SP,
|
||||
kind: box PatternKind::Wild,
|
||||
}
|
||||
@ -344,7 +344,7 @@ impl<'tcx> Witness<'tcx> {
|
||||
if adt.variants.len() > 1 {
|
||||
PatternKind::Variant {
|
||||
adt_def: adt,
|
||||
substs: substs,
|
||||
substs,
|
||||
variant_index: ctor.variant_index_for_adt(adt),
|
||||
subpatterns: pats
|
||||
}
|
||||
@ -378,7 +378,7 @@ impl<'tcx> Witness<'tcx> {
|
||||
};
|
||||
|
||||
self.0.push(Pattern {
|
||||
ty: ty,
|
||||
ty,
|
||||
span: DUMMY_SP,
|
||||
kind: Box::new(pat),
|
||||
});
|
||||
@ -673,7 +673,7 @@ fn is_useful_specialized<'p, 'a:'p, 'tcx: 'a>(
|
||||
let sub_pat_tys = constructor_sub_pattern_tys(cx, &ctor, lty);
|
||||
let wild_patterns_owned: Vec<_> = sub_pat_tys.iter().map(|ty| {
|
||||
Pattern {
|
||||
ty: ty,
|
||||
ty,
|
||||
span: DUMMY_SP,
|
||||
kind: box PatternKind::Wild,
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ fn check_legality_of_move_bindings(cx: &MatchVisitor,
|
||||
/// FIXME: this should be done by borrowck.
|
||||
fn check_for_mutation_in_guard(cx: &MatchVisitor, guard: &hir::Expr) {
|
||||
let mut checker = MutationChecker {
|
||||
cx: cx,
|
||||
cx,
|
||||
};
|
||||
ExprUseVisitor::new(&mut checker, cx.tcx, cx.param_env, cx.region_maps, cx.tables)
|
||||
.walk_expr(guard);
|
||||
|
@ -379,7 +379,7 @@ fn eval_const_expr_partial<'a, 'tcx>(cx: &ConstContext<'a, 'tcx>,
|
||||
tcx,
|
||||
param_env: cx.param_env,
|
||||
tables: tcx.typeck_tables_of(def_id),
|
||||
substs: substs,
|
||||
substs,
|
||||
fn_args: Some(call_args)
|
||||
};
|
||||
callee_cx.eval(&body.value)?
|
||||
|
@ -407,8 +407,8 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
|
||||
}
|
||||
|
||||
PatternKind::Binding {
|
||||
mutability: mutability,
|
||||
mode: mode,
|
||||
mutability,
|
||||
mode,
|
||||
name: ident.node,
|
||||
var: id,
|
||||
ty: var_ty,
|
||||
@ -470,7 +470,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
|
||||
|
||||
Pattern {
|
||||
span: pat.span,
|
||||
ty: ty,
|
||||
ty,
|
||||
kind: Box::new(kind),
|
||||
}
|
||||
}
|
||||
@ -569,10 +569,10 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
|
||||
_ => bug!("inappropriate type for def: {:?}", ty.sty),
|
||||
};
|
||||
PatternKind::Variant {
|
||||
adt_def: adt_def,
|
||||
substs: substs,
|
||||
adt_def,
|
||||
substs,
|
||||
variant_index: adt_def.variant_index_with_id(variant_id),
|
||||
subpatterns: subpatterns,
|
||||
subpatterns,
|
||||
}
|
||||
} else {
|
||||
PatternKind::Leaf { subpatterns: subpatterns }
|
||||
@ -626,8 +626,8 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
|
||||
};
|
||||
|
||||
Pattern {
|
||||
span: span,
|
||||
ty: ty,
|
||||
span,
|
||||
ty,
|
||||
kind: Box::new(kind),
|
||||
}
|
||||
}
|
||||
@ -762,7 +762,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
|
||||
};
|
||||
|
||||
Pattern {
|
||||
span: span,
|
||||
span,
|
||||
ty: pat_ty,
|
||||
kind: Box::new(kind),
|
||||
}
|
||||
|
@ -281,8 +281,8 @@ impl<A: Array> IntoIterator for ArrayVec<A> {
|
||||
let indices = 0..self.count;
|
||||
mem::forget(self);
|
||||
Iter {
|
||||
indices: indices,
|
||||
store: store,
|
||||
indices,
|
||||
store,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ impl BitMatrix {
|
||||
// element. Round up to an even number of u64s.
|
||||
let u64s_per_row = u64s(columns);
|
||||
BitMatrix {
|
||||
columns: columns,
|
||||
columns,
|
||||
vector: vec![0; rows * u64s_per_row],
|
||||
}
|
||||
}
|
||||
|
@ -71,8 +71,8 @@ pub fn dominators_given_rpo<G: ControlFlowGraph>(graph: &G,
|
||||
}
|
||||
|
||||
Dominators {
|
||||
post_order_rank: post_order_rank,
|
||||
immediate_dominators: immediate_dominators,
|
||||
post_order_rank,
|
||||
immediate_dominators,
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ impl<Node: Idx> Dominators<Node> {
|
||||
}
|
||||
DominatorTree {
|
||||
root: root.unwrap(),
|
||||
children: children,
|
||||
children,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ impl TestGraph {
|
||||
pub fn new(start_node: usize, edges: &[(usize, usize)]) -> Self {
|
||||
let mut graph = TestGraph {
|
||||
num_nodes: start_node + 1,
|
||||
start_node: start_node,
|
||||
start_node,
|
||||
successors: HashMap::new(),
|
||||
predecessors: HashMap::new(),
|
||||
};
|
||||
|
@ -23,8 +23,8 @@ impl<G: ControlFlowGraph> TransposedGraph<G> {
|
||||
|
||||
pub fn with_start(base_graph: G, start_node: G::Node) -> Self {
|
||||
TransposedGraph {
|
||||
base_graph: base_graph,
|
||||
start_node: start_node,
|
||||
base_graph,
|
||||
start_node,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ impl<N: Debug, E: Debug> Graph<N, E> {
|
||||
let idx = self.next_node_index();
|
||||
self.nodes.push(Node {
|
||||
first_edge: [INVALID_EDGE_INDEX, INVALID_EDGE_INDEX],
|
||||
data: data,
|
||||
data,
|
||||
});
|
||||
idx
|
||||
}
|
||||
@ -189,9 +189,9 @@ impl<N: Debug, E: Debug> Graph<N, E> {
|
||||
// as the next pointers
|
||||
self.edges.push(Edge {
|
||||
next_edge: [source_first, target_first],
|
||||
source: source,
|
||||
target: target,
|
||||
data: data,
|
||||
source,
|
||||
target,
|
||||
data,
|
||||
});
|
||||
|
||||
// adjust the firsts for each node target be the next object.
|
||||
@ -269,7 +269,7 @@ impl<N: Debug, E: Debug> Graph<N, E> {
|
||||
let first_edge = self.node(source).first_edge[direction.repr];
|
||||
AdjacentEdges {
|
||||
graph: self,
|
||||
direction: direction,
|
||||
direction,
|
||||
next: first_edge,
|
||||
}
|
||||
}
|
||||
@ -482,10 +482,10 @@ impl<'g, N: Debug, E: Debug> DepthFirstTraversal<'g, N, E> {
|
||||
pub fn new(graph: &'g Graph<N, E>, direction: Direction) -> Self {
|
||||
let visited = BitVector::new(graph.len_nodes());
|
||||
DepthFirstTraversal {
|
||||
graph: graph,
|
||||
graph,
|
||||
stack: vec![],
|
||||
visited: visited,
|
||||
direction: direction,
|
||||
visited,
|
||||
direction,
|
||||
}
|
||||
}
|
||||
|
||||
@ -496,10 +496,10 @@ impl<'g, N: Debug, E: Debug> DepthFirstTraversal<'g, N, E> {
|
||||
let mut visited = BitVector::new(graph.len_nodes());
|
||||
visited.insert(start_node.node_id());
|
||||
DepthFirstTraversal {
|
||||
graph: graph,
|
||||
graph,
|
||||
stack: vec![start_node],
|
||||
visited: visited,
|
||||
direction: direction,
|
||||
visited,
|
||||
direction,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ impl<O: ForestObligation> ObligationForest<O> {
|
||||
let backtrace = self.error_at(index);
|
||||
errors.push(Error {
|
||||
error: error.clone(),
|
||||
backtrace: backtrace,
|
||||
backtrace,
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -346,7 +346,7 @@ impl<O: ForestObligation> ObligationForest<O> {
|
||||
let backtrace = self.error_at(index);
|
||||
errors.push(Error {
|
||||
error: err,
|
||||
backtrace: backtrace,
|
||||
backtrace,
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -357,8 +357,8 @@ impl<O: ForestObligation> ObligationForest<O> {
|
||||
// changed.
|
||||
return Outcome {
|
||||
completed: vec![],
|
||||
errors: errors,
|
||||
stalled: stalled,
|
||||
errors,
|
||||
stalled,
|
||||
};
|
||||
}
|
||||
|
||||
@ -372,8 +372,8 @@ impl<O: ForestObligation> ObligationForest<O> {
|
||||
|
||||
Outcome {
|
||||
completed: completed_obligations,
|
||||
errors: errors,
|
||||
stalled: stalled,
|
||||
errors,
|
||||
stalled,
|
||||
}
|
||||
}
|
||||
|
||||
@ -638,8 +638,8 @@ impl<O: ForestObligation> ObligationForest<O> {
|
||||
impl<O> Node<O> {
|
||||
fn new(parent: Option<NodeIndex>, obligation: O) -> Node<O> {
|
||||
Node {
|
||||
obligation: obligation,
|
||||
parent: parent,
|
||||
obligation,
|
||||
parent,
|
||||
state: Cell::new(NodeState::Pending),
|
||||
dependents: vec![],
|
||||
}
|
||||
|
@ -87,8 +87,8 @@ impl<K: UnifyKey> VarValue<K> {
|
||||
fn new(parent: K, value: K::Value, rank: u32) -> VarValue<K> {
|
||||
VarValue {
|
||||
parent: parent, // this is a root
|
||||
value: value,
|
||||
rank: rank,
|
||||
value,
|
||||
rank,
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,8 +98,8 @@ impl<K: UnifyKey> VarValue<K> {
|
||||
|
||||
fn root(self, rank: u32, value: K::Value) -> VarValue<K> {
|
||||
VarValue {
|
||||
rank: rank,
|
||||
value: value,
|
||||
rank,
|
||||
value,
|
||||
..self
|
||||
}
|
||||
}
|
||||
|
@ -401,8 +401,8 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> {
|
||||
out_dir: &'a Option<PathBuf>)
|
||||
-> Self {
|
||||
CompileState {
|
||||
input: input,
|
||||
session: session,
|
||||
input,
|
||||
session,
|
||||
out_dir: out_dir.as_ref().map(|s| &**s),
|
||||
out_file: None,
|
||||
arena: None,
|
||||
@ -868,7 +868,7 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
|
||||
trait_map: resolver.trait_map,
|
||||
maybe_unused_trait_imports: resolver.maybe_unused_trait_imports,
|
||||
},
|
||||
hir_forest: hir_forest,
|
||||
hir_forest,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -802,7 +802,7 @@ impl RustcDefaultCalls {
|
||||
let mut cfgs = Vec::new();
|
||||
for &(name, ref value) in sess.parse_sess.config.iter() {
|
||||
let gated_cfg = GatedCfg::gate(&ast::MetaItem {
|
||||
name: name,
|
||||
name,
|
||||
node: ast::MetaItemKind::Word,
|
||||
span: DUMMY_SP,
|
||||
});
|
||||
|
@ -174,7 +174,7 @@ impl PpSourceMode {
|
||||
match *self {
|
||||
PpmNormal | PpmEveryBodyLoops | PpmExpanded => {
|
||||
let annotation = NoAnn {
|
||||
sess: sess,
|
||||
sess,
|
||||
hir_map: hir_map.map(|m| m.clone()),
|
||||
};
|
||||
f(&annotation)
|
||||
@ -182,14 +182,14 @@ impl PpSourceMode {
|
||||
|
||||
PpmIdentified | PpmExpandedIdentified => {
|
||||
let annotation = IdentifiedAnnotation {
|
||||
sess: sess,
|
||||
sess,
|
||||
hir_map: hir_map.map(|m| m.clone()),
|
||||
};
|
||||
f(&annotation)
|
||||
}
|
||||
PpmExpandedHygiene => {
|
||||
let annotation = HygieneAnnotation {
|
||||
sess: sess,
|
||||
sess,
|
||||
};
|
||||
f(&annotation)
|
||||
}
|
||||
@ -211,7 +211,7 @@ impl PpSourceMode {
|
||||
match *self {
|
||||
PpmNormal => {
|
||||
let annotation = NoAnn {
|
||||
sess: sess,
|
||||
sess,
|
||||
hir_map: Some(hir_map.clone()),
|
||||
};
|
||||
f(&annotation, hir_map.forest.krate())
|
||||
@ -219,7 +219,7 @@ impl PpSourceMode {
|
||||
|
||||
PpmIdentified => {
|
||||
let annotation = IdentifiedAnnotation {
|
||||
sess: sess,
|
||||
sess,
|
||||
hir_map: Some(hir_map.clone()),
|
||||
};
|
||||
f(&annotation, hir_map.forest.krate())
|
||||
@ -235,7 +235,7 @@ impl PpSourceMode {
|
||||
|tcx, _, _, _| {
|
||||
let empty_tables = ty::TypeckTables::empty(None);
|
||||
let annotation = TypedAnnotation {
|
||||
tcx: tcx,
|
||||
tcx,
|
||||
tables: Cell::new(&empty_tables)
|
||||
};
|
||||
let _ignore = tcx.dep_graph.in_ignore();
|
||||
@ -680,7 +680,7 @@ impl fold::Folder for ReplaceBodyWithLoop {
|
||||
})
|
||||
.into_iter()
|
||||
.collect(),
|
||||
rules: rules,
|
||||
rules,
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
span: syntax_pos::DUMMY_SP,
|
||||
})
|
||||
@ -739,7 +739,7 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec<borrowck_dot::Variant>,
|
||||
hir_map: &tcx.hir,
|
||||
cfg: &cfg,
|
||||
name: format!("node_{}", code.id()),
|
||||
labelled_edges: labelled_edges,
|
||||
labelled_edges,
|
||||
};
|
||||
|
||||
match code {
|
||||
@ -758,7 +758,7 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec<borrowck_dot::Variant>,
|
||||
|
||||
let lcfg = borrowck_dot::DataflowLabeller {
|
||||
inner: lcfg,
|
||||
variants: variants,
|
||||
variants,
|
||||
borrowck_ctxt: &bccx,
|
||||
analysis_data: &analysis_data,
|
||||
};
|
||||
|
@ -83,9 +83,9 @@ impl Diagnostic {
|
||||
|
||||
pub fn new_with_code(level: Level, code: Option<String>, message: &str) -> Self {
|
||||
Diagnostic {
|
||||
level: level,
|
||||
level,
|
||||
message: vec![(message.to_owned(), Style::NoStyle)],
|
||||
code: code,
|
||||
code,
|
||||
span: MultiSpan::new(),
|
||||
children: vec![],
|
||||
suggestions: vec![],
|
||||
@ -306,10 +306,10 @@ impl Diagnostic {
|
||||
span: MultiSpan,
|
||||
render_span: Option<RenderSpan>) {
|
||||
let sub = SubDiagnostic {
|
||||
level: level,
|
||||
level,
|
||||
message: vec![(message.to_owned(), Style::NoStyle)],
|
||||
span: span,
|
||||
render_span: render_span,
|
||||
span,
|
||||
render_span,
|
||||
};
|
||||
self.children.push(sub);
|
||||
}
|
||||
@ -322,10 +322,10 @@ impl Diagnostic {
|
||||
span: MultiSpan,
|
||||
render_span: Option<RenderSpan>) {
|
||||
let sub = SubDiagnostic {
|
||||
level: level,
|
||||
message: message,
|
||||
span: span,
|
||||
render_span: render_span,
|
||||
level,
|
||||
message,
|
||||
span,
|
||||
render_span,
|
||||
};
|
||||
self.children.push(sub);
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ impl<'a> DiagnosticBuilder<'a> {
|
||||
message: &str)
|
||||
-> DiagnosticBuilder<'a> {
|
||||
DiagnosticBuilder {
|
||||
handler: handler,
|
||||
handler,
|
||||
diagnostic: Diagnostic::new_with_code(level, code, message)
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ impl EmitterWriter {
|
||||
if color_config.use_color() {
|
||||
let dst = Destination::from_stderr();
|
||||
EmitterWriter {
|
||||
dst: dst,
|
||||
dst,
|
||||
cm: code_map,
|
||||
}
|
||||
} else {
|
||||
@ -156,7 +156,7 @@ impl EmitterWriter {
|
||||
}
|
||||
// We don't have a line yet, create one
|
||||
slot.lines.push(Line {
|
||||
line_index: line_index,
|
||||
line_index,
|
||||
annotations: vec![ann],
|
||||
});
|
||||
slot.lines.sort();
|
||||
@ -165,9 +165,9 @@ impl EmitterWriter {
|
||||
}
|
||||
// This is the first time we're seeing the file
|
||||
file_vec.push(FileWithAnnotatedLines {
|
||||
file: file,
|
||||
file,
|
||||
lines: vec![Line {
|
||||
line_index: line_index,
|
||||
line_index,
|
||||
annotations: vec![ann],
|
||||
}],
|
||||
multiline_depth: 0,
|
||||
|
@ -155,8 +155,8 @@ impl CodeSuggestion {
|
||||
let lo = primary_spans.iter().map(|sp| sp.0.lo).min().unwrap();
|
||||
let hi = primary_spans.iter().map(|sp| sp.0.hi).min().unwrap();
|
||||
let bounding_span = Span {
|
||||
lo: lo,
|
||||
hi: hi,
|
||||
lo,
|
||||
hi,
|
||||
ctxt: NO_EXPANSION,
|
||||
};
|
||||
let lines = cm.span_to_lines(bounding_span).unwrap();
|
||||
@ -292,8 +292,8 @@ impl Handler {
|
||||
Handler {
|
||||
err_count: Cell::new(0),
|
||||
emitter: RefCell::new(e),
|
||||
can_emit_warnings: can_emit_warnings,
|
||||
treat_err_as_bug: treat_err_as_bug,
|
||||
can_emit_warnings,
|
||||
treat_err_as_bug,
|
||||
continue_after_error: Cell::new(true),
|
||||
delayed_span_bug: RefCell::new(None),
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ pub fn assert_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
||||
|
||||
// Find annotations supplied by user (if any).
|
||||
let (if_this_changed, then_this_would_need) = {
|
||||
let mut visitor = IfThisChanged { tcx: tcx,
|
||||
let mut visitor = IfThisChanged { tcx,
|
||||
if_this_changed: vec![],
|
||||
then_this_would_need: vec![] };
|
||||
visitor.process_attrs(ast::CRATE_NODE_ID, &tcx.hir.krate().attrs);
|
||||
|
@ -83,15 +83,15 @@ pub fn check_dirty_clean_annotations<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
debug!("query-nodes: {:?}", query.nodes());
|
||||
let krate = tcx.hir.krate();
|
||||
let mut dirty_clean_visitor = DirtyCleanVisitor {
|
||||
tcx: tcx,
|
||||
tcx,
|
||||
query: &query,
|
||||
dirty_inputs: dirty_inputs,
|
||||
dirty_inputs,
|
||||
checked_attrs: FxHashSet(),
|
||||
};
|
||||
krate.visit_all_item_likes(&mut dirty_clean_visitor);
|
||||
|
||||
let mut all_attrs = FindAllAttrs {
|
||||
tcx: tcx,
|
||||
tcx,
|
||||
attr_names: vec![ATTR_DIRTY, ATTR_CLEAN],
|
||||
found_attrs: vec![],
|
||||
};
|
||||
@ -243,15 +243,15 @@ pub fn check_dirty_clean_metadata<'a, 'tcx>(
|
||||
tcx.dep_graph.with_ignore(||{
|
||||
let krate = tcx.hir.krate();
|
||||
let mut dirty_clean_visitor = DirtyCleanMetadataVisitor {
|
||||
tcx: tcx,
|
||||
prev_metadata_hashes: prev_metadata_hashes,
|
||||
current_metadata_hashes: current_metadata_hashes,
|
||||
tcx,
|
||||
prev_metadata_hashes,
|
||||
current_metadata_hashes,
|
||||
checked_attrs: FxHashSet(),
|
||||
};
|
||||
intravisit::walk_crate(&mut dirty_clean_visitor, krate);
|
||||
|
||||
let mut all_attrs = FindAllAttrs {
|
||||
tcx: tcx,
|
||||
tcx,
|
||||
attr_names: vec![ATTR_DIRTY_METADATA, ATTR_CLEAN_METADATA],
|
||||
found_attrs: vec![],
|
||||
};
|
||||
|
@ -38,8 +38,8 @@ impl<'a, 'tcx> HashContext<'a, 'tcx> {
|
||||
incremental_hashes_map: &'a IncrementalHashesMap)
|
||||
-> Self {
|
||||
HashContext {
|
||||
tcx: tcx,
|
||||
incremental_hashes_map: incremental_hashes_map,
|
||||
tcx,
|
||||
incremental_hashes_map,
|
||||
metadata_hashes: FxHashMap(),
|
||||
crate_hashes: FxHashMap(),
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ impl<'a, 'g, N, I, O> Classify<'a, 'g, N, I, O>
|
||||
{
|
||||
pub(super) fn new(r: &'a mut GraphReduce<'g, N, I, O>) -> Self {
|
||||
Classify {
|
||||
r: r,
|
||||
r,
|
||||
colors: vec![Color::White; r.in_graph.len_nodes()],
|
||||
stack: vec![],
|
||||
dag: Dag {
|
||||
|
@ -103,8 +103,8 @@ impl<'q> Predecessors<'q> {
|
||||
|
||||
Predecessors {
|
||||
reduced_graph: graph,
|
||||
bootstrap_outputs: bootstrap_outputs,
|
||||
hashes: hashes,
|
||||
bootstrap_outputs,
|
||||
hashes,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ pub fn save_trans_partition(sess: &Session,
|
||||
let work_product = WorkProduct {
|
||||
cgu_name: cgu_name.to_string(),
|
||||
input_hash: partition_hash,
|
||||
saved_files: saved_files,
|
||||
saved_files,
|
||||
};
|
||||
|
||||
sess.dep_graph.insert_work_product(&work_product_id, work_product);
|
||||
|
@ -94,7 +94,7 @@ impl<'a> Iterator for Iter<'a> {
|
||||
::last_error().map(Err)
|
||||
} else {
|
||||
Some(Ok(Child {
|
||||
ptr: ptr,
|
||||
ptr,
|
||||
_data: marker::PhantomData,
|
||||
}))
|
||||
}
|
||||
|
@ -82,12 +82,12 @@ impl OptimizationDiagnostic {
|
||||
}
|
||||
|
||||
OptimizationDiagnostic {
|
||||
kind: kind,
|
||||
kind,
|
||||
pass_name: pass_name.expect("got a non-UTF8 pass name from LLVM"),
|
||||
function: function,
|
||||
line: line,
|
||||
column: column,
|
||||
filename: filename,
|
||||
function,
|
||||
line,
|
||||
column,
|
||||
filename,
|
||||
message: message.expect("got a non-UTF8 OptimizationDiagnostic message from LLVM")
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ impl<'a, 'b, 'tcx> IsolatedEncoder<'a, 'b, 'tcx> {
|
||||
body: lazy_body,
|
||||
tables: lazy_tables,
|
||||
nested_bodies: lazy_nested_bodies,
|
||||
rvalue_promotable_to_static: rvalue_promotable_to_static
|
||||
rvalue_promotable_to_static,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -162,8 +162,8 @@ enum LoadResult {
|
||||
impl<'a> CrateLoader<'a> {
|
||||
pub fn new(sess: &'a Session, cstore: &'a CStore, local_crate_name: &str) -> Self {
|
||||
CrateLoader {
|
||||
sess: sess,
|
||||
cstore: cstore,
|
||||
sess,
|
||||
cstore,
|
||||
next_crate_num: cstore.next_crate_num(),
|
||||
local_crate_name: Symbol::intern(local_crate_name),
|
||||
}
|
||||
@ -184,7 +184,7 @@ impl<'a> CrateLoader<'a> {
|
||||
};
|
||||
Some(ExternCrateInfo {
|
||||
ident: i.ident.name,
|
||||
name: name,
|
||||
name,
|
||||
id: i.id,
|
||||
dep_kind: if attr::contains_name(&i.attrs, "no_link") {
|
||||
DepKind::UnexportedMacrosOnly
|
||||
@ -325,25 +325,25 @@ impl<'a> CrateLoader<'a> {
|
||||
});
|
||||
|
||||
let mut cmeta = cstore::CrateMetadata {
|
||||
name: name,
|
||||
name,
|
||||
extern_crate: Cell::new(None),
|
||||
def_path_table: Rc::new(def_path_table),
|
||||
exported_symbols: exported_symbols,
|
||||
trait_impls: trait_impls,
|
||||
exported_symbols,
|
||||
trait_impls,
|
||||
proc_macros: crate_root.macro_derive_registrar.map(|_| {
|
||||
self.load_derive_macros(&crate_root, dylib.clone().map(|p| p.0), span)
|
||||
}),
|
||||
root: crate_root,
|
||||
blob: metadata,
|
||||
cnum_map: RefCell::new(cnum_map),
|
||||
cnum: cnum,
|
||||
cnum,
|
||||
codemap_import_info: RefCell::new(vec![]),
|
||||
attribute_cache: RefCell::new([Vec::new(), Vec::new()]),
|
||||
dep_kind: Cell::new(dep_kind),
|
||||
source: cstore::CrateSource {
|
||||
dylib: dylib,
|
||||
rlib: rlib,
|
||||
rmeta: rmeta,
|
||||
dylib,
|
||||
rlib,
|
||||
rmeta,
|
||||
},
|
||||
// Initialize this with an empty set. The field is populated below
|
||||
// after we were able to deserialize its contents.
|
||||
@ -388,14 +388,14 @@ impl<'a> CrateLoader<'a> {
|
||||
info!("falling back to a load");
|
||||
let mut locate_ctxt = locator::Context {
|
||||
sess: self.sess,
|
||||
span: span,
|
||||
ident: ident,
|
||||
span,
|
||||
ident,
|
||||
crate_name: name,
|
||||
hash: hash.map(|a| &*a),
|
||||
filesearch: self.sess.target_filesearch(path_kind),
|
||||
target: &self.sess.target.target,
|
||||
triple: &self.sess.opts.target_triple,
|
||||
root: root,
|
||||
root,
|
||||
rejected_via_hash: vec![],
|
||||
rejected_via_triple: vec![],
|
||||
rejected_via_kind: vec![],
|
||||
@ -547,7 +547,7 @@ impl<'a> CrateLoader<'a> {
|
||||
let mut target_only = false;
|
||||
let mut locate_ctxt = locator::Context {
|
||||
sess: self.sess,
|
||||
span: span,
|
||||
span,
|
||||
ident: info.ident,
|
||||
crate_name: info.name,
|
||||
hash: None,
|
||||
@ -596,9 +596,9 @@ impl<'a> CrateLoader<'a> {
|
||||
};
|
||||
|
||||
ExtensionCrate {
|
||||
metadata: metadata,
|
||||
metadata,
|
||||
dylib: dylib.map(|p| p.0),
|
||||
target_only: target_only,
|
||||
target_only,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1221,9 +1221,9 @@ impl<'a> CrateLoader<'a> {
|
||||
.collect();
|
||||
let lib = NativeLibrary {
|
||||
name: n,
|
||||
kind: kind,
|
||||
cfg: cfg,
|
||||
foreign_items: foreign_items,
|
||||
kind,
|
||||
cfg,
|
||||
foreign_items,
|
||||
};
|
||||
register_native_lib(self.sess, self.cstore, Some(m.span), lib);
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ impl CStore {
|
||||
statically_included_foreign_items: RefCell::new(FxHashSet()),
|
||||
dllimport_foreign_items: RefCell::new(FxHashSet()),
|
||||
visible_parent_map: RefCell::new(FxHashMap()),
|
||||
metadata_loader: metadata_loader,
|
||||
metadata_loader,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ impl CrateStore for cstore::CStore {
|
||||
{
|
||||
self.get_crate_data(cnum).root.plugin_registrar_fn.map(|index| DefId {
|
||||
krate: cnum,
|
||||
index: index
|
||||
index,
|
||||
})
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ impl CrateStore for cstore::CStore {
|
||||
{
|
||||
self.get_crate_data(cnum).root.macro_derive_registrar.map(|index| DefId {
|
||||
krate: cnum,
|
||||
index: index
|
||||
index,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ pub trait Metadata<'a, 'tcx>: Copy {
|
||||
opaque: opaque::Decoder::new(self.raw_bytes(), pos),
|
||||
cdata: self.cdata(),
|
||||
sess: self.sess().or(tcx.map(|tcx| tcx.sess)),
|
||||
tcx: tcx,
|
||||
tcx,
|
||||
last_filemap_index: 0,
|
||||
lazy_state: LazyState::NoNode,
|
||||
}
|
||||
@ -468,7 +468,7 @@ impl<'a, 'tcx> CrateMetadata {
|
||||
fn local_def_id(&self, index: DefIndex) -> DefId {
|
||||
DefId {
|
||||
krate: self.cnum,
|
||||
index: index,
|
||||
index,
|
||||
}
|
||||
}
|
||||
|
||||
@ -703,7 +703,7 @@ impl<'a, 'tcx> CrateMetadata {
|
||||
for child_index in child.children.decode((self, sess)) {
|
||||
if let Some(def) = self.get_def(child_index) {
|
||||
callback(def::Export {
|
||||
def: def,
|
||||
def,
|
||||
ident: Ident::with_empty_ctxt(self.item_name(child_index)),
|
||||
span: self.entry(child_index).span.decode((self, sess)),
|
||||
});
|
||||
@ -835,8 +835,8 @@ impl<'a, 'tcx> CrateMetadata {
|
||||
};
|
||||
|
||||
ty::AssociatedItem {
|
||||
name: name,
|
||||
kind: kind,
|
||||
name,
|
||||
kind,
|
||||
vis: item.visibility.decode(self),
|
||||
defaultness: container.defaultness(),
|
||||
def_id: self.local_def_id(id),
|
||||
|
@ -422,16 +422,16 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||
None
|
||||
},
|
||||
|
||||
crate_deps: crate_deps,
|
||||
dylib_dependency_formats: dylib_dependency_formats,
|
||||
lang_items: lang_items,
|
||||
lang_items_missing: lang_items_missing,
|
||||
native_libraries: native_libraries,
|
||||
codemap: codemap,
|
||||
def_path_table: def_path_table,
|
||||
impls: impls,
|
||||
exported_symbols: exported_symbols,
|
||||
index: index,
|
||||
crate_deps,
|
||||
dylib_dependency_formats,
|
||||
lang_items,
|
||||
lang_items_missing,
|
||||
native_libraries,
|
||||
codemap,
|
||||
def_path_table,
|
||||
impls,
|
||||
exported_symbols,
|
||||
index,
|
||||
});
|
||||
|
||||
let total_bytes = self.position();
|
||||
@ -719,15 +719,15 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
||||
};
|
||||
FnData {
|
||||
constness: hir::Constness::NotConst,
|
||||
arg_names: arg_names,
|
||||
arg_names,
|
||||
sig: self.lazy(&tcx.fn_sig(def_id)),
|
||||
}
|
||||
} else {
|
||||
bug!()
|
||||
};
|
||||
EntryKind::Method(self.lazy(&MethodData {
|
||||
fn_data: fn_data,
|
||||
container: container,
|
||||
fn_data,
|
||||
container,
|
||||
has_self: trait_item.method_has_self_argument,
|
||||
}))
|
||||
}
|
||||
@ -735,7 +735,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
||||
};
|
||||
|
||||
Entry {
|
||||
kind: kind,
|
||||
kind,
|
||||
visibility: self.lazy(&trait_item.vis),
|
||||
span: self.lazy(&ast_item.span),
|
||||
attributes: self.encode_attributes(&ast_item.attrs),
|
||||
@ -805,8 +805,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
||||
bug!()
|
||||
};
|
||||
EntryKind::Method(self.lazy(&MethodData {
|
||||
fn_data: fn_data,
|
||||
container: container,
|
||||
fn_data,
|
||||
container,
|
||||
has_self: impl_item.method_has_self_argument,
|
||||
}))
|
||||
}
|
||||
@ -828,7 +828,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
||||
};
|
||||
|
||||
Entry {
|
||||
kind: kind,
|
||||
kind,
|
||||
visibility: self.lazy(&impl_item.vis),
|
||||
span: self.lazy(&ast_item.span),
|
||||
attributes: self.encode_attributes(&ast_item.attrs),
|
||||
@ -915,7 +915,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
||||
}
|
||||
hir::ItemFn(_, _, constness, .., body) => {
|
||||
let data = FnData {
|
||||
constness: constness,
|
||||
constness,
|
||||
arg_names: self.encode_fn_arg_names_for_body(body),
|
||||
sig: self.lazy(&tcx.fn_sig(def_id)),
|
||||
};
|
||||
@ -946,7 +946,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
||||
EntryKind::Struct(self.lazy(&VariantData {
|
||||
ctor_kind: variant.ctor_kind,
|
||||
discr: variant.discr,
|
||||
struct_ctor: struct_ctor,
|
||||
struct_ctor,
|
||||
ctor_sig: None,
|
||||
}), repr_options)
|
||||
}
|
||||
@ -998,10 +998,10 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
||||
});
|
||||
|
||||
let data = ImplData {
|
||||
polarity: polarity,
|
||||
defaultness: defaultness,
|
||||
polarity,
|
||||
defaultness,
|
||||
parent_impl: parent,
|
||||
coerce_unsized_info: coerce_unsized_info,
|
||||
coerce_unsized_info,
|
||||
trait_ref: trait_ref.map(|trait_ref| self.lazy(&trait_ref)),
|
||||
};
|
||||
|
||||
@ -1023,7 +1023,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
||||
};
|
||||
|
||||
Entry {
|
||||
kind: kind,
|
||||
kind,
|
||||
visibility: self.lazy(&ty::Visibility::from_hir(&item.vis, item.id, tcx)),
|
||||
span: self.lazy(&item.span),
|
||||
attributes: self.encode_attributes(&item.attrs),
|
||||
@ -1333,7 +1333,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
||||
debug!("IsolatedEncoder::encode_impls()");
|
||||
let tcx = self.tcx;
|
||||
let mut visitor = ImplVisitor {
|
||||
tcx: tcx,
|
||||
tcx,
|
||||
impls: FxHashMap(),
|
||||
};
|
||||
tcx.hir.krate().visit_all_item_likes(&mut visitor);
|
||||
@ -1412,7 +1412,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
||||
};
|
||||
|
||||
Entry {
|
||||
kind: kind,
|
||||
kind,
|
||||
visibility: self.lazy(&ty::Visibility::from_hir(&nitem.vis, nitem.id, tcx)),
|
||||
span: self.lazy(&nitem.span),
|
||||
attributes: self.encode_attributes(&nitem.attrs),
|
||||
@ -1653,14 +1653,14 @@ pub fn encode_metadata<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
let (root, metadata_hashes) = {
|
||||
let mut ecx = EncodeContext {
|
||||
opaque: opaque::Encoder::new(&mut cursor),
|
||||
tcx: tcx,
|
||||
link_meta: link_meta,
|
||||
exported_symbols: exported_symbols,
|
||||
tcx,
|
||||
link_meta,
|
||||
exported_symbols,
|
||||
lazy_state: LazyState::NoNode,
|
||||
type_shorthands: Default::default(),
|
||||
predicate_shorthands: Default::default(),
|
||||
metadata_hashes: EncodedMetadataHashes::new(),
|
||||
compute_ich: compute_ich,
|
||||
compute_ich,
|
||||
};
|
||||
|
||||
// Encode the rustc version string in a predictable location.
|
||||
|
@ -92,7 +92,7 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> {
|
||||
pub fn new(ecx: &'a mut EncodeContext<'b, 'tcx>) -> Self {
|
||||
IndexBuilder {
|
||||
items: Index::new(ecx.tcx.hir.definitions().def_index_counts_lo_hi()),
|
||||
ecx: ecx,
|
||||
ecx,
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> {
|
||||
if let Some(hash) = fingerprint {
|
||||
ecx.metadata_hashes.hashes.push(EncodedMetadataHash {
|
||||
def_index: id.index,
|
||||
hash: hash,
|
||||
hash,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
||||
let tcx = ecx.tcx;
|
||||
let compute_ich = ecx.compute_ich;
|
||||
IsolatedEncoder {
|
||||
tcx: tcx,
|
||||
ecx: ecx,
|
||||
tcx,
|
||||
ecx,
|
||||
hcx: if compute_ich {
|
||||
// We are always hashing spans for things in metadata because
|
||||
// don't know if a downstream crate will use them or not.
|
||||
|
@ -518,9 +518,9 @@ impl<'a> Context<'a> {
|
||||
if let Some((h, m)) = slot {
|
||||
libraries.insert(h,
|
||||
Library {
|
||||
dylib: dylib,
|
||||
rlib: rlib,
|
||||
rmeta: rmeta,
|
||||
dylib,
|
||||
rlib,
|
||||
rmeta,
|
||||
metadata: m,
|
||||
});
|
||||
}
|
||||
@ -808,10 +808,10 @@ impl<'a> Context<'a> {
|
||||
match slot {
|
||||
Some((_, metadata)) => {
|
||||
Some(Library {
|
||||
dylib: dylib,
|
||||
rlib: rlib,
|
||||
rmeta: rmeta,
|
||||
metadata: metadata,
|
||||
dylib,
|
||||
rlib,
|
||||
rmeta,
|
||||
metadata,
|
||||
})
|
||||
}
|
||||
None => None,
|
||||
|
@ -84,7 +84,7 @@ pub struct Lazy<T> {
|
||||
impl<T> Lazy<T> {
|
||||
pub fn with_position(position: usize) -> Lazy<T> {
|
||||
Lazy {
|
||||
position: position,
|
||||
position,
|
||||
_marker: PhantomData,
|
||||
}
|
||||
}
|
||||
@ -141,8 +141,8 @@ impl<T> LazySeq<T> {
|
||||
|
||||
pub fn with_position_and_length(position: usize, len: usize) -> LazySeq<T> {
|
||||
LazySeq {
|
||||
len: len,
|
||||
position: position,
|
||||
len,
|
||||
position,
|
||||
_marker: PhantomData,
|
||||
}
|
||||
}
|
||||
@ -199,7 +199,7 @@ pub struct Tracked<T> {
|
||||
impl<T> Tracked<T> {
|
||||
pub fn new(state: T) -> Tracked<T> {
|
||||
Tracked {
|
||||
state: state,
|
||||
state,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ impl<'tcx> CFG<'tcx> {
|
||||
source_info: SourceInfo,
|
||||
extent: CodeExtent) {
|
||||
self.push(block, Statement {
|
||||
source_info: source_info,
|
||||
source_info,
|
||||
kind: StatementKind::EndRegion(extent),
|
||||
});
|
||||
}
|
||||
@ -60,7 +60,7 @@ impl<'tcx> CFG<'tcx> {
|
||||
lvalue: &Lvalue<'tcx>,
|
||||
rvalue: Rvalue<'tcx>) {
|
||||
self.push(block, Statement {
|
||||
source_info: source_info,
|
||||
source_info,
|
||||
kind: StatementKind::Assign(lvalue.clone(), rvalue)
|
||||
});
|
||||
}
|
||||
@ -93,8 +93,8 @@ impl<'tcx> CFG<'tcx> {
|
||||
block,
|
||||
self.block_data(block));
|
||||
self.block_data_mut(block).terminator = Some(Terminator {
|
||||
source_info: source_info,
|
||||
kind: kind,
|
||||
source_info,
|
||||
kind,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
|
||||
if let Some(scope) = scope {
|
||||
// schedule a shallow free of that memory, lest we unwind:
|
||||
this.cfg.push(block, Statement {
|
||||
source_info: source_info,
|
||||
source_info,
|
||||
kind: StatementKind::StorageLive(result.clone())
|
||||
});
|
||||
this.schedule_drop(expr_span, scope, &result, value.ty);
|
||||
|
@ -52,7 +52,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
|
||||
|
||||
if !expr_ty.is_never() && temp_lifetime.is_some() {
|
||||
this.cfg.push(block, Statement {
|
||||
source_info: source_info,
|
||||
source_info,
|
||||
kind: StatementKind::StorageLive(temp.clone())
|
||||
});
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user