about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/example/std_example.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-05-11 13:16:40 +0200
committerGitHub <noreply@github.com>2024-05-11 13:16:40 +0200
commit6c3fce90cca0d6744c8425ed944a8b606437ec73 (patch)
treeab1ee91afd21d4aca0aa81731ade39f205612f0e /compiler/rustc_codegen_cranelift/example/std_example.rs
parent03ff775966487008c60eabf6197fa144d7ecdc04 (diff)
parentc21c5baad9e8404777297705b6e55c0abcc7e6d9 (diff)
downloadrust-6c3fce90cca0d6744c8425ed944a8b606437ec73.tar.gz
rust-6c3fce90cca0d6744c8425ed944a8b606437ec73.zip
Rollup merge of #124954 - kpreid:fmterr, r=Nilstrieb
Document proper usage of `fmt::Error` and `fmt()`'s `Result`.

I've seen several newcomers wonder why `fmt::Error` doesn't have any error detail information, or propose to return it in response to an error condition found inside a `impl fmt::Display for MyType`.

That is incorrect, per [a lone paragraph of the `fmt` module's documentation](https://doc.rust-lang.org/1.78.0/std/fmt/index.html#formatting-traits). However, users looking to implement a formatting trait won't necessarily look there. Therefore, let's add the critical information (that formatting per se is infallible) to all the involved items: every `fmt()` method, and `fmt::Error`.

This PR is not intended to make any novel claims about `fmt`; only to repeat an existing one in places where it will be more visible.
Diffstat (limited to 'compiler/rustc_codegen_cranelift/example/std_example.rs')
0 files changed, 0 insertions, 0 deletions