Skip to content

Commit 876e9fd

Browse files
committed
rustc: Rename diagnostic::diagnostictype to 'level'
1 parent 824beb4 commit 876e9fd

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/comp/driver/diagnostic.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import syntax::codemap;
44
import codemap::span;
55

66
export emitter, emit_diagnostic;
7-
export diagnostictype, fatal, error, warning, note;
7+
export level, fatal, error, warning, note;
88
export handler, mk_codemap_handler;
99

1010
type emitter = fn@(cmsp: option<(codemap::codemap, span)>,
11-
msg: str, t: diagnostictype);
11+
msg: str, lvl: level);
1212

1313

1414
iface handler {
@@ -88,7 +88,7 @@ fn mk_codemap_handler(cm: codemap::codemap,
8888
some(e) { e }
8989
none. {
9090
let f = fn@(cmsp: option<(codemap::codemap, span)>,
91-
msg: str, t: diagnostictype) {
91+
msg: str, t: level) {
9292
emit_diagnostic(cmsp, msg, t);
9393
};
9494
f
@@ -102,56 +102,56 @@ fn mk_codemap_handler(cm: codemap::codemap,
102102
} as handler
103103
}
104104

105-
tag diagnostictype {
105+
tag level {
106106
fatal;
107107
error;
108108
warning;
109109
note;
110110
}
111111

112-
fn diagnosticstr(t: diagnostictype) -> str {
113-
alt t {
112+
fn diagnosticstr(lvl: level) -> str {
113+
alt lvl {
114114
fatal. { "error" }
115115
error. { "error" }
116116
warning. { "warning" }
117117
note. { "note" }
118118
}
119119
}
120120

121-
fn diagnosticcolor(t: diagnostictype) -> u8 {
122-
alt t {
121+
fn diagnosticcolor(lvl: level) -> u8 {
122+
alt lvl {
123123
fatal. { term::color_bright_red }
124124
error. { term::color_bright_red }
125125
warning. { term::color_bright_yellow }
126126
note. { term::color_bright_green }
127127
}
128128
}
129129

130-
fn print_diagnostic(topic: str, t: diagnostictype, msg: str) {
130+
fn print_diagnostic(topic: str, lvl: level, msg: str) {
131131
if str::is_not_empty(topic) {
132132
io::stdout().write_str(#fmt["%s ", topic]);
133133
}
134134
if term::color_supported() {
135-
term::fg(io::stdout(), diagnosticcolor(t));
135+
term::fg(io::stdout(), diagnosticcolor(lvl));
136136
}
137-
io::stdout().write_str(#fmt["%s:", diagnosticstr(t)]);
137+
io::stdout().write_str(#fmt["%s:", diagnosticstr(lvl)]);
138138
if term::color_supported() {
139139
term::reset(io::stdout());
140140
}
141141
io::stdout().write_str(#fmt[" %s\n", msg]);
142142
}
143143

144144
fn emit_diagnostic(cmsp: option<(codemap::codemap, span)>,
145-
msg: str, t: diagnostictype) {
145+
msg: str, lvl: level) {
146146
alt cmsp {
147147
some((cm, sp)) {
148148
let ss = codemap::span_to_str(sp, cm);
149149
let lines = codemap::span_to_lines(sp, cm);
150-
print_diagnostic(ss, t, msg);
150+
print_diagnostic(ss, lvl, msg);
151151
highlight_lines(cm, sp, lines);
152152
}
153153
none. {
154-
print_diagnostic("", t, msg);
154+
print_diagnostic("", lvl, msg);
155155
}
156156
}
157157
}

0 commit comments

Comments
 (0)