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

Add inherent constructors on str #131118

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

robertbastian
Copy link
Contributor

@robertbastian robertbastian commented Oct 1, 2024

#131114

Unresolved questions

Do we mark the core::str functions as future-deprecation? This will causes warnings when core::str is imported and str::from_utf8 is used, because the compiler decides to interpret that as the module, not the type.

@rustbot
Copy link
Collaborator

rustbot commented Oct 1, 2024

r? @Amanieu

rustbot has assigned @Amanieu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 1, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the O-windows Operating system: Windows label Oct 1, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@jieyouxu jieyouxu added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Oct 2, 2024
@bors
Copy link
Contributor

bors commented Oct 5, 2024

☔ The latest upstream changes (presumably #131269) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#16 2.795 Building wheels for collected packages: reuse
#16 2.796   Building wheel for reuse (pyproject.toml): started
#16 3.043   Building wheel for reuse (pyproject.toml): finished with status 'done'
#16 3.044   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132715 sha256=dfa09868353292d98f811d3efdb0d54d07389e808efc71d68e3b93c514bf8bec
#16 3.044   Stored in directory: /tmp/pip-ephem-wheel-cache-8zpmccr7/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#16 3.047 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#16 3.435 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#16 3.436 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#16 DONE 3.5s
---
    Checking core v0.0.0 (/checkout/library/core)
   Compiling libc v0.2.159
   Compiling memchr v2.5.0
   Compiling std v0.0.0 (/checkout/library/std)
error: use of function `str::converts::from_utf8` that will be deprecated in a future Rust version: replaced by the `from_utf8` method on the `str` type
   |
30 | pub use converts::{from_utf8, from_utf8_unchecked};
   |                    ^^^^^^^^^
   |
---

error[E0711]: feature `const_str_from_utf8_unchecked_mut` is declared unstable, but was previously declared stable
   --> core/src/str/mod.rs:350:5
    |
350 |     #[rustc_const_unstable(feature = "const_str_from_utf8_unchecked_mut", issue = "91005")]

error: `str::<impl str>::from_utf8_unchecked_mut` is not yet stable as a const fn
   --> core/src/char/methods.rs:680:18
    |
    |
680 |         unsafe { str::from_utf8_unchecked_mut(encode_utf8_raw(self as u32, dst)) }
    |
    = help: add `#![feature(const_str_from_utf8_unchecked_mut)]` to the crate attributes to enable

error: `str::<impl str>::from_utf8_unchecked_mut` is not yet stable as a const fn
error: `str::<impl str>::from_utf8_unchecked_mut` is not yet stable as a const fn
   --> core/src/str/converts.rs:130:25
    |
130 |             Ok(unsafe { str::from_utf8_unchecked_mut(v) })
    |
    = help: add `#![feature(const_str_from_utf8_unchecked_mut)]` to the crate attributes to enable

error: `str::<impl str>::from_utf8_unchecked_mut` is not yet stable as a const fn
error: `str::<impl str>::from_utf8_unchecked_mut` is not yet stable as a const fn
   --> core/src/str/converts.rs:207:14
    |
207 |     unsafe { str::from_utf8_unchecked_mut(v) }
    |
    = help: const-stable functions can only call other const-stable functions

error: `str::<impl str>::from_utf8_unchecked_mut` is not yet stable as a const fn
error: `str::<impl str>::from_utf8_unchecked_mut` is not yet stable as a const fn
   --> core/src/str/mod.rs:288:29
    |
288 |                 Ok(unsafe { Self::from_utf8_unchecked_mut(v) })
    |
    = help: add `#![feature(const_str_from_utf8_unchecked_mut)]` to the crate attributes to enable

For more information about this error, try `rustc --explain E0711`.

@bors
Copy link
Contributor

bors commented Oct 16, 2024

☔ The latest upstream changes (presumably #131767) made this pull request unmergeable. Please resolve the merge conflicts.

@scottmcm
Copy link
Member

Do we mark the core::str functions as future-deprecation?

I think it'll make your life much easier to do it in different PRs. Add the new ones first, then you can do separate PRs to update different parts of things to use the new ones, then once you're through that you can PR the future-deprecation.

(Keeping it locally will help you make those other PRs, but no need to check it in for a while.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-windows Operating system: Windows S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants