Skip to content

Commit f4a2672

Browse files
committed
Add test for -Z extra-plugins
1 parent 0bd022c commit f4a2672

File tree

4 files changed

+31
-8
lines changed

4 files changed

+31
-8
lines changed

src/librustc/metadata/creader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ impl<'a> CrateReader<'a> {
497497
let register = should_link && self.existing_match(info.name.as_slice(), None).is_none();
498498
let metadata = if register {
499499
// Register crate now to avoid double-reading metadata
500-
let (_, cmd, _) = self.register_crate(&None, info.ident[],
501-
info.name[], span, library);
500+
let (_, cmd, _) = self.register_crate(&None, &info.ident[],
501+
&info.name[], span, library);
502502
PMDSource::Registered(cmd)
503503
} else {
504504
// Not registering the crate; just hold on to the metadata

src/librustc/session/config.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,18 +311,20 @@ macro_rules! options {
311311
if !setter(&mut op, value) {
312312
match (value, opt_type_desc) {
313313
(Some(..), None) => {
314-
early_error(format!("{} option `{}` takes no \
314+
early_error(&format!("{} option `{}` takes no \
315315
value", $outputname, key)[])
316316
}
317317
(None, Some(type_desc)) => {
318-
early_error(format!("{0} option `{1}` requires \
318+
early_error(&format!("{0} option `{1}` requires \
319319
{2} ({3} {1}=<value>)",
320-
$outputname, key, type_desc, $prefix)[])
320+
$outputname, key,
321+
type_desc, $prefix)[])
321322
}
322323
(Some(value), Some(type_desc)) => {
323-
early_error(format!("incorrect value `{}` for {} \
324+
early_error(&format!("incorrect value `{}` for {} \
324325
option `{}` - {} was expected",
325-
value, $outputname, key, type_desc)[])
326+
value, $outputname,
327+
key, type_desc)[])
326328
}
327329
(None, None) => unreachable!()
328330
}
@@ -331,7 +333,7 @@ macro_rules! options {
331333
break;
332334
}
333335
if !found {
334-
early_error(format!("unknown codegen option: `{}`",
336+
early_error(&format!("unknown codegen option: `{}`",
335337
key)[]);
336338
}
337339
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:lint_plugin_test.rs
12+
// ignore-stage1
13+
// ignore-pretty: Random space appears with the pretty test
14+
// compile-flags: -Z extra-plugins=lint_plugin_test
15+
16+
fn lintme() { } //~ WARNING item is named 'lintme'
17+
18+
#[allow(test_lint)]
19+
pub fn main() {
20+
fn lintme() { }
21+
}

0 commit comments

Comments
 (0)