File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,12 @@ pub fn set_level(level Level) {
30
30
}
31
31
32
32
// fatal logs a `fatal` message, using the default Logger instance
33
+ @[noreturn]
33
34
pub fn fatal (s string ) {
34
35
default_logger.fatal (s)
36
+ // the compiler currently has no way to mark functions in an interface
37
+ // as @[noreturn], so we need to make sure this is never returning ourselves
38
+ exit (1 )
35
39
}
36
40
37
41
// error logs an `error` message, using the default Logger instance
Original file line number Diff line number Diff line change @@ -136,3 +136,11 @@ fn test_log_time_format() {
136
136
assert true
137
137
println (@FN + ' end' )
138
138
}
139
+
140
+ fn make_error () ? string {
141
+ return 'ok'
142
+ }
143
+
144
+ fn test_log_default_fatal_has_noreturn () {
145
+ _ := make_error () or { fatal ('error' ) }
146
+ }
You can’t perform that action at this time.
0 commit comments