Skip to content

Commit 5394e34

Browse files
committed
core: Camel case some lesser-used modules
1 parent 6b43c0c commit 5394e34

40 files changed

+187
-169
lines changed

src/libcore/at_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export unsafe;
1414
1515
#[abi = "cdecl"]
1616
extern mod rustrt {
17-
fn vec_reserve_shared_actual(++t: *sys::type_desc,
17+
fn vec_reserve_shared_actual(++t: *sys::TypeDesc,
1818
++v: **vec::unsafe::vec_repr,
1919
++n: libc::size_t);
2020
}

src/libcore/cmp.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44

55
/// Interfaces used for comparison.
66
7-
trait ord {
7+
trait Ord {
88
pure fn lt(&&other: self) -> bool;
99
}
1010

11-
trait eq {
11+
trait Eq {
1212
pure fn eq(&&other: self) -> bool;
1313
}
1414

15-
pure fn lt<T: ord>(v1: &T, v2: &T) -> bool {
15+
pure fn lt<T: Ord>(v1: &T, v2: &T) -> bool {
1616
v1.lt(*v2)
1717
}
1818

19-
pure fn le<T: ord eq>(v1: &T, v2: &T) -> bool {
19+
pure fn le<T: Ord Eq>(v1: &T, v2: &T) -> bool {
2020
v1.lt(*v2) || v1.eq(*v2)
2121
}
2222

23-
pure fn eq<T: eq>(v1: &T, v2: &T) -> bool {
23+
pure fn eq<T: Eq>(v1: &T, v2: &T) -> bool {
2424
v1.eq(*v2)
2525
}

src/libcore/core.rc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,22 @@ mod ptr;
159159
mod vec;
160160
mod at_vec;
161161
mod bool;
162+
#[warn(non_camel_case_types)]
162163
mod tuple;
163164

164165
// Ubiquitous-utility-type modules
165166

166167
#[cfg(notest)]
167168
mod ops;
169+
#[warn(non_camel_case_types)]
168170
mod cmp;
171+
#[warn(non_camel_case_types)]
169172
mod num;
173+
#[warn(non_camel_case_types)]
170174
mod hash;
171175
mod either;
172176
mod iter;
177+
#[warn(non_camel_case_types)]
173178
mod logging;
174179
mod option;
175180
#[path="iter-trait"]
@@ -178,8 +183,11 @@ mod option_iter {
178183
mod inst;
179184
}
180185
mod result;
186+
#[warn(non_camel_case_types)]
181187
mod to_str;
188+
#[warn(non_camel_case_types)]
182189
mod to_bytes;
190+
#[warn(non_camel_case_types)]
183191
mod util;
184192

185193
// Data structure modules
@@ -212,7 +220,9 @@ mod os;
212220
mod path;
213221
mod rand;
214222
mod run;
223+
#[warn(non_camel_case_types)]
215224
mod sys;
225+
#[warn(non_camel_case_types)]
216226
mod unsafe;
217227

218228

@@ -227,9 +237,13 @@ mod rt;
227237

228238
// For internal use, not exported
229239

240+
#[warn(non_camel_case_types)]
230241
mod unicode;
242+
#[warn(non_camel_case_types)]
231243
mod priv;
244+
#[warn(non_camel_case_types)]
232245
mod cmath;
246+
#[warn(non_camel_case_types)]
233247
mod stackwalk;
234248

235249
// Local Variables:

src/libcore/core.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@
55
import option::{some, none};
66
import option = option::option;
77
import path = path::path;
8-
import tuple::{tuple_ops, extended_tuple_ops};
8+
import tuple::{TupleOps, ExtendedTupleOps};
99
import str::{str_slice, unique_str};
1010
import vec::{const_vector, copyable_vector, immutable_vector};
1111
import vec::{immutable_copyable_vector, iter_trait_extensions};
1212
import iter::{base_iter, extended_iter, copyable_iter, times, timesi};
13-
import num::num;
13+
import num::Num;
1414
import ptr::ptr;
15-
import to_str::to_str;
15+
import to_str::ToStr;
1616

1717
export path, option, some, none, unreachable;
1818
export extensions;
1919
// The following exports are the extension impls for numeric types
20-
export num, times, timesi;
20+
export Num, times, timesi;
2121
// The following exports are the common traits
2222
export str_slice, unique_str;
2323
export const_vector, copyable_vector, immutable_vector;
2424
export immutable_copyable_vector, iter_trait_extensions;
2525
export base_iter, copyable_iter, extended_iter;
26-
export tuple_ops, extended_tuple_ops;
26+
export TupleOps, ExtendedTupleOps;
2727
export ptr;
28-
export to_str;
28+
export ToStr;
2929

3030
// The following exports are the core operators and kinds
3131
// The compiler has special knowlege of these so we must not duplicate them

src/libcore/f32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pure fn log2(n: f32) -> f32 {
167167
return ln(n) / consts::ln_2;
168168
}
169169

170-
impl f32: num::num {
170+
impl f32: num::Num {
171171
pure fn add(&&other: f32) -> f32 { return self + other; }
172172
pure fn sub(&&other: f32) -> f32 { return self - other; }
173173
pure fn mul(&&other: f32) -> f32 { return self * other; }

src/libcore/f64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ pure fn log2(n: f64) -> f64 {
194194
return ln(n) / consts::ln_2;
195195
}
196196

197-
impl f64: num::num {
197+
impl f64: num::Num {
198198
pure fn add(&&other: f64) -> f64 { return self + other; }
199199
pure fn sub(&&other: f64) -> f64 { return self - other; }
200200
pure fn mul(&&other: f64) -> f64 { return self * other; }

src/libcore/float.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ pure fn sin(x: float) -> float { f64::sin(x as f64) as float }
409409
pure fn cos(x: float) -> float { f64::cos(x as f64) as float }
410410
pure fn tan(x: float) -> float { f64::tan(x as f64) as float }
411411

412-
impl float: num::num {
412+
impl float: num::Num {
413413
pure fn add(&&other: float) -> float { return self + other; }
414414
pure fn sub(&&other: float) -> float { return self - other; }
415415
pure fn mul(&&other: float) -> float { return self * other; }
@@ -516,7 +516,7 @@ fn test_to_str_inf() {
516516

517517
#[test]
518518
fn test_traits() {
519-
fn test<U:num::num>(ten: U) {
519+
fn test<U:num::Num>(ten: U) {
520520
assert (ten.to_int() == 10);
521521

522522
let two = ten.from_int(2);

src/libcore/int-template.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import T = inst::T;
2-
import cmp::{eq, ord};
2+
import cmp::{Eq, Ord};
33

44
export min_value, max_value;
55
export min, max;
@@ -62,20 +62,20 @@ pure fn abs(i: T) -> T {
6262
if is_negative(i) { -i } else { i }
6363
}
6464

65-
impl T: ord {
65+
impl T: Ord {
6666
pure fn lt(&&other: T) -> bool {
6767
return self < other;
6868
}
6969
}
7070

71-
impl T: eq {
71+
impl T: Eq {
7272
pure fn eq(&&other: T) -> bool {
7373
return self == other;
7474
}
7575
}
7676

7777

78-
impl T: num::num {
78+
impl T: num::Num {
7979
pure fn add(&&other: T) -> T { return self + other; }
8080
pure fn sub(&&other: T) -> T { return self - other; }
8181
pure fn mul(&&other: T) -> T { return self * other; }
@@ -235,7 +235,7 @@ fn test_to_str() {
235235

236236
#[test]
237237
fn test_interfaces() {
238-
fn test<U:num::num>(ten: U) {
238+
fn test<U:num::Num>(ten: U) {
239239
assert (ten.to_int() == 10);
240240

241241
let two = ten.from_int(2);

src/libcore/num.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// An interface for numbers.
22
3-
trait num {
3+
trait Num {
44
// FIXME: Cross-crate overloading doesn't work yet. (#2615)
55
// FIXME: Trait composition. (#2616)
66
pure fn add(&&other: self) -> self;

src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ fn test_option_dance() {
227227
}
228228
#[test] #[should_fail] #[ignore(cfg(windows))]
229229
fn test_option_too_much_dance() {
230-
let mut y = some(util::noncopyable());
230+
let mut y = some(util::NonCopyable());
231231
let _y2 = swap_unwrap(&mut y);
232232
let _y3 = swap_unwrap(&mut y);
233233
}

src/libcore/pipes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ impl<T: send> port<T>: selectable {
10811081
}
10821082

10831083
/// A channel that can be shared between many senders.
1084-
type shared_chan<T: send> = unsafe::exclusive<chan<T>>;
1084+
type shared_chan<T: send> = unsafe::Exclusive<chan<T>>;
10851085

10861086
impl<T: send> shared_chan<T>: channel<T> {
10871087
fn send(+x: T) {

src/libcore/priv.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export chan_from_global_ptr, weaken_task;
55
import compare_and_swap = rustrt::rust_compare_and_swap_ptr;
66
import task::task_builder;
77

8+
#[allow(non_camel_case_types)] // runtime type
89
type rust_port_id = uint;
910

1011
extern mod rustrt {
@@ -15,22 +16,22 @@ extern mod rustrt {
1516
fn rust_task_unweaken(ch: rust_port_id);
1617
}
1718

18-
type global_ptr = *libc::uintptr_t;
19+
type GlobalPtr = *libc::uintptr_t;
1920

2021
/**
2122
* Atomically gets a channel from a pointer to a pointer-sized memory location
2223
* or, if no channel exists creates and installs a new channel and sets up a
2324
* new task to receive from it.
2425
*/
2526
unsafe fn chan_from_global_ptr<T: send>(
26-
global: global_ptr,
27+
global: GlobalPtr,
2728
task_fn: fn() -> task::task_builder,
2829
+f: fn~(comm::port<T>)
2930
) -> comm::chan<T> {
3031

31-
enum msg {
32-
proceed,
33-
abort
32+
enum Msg {
33+
Proceed,
34+
Abort
3435
}
3536

3637
log(debug,~"ENTERING chan_from_global_ptr, before is_prob_zero check");
@@ -48,9 +49,9 @@ unsafe fn chan_from_global_ptr<T: send>(
4849
4950
// Wait to hear if we are the official instance of
5051
// this global task
51-
match comm::recv::<msg>(setup_po) {
52-
proceed => f(po),
53-
abort => ()
52+
match comm::recv::<Msg>(setup_po) {
53+
Proceed => f(po),
54+
Abort => ()
5455
}
5556
};
5657
@@ -68,11 +69,11 @@ unsafe fn chan_from_global_ptr<T: send>(
6869

6970
if swapped {
7071
// Success!
71-
comm::send(setup_ch, proceed);
72+
comm::send(setup_ch, Proceed);
7273
ch
7374
} else {
7475
// Somebody else got in before we did
75-
comm::send(setup_ch, abort);
76+
comm::send(setup_ch, Abort);
7677
unsafe::reinterpret_cast(*global)
7778
}
7879
} else {
@@ -186,10 +187,10 @@ unsafe fn weaken_task(f: fn(comm::port<()>)) {
186187
unsafe {
187188
rustrt::rust_task_weaken(unsafe::reinterpret_cast(ch));
188189
}
189-
let _unweaken = unweaken(ch);
190+
let _unweaken = Unweaken(ch);
190191
f(po);
191192

192-
class unweaken {
193+
class Unweaken {
193194
let ch: comm::chan<()>;
194195
new(ch: comm::chan<()>) { self.ch = ch; }
195196
drop unsafe {

src/libcore/stackwalk.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@ import unsafe::reinterpret_cast;
44
import ptr::offset;
55
import sys::size_of;
66

7-
type word = uint;
7+
type Word = uint;
88

9-
class frame {
10-
let fp: *word;
9+
class Frame {
10+
let fp: *Word;
1111

12-
new(fp: *word) {
12+
new(fp: *Word) {
1313
self.fp = fp;
1414
}
1515
}
1616

17-
fn walk_stack(visit: fn(frame) -> bool) {
17+
fn walk_stack(visit: fn(Frame) -> bool) {
1818

1919
debug!{"beginning stack walk"};
2020

2121
do frame_address |frame_pointer| {
22-
let mut frame_address: *word = unsafe {
22+
let mut frame_address: *Word = unsafe {
2323
reinterpret_cast(frame_pointer)
2424
};
2525
loop {
26-
let fr = frame(frame_address);
26+
let fr = Frame(frame_address);
2727

2828
debug!{"frame: %x", unsafe { reinterpret_cast(fr.fp) }};
2929
visit(fr);
3030

3131
unsafe {
32-
let next_fp: **word = reinterpret_cast(frame_address);
32+
let next_fp: **Word = reinterpret_cast(frame_address);
3333
frame_address = *next_fp;
3434
if *frame_address == 0u {
3535
debug!{"encountered task_start_wrapper. ending walk"};

src/libcore/sys.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Misc low level stuff
22
3-
export type_desc;
3+
export TypeDesc;
44
export get_type_desc;
55
export size_of;
66
export min_align_of;
@@ -9,15 +9,16 @@ export refcount;
99
export log_str;
1010
export shape_eq, shape_lt, shape_le;
1111

12-
enum type_desc = {
12+
// Corresponds to runtime type_desc type
13+
enum TypeDesc = {
1314
size: uint,
1415
align: uint
1516
// Remaining fields not listed
1617
};
1718

1819
#[abi = "cdecl"]
1920
extern mod rustrt {
20-
pure fn shape_log_str(t: *sys::type_desc, data: *()) -> ~str;
21+
pure fn shape_log_str(t: *sys::TypeDesc, data: *()) -> ~str;
2122
}
2223

2324
#[abi = "rust-intrinsic"]
@@ -48,8 +49,8 @@ pure fn shape_le<T>(x1: &T, x2: &T) -> bool {
4849
* Useful for calling certain function in the Rust runtime or otherwise
4950
* performing dark magick.
5051
*/
51-
pure fn get_type_desc<T>() -> *type_desc {
52-
unchecked { rusti::get_tydesc::<T>() as *type_desc }
52+
pure fn get_type_desc<T>() -> *TypeDesc {
53+
unchecked { rusti::get_tydesc::<T>() as *TypeDesc }
5354
}
5455

5556
/// Returns the size of a type

0 commit comments

Comments
 (0)