You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auto merge of #17894 : steveklabnik/rust/fail_to_panic, r=aturon
This in-progress PR implements #17489.
I made the code changes in this commit, next is to go through alllllllll the documentation and fix various things.
- Rename column headings as appropriate, `# Panics` for panic conditions and `# Errors` for `Result`s.
- clean up usage of words like 'fail' in error messages
Anything else to add to the list, @aturon ? I think I should leave the actual functions with names like `slice_or_fail` alone, since you'll get to those in your conventions work?
I'm submitting just the code bits now so that we can see it separately, and I also don't want to have to keep re-building rust over and over again if I don't have to 😉
Listing all the bits so I can remember as I go:
- [x] compiler-rt
- [x] compiletest
- [x] doc
- [x] driver
- [x] etc
- [x] grammar
- [x] jemalloc
- [x] liballoc
- [x] libarena
- [x] libbacktrace
- [x] libcollections
- [x] libcore
- [x] libcoretest
- [x] libdebug
- [x] libflate
- [x] libfmt_macros
- [x] libfourcc
- [x] libgetopts
- [x] libglob
- [x] libgraphviz
- [x] libgreen
- [x] libhexfloat
- [x] liblibc
- [x] liblog
- [x] libnative
- [x] libnum
- [x] librand
- [x] librbml
- [x] libregex
- [x] libregex_macros
- [x] librlibc
- [x] librustc
- [x] librustc_back
- [x] librustc_llvm
- [x] librustdoc
- [x] librustrt
- [x] libsemver
- [x] libserialize
- [x] libstd
- [x] libsync
- [x] libsyntax
- [x] libterm
- [x] libtest
- [x] libtime
- [x] libunicode
- [x] liburl
- [x] libuuid
- [x] llvm
- [x] rt
- [x] test
Copy file name to clipboardExpand all lines: src/doc/complement-lang-faq.md
+3-2
Original file line number
Diff line number
Diff line change
@@ -65,14 +65,15 @@ Data values in the language can only be constructed through a fixed set of initi
65
65
* There is no global inter-crate namespace; all name management occurs within a crate.
66
66
* Using another crate binds the root of _its_ namespace into the user's namespace.
67
67
68
-
## Why is failure unwinding non-recoverable within a task? Why not try to "catch exceptions"?
68
+
## Why is panic unwinding non-recoverable within a task? Why not try to "catch exceptions"?
69
69
70
70
In short, because too few guarantees could be made about the dynamic environment of the catch block, as well as invariants holding in the unwound heap, to be able to safely resume; we believe that other methods of signalling and logging errors are more appropriate, with tasks playing the role of a "hard" isolation boundary between separate heaps.
71
71
72
72
Rust provides, instead, three predictable and well-defined options for handling any combination of the three main categories of "catch" logic:
73
73
74
74
* Failure _logging_ is done by the integrated logging subsystem.
75
-
*_Recovery_ after a failure is done by trapping a task failure from _outside_ the task, where other tasks are known to be unaffected.
75
+
*_Recovery_ after a panic is done by trapping a task panic from _outside_
76
+
the task, where other tasks are known to be unaffected.
76
77
*_Cleanup_ of resources is done by RAII-style objects with destructors.
77
78
78
79
Cleanup through RAII-style destructors is more likely to work than in catch blocks anyways, since it will be better tested (part of the non-error control paths, so executed all the time).
0 commit comments