Skip to content

Commit

Permalink
Rollup merge of rust-lang#23782 - mvdnes:obsolete_note, r=alexcrichton
Browse files Browse the repository at this point in the history
When emmitting a note, previously it was not known if the note was for an error or a
warning. If it was for a warning, then with `-Awarnings` it should not have been print.
The `emit_for` function allows someone to specify which level should determine its visibility.

An example:
```rust
extern crate "std" as std2;
fn main() {}
```

When compiling with `-Awarnings`, this would previously emit `note: use an identifier not in quotes instead` (and nothing else).
With this patch, it will be completely silent as expected.
  • Loading branch information
steveklabnik committed Apr 16, 2015
2 parents e9080ec + 6de33c2 commit 6140872
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libsyntax/parse/obsolete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
self.span_warn(sp, &format!("obsolete syntax: {}", kind_str));
}

if !self.obsolete_set.contains(&kind) {
if !self.obsolete_set.contains(&kind) &&
(error || self.sess.span_diagnostic.handler().can_emit_warnings) {
self.sess
.span_diagnostic
.handler()
Expand Down

0 comments on commit 6140872

Please sign in to comment.