Skip to content

Commit 09fc340

Browse files
committed
librustc: Fix snake case errors.
A number of functions/methods have been moved or renamed to align better with rust standard conventions. rustc::back::link::WriteOutputFile => write_output_file rustc::middle::ty::EmptyBuiltinBounds => empty_builtin_bounds rustc::middle::ty::AllBuiltinBounds => all_builtin_bounds rustc::middle::liveness::IrMaps => IrMaps::new rustc::middle::liveness::Liveness => Liveness::new rustc::middle::resolve::NameBindings => NameBindings::new rustc::middle::resolve::PrimitiveTypeTable => PrimitiveTypeTable::new rustc::middle::resolve::Resolver => Resolver::new rustc::middle::trans::datum::Datum => Datum::new rustc::middle::trans::datum::DatumBlock => DatumBlock::new rustc::middle::trans::datum::Rvalue => Rvalue::new rustc::middle::typeck::infer::new_ValsAndBindings => ::infer::unify::ValsAndBindings::new rustc::middle::typeck::infer::region_inference::RegionVarBindings => RegionVarBindings::new [breaking-change]
1 parent ed5bf66 commit 09fc340

31 files changed

+301
-299
lines changed

src/compiletest/runtest.rs

+28-28
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) {
7373
let proc_res = compile_test(config, props, testfile);
7474

7575
if proc_res.status.success() {
76-
fatal_ProcRes("compile-fail test compiled successfully!".to_string(),
76+
fatal_proc_rec("compile-fail test compiled successfully!".to_string(),
7777
&proc_res);
7878
}
7979

@@ -97,7 +97,7 @@ fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) {
9797
let proc_res = compile_test(config, props, testfile);
9898

9999
if !proc_res.status.success() {
100-
fatal_ProcRes("compilation failed!".to_string(), &proc_res);
100+
fatal_proc_rec("compilation failed!".to_string(), &proc_res);
101101
}
102102

103103
exec_compiled_test(config, props, testfile)
@@ -108,7 +108,7 @@ fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) {
108108
// The value our Makefile configures valgrind to return on failure
109109
static VALGRIND_ERR: int = 100;
110110
if proc_res.status.matches_exit_status(VALGRIND_ERR) {
111-
fatal_ProcRes("run-fail test isn't valgrind-clean!".to_string(),
111+
fatal_proc_rec("run-fail test isn't valgrind-clean!".to_string(),
112112
&proc_res);
113113
}
114114

@@ -120,7 +120,7 @@ fn check_correct_failure_status(proc_res: &ProcRes) {
120120
// The value the rust runtime returns on failure
121121
static RUST_ERR: int = 101;
122122
if !proc_res.status.matches_exit_status(RUST_ERR) {
123-
fatal_ProcRes(
123+
fatal_proc_rec(
124124
format!("failure produced the wrong error: {}", proc_res.status),
125125
proc_res);
126126
}
@@ -131,19 +131,19 @@ fn run_rpass_test(config: &Config, props: &TestProps, testfile: &Path) {
131131
let mut proc_res = compile_test(config, props, testfile);
132132

133133
if !proc_res.status.success() {
134-
fatal_ProcRes("compilation failed!".to_string(), &proc_res);
134+
fatal_proc_rec("compilation failed!".to_string(), &proc_res);
135135
}
136136

137137
proc_res = exec_compiled_test(config, props, testfile);
138138

139139
if !proc_res.status.success() {
140-
fatal_ProcRes("test run failed!".to_string(), &proc_res);
140+
fatal_proc_rec("test run failed!".to_string(), &proc_res);
141141
}
142142
} else {
143143
let proc_res = jit_test(config, props, testfile);
144144

145145
if !proc_res.status.success() {
146-
fatal_ProcRes("jit failed!".to_string(), &proc_res);
146+
fatal_proc_rec("jit failed!".to_string(), &proc_res);
147147
}
148148
}
149149
}
@@ -172,7 +172,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
172172
"normal");
173173

174174
if !proc_res.status.success() {
175-
fatal_ProcRes(format!("pretty-printing failed in round {}", round),
175+
fatal_proc_rec(format!("pretty-printing failed in round {}", round),
176176
&proc_res);
177177
}
178178

@@ -204,21 +204,21 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
204204
let proc_res = typecheck_source(config, props, testfile, actual);
205205

206206
if !proc_res.status.success() {
207-
fatal_ProcRes("pretty-printed source does not typecheck".to_string(),
207+
fatal_proc_rec("pretty-printed source does not typecheck".to_string(),
208208
&proc_res);
209209
}
210210
if props.no_pretty_expanded { return }
211211

212212
// additionally, run `--pretty expanded` and try to build it.
213213
let proc_res = print_source(config, props, testfile, (*srcs.get(round)).clone(), "expanded");
214214
if !proc_res.status.success() {
215-
fatal_ProcRes(format!("pretty-printing (expanded) failed"), &proc_res);
215+
fatal_proc_rec(format!("pretty-printing (expanded) failed"), &proc_res);
216216
}
217217

218218
let ProcRes{ stdout: expanded_src, .. } = proc_res;
219219
let proc_res = typecheck_source(config, props, testfile, expanded_src);
220220
if !proc_res.status.success() {
221-
fatal_ProcRes(format!("pretty-printed source (expanded) does \
221+
fatal_proc_rec(format!("pretty-printed source (expanded) does \
222222
not typecheck"),
223223
&proc_res);
224224
}
@@ -326,7 +326,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
326326
// compile test file (it shoud have 'compile-flags:-g' in the header)
327327
let compiler_run_result = compile_test(config, props, testfile);
328328
if !compiler_run_result.status.success() {
329-
fatal_ProcRes("compilation failed!".to_string(), &compiler_run_result);
329+
fatal_proc_rec("compilation failed!".to_string(), &compiler_run_result);
330330
}
331331

332332
let exe_file = make_exe_name(config, testfile);
@@ -517,7 +517,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
517517
// compile test file (it shoud have 'compile-flags:-g' in the header)
518518
let compile_result = compile_test(config, props, testfile);
519519
if !compile_result.status.success() {
520-
fatal_ProcRes("compilation failed!".to_string(), &compile_result);
520+
fatal_proc_rec("compilation failed!".to_string(), &compile_result);
521521
}
522522

523523
let exe_file = make_exe_name(config, testfile);
@@ -560,7 +560,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
560560
let debugger_run_result = run_lldb(config, &exe_file, &debugger_script);
561561

562562
if !debugger_run_result.status.success() {
563-
fatal_ProcRes("Error while running LLDB".to_string(),
563+
fatal_proc_rec("Error while running LLDB".to_string(),
564564
&debugger_run_result);
565565
}
566566

@@ -720,7 +720,7 @@ fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String])
720720
}
721721
}
722722
if i != num_check_lines {
723-
fatal_ProcRes(format!("line not found in debugger output: {}",
723+
fatal_proc_rec(format!("line not found in debugger output: {}",
724724
check_lines.get(i).unwrap()),
725725
debugger_run_result);
726726
}
@@ -764,22 +764,22 @@ fn check_error_patterns(props: &TestProps,
764764
let missing_patterns =
765765
props.error_patterns.slice(next_err_idx, props.error_patterns.len());
766766
if missing_patterns.len() == 1u {
767-
fatal_ProcRes(format!("error pattern '{}' not found!",
767+
fatal_proc_rec(format!("error pattern '{}' not found!",
768768
missing_patterns[0]),
769769
proc_res);
770770
} else {
771771
for pattern in missing_patterns.iter() {
772772
error(format!("error pattern '{}' not found!", *pattern));
773773
}
774-
fatal_ProcRes("multiple error patterns not found".to_string(),
774+
fatal_proc_rec("multiple error patterns not found".to_string(),
775775
proc_res);
776776
}
777777
}
778778

779779
fn check_no_compiler_crash(proc_res: &ProcRes) {
780780
for line in proc_res.stderr.as_slice().lines() {
781781
if line.starts_with("error: internal compiler error:") {
782-
fatal_ProcRes("compiler encountered internal error".to_string(),
782+
fatal_proc_rec("compiler encountered internal error".to_string(),
783783
proc_res);
784784
}
785785
}
@@ -857,7 +857,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
857857
}
858858

859859
if !was_expected && is_compiler_error_or_warning(line) {
860-
fatal_ProcRes(format!("unexpected compiler error or warning: '{}'",
860+
fatal_proc_rec(format!("unexpected compiler error or warning: '{}'",
861861
line),
862862
proc_res);
863863
}
@@ -866,7 +866,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
866866
for (i, &flag) in found_flags.iter().enumerate() {
867867
if !flag {
868868
let ee = expected_errors.get(i);
869-
fatal_ProcRes(format!("expected {} on line {} not found: {}",
869+
fatal_proc_rec(format!("expected {} on line {} not found: {}",
870870
ee.kind, ee.line, ee.msg),
871871
proc_res);
872872
}
@@ -1047,7 +1047,7 @@ fn compose_and_run_compiler(
10471047
config.compile_lib_path.as_slice(),
10481048
None);
10491049
if !auxres.status.success() {
1050-
fatal_ProcRes(
1050+
fatal_proc_rec(
10511051
format!("auxiliary build of {} failed to compile: ",
10521052
abs_ab.display()),
10531053
&auxres);
@@ -1286,7 +1286,7 @@ fn error(err: String) { println!("\nerror: {}", err); }
12861286

12871287
fn fatal(err: String) -> ! { error(err); fail!(); }
12881288

1289-
fn fatal_ProcRes(err: String, proc_res: &ProcRes) -> ! {
1289+
fn fatal_proc_rec(err: String, proc_res: &ProcRes) -> ! {
12901290
print!("\n\
12911291
error: {}\n\
12921292
status: {}\n\
@@ -1562,35 +1562,35 @@ fn run_codegen_test(config: &Config, props: &TestProps,
15621562

15631563
let mut proc_res = compile_test_and_save_bitcode(config, props, testfile);
15641564
if !proc_res.status.success() {
1565-
fatal_ProcRes("compilation failed!".to_string(), &proc_res);
1565+
fatal_proc_rec("compilation failed!".to_string(), &proc_res);
15661566
}
15671567

15681568
proc_res = extract_function_from_bitcode(config, props, "test", testfile, "");
15691569
if !proc_res.status.success() {
1570-
fatal_ProcRes("extracting 'test' function failed".to_string(),
1570+
fatal_proc_rec("extracting 'test' function failed".to_string(),
15711571
&proc_res);
15721572
}
15731573

15741574
proc_res = disassemble_extract(config, props, testfile, "");
15751575
if !proc_res.status.success() {
1576-
fatal_ProcRes("disassembling extract failed".to_string(), &proc_res);
1576+
fatal_proc_rec("disassembling extract failed".to_string(), &proc_res);
15771577
}
15781578

15791579

15801580
let mut proc_res = compile_cc_with_clang_and_save_bitcode(config, props, testfile);
15811581
if !proc_res.status.success() {
1582-
fatal_ProcRes("compilation failed!".to_string(), &proc_res);
1582+
fatal_proc_rec("compilation failed!".to_string(), &proc_res);
15831583
}
15841584

15851585
proc_res = extract_function_from_bitcode(config, props, "test", testfile, "clang");
15861586
if !proc_res.status.success() {
1587-
fatal_ProcRes("extracting 'test' function failed".to_string(),
1587+
fatal_proc_rec("extracting 'test' function failed".to_string(),
15881588
&proc_res);
15891589
}
15901590

15911591
proc_res = disassemble_extract(config, props, testfile, "clang");
15921592
if !proc_res.status.success() {
1593-
fatal_ProcRes("disassembling extract failed".to_string(), &proc_res);
1593+
fatal_proc_rec("disassembling extract failed".to_string(), &proc_res);
15941594
}
15951595

15961596
let base = output_base_name(config, testfile);

src/librustc/back/link.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub fn llvm_err(sess: &Session, msg: String) -> ! {
6969
}
7070
}
7171

72-
pub fn WriteOutputFile(
72+
pub fn write_output_file(
7373
sess: &Session,
7474
target: lib::llvm::TargetMachineRef,
7575
pm: lib::llvm::PassManagerRef,
@@ -90,7 +90,7 @@ pub fn WriteOutputFile(
9090
pub mod write {
9191

9292
use back::lto;
93-
use back::link::{WriteOutputFile, OutputType};
93+
use back::link::{write_output_file, OutputType};
9494
use back::link::{OutputTypeAssembly, OutputTypeBitcode};
9595
use back::link::{OutputTypeExe, OutputTypeLlvmAssembly};
9696
use back::link::{OutputTypeObject};
@@ -310,7 +310,7 @@ pub mod write {
310310
output.temp_path(OutputTypeAssembly)
311311
};
312312
with_codegen(tm, llmod, trans.no_builtins, |cpm| {
313-
WriteOutputFile(sess, tm, cpm, llmod, &path,
313+
write_output_file(sess, tm, cpm, llmod, &path,
314314
lib::llvm::AssemblyFile);
315315
});
316316
}
@@ -328,7 +328,7 @@ pub mod write {
328328
match object_file {
329329
Some(ref path) => {
330330
with_codegen(tm, llmod, trans.no_builtins, |cpm| {
331-
WriteOutputFile(sess, tm, cpm, llmod, path,
331+
write_output_file(sess, tm, cpm, llmod, path,
332332
lib::llvm::ObjectFile);
333333
});
334334
}
@@ -339,7 +339,7 @@ pub mod write {
339339
trans.no_builtins, |cpm| {
340340
let out = output.temp_path(OutputTypeObject)
341341
.with_extension("metadata.o");
342-
WriteOutputFile(sess, tm, cpm,
342+
write_output_file(sess, tm, cpm,
343343
trans.metadata_module, &out,
344344
lib::llvm::ObjectFile);
345345
})

src/librustc/lib/llvm.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -10,6 +10,7 @@
1010

1111
#![allow(non_uppercase_pattern_statics)]
1212
#![allow(non_camel_case_types)]
13+
#![allow(non_snake_case_functions)]
1314
#![allow(dead_code)]
1415

1516
use std::c_str::ToCStr;

src/librustc/metadata/csearch.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ use middle::lang_items;
1919
use middle::ty;
2020
use middle::typeck;
2121

22-
use reader = serialize::ebml::reader;
22+
use serialize::ebml;
23+
use serialize::ebml::reader;
2324
use std::rc::Rc;
2425
use syntax::ast;
2526
use syntax::ast_map;
@@ -206,7 +207,7 @@ pub fn get_field_type(tcx: &ty::ctxt, class_id: ast::DefId,
206207
def: ast::DefId) -> ty::ty_param_bounds_and_ty {
207208
let cstore = &tcx.sess.cstore;
208209
let cdata = cstore.get_crate_data(class_id.krate);
209-
let all_items = reader::get_doc(reader::Doc(cdata.data()), tag_items);
210+
let all_items = reader::get_doc(ebml::Doc::new(cdata.data()), tag_items);
210211
let class_doc = expect(tcx.sess.diagnostic(),
211212
decoder::maybe_find_item(class_id.node, all_items),
212213
|| {

0 commit comments

Comments
 (0)