diff options
| author | Philipp Hansch <dev@phansch.net> | 2019-06-01 08:29:12 +0200 |
|---|---|---|
| committer | Philipp Hansch <dev@phansch.net> | 2019-06-04 18:46:00 +0200 |
| commit | 94c8aa67917fe053c9d03d5be22ded221c0a5241 (patch) | |
| tree | e600659f0d1ce55e545382a299dd5345063342b1 | |
| parent | c04a2ccb3525ee55ab2484f0390eff2a047eecce (diff) | |
| download | rust-94c8aa67917fe053c9d03d5be22ded221c0a5241.tar.gz rust-94c8aa67917fe053c9d03d5be22ded221c0a5241.zip | |
Print to stderr and bless
| -rw-r--r-- | src/librustc_errors/annotate_rs_emitter.rs | 5 | ||||
| -rw-r--r-- | src/test/ui/annotate-snippet/missing-type.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/annotate-snippet/missing-type.stderr | 6 |
3 files changed, 11 insertions, 2 deletions
diff --git a/src/librustc_errors/annotate_rs_emitter.rs b/src/librustc_errors/annotate_rs_emitter.rs index 172b8b5551f..a5699035dea 100644 --- a/src/librustc_errors/annotate_rs_emitter.rs +++ b/src/librustc_errors/annotate_rs_emitter.rs @@ -204,7 +204,10 @@ impl AnnotateRsEmitterWriter { if let Some(snippet) = converter.to_annotation_snippet() { let dl = DisplayList::from(snippet); let dlf = DisplayListFormatter::new(true); - print!("{}", dlf.format(&dl)); + // FIXME(#59346): Figure out if we can _always_ print to stderr or not. + // `emitter.rs` has the `Destination` enum that lists various possible output + // destinations. + eprint!("{}", dlf.format(&dl)); }; } } diff --git a/src/test/ui/annotate-snippet/missing-type.rs b/src/test/ui/annotate-snippet/missing-type.rs index e52a81ec161..d0814a9537d 100644 --- a/src/test/ui/annotate-snippet/missing-type.rs +++ b/src/test/ui/annotate-snippet/missing-type.rs @@ -1,5 +1,5 @@ // compile-flags: --error-format human-annotate-rs pub fn main() { - let x: Iter; + let x: Iter; //~ ERROR cannot find type `Iter` in this scope } diff --git a/src/test/ui/annotate-snippet/missing-type.stderr b/src/test/ui/annotate-snippet/missing-type.stderr new file mode 100644 index 00000000000..1e84929d3c5 --- /dev/null +++ b/src/test/ui/annotate-snippet/missing-type.stderr @@ -0,0 +1,6 @@ +error[E0412]: cannot find type `Iter` in this scope + --> $DIR/missing-type.rs:4:11 + | +4 | let x: Iter; + | ^^^^ not found in this scope + | \ No newline at end of file |
