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