Skip to content

Rollup of 5 pull requests - #62452

Merged
bors merged 22 commits into
rust-lang:masterfrom
Centril:rollup-5jww3h7
Jul 7, 2019
Merged

Rollup of 5 pull requests#62452
bors merged 22 commits into
rust-lang:masterfrom
Centril:rollup-5jww3h7

Conversation

@Centril

Copy link
Copy Markdown
Contributor

Successful merges:

Failed merges:

r? @ghost

pawromanand others added 22 commits April 18, 2019 15:30
Co-Authored-By: varkor <github@varkor.com>
Because Weak doesn't Deref, so there's no reason for them to be only
associated methods.
…varkor
Refactor unicode.py script
Hi, I noticed that the `unicode.py` script used some deprecated escapes in regular expressions. E.g. `\d`, `\w`, `\.` will be illegal in the future without "raw strings". This is now fixed. I have also cleaned up the script quite a bit.
## Escape deprecation
OK (note the `r`):
`re.compile(r"\d")`
Deprecated (from Python 3.6 onwards, see [here][link1] and [here][link2]):
`re.compile("\d")`.
[link1]: https://docs.python.org/3.6/whatsnew/3.6.html#deprecated-python-behavior
[link2]: https://bugs.python.org/issue27364
This was evident running the script using Python 3.7 like so:
```
$ python3 -Wall unicode.py
unicode.py:227: DeprecationWarning: invalid escape sequence \w
re1 = re.compile("^ *([0-9A-F]+) *; *(\w+)")
unicode.py:228: DeprecationWarning: invalid escape sequence \.
re2 = re.compile("^ *([0-9A-F]+)\.\.([0-9A-F]+) *; *(\w+)")
unicode.py:453: DeprecationWarning: invalid escape sequence \d
pattern = "for Version (\d+)\.(\d+)\.(\d+) of the Unicode"
```
The documentation states that
> A backslash-character pair that is not a valid escape sequence now generates a DeprecationWarning. Although this will eventually become a SyntaxError, that will not be for several Python releases.
## Testing
To test my changes, I had to add support for choosing the Unicode version to use. The script will default to latest release (which is 12.0.0 at the moment, repo has 11.0.0 checked in).
The script generates the exact same output for version 11.0.0 with Python 2.7 and 3.7 and no longer generates any deprecation warnings:
```
$ python3 -Wall unicode.py -v 11.0.0
Using Unicode version: 11.0.0
Regenerated tables.rs.
$ git diff tables.rs
$ python2 -Wall unicode.py -v 11.0.0
Using Unicode version: 11.0.0
Regenerated tables.rs.
$ git diff tables.rs
$ python2 --version
Python 2.7.16
$ python3 --version
Python 3.7.3
```
## Extra functionality
Furthermore, the script will check and download the latest Unicode version by default (without the `-v` argument). The `--help` is below:
```
$ ./unicode.py --help
usage: unicode.py [-h] [-v VERSION]
Regenerate Unicode tables (tables.rs).
optional arguments:
-h, --help show this help message and exit
-v VERSION, --version VERSION
Unicode version to use (if not specified, defaults to
latest available final release).
```
## Cleanups
I have cleaned up the code quite a bit, with Python best practices and code style in mind. I'm happy to provide more details and rationale for all my changes if the reviewers so desire.
One externally visible change is that the Unicode data will now be downloaded into `src/libcore/unicode/downloaded` directory suffixed by Unicode version:
```
$ pwd
.../rust/src/libcore/unicode
$ exa -T downloaded/
downloaded
├── 11.0.0
│ ├── DerivedCoreProperties.txt
│ ├── DerivedNormalizationProps.txt
│ ├── PropList.txt
│ ├── ReadMe.txt
│ ├── Scripts.txt
│ ├── SpecialCasing.txt
│ └── UnicodeData.txt
└── 12.0.0
├── DerivedCoreProperties.txt
├── DerivedNormalizationProps.txt
├── PropList.txt
├── ReadMe.txt
├── Scripts.txt
├── SpecialCasing.txt
└── UnicodeData.txt
```
…ckler
Make the Weak::{into,as}_raw methods
Because Weak doesn't Deref, so there's no reason for them to be only
associated methods.
As kindly pointed out here rust-lang#60766 (comment) by @chpio.
Improve documentation for built-in macros
This is the `libcore` part of rust-lang#62086.
Right now the only effect is improved documentation.
The changes in the last few commits are required to make the `libcore` change compile successfully.
…_compiler_messages_1, r=Centril
normalize use of backticks/lowercase in compiler messages for librustc_mir
normalize use of backticks/lowercase in compiler messages for librustc_mir
rust-lang#60532
r? @alexreg
@Centril

Copy link
Copy Markdown
ContributorAuthor

@bors r+ p=5 rollup=never

@bors

bors commented Jul 6, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit 7ef02dc has been approved by Centril

@borsbors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jul 6, 2019
@bors

bors commented Jul 6, 2019

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 7ef02dc with merge b0bd5f2...

bors added a commit that referenced this pull request Jul 6, 2019
Rollup of 5 pull requests
Successful merges:
- #60081 (Refactor unicode.py script)
- #61862 (Make the Weak::{into,as}_raw methods)
- #62243 (Improve documentation for built-in macros)
- #62422 (Remove some uses of mem::uninitialized)
- #62436 (normalize use of backticks/lowercase in compiler messages for librustc_mir)
Failed merges:
r? @ghost
@bors

bors commented Jul 7, 2019

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-azure, checks-travis, status-appveyor
Approved by: Centril
Pushing b0bd5f2 to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Jul 7, 2019
@bors
bors merged commit 7ef02dc into rust-lang:masterJul 7, 2019
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-borsThis PR was explicitly merged by bors.rollupA PR which is a rollupS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@Centril@bors@pawroman@vorner@tesuji@petrochenkov