Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/core/src/unicode/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub use unicode_data::conversions;
pub(crate) use unicode_data::alphabetic::lookup as Alphabetic;
pub(crate) use unicode_data::grapheme_extend::lookup as Grapheme_Extend;
pub(crate) use unicode_data::lowercase::lookup as Lowercase;
pub(crate) use unicode_data::n::lookup as N;
pub(crate) use unicode_data::number::lookup as N;
pub(crate) use unicode_data::uppercase::lookup as Uppercase;
pub(crate) use unicode_data::white_space::lookup as White_Space;

Expand Down
2 changes: 1 addition & 1 deletion library/core/src/unicode/unicode_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ pub mod lowercase {
}
}

pub mod n {
pub mod number {
use super::ShortOffsetRunHeader;

static SHORT_OFFSET_RUNS: [ShortOffsetRunHeader; 43] = [
Expand Down
3 changes: 2 additions & 1 deletion library/coretests/tests/unicode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ fn lowercase() {
}

#[test]
#[cfg_attr(miri, ignore)]
fn n() {
test_boolean_property(test_data::N, unicode_data::n::lookup);
test_boolean_property(test_data::N, unicode_data::number::lookup);
}

#[test]
Expand Down
14 changes: 8 additions & 6 deletions src/tools/unicode-table-generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,13 @@ fn main() {
emit_codepoints(&mut emitter, ranges);
}

modules.push((property.to_lowercase().to_string(), emitter.file));
// FIXME: the generated `unicode_data` is `pub`, so the module names
// can show up in recommendations. While that's a rustc issue, we
// choose a better name for the "N" property to avoid bad diagnostics.
let module_name =
if property == &"N" { "number".to_string() } else { property.to_lowercase() };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this!


modules.push((module_name, emitter.file));
writeln!(
table_file,
"// {:16}: {:5} bytes, {:6} codepoints in {:3} ranges (U+{:06X} - U+{:06X}) using {}",
Expand Down Expand Up @@ -280,12 +286,8 @@ fn main() {

std::fs::write(&test_path, test_file).unwrap();
std::fs::write(&data_path, table_file).unwrap();
rustfmt(&data_path);
rustfmt(&test_path);
}

fn rustfmt(path: &str) {
std::process::Command::new("rustfmt").arg(path).status().expect("rustfmt failed");
eprintln!("Unicode data was generated. Remember to run \"x fmt\"!");
}

fn version() -> String {
Expand Down
Loading