Skip to content

Commit

Permalink
auto merge of #6226 : alexcrichton/rust/issue-6199, r=brson
Browse files Browse the repository at this point in the history
I just removed `pub mod` from `core.rc` and then got everything to compile again. One thing I'm worried about is an import like this:

```rust
use a;
use a::b;

mod a {
  pub type b = int;
}
mod b {
  use a;    // bad
  use a::b; // good
}
```

I'm not sure if `use a::b` being valid is a bug or intended behavior (same question about `use a`). If it's intended behavior, then I got around these modules not being public by only importing the specific members that are necessary. Otherwise that probably needs an open issue.
  • Loading branch information
bors committed May 7, 2013
2 parents 05460fc + 24cda9f commit 4b6864f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
33 changes: 16 additions & 17 deletions src/libcore/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use option::{None, Option, Some};
use str;
use u32;
use uint;
use unicode;
use unicode::{derived_property, general_category};

#[cfg(notest)] use cmp::Eq;

Expand Down Expand Up @@ -53,18 +53,17 @@ use unicode;
Cn Unassigned a reserved unassigned code point or a noncharacter
*/

pub use is_alphabetic = unicode::derived_property::Alphabetic;
pub use is_XID_start = unicode::derived_property::XID_Start;
pub use is_XID_continue = unicode::derived_property::XID_Continue;

pub fn is_alphabetic(c: char) -> bool { derived_property::Alphabetic(c) }
pub fn is_XID_start(c: char) -> bool { derived_property::XID_Start(c) }
pub fn is_XID_continue(c: char) -> bool { derived_property::XID_Continue(c) }

/**
* Indicates whether a character is in lower case, defined
* in terms of the Unicode General Category 'Ll'
*/
#[inline(always)]
pub fn is_lowercase(c: char) -> bool {
return unicode::general_category::Ll(c);
return general_category::Ll(c);
}

/**
Expand All @@ -73,7 +72,7 @@ pub fn is_lowercase(c: char) -> bool {
*/
#[inline(always)]
pub fn is_uppercase(c: char) -> bool {
return unicode::general_category::Lu(c);
return general_category::Lu(c);
}

/**
Expand All @@ -84,9 +83,9 @@ pub fn is_uppercase(c: char) -> bool {
#[inline(always)]
pub fn is_whitespace(c: char) -> bool {
return ('\x09' <= c && c <= '\x0d')
|| unicode::general_category::Zs(c)
|| unicode::general_category::Zl(c)
|| unicode::general_category::Zp(c);
|| general_category::Zs(c)
|| general_category::Zl(c)
|| general_category::Zp(c);
}

/**
Expand All @@ -96,18 +95,18 @@ pub fn is_whitespace(c: char) -> bool {
*/
#[inline(always)]
pub fn is_alphanumeric(c: char) -> bool {
return unicode::derived_property::Alphabetic(c) ||
unicode::general_category::Nd(c) ||
unicode::general_category::Nl(c) ||
unicode::general_category::No(c);
return derived_property::Alphabetic(c) ||
general_category::Nd(c) ||
general_category::Nl(c) ||
general_category::No(c);
}

/// Indicates whether the character is numeric (Nd, Nl, or No)
#[inline(always)]
pub fn is_digit(c: char) -> bool {
return unicode::general_category::Nd(c) ||
unicode::general_category::Nl(c) ||
unicode::general_category::No(c);
return general_category::Nd(c) ||
general_category::Nl(c) ||
general_category::No(c);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/core.rc
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@ pub mod unstable;

/* For internal use, not exported */

pub mod unicode;
mod unicode;
#[path = "num/cmath.rs"]
pub mod cmath;
pub mod stackwalk;
mod cmath;
mod stackwalk;
#[path = "rt/mod.rs"]
pub mod rt;
mod rt;

// A curious inner-module that's not exported that contains the binding
// 'core' so that macro-expanded references to core::error and such
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use libc::{size_t, uintptr_t};
use option::{None, Option, Some};
use ptr;
use hashmap::HashSet;
use stackwalk;
use stackwalk::walk_stack;
use sys;

pub use stackwalk::Word;
Expand Down Expand Up @@ -230,7 +230,7 @@ unsafe fn walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) {
// frame is marked by a sentinel, which is a box pointer stored on
// the stack.
let mut reached_sentinel = ptr::is_null(sentinel);
for stackwalk::walk_stack |frame| {
for walk_stack |frame| {
let pc = last_ret;
let Segment {segment: next_segment, boundary: boundary} =
find_segment_for_frame(frame.fp, segment);
Expand Down

0 comments on commit 4b6864f

Please sign in to comment.