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

Deprecate the bytes!() macro. #15017

Closed
wants to merge 2 commits into from

Conversation

SimonSapin
Copy link
Contributor

Replace its usage with byte string literals, except in bytes!() tests.
Also add a new snapshot, to be able to use the new b"foo" syntax.

The src/etc/2014-06-rewrite-bytes-macros.py script automatically rewrites bytes!() invocations into byte string literals. Pass it filenames as arguments to generate a diff that you can inspect, or --apply followed by filenames to apply the changes in place. Diffs can be piped into tip or pygmentize -l diff for coloring.

Closes #14646.
Closes #14881.

r? @alexcrichton

@SimonSapin
Copy link
Contributor Author

Most of the changes here are mechanical, made automatically by the new src/etc/2014-06-rewrite-bytes-macros.py script. src/libstd/path/posix.rs and src/libstd/path/windows.rs required special attention, due to their testing macros that themselves used bytes!() in an unusual way.

The warning message includes a link to http://doc.rust-lang.org/rust.html#byte-and-byte-string-literals , which is not valid yet since doc.rust-lang.org has not been rebuilt yet since #14880 (adding this section) landed.

Replace its usage with byte string literals, except in `bytes!()` tests.
Also add a new snapshot, to be able to use the new b"foo" syntax.

The src/etc/2014-06-rewrite-bytes-macros.py script automatically
rewrites `bytes!()` invocations into byte string literals.
Pass it filenames as arguments to generate a diff that you can inspect,
or `--apply` followed by filenames to apply the changes in place.
Diffs can be piped into `tip` or `pygmentize -l diff` for coloring.
@@ -463,7 +463,7 @@ pub mod builtin {
/// # Example
///
/// ```
/// let rust = bytes!("r", 'u', "st", 255);
/// let rust = b"rust\xFF";
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the doc string for the bytes!() macro, it should continue to use bytes!().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The dangers of automation :)

@SimonSapin
Copy link
Contributor Author

@kballard Fixed both issues.

@SimonSapin
Copy link
Contributor Author

@alexcrichton I don’t understand why 2c3bf88 closed this, it seems unrelated. Did I miss something?

@SimonSapin SimonSapin deleted the deprecate-bytes-macro branch June 19, 2014 11:05
@SimonSapin
Copy link
Contributor Author

Never mind, I needed to look at #15025 rather than just 2c3bf88.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 21, 2024
Expand lint tables && make clippy happy 🎉

This PR expands the lint tables on `./Cargo.toml` and thereby makes `cargo clippy` exit successfully! 🎉

Fixes rust-lang#15918

## How?

In the beginning there are some warnings for rustc.

Next, and most importantly, there is the clippy lint table. There are a few sections in there.

First there are the lint groups.

Second there are all lints which are permanently allowed with the reasoning why they are allowed.

Third there is a huge list of temporarily allowed lints. They should be removed in the mid-term, but incur a substantial amount of work, therefore they are allowed for now and can be worked on bit by bit.

Fourth there are all lints which should warn.

Additionally there are a few allow statements in the code for lints which should be permanently allowed in this specific place, but not in the whole code base.

## Follow up work
- [ ] Run clippy in CI
- [ ] Remove tidy test (at least `@Veykril` wrote this in rust-lang#15017)
- [ ] Work on temporarily allowed lints
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate the bytes!() macro Tracking issue for RFC 23 - byte string literals
3 participants