Skip to content

Commit f3bfa31

Browse files
committed
Auto merge of #33965 - Manishearth:rollup, r=Manishearth
Rollup of 5 pull requests - Successful merges: #33867, #33926, #33942, #33958, #33964 - Failed merges:
2 parents 5da602b + 26c2098 commit f3bfa31

File tree

13 files changed

+196
-165
lines changed

13 files changed

+196
-165
lines changed

src/etc/htmldocck.py

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
from htmlentitydefs import entitydefs
118118
entitydefs['larrb'] = u'\u21e4'
119119
entitydefs['rarrb'] = u'\u21e5'
120+
entitydefs['nbsp'] = ' '
120121

121122
# "void elements" (no closing tag) from the HTML Standard section 12.1.2
122123
VOID_ELEMENTS = set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen',

src/librustc_driver/driver.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ use syntax_ext;
6363

6464
#[derive(Clone)]
6565
pub struct Resolutions {
66-
pub def_map: RefCell<DefMap>,
66+
pub def_map: DefMap,
6767
pub freevars: FreevarMap,
6868
pub trait_map: TraitMap,
6969
pub maybe_unused_trait_imports: NodeSet,
@@ -818,7 +818,7 @@ pub fn lower_and_resolve<'a>(sess: &Session,
818818
name: &id,
819819
glob_map: if resolver.make_glob_map { Some(resolver.glob_map) } else { None },
820820
}, Resolutions {
821-
def_map: RefCell::new(resolver.def_map),
821+
def_map: resolver.def_map,
822822
freevars: resolver.freevars,
823823
trait_map: resolver.trait_map,
824824
maybe_unused_trait_imports: resolver.maybe_unused_trait_imports,
@@ -866,7 +866,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
866866
"lifetime resolution",
867867
|| middle::resolve_lifetime::krate(sess,
868868
&hir_map,
869-
&resolutions.def_map.borrow()))?;
869+
&resolutions.def_map))?;
870870

871871
time(time_passes,
872872
"looking for entry point",
@@ -886,14 +886,14 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
886886

887887
time(time_passes,
888888
"static item recursion checking",
889-
|| static_recursion::check_crate(sess, &resolutions.def_map.borrow(), &hir_map))?;
889+
|| static_recursion::check_crate(sess, &resolutions.def_map, &hir_map))?;
890890

891891
let index = stability::Index::new(&hir_map);
892892

893893
let trait_map = resolutions.trait_map;
894894
TyCtxt::create_and_enter(sess,
895895
arenas,
896-
resolutions.def_map,
896+
RefCell::new(resolutions.def_map),
897897
named_region_map,
898898
hir_map,
899899
resolutions.freevars,

src/librustc_driver/test.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use rustc_metadata::cstore::CStore;
2929
use rustc_metadata::creader::read_local_crates;
3030
use rustc::hir::map as hir_map;
3131
use rustc::session::{self, config};
32+
use std::cell::RefCell;
3233
use std::rc::Rc;
3334
use syntax::ast;
3435
use syntax::abi::Abi;
@@ -134,12 +135,12 @@ fn test_env<F>(source_string: &str,
134135

135136
// run just enough stuff to build a tcx:
136137
let lang_items = lang_items::collect_language_items(&sess, &ast_map);
137-
let named_region_map = resolve_lifetime::krate(&sess, &ast_map, &resolutions.def_map.borrow());
138+
let named_region_map = resolve_lifetime::krate(&sess, &ast_map, &resolutions.def_map);
138139
let region_map = region::resolve_crate(&sess, &ast_map);
139140
let index = stability::Index::new(&ast_map);
140141
TyCtxt::create_and_enter(&sess,
141142
&arenas,
142-
resolutions.def_map,
143+
RefCell::new(resolutions.def_map),
143144
named_region_map.unwrap(),
144145
ast_map,
145146
resolutions.freevars,

src/librustc_llvm/archive_ro.rs

+21-8
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ use std::path::Path;
1818
use std::slice;
1919
use std::str;
2020

21-
pub struct ArchiveRO { ptr: ArchiveRef }
21+
pub struct ArchiveRO {
22+
ptr: ArchiveRef,
23+
}
2224

2325
pub struct Iter<'a> {
2426
archive: &'a ArchiveRO,
@@ -61,11 +63,16 @@ impl ArchiveRO {
6163
}
6264
}
6365

64-
pub fn raw(&self) -> ArchiveRef { self.ptr }
66+
pub fn raw(&self) -> ArchiveRef {
67+
self.ptr
68+
}
6569

6670
pub fn iter(&self) -> Iter {
6771
unsafe {
68-
Iter { ptr: ::LLVMRustArchiveIteratorNew(self.ptr), archive: self }
72+
Iter {
73+
ptr: ::LLVMRustArchiveIteratorNew(self.ptr),
74+
archive: self,
75+
}
6976
}
7077
}
7178
}
@@ -86,7 +93,10 @@ impl<'a> Iterator for Iter<'a> {
8693
if ptr.is_null() {
8794
::last_error().map(Err)
8895
} else {
89-
Some(Ok(Child { ptr: ptr, _data: marker::PhantomData }))
96+
Some(Ok(Child {
97+
ptr: ptr,
98+
_data: marker::PhantomData,
99+
}))
90100
}
91101
}
92102
}
@@ -107,8 +117,7 @@ impl<'a> Child<'a> {
107117
if name_ptr.is_null() {
108118
None
109119
} else {
110-
let name = slice::from_raw_parts(name_ptr as *const u8,
111-
name_len as usize);
120+
let name = slice::from_raw_parts(name_ptr as *const u8, name_len as usize);
112121
str::from_utf8(name).ok().map(|s| s.trim())
113122
}
114123
}
@@ -125,11 +134,15 @@ impl<'a> Child<'a> {
125134
}
126135
}
127136

128-
pub fn raw(&self) -> ::ArchiveChildRef { self.ptr }
137+
pub fn raw(&self) -> ::ArchiveChildRef {
138+
self.ptr
139+
}
129140
}
130141

131142
impl<'a> Drop for Child<'a> {
132143
fn drop(&mut self) {
133-
unsafe { ::LLVMRustArchiveChildFree(self.ptr); }
144+
unsafe {
145+
::LLVMRustArchiveChildFree(self.ptr);
146+
}
134147
}
135148
}

src/librustc_llvm/build.rs

+36-25
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,25 @@ fn main() {
2121
println!("cargo:rustc-cfg=cargobuild");
2222

2323
let target = env::var("TARGET").unwrap();
24-
let llvm_config = env::var_os("LLVM_CONFIG").map(PathBuf::from)
25-
.unwrap_or_else(|| {
26-
match env::var_os("CARGO_TARGET_DIR").map(PathBuf::from) {
27-
Some(dir) => {
28-
let to_test = dir.parent().unwrap().parent().unwrap()
29-
.join(&target).join("llvm/bin/llvm-config");
30-
if Command::new(&to_test).output().is_ok() {
31-
return to_test
32-
}
33-
}
34-
None => {}
35-
}
36-
PathBuf::from("llvm-config")
37-
});
24+
let llvm_config = env::var_os("LLVM_CONFIG")
25+
.map(PathBuf::from)
26+
.unwrap_or_else(|| {
27+
match env::var_os("CARGO_TARGET_DIR").map(PathBuf::from) {
28+
Some(dir) => {
29+
let to_test = dir.parent()
30+
.unwrap()
31+
.parent()
32+
.unwrap()
33+
.join(&target)
34+
.join("llvm/bin/llvm-config");
35+
if Command::new(&to_test).output().is_ok() {
36+
return to_test;
37+
}
38+
}
39+
None => {}
40+
}
41+
PathBuf::from("llvm-config")
42+
});
3843

3944
println!("cargo:rerun-if-changed={}", llvm_config.display());
4045

@@ -63,20 +68,22 @@ fn main() {
6368
let host = env::var("HOST").unwrap();
6469
let is_crossed = target != host;
6570

66-
let optional_components = ["x86", "arm", "aarch64", "mips", "powerpc",
67-
"pnacl"];
71+
let optional_components = ["x86", "arm", "aarch64", "mips", "powerpc", "pnacl"];
6872

6973
// FIXME: surely we don't need all these components, right? Stuff like mcjit
7074
// or interpreter the compiler itself never uses.
71-
let required_components = &["ipo", "bitreader", "bitwriter", "linker",
72-
"asmparser", "mcjit", "interpreter",
75+
let required_components = &["ipo",
76+
"bitreader",
77+
"bitwriter",
78+
"linker",
79+
"asmparser",
80+
"mcjit",
81+
"interpreter",
7382
"instrumentation"];
7483

7584
let components = output(Command::new(&llvm_config).arg("--components"));
7685
let mut components = components.split_whitespace().collect::<Vec<_>>();
77-
components.retain(|c| {
78-
optional_components.contains(c) || required_components.contains(c)
79-
});
86+
components.retain(|c| optional_components.contains(c) || required_components.contains(c));
8087

8188
for component in required_components {
8289
if !components.contains(component) {
@@ -96,7 +103,7 @@ fn main() {
96103
for flag in cxxflags.split_whitespace() {
97104
// Ignore flags like `-m64` when we're doing a cross build
98105
if is_crossed && flag.starts_with("-m") {
99-
continue
106+
continue;
100107
}
101108
cfg.flag(flag);
102109
}
@@ -131,7 +138,7 @@ fn main() {
131138
} else if lib.starts_with("-") {
132139
&lib[1..]
133140
} else {
134-
continue
141+
continue;
135142
};
136143

137144
// Don't need or want this library, but LLVM's CMake build system
@@ -140,10 +147,14 @@ fn main() {
140147
// library and it otherwise may just pull in extra dependencies on
141148
// libedit which we don't want
142149
if name == "LLVMLineEditor" {
143-
continue
150+
continue;
144151
}
145152

146-
let kind = if name.starts_with("LLVM") {"static"} else {"dylib"};
153+
let kind = if name.starts_with("LLVM") {
154+
"static"
155+
} else {
156+
"dylib"
157+
};
147158
println!("cargo:rustc-link-lib={}={}", kind, name);
148159
}
149160

src/librustc_llvm/diagnostic.rs

+26-23
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub use self::Diagnostic::*;
1616
use libc::{c_char, c_uint};
1717
use std::ptr;
1818

19-
use {ValueRef, TwineRef, DebugLocRef, DiagnosticInfoRef};
19+
use {DebugLocRef, DiagnosticInfoRef, TwineRef, ValueRef};
2020

2121
#[derive(Copy, Clone)]
2222
pub enum OptimizationDiagnosticKind {
@@ -46,8 +46,9 @@ pub struct OptimizationDiagnostic {
4646
}
4747

4848
impl OptimizationDiagnostic {
49-
unsafe fn unpack(kind: OptimizationDiagnosticKind, di: DiagnosticInfoRef)
50-
-> OptimizationDiagnostic {
49+
unsafe fn unpack(kind: OptimizationDiagnosticKind,
50+
di: DiagnosticInfoRef)
51+
-> OptimizationDiagnostic {
5152

5253
let mut opt = OptimizationDiagnostic {
5354
kind: kind,
@@ -58,10 +59,10 @@ impl OptimizationDiagnostic {
5859
};
5960

6061
super::LLVMUnpackOptimizationDiagnostic(di,
61-
&mut opt.pass_name,
62-
&mut opt.function,
63-
&mut opt.debug_loc,
64-
&mut opt.message);
62+
&mut opt.pass_name,
63+
&mut opt.function,
64+
&mut opt.debug_loc,
65+
&mut opt.message);
6566

6667
opt
6768
}
@@ -75,8 +76,7 @@ pub struct InlineAsmDiagnostic {
7576
}
7677

7778
impl InlineAsmDiagnostic {
78-
unsafe fn unpack(di: DiagnosticInfoRef)
79-
-> InlineAsmDiagnostic {
79+
unsafe fn unpack(di: DiagnosticInfoRef) -> InlineAsmDiagnostic {
8080

8181
let mut opt = InlineAsmDiagnostic {
8282
cookie: 0,
@@ -85,9 +85,9 @@ impl InlineAsmDiagnostic {
8585
};
8686

8787
super::LLVMUnpackInlineAsmDiagnostic(di,
88-
&mut opt.cookie,
89-
&mut opt.message,
90-
&mut opt.instruction);
88+
&mut opt.cookie,
89+
&mut opt.message,
90+
&mut opt.instruction);
9191

9292
opt
9393
}
@@ -106,22 +106,25 @@ impl Diagnostic {
106106
let kind = super::LLVMGetDiagInfoKind(di);
107107

108108
match kind {
109-
super::DK_InlineAsm
110-
=> InlineAsm(InlineAsmDiagnostic::unpack(di)),
109+
super::DK_InlineAsm => InlineAsm(InlineAsmDiagnostic::unpack(di)),
111110

112-
super::DK_OptimizationRemark
113-
=> Optimization(OptimizationDiagnostic::unpack(OptimizationRemark, di)),
111+
super::DK_OptimizationRemark => {
112+
Optimization(OptimizationDiagnostic::unpack(OptimizationRemark, di))
113+
}
114114

115-
super::DK_OptimizationRemarkMissed
116-
=> Optimization(OptimizationDiagnostic::unpack(OptimizationMissed, di)),
115+
super::DK_OptimizationRemarkMissed => {
116+
Optimization(OptimizationDiagnostic::unpack(OptimizationMissed, di))
117+
}
117118

118-
super::DK_OptimizationRemarkAnalysis
119-
=> Optimization(OptimizationDiagnostic::unpack(OptimizationAnalysis, di)),
119+
super::DK_OptimizationRemarkAnalysis => {
120+
Optimization(OptimizationDiagnostic::unpack(OptimizationAnalysis, di))
121+
}
120122

121-
super::DK_OptimizationFailure
122-
=> Optimization(OptimizationDiagnostic::unpack(OptimizationFailure, di)),
123+
super::DK_OptimizationFailure => {
124+
Optimization(OptimizationDiagnostic::unpack(OptimizationFailure, di))
125+
}
123126

124-
_ => UnknownDiagnostic(di)
127+
_ => UnknownDiagnostic(di),
125128
}
126129
}
127130
}

0 commit comments

Comments
 (0)