Skip to content

Commit 8898cdb

Browse files
committed
Address more comments
1 parent b9b1013 commit 8898cdb

File tree

13 files changed

+102
-98
lines changed

13 files changed

+102
-98
lines changed

src/etc/platform-intrinsics/generator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ def open(platform):
801801
// The default inlining settings trigger a pathological behaviour in
802802
// LLVM, which causes makes compilation very slow. See #28273.
803803
#[inline(never)]
804-
pub fn find(name: &str) -> Option<Intrinsic> {{
804+
pub(crate) fn find(name: &str) -> Option<Intrinsic> {{
805805
if !name.starts_with("{0}") {{ return None }}
806806
Some(match &name["{0}".len()..] {{'''.format(platform.platform_prefix())
807807

src/librustc_driver/driver.rs

+33-33
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ pub fn anon_src() -> String {
271271
"<anon>".to_string()
272272
}
273273

274-
pub(crate) fn source_name(input: &Input) -> String {
274+
pub fn source_name(input: &Input) -> String {
275275
match *input {
276276
// FIXME (#9639): This needs to handle non-utf8 paths
277277
Input::File(ref ifile) => ifile.to_str().unwrap().to_string(),
@@ -295,11 +295,11 @@ pub(crate) fn source_name(input: &Input) -> String {
295295
/// Expect more entry points to be added in the future.
296296
pub struct CompileController<'a> {
297297
pub after_parse: PhaseController<'a>,
298-
pub(crate) after_expand: PhaseController<'a>,
298+
pub after_expand: PhaseController<'a>,
299299
pub after_hir_lowering: PhaseController<'a>,
300300
pub after_analysis: PhaseController<'a>,
301301
pub after_llvm: PhaseController<'a>,
302-
pub(crate) compilation_done: PhaseController<'a>,
302+
pub compilation_done: PhaseController<'a>,
303303

304304
pub make_glob_map: MakeGlobMap,
305305
}
@@ -327,7 +327,7 @@ pub struct PhaseController<'a> {
327327
}
328328

329329
impl<'a> PhaseController<'a> {
330-
pub(crate) fn basic() -> PhaseController<'a> {
330+
pub fn basic() -> PhaseController<'a> {
331331
PhaseController {
332332
stop: Compilation::Continue,
333333
run_callback_on_error: false,
@@ -340,19 +340,19 @@ impl<'a> PhaseController<'a> {
340340
/// during compilation the callback is made. See the various constructor methods
341341
/// (`state_*`) in the impl to see which data is provided for any given entry point.
342342
pub struct CompileState<'a, 'tcx: 'a> {
343-
pub(crate) input: &'a Input,
343+
pub input: &'a Input,
344344
pub session: &'tcx Session,
345345
pub krate: Option<ast::Crate>,
346-
pub(crate) registry: Option<Registry<'a>>,
346+
pub registry: Option<Registry<'a>>,
347347
pub crate_name: Option<&'a str>,
348-
pub(crate) out_dir: Option<&'a Path>,
349-
pub(crate) out_file: Option<&'a Path>,
350-
pub(crate) arena: Option<&'tcx DroplessArena>,
351-
pub(crate) arenas: Option<&'tcx GlobalArenas<'tcx>>,
348+
pub out_dir: Option<&'a Path>,
349+
pub out_file: Option<&'a Path>,
350+
pub arena: Option<&'tcx DroplessArena>,
351+
pub arenas: Option<&'tcx GlobalArenas<'tcx>>,
352352
pub expanded_crate: Option<&'a ast::Crate>,
353353
pub hir_crate: Option<&'a hir::Crate>,
354-
pub(crate) hir_map: Option<&'a hir_map::Map<'tcx>>,
355-
pub(crate) resolutions: Option<&'a Resolutions>,
354+
pub hir_map: Option<&'a hir_map::Map<'tcx>>,
355+
pub resolutions: Option<&'a Resolutions>,
356356
pub analysis: Option<&'a ty::CrateAnalysis>,
357357
pub tcx: Option<TyCtxt<'a, 'tcx, 'tcx>>,
358358
pub trans: Option<&'a trans::CrateTranslation>,
@@ -534,7 +534,7 @@ fn count_nodes(krate: &ast::Crate) -> usize {
534534
// modified
535535

536536
pub struct ExpansionResult {
537-
pub(crate) expanded_crate: ast::Crate,
537+
pub expanded_crate: ast::Crate,
538538
pub defs: hir_map::Definitions,
539539
pub analysis: ty::CrateAnalysis,
540540
pub resolutions: Resolutions,
@@ -1041,11 +1041,11 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
10411041

10421042
/// Run the translation phase to LLVM, after which the AST and analysis can
10431043
/// be discarded.
1044-
pub(crate) fn phase_4_translate_to_llvm<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1045-
analysis: ty::CrateAnalysis,
1046-
incremental_hashes_map: &IncrementalHashesMap,
1047-
output_filenames: &OutputFilenames)
1048-
-> trans::CrateTranslation {
1044+
pub fn phase_4_translate_to_llvm<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1045+
analysis: ty::CrateAnalysis,
1046+
incremental_hashes_map: &IncrementalHashesMap,
1047+
output_filenames: &OutputFilenames)
1048+
-> trans::CrateTranslation {
10491049
let time_passes = tcx.sess.time_passes();
10501050

10511051
time(time_passes,
@@ -1072,9 +1072,9 @@ pub(crate) fn phase_4_translate_to_llvm<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
10721072

10731073
/// Run LLVM itself, producing a bitcode file, assembly file or object file
10741074
/// as a side effect.
1075-
pub(crate) fn phase_5_run_llvm_passes(sess: &Session,
1076-
trans: &trans::CrateTranslation,
1077-
outputs: &OutputFilenames) -> CompileResult {
1075+
pub fn phase_5_run_llvm_passes(sess: &Session,
1076+
trans: &trans::CrateTranslation,
1077+
outputs: &OutputFilenames) -> CompileResult {
10781078
if sess.opts.cg.no_integrated_as ||
10791079
(sess.target.target.options.no_integrated_as &&
10801080
(outputs.outputs.contains_key(&OutputType::Object) ||
@@ -1116,9 +1116,9 @@ pub(crate) fn phase_5_run_llvm_passes(sess: &Session,
11161116

11171117
/// Run the linker on any artifacts that resulted from the LLVM run.
11181118
/// This should produce either a finished executable or library.
1119-
pub(crate) fn phase_6_link_output(sess: &Session,
1120-
trans: &trans::CrateTranslation,
1121-
outputs: &OutputFilenames) {
1119+
pub fn phase_6_link_output(sess: &Session,
1120+
trans: &trans::CrateTranslation,
1121+
outputs: &OutputFilenames) {
11221122
time(sess.time_passes(),
11231123
"linking",
11241124
|| link::link_binary(sess, trans, outputs, &trans.crate_name.as_str()));
@@ -1188,8 +1188,8 @@ fn write_out_deps(sess: &Session, outputs: &OutputFilenames, crate_name: &str) {
11881188
}
11891189
}
11901190

1191-
pub(crate) fn collect_crate_types(session: &Session, attrs: &[ast::Attribute])
1192-
-> Vec<config::CrateType> {
1191+
pub fn collect_crate_types(session: &Session, attrs: &[ast::Attribute])
1192+
-> Vec<config::CrateType> {
11931193
// Unconditionally collect crate types from attributes to make them used
11941194
let attr_types: Vec<config::CrateType> =
11951195
attrs.iter()
@@ -1269,7 +1269,7 @@ pub(crate) fn collect_crate_types(session: &Session, attrs: &[ast::Attribute])
12691269
.collect()
12701270
}
12711271

1272-
pub(crate) fn compute_crate_disambiguator(session: &Session) -> String {
1272+
pub fn compute_crate_disambiguator(session: &Session) -> String {
12731273
use std::hash::Hasher;
12741274

12751275
// The crate_disambiguator is a 128 bit hash. The disambiguator is fed
@@ -1304,12 +1304,12 @@ pub(crate) fn compute_crate_disambiguator(session: &Session) -> String {
13041304
format!("{}{}", hasher.finish().to_hex(), if is_exe { "-exe" } else {""})
13051305
}
13061306

1307-
pub(crate) fn build_output_filenames(input: &Input,
1308-
odir: &Option<PathBuf>,
1309-
ofile: &Option<PathBuf>,
1310-
attrs: &[ast::Attribute],
1311-
sess: &Session)
1312-
-> OutputFilenames {
1307+
pub fn build_output_filenames(input: &Input,
1308+
odir: &Option<PathBuf>,
1309+
ofile: &Option<PathBuf>,
1310+
attrs: &[ast::Attribute],
1311+
sess: &Session)
1312+
-> OutputFilenames {
13131313
match *ofile {
13141314
None => {
13151315
// "-" as input file will cause the parser to read from stdin so we

src/librustc_driver/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ pub enum Compilation {
273273
}
274274

275275
impl Compilation {
276-
fn and_then<F: FnOnce() -> Compilation>(self, next: F) -> Compilation {
276+
pub fn and_then<F: FnOnce() -> Compilation>(self, next: F) -> Compilation {
277277
match self {
278278
Compilation::Stop => Compilation::Stop,
279279
Compilation::Continue => next(),
@@ -617,7 +617,7 @@ fn save_analysis_format(sess: &Session) -> save::Format {
617617
}
618618

619619
impl RustcDefaultCalls {
620-
fn list_metadata(sess: &Session, matches: &getopts::Matches, input: &Input) -> Compilation {
620+
pub fn list_metadata(sess: &Session, matches: &getopts::Matches, input: &Input) -> Compilation {
621621
let r = matches.opt_strs("Z");
622622
if r.contains(&("ls".to_string())) {
623623
match input {
@@ -1016,7 +1016,7 @@ fn print_flag_list<T>(cmdline_opt: &str,
10161016
///
10171017
/// So with all that in mind, the comments below have some more detail about the
10181018
/// contortions done here to get things to work out correctly.
1019-
fn handle_options(args: &[String]) -> Option<getopts::Matches> {
1019+
pub fn handle_options(args: &[String]) -> Option<getopts::Matches> {
10201020
// Throw away the first argument, the name of the binary
10211021
let args = &args[1..];
10221022

@@ -1200,7 +1200,7 @@ fn exit_on_err() -> ! {
12001200
panic!();
12011201
}
12021202

1203-
fn diagnostics_registry() -> errors::registry::Registry {
1203+
pub fn diagnostics_registry() -> errors::registry::Registry {
12041204
use errors::registry::Registry;
12051205

12061206
let mut all_errors = Vec::new();

src/librustc_errors/diagnostic.rs

+28-28
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use snippet::Style;
2020
#[derive(Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)]
2121
pub struct Diagnostic {
2222
pub level: Level,
23-
pub(crate) message: Vec<(String, Style)>,
23+
pub message: Vec<(String, Style)>,
2424
pub code: Option<String>,
2525
pub span: MultiSpan,
2626
pub children: Vec<SubDiagnostic>,
@@ -31,7 +31,7 @@ pub struct Diagnostic {
3131
#[derive(Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)]
3232
pub struct SubDiagnostic {
3333
pub level: Level,
34-
pub(crate) message: Vec<(String, Style)>,
34+
pub message: Vec<(String, Style)>,
3535
pub span: MultiSpan,
3636
pub render_span: Option<RenderSpan>,
3737
}
@@ -69,7 +69,7 @@ pub enum StringPart {
6969
}
7070

7171
impl StringPart {
72-
pub(crate) fn content(&self) -> String {
72+
pub fn content(&self) -> String {
7373
match self {
7474
&StringPart::Normal(ref s) | & StringPart::Highlighted(ref s) => s.to_owned()
7575
}
@@ -81,7 +81,7 @@ impl Diagnostic {
8181
Diagnostic::new_with_code(level, None, message)
8282
}
8383

84-
pub(crate) fn new_with_code(level: Level, code: Option<String>, message: &str) -> Self {
84+
pub fn new_with_code(level: Level, code: Option<String>, message: &str) -> Self {
8585
Diagnostic {
8686
level: level,
8787
message: vec![(message.to_owned(), Style::NoStyle)],
@@ -101,7 +101,7 @@ impl Diagnostic {
101101
self.level = Level::Cancelled;
102102
}
103103

104-
pub(crate) fn cancelled(&self) -> bool {
104+
pub fn cancelled(&self) -> bool {
105105
self.level == Level::Cancelled
106106
}
107107

@@ -116,22 +116,22 @@ impl Diagnostic {
116116
self
117117
}
118118

119-
pub(crate) fn note_expected_found(&mut self,
120-
label: &fmt::Display,
121-
expected: DiagnosticStyledString,
122-
found: DiagnosticStyledString)
123-
-> &mut Self
119+
pub fn note_expected_found(&mut self,
120+
label: &fmt::Display,
121+
expected: DiagnosticStyledString,
122+
found: DiagnosticStyledString)
123+
-> &mut Self
124124
{
125125
self.note_expected_found_extra(label, expected, found, &"", &"")
126126
}
127127

128-
pub(crate) fn note_expected_found_extra(&mut self,
129-
label: &fmt::Display,
130-
expected: DiagnosticStyledString,
131-
found: DiagnosticStyledString,
132-
expected_extra: &fmt::Display,
133-
found_extra: &fmt::Display)
134-
-> &mut Self
128+
pub fn note_expected_found_extra(&mut self,
129+
label: &fmt::Display,
130+
expected: DiagnosticStyledString,
131+
found: DiagnosticStyledString,
132+
expected_extra: &fmt::Display,
133+
found_extra: &fmt::Display)
134+
-> &mut Self
135135
{
136136
let mut msg: Vec<_> = vec![(format!("expected {} `", label), Style::NoStyle)];
137137
msg.extend(expected.0.iter()
@@ -161,12 +161,12 @@ impl Diagnostic {
161161
self
162162
}
163163

164-
pub(crate) fn note(&mut self, msg: &str) -> &mut Self {
164+
pub fn note(&mut self, msg: &str) -> &mut Self {
165165
self.sub(Level::Note, msg, MultiSpan::new(), None);
166166
self
167167
}
168168

169-
pub(crate) fn highlighted_note(&mut self, msg: Vec<(String, Style)>) -> &mut Self {
169+
pub fn highlighted_note(&mut self, msg: Vec<(String, Style)>) -> &mut Self {
170170
self.sub_with_highlights(Level::Note, msg, MultiSpan::new(), None);
171171
self
172172
}
@@ -179,25 +179,25 @@ impl Diagnostic {
179179
self
180180
}
181181

182-
pub(crate) fn warn(&mut self, msg: &str) -> &mut Self {
182+
pub fn warn(&mut self, msg: &str) -> &mut Self {
183183
self.sub(Level::Warning, msg, MultiSpan::new(), None);
184184
self
185185
}
186186

187-
pub(crate) fn span_warn<S: Into<MultiSpan>>(&mut self,
187+
pub fn span_warn<S: Into<MultiSpan>>(&mut self,
188188
sp: S,
189189
msg: &str)
190190
-> &mut Self {
191191
self.sub(Level::Warning, msg, sp.into(), None);
192192
self
193193
}
194194

195-
pub(crate) fn help(&mut self , msg: &str) -> &mut Self {
195+
pub fn help(&mut self , msg: &str) -> &mut Self {
196196
self.sub(Level::Help, msg, MultiSpan::new(), None);
197197
self
198198
}
199199

200-
pub(crate) fn span_help<S: Into<MultiSpan>>(&mut self,
200+
pub fn span_help<S: Into<MultiSpan>>(&mut self,
201201
sp: S,
202202
msg: &str)
203203
-> &mut Self {
@@ -220,7 +220,7 @@ impl Diagnostic {
220220
/// * may contain a name of a function, variable or type, but not whole expressions
221221
///
222222
/// See `diagnostic::CodeSuggestion` for more information.
223-
pub(crate) fn span_suggestion(&mut self, sp: Span, msg: &str, suggestion: String) -> &mut Self {
223+
pub fn span_suggestion(&mut self, sp: Span, msg: &str, suggestion: String) -> &mut Self {
224224
self.suggestions.push(CodeSuggestion {
225225
substitution_parts: vec![Substitution {
226226
span: sp,
@@ -231,7 +231,7 @@ impl Diagnostic {
231231
self
232232
}
233233

234-
pub(crate) fn span_suggestions(&mut self, sp: Span, msg: &str, suggestions: Vec<String>)
234+
pub fn span_suggestions(&mut self, sp: Span, msg: &str, suggestions: Vec<String>)
235235
-> &mut Self {
236236
self.suggestions.push(CodeSuggestion {
237237
substitution_parts: vec![Substitution {
@@ -248,7 +248,7 @@ impl Diagnostic {
248248
self
249249
}
250250

251-
pub(crate) fn code(&mut self, s: String) -> &mut Self {
251+
pub fn code(&mut self, s: String) -> &mut Self {
252252
self.code = Some(s);
253253
self
254254
}
@@ -257,7 +257,7 @@ impl Diagnostic {
257257
self.message.iter().map(|i| i.0.to_owned()).collect::<String>()
258258
}
259259

260-
pub(crate) fn styled_message(&self) -> &Vec<(String, Style)> {
260+
pub fn styled_message(&self) -> &Vec<(String, Style)> {
261261
&self.message
262262
}
263263

@@ -307,7 +307,7 @@ impl SubDiagnostic {
307307
self.message.iter().map(|i| i.0.to_owned()).collect::<String>()
308308
}
309309

310-
pub(crate) fn styled_message(&self) -> &Vec<(String, Style)> {
310+
pub fn styled_message(&self) -> &Vec<(String, Style)> {
311311
&self.message
312312
}
313313
}

src/librustc_errors/snippet.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ pub(crate) struct StyledString {
204204
}
205205

206206
#[derive(Copy, Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)]
207-
pub(crate) enum Style {
207+
pub enum Style {
208208
HeaderMsg,
209209
LineAndColumn,
210210
LineNumber,

src/librustc_llvm/ffi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ extern "C" {
677677
pub fn LLVMRustSetLinkage(Global: ValueRef, RustLinkage: Linkage);
678678
pub(crate) fn LLVMGetSection(Global: ValueRef) -> *const c_char;
679679
pub fn LLVMSetSection(Global: ValueRef, Section: *const c_char);
680-
pub(crate) fn LLVMRustGetVisibility(Global: ValueRef) -> Visibility;
680+
pub fn LLVMRustGetVisibility(Global: ValueRef) -> Visibility;
681681
pub fn LLVMRustSetVisibility(Global: ValueRef, Viz: Visibility);
682682
pub fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
683683
pub fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);

src/librustc_privacy/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
156156
hir::ItemForeignMod(..) => {
157157
self.prev_level
158158
}
159-
// Other `pub(crate)` items inherit levels from parents
159+
// Other `pub` items inherit levels from parents
160160
hir::ItemConst(..) | hir::ItemEnum(..) | hir::ItemExternCrate(..) |
161161
hir::ItemGlobalAsm(..) | hir::ItemFn(..) | hir::ItemMod(..) |
162162
hir::ItemStatic(..) | hir::ItemStruct(..) | hir::ItemTrait(..) |

0 commit comments

Comments
 (0)