Skip to content

Commit

Permalink
Add test for -Z extra-plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Jan 8, 2015
1 parent 0bd022c commit f4a2672
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/librustc/metadata/creader.rs
Expand Up @@ -497,8 +497,8 @@ impl<'a> CrateReader<'a> {
let register = should_link && self.existing_match(info.name.as_slice(), None).is_none();
let metadata = if register {
// Register crate now to avoid double-reading metadata
let (_, cmd, _) = self.register_crate(&None, info.ident[],
info.name[], span, library);
let (_, cmd, _) = self.register_crate(&None, &info.ident[],
&info.name[], span, library);
PMDSource::Registered(cmd)
} else {
// Not registering the crate; just hold on to the metadata
Expand Down
14 changes: 8 additions & 6 deletions src/librustc/session/config.rs
Expand Up @@ -311,18 +311,20 @@ macro_rules! options {
if !setter(&mut op, value) {
match (value, opt_type_desc) {
(Some(..), None) => {
early_error(format!("{} option `{}` takes no \
early_error(&format!("{} option `{}` takes no \
value", $outputname, key)[])
}
(None, Some(type_desc)) => {
early_error(format!("{0} option `{1}` requires \
early_error(&format!("{0} option `{1}` requires \
{2} ({3} {1}=<value>)",
$outputname, key, type_desc, $prefix)[])
$outputname, key,
type_desc, $prefix)[])
}
(Some(value), Some(type_desc)) => {
early_error(format!("incorrect value `{}` for {} \
early_error(&format!("incorrect value `{}` for {} \
option `{}` - {} was expected",
value, $outputname, key, type_desc)[])
value, $outputname,
key, type_desc)[])
}
(None, None) => unreachable!()
}
Expand All @@ -331,7 +333,7 @@ macro_rules! options {
break;
}
if !found {
early_error(format!("unknown codegen option: `{}`",
early_error(&format!("unknown codegen option: `{}`",
key)[]);
}
}
Expand Down
21 changes: 21 additions & 0 deletions src/test/run-pass-fulldeps/lint-plugin-cmdline-load.rs
@@ -0,0 +1,21 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// aux-build:lint_plugin_test.rs
// ignore-stage1
// ignore-pretty: Random space appears with the pretty test
// compile-flags: -Z extra-plugins=lint_plugin_test

fn lintme() { } //~ WARNING item is named 'lintme'

#[allow(test_lint)]
pub fn main() {
fn lintme() { }
}

0 comments on commit f4a2672

Please sign in to comment.