Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move static code outside of unciode.py. #47088

Merged
merged 1 commit into from
Jan 3, 2018

Conversation

clarfonthey
Copy link
Contributor

This script in libstd_unicode is a mess and also contains code that shouldn't be output by a script, and instead just put in modules. So, this change does that.

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@clarfonthey clarfonthey force-pushed the cleanup_unicode_py branch 2 times, most recently from 1a94ca7 to 157f58b Compare December 31, 2017 07:13
@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 31, 2017
pub mod general_category {
pub const Cc_table: &'static super::SmallBoolTrie = &super::SmallBoolTrie {
pub const Cc_table: &SmallBoolTrie = &super::SmallBoolTrie {
Copy link
Member

Choose a reason for hiding this comment

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

[00:04:03] error[E0412]: cannot find type `SmallBoolTrie` in this scope
[00:04:03]   --> /checkout/src/libstd_unicode/tables.rs:29:26
[00:04:03]    |
[00:04:03] 29 |     pub const Cc_table: &SmallBoolTrie = &super::SmallBoolTrie {
[00:04:03]    |                          ^^^^^^^^^^^^^ not found in this scope
[00:04:03] help: possible candidate is found in another module, you can import it into scope
[00:04:03]    |
[00:04:03] 29 |     use bool_trie::SmallBoolTrie;
[00:04:03]    |

@@ -120,7 +39,7 @@ pub mod general_category {
Cc_table.lookup(c)
}

pub const N_table: &'static super::BoolTrie = &super::BoolTrie {
pub const N_table: &BoolTrie = &BoolTrie {
Copy link
Member

Choose a reason for hiding this comment

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

[00:04:03] error[E0412]: cannot find type `BoolTrie` in this scope
[00:04:03]   --> /checkout/src/libstd_unicode/tables.rs:42:25
[00:04:03]    |
[00:04:03] 42 |     pub const N_table: &BoolTrie = &BoolTrie {
[00:04:03]    |                         ^^^^^^^^ not found in this scope
[00:04:03] help: possible candidate is found in another module, you can import it into scope
[00:04:03]    |
[00:04:03] 29 |     use bool_trie::BoolTrie;
[00:04:03]    |
[00:04:03] 
[00:04:03] error[E0422]: cannot find struct, variant or union type `BoolTrie` in this scope
[00:04:03]   --> /checkout/src/libstd_unicode/tables.rs:42:37
[00:04:03]    |
[00:04:03] 42 |     pub const N_table: &BoolTrie = &BoolTrie {
[00:04:03]    |                                     ^^^^^^^^ not found in this scope
[00:04:03] help: possible candidate is found in another module, you can import it into scope
[00:04:03]    |
[00:04:03] 29 |     use bool_trie::BoolTrie;
[00:04:03]    |

}

}

pub mod derived_property {
pub const Alphabetic_table: &'static super::BoolTrie = &super::BoolTrie {
pub const Alphabetic_table: &BoolTrie = &BoolTrie {
Copy link
Member

Choose a reason for hiding this comment

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

cannot find type BoolTrie in this scope

}

pub const Case_Ignorable_table: &'static super::BoolTrie = &super::BoolTrie {
pub const Case_Ignorable_table: &BoolTrie = &BoolTrie {
Copy link
Member

Choose a reason for hiding this comment

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

etc.

_priv: (),
}
use version::UnicodeVersion;
use bool_trie::{BoolTrie, SmallBoolTrie};
Copy link
Member

Choose a reason for hiding this comment

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

[00:04:03] error: unused import: `BoolTrie`
[00:04:03]   --> /checkout/src/libstd_unicode/tables.rs:16:17
[00:04:03]    |
[00:04:03] 16 | use bool_trie::{BoolTrie, SmallBoolTrie};
[00:04:03]    |                 ^^^^^^^^
[00:04:03]    |

@clarfonthey
Copy link
Contributor Author

@kennytm I actually just stumbled upon those errors this morning; I just pushed the fix.

/// Represents a Unicode Version.
///
/// See also: <http://www.unicode.org/versions/>
#[non_exhaustive]
Copy link
Member

Choose a reason for hiding this comment

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

Could this be omitted? It seems like there's not really much need to pull in a new unstable feature to this library

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will leave this to #47122 to fix and remove it from this PR.

/// non-BMP range of most Unicode sets.
pub struct BoolTrie {
// 0..0x800 (corresponding to 1 and 2 byte utf-8 sequences)
pub(crate) r1: [u64; 32], // leaves
Copy link
Member

Choose a reason for hiding this comment

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

Can these just be pub as this module isn't exported anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do

@clarfonthey clarfonthey force-pushed the cleanup_unicode_py branch 2 times, most recently from 60f9f98 to c4dceb0 Compare January 3, 2018 02:39
@clarfonthey
Copy link
Contributor Author

Requested changes have been made.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Jan 3, 2018

📌 Commit b4b3ddd has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Jan 3, 2018

⌛ Testing commit b4b3ddd with merge b893439...

bors added a commit that referenced this pull request Jan 3, 2018
Move static code outside of unciode.py.

This script in libstd_unicode is a mess and also contains code that shouldn't be output by a script, and instead just put in modules. So, this change does that.
@bors
Copy link
Contributor

bors commented Jan 3, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing b893439 to master...

@bors bors merged commit b4b3ddd into rust-lang:master Jan 3, 2018
@clarfonthey clarfonthey deleted the cleanup_unicode_py branch January 29, 2022 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants