Skip to content

Add ErrorKind::OutOfMemory #84744

New issue

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

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

Already on GitHub? # to your account

Merged
merged 2 commits into from
May 3, 2021
Merged

Add ErrorKind::OutOfMemory #84744

merged 2 commits into from
May 3, 2021

Conversation

kornelski
Copy link
Contributor

@kornelski kornelski commented Apr 30, 2021

Ability to express ENOMEM as an io::Error.

I've used OutOfMemory as opposed to NotEnoughMem or AllocationFailed, because "OOM" is used in Rust already.

See also #84612

@rust-highfive
Copy link
Contributor

r? @dtolnay

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 30, 2021
@rust-log-analyzer

This comment has been minimized.

@jyn514 jyn514 added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Apr 30, 2021
@joshtriplett
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 30, 2021

📌 Commit 91caf05 has been approved by joshtriplett

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 30, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this pull request May 1, 2021
Add ErrorKind::OutOfMemory

Ability to express `ENOMEM` as an `io::Error`.

I've used `OutOfMemory` as opposed to `NotEnoughMem` or `AllocationFailed`, because "OOM" is used in Rust already.

See also rust-lang#84612
@JohnTitor
Copy link
Member

Failed in rollup: #84785 (comment)
We should tweak this clippy test: https://github.com/rust-lang/rust/blob/5a4ab26459a1ccf17ef5bb4c841d3ae5517b2890/src/tools/clippy/tests/ui/wildcard_enum_match_arm.rs

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 1, 2021
@rust-log-analyzer

This comment has been minimized.

@kornelski
Copy link
Contributor Author

@JohnTitor I've updated the Clippy test

@JohnTitor
Copy link
Member

@bors r=joshtriplett

@bors
Copy link
Collaborator

bors commented May 2, 2021

📌 Commit 19568f9 has been approved by joshtriplett

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 2, 2021
@bors
Copy link
Collaborator

bors commented May 2, 2021

⌛ Testing commit 19568f9 with merge b8ede0a7a60a5d31e94006d225d88bb3d6292ece...

@bors
Copy link
Collaborator

bors commented May 2, 2021

💔 Test failed - checks-actions

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label May 2, 2021
@bors bors added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 2, 2021
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@JohnTitor
Copy link
Member

2021-05-02T19:45:52.1008217Z Can't find any online and idle self-hosted runner in current repository that matches the required labels: 'ubuntu-latest'
2021-05-02T19:45:52.1387762Z Can't find any online and idle self-hosted runner in current repository's organization account that matches the required labels: 'ubuntu-latest'
2021-05-02T19:45:52.2775891Z Found online and idle hosted runner in current repository's organization account that matches the required labels: 'ubuntu-latest'

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 2, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request May 3, 2021
Rollup of 6 pull requests

Successful merges:

 - rust-lang#84072 (Allow setting `target_family` to multiple values, and implement `target_family="wasm"`)
 - rust-lang#84744 (Add ErrorKind::OutOfMemory)
 - rust-lang#84784 (Add help message to suggest const for unused type param)
 - rust-lang#84811 (RustDoc: Fix bounds linking trait.Foo instead of traitalias.Foo)
 - rust-lang#84818 (suggestion for unit enum variant when matched with a patern)
 - rust-lang#84832 (Do not print visibility in external traits)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 77abe7a into rust-lang:master May 3, 2021
@rustbot rustbot added this to the 1.54.0 milestone May 3, 2021
@dtolnay dtolnay added the needs-fcp This change is insta-stable, so needs a completed FCP to proceed. label May 3, 2021
@dtolnay
Copy link
Member

dtolnay commented May 3, 2021

@rfcbot fcp merge

I guess JFYI @rust-lang/libs.

@joshtriplett
Copy link
Member

joshtriplett commented May 3, 2021

The idea of adding more error codes did come up a few times, but you're right, an fcp is warranted to have all of that discussion in public and make sure everyone gets polled.

@rfcbot poll T-libs confirming addition of ErrorKind values

EDIT: hmmm, rfcbot doesn't seem to be responding...

@m-ou-se
Copy link
Member

m-ou-se commented May 3, 2021

EDIT: hmmm, rfcbot doesn't seem to be responding...

@joshtriplett I don't think it watches merged/closed PRs. An FCP would require a new issue.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request May 3, 2021
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request May 3, 2021
Correct stability of ErrorKind::OutOfMemory

Fix for rust-lang#84744
@BurntSushi
Copy link
Member

Wait, did this get merged without going through FCP? AIUI, all new stable APIs to std should be going through FCP. cc @rust-lang/libs

@joshtriplett
Copy link
Member

That was my mistake, sorry; this was discussed verbally but not FCPed, and despite the positive outcome of that discussion, it does still need an FCP to check for (and document) consensus. I'll start a new issue to do that FCP poll.

wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Aug 12, 2021
Pkgsrc changes:
 * Bump bootstrap requirements to 1.53.0.
 * Adjust patches, adapt to upstream changes, adjust cargo checksums
 * If using an external llvm, require >= 10.0

Upsteream changes:

Version 1.54.0 (2021-07-29)
============================

Language
-----------------------

- [You can now use macros for values in built-in attribute macros.][83366]
  While a seemingly minor addition on its own, this enables a lot of
  powerful functionality when combined correctly. Most notably you can
  now include external documentation in your crate by writing the following.
  ```rust
  #![doc = include_str!("README.md")]
  ```
  You can also use this to include auto-generated modules:
  ```rust
  #[path = concat!(env!("OUT_DIR"), "/generated.rs")]
  mod generated;
  ```

- [You can now cast between unsized slice types (and types which contain
  unsized slices) in `const fn`.][85078]
- [You can now use multiple generic lifetimes with `impl Trait` where the
   lifetimes don't explicitly outlive another.][84701] In code this means
   that you can now have `impl Trait<'a, 'b>` where as before you could
   only have `impl Trait<'a, 'b> where 'b: 'a`.

Compiler
-----------------------

- [Rustc will now search for custom JSON targets in
  `/lib/rustlib/<target-triple>/target.json` where `/` is the "sysroot"
  directory.][83800] You can find your sysroot directory by running
  `rustc --print sysroot`.
- [Added `wasm` as a `target_family` for WebAssembly platforms.][84072]
- [You can now use `#[target_feature]` on safe functions when targeting
  WebAssembly platforms.][84988]
- [Improved debugger output for enums on Windows MSVC platforms.][85292]
- [Added tier 3\* support for `bpfel-unknown-none`
   and `bpfeb-unknown-none`.][79608]

\* Refer to Rust's [platform support page][platform-support-doc] for more
   information on Rust's tiered platform support.

Libraries
-----------------------

- [`panic::panic_any` will now `#[track_caller]`.][85745]
- [Added `OutOfMemory` as a variant of `io::ErrorKind`.][84744]
- [ `proc_macro::Literal` now implements `FromStr`.][84717]
- [The implementations of vendor intrinsics in core::arch have been
   significantly refactored.][83278] The main user-visible changes are
   a 50% reduction in the size of libcore.rlib and stricter validation
   of constant operands passed to intrinsics. The latter is technically
   a breaking change, but allows Rust to more closely match the C vendor
   intrinsics API.

Stabilized APIs
---------------

- [`BTreeMap::into_keys`]
- [`BTreeMap::into_values`]
- [`HashMap::into_keys`]
- [`HashMap::into_values`]
- [`arch::wasm32`]
- [`VecDeque::binary_search`]
- [`VecDeque::binary_search_by`]
- [`VecDeque::binary_search_by_key`]
- [`VecDeque::partition_point`]

Cargo
-----

- [Added the `--prune <spec>` option to `cargo-tree` to remove a package from
  the dependency graph.][cargo/9520]
- [Added the `--depth` option to `cargo-tree` to print only to a certain depth
  in the tree ][cargo/9499]
- [Added the `no-proc-macro` value to `cargo-tree --edges` to hide procedural
  macro dependencies.][cargo/9488]
- [A new environment variable named `CARGO_TARGET_TMPDIR` is
  available.][cargo/9375]
  This variable points to a directory that integration tests and
  benches can use as a "scratchpad" for testing filesystem operations.

Compatibility Notes
-------------------
- [Mixing Option and Result via `?` is no longer permitted in
  closures for inferred types.][86831]
- [Previously unsound code is no longer permitted where different
  constructors in branches could require different lifetimes.][85574]
- As previously mentioned the [`std::arch` instrinsics now uses
  stricter const checking][83278] than before and may reject some
  previously accepted code.
- [`i128` multiplication on Cortex M0+ platforms currently
  unconditionally causes overflow when compiled with `codegen-units
  = 1`.][86063]

[85574]: rust-lang/rust#85574
[86831]: rust-lang/rust#86831
[86063]: rust-lang/rust#86063
[86831]: rust-lang/rust#86831
[79608]: rust-lang/rust#79608
[84988]: rust-lang/rust#84988
[84701]: rust-lang/rust#84701
[84072]: rust-lang/rust#84072
[85745]: rust-lang/rust#85745
[84744]: rust-lang/rust#84744
[85078]: rust-lang/rust#85078
[84717]: rust-lang/rust#84717
[83800]: rust-lang/rust#83800
[83366]: rust-lang/rust#83366
[83278]: rust-lang/rust#83278
[85292]: rust-lang/rust#85292
[cargo/9520]: rust-lang/cargo#9520
[cargo/9499]: rust-lang/cargo#9499
[cargo/9488]: rust-lang/cargo#9488
[cargo/9375]: rust-lang/cargo#9375
[`BTreeMap::into_keys`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.into_keys
[`BTreeMap::into_values`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.into_values
[`HashMap::into_keys`]: https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.into_keys
[`HashMap::into_values`]: https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.into_values
[`arch::wasm32`]: https://doc.rust-lang.org/core/arch/wasm32/index.html
[`VecDeque::binary_search`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.binary_search
[`VecDeque::binary_search_by`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.binary_search_by
[`VecDeque::binary_search_by_key`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.binary_search_by_key
[`VecDeque::partition_point`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.partition_point
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
needs-fcp This change is insta-stable, so needs a completed FCP to proceed. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.