Skip to content

Rollup of 19 pull requests #47513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 63 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
bdc34fd
fix faulty comment
andjo403 Jan 9, 2018
45cad04
rustdoc: Populate external_traits with traits only seen in impls
ollie27 Jan 10, 2018
f7b4877
Report errors instead of panic!()
Rantanen Jan 12, 2018
f18c52b
Start adding js tests
GuillaumeGomez Dec 12, 2017
53d8ec0
Prepare main.js for tests
GuillaumeGomez Jan 7, 2018
43acd23
Add tester and a few tests
GuillaumeGomez Jan 7, 2018
50bb6ba
Move forward to add rustdoc test
GuillaumeGomez Jan 8, 2018
6952199
End of rustdoc-js tool add into builder
GuillaumeGomez Jan 12, 2018
4cedbfc
fix mispositioned span
gaurikholkar Jan 13, 2018
eb1ada2
revert changes to ui test
gaurikholkar Jan 13, 2018
3c8c505
add ui test
gaurikholkar Jan 13, 2018
026c749
Only run rustdoc-js test suite when nodejs is available
GuillaumeGomez Jan 13, 2018
a22e716
Add a default directory for -Zmir-dump-dir
varkor Jan 14, 2018
2ccc82e
Make dump_mir_dir non-optional
varkor Jan 14, 2018
394b95f
Fix test
varkor Jan 15, 2018
ecd47a9
Don't include bang in macro replacement suggestion
etaoins Jan 14, 2018
b726204
incr.comp.: Cache type_of and some other queries.
michaelwoerister Jan 15, 2018
f9e1b9c
Add NLL test for #45045
chrisvittal Jan 15, 2018
c698496
Reexport -> re-export in documentation section headings
carols10cents Jan 12, 2018
90fcd44
Reexport -> re-export in error messages
carols10cents Jan 12, 2018
e168aa3
Reexport -> re-export in prose and documentation comments
carols10cents Jan 12, 2018
dc44d41
remove noop landing pads in cleanup shims
arielb1 Jan 15, 2018
bfde33f
Add "-lmsvcrt" twice to get rustc to build with the latest mingw64
segevfiner Jan 16, 2018
a4660df
Point at unused arguments for format string
estebank Jan 16, 2018
661e033
in which the private no-mangle lints receive a valued lesson in humility
zackmdavis Jan 16, 2018
fd075c6
implement "only-<platforms>" for test headers
Pulkit07 Jan 16, 2018
1e436eb
return the boolean value directly instead of using if-else
Pulkit07 Jan 16, 2018
567b07c
rename parse_cfg_prefix() to has_cfg_prefix()
Pulkit07 Jan 16, 2018
bd70f0f
add a comment about parsing only prefix in header.rs
Pulkit07 Jan 16, 2018
3a7e247
Fix for older JS versions
GuillaumeGomez Jan 16, 2018
24c3a6d
Add a Docker container for doing automated builds for CloudABI.
EdSchouten Jan 14, 2018
5801f95
Move dist-cloudabi/ into disabled/.
EdSchouten Jan 14, 2018
46c20c0
Remove incorrect `Default::default` links, add a new one
goffrie Jan 16, 2018
1dcfd14
Make non-found module name optional
dominikWin Jan 16, 2018
d769539
fix tidy checks
gaurikholkar Jan 16, 2018
a4e3f36
using tabs in ui tests
gaurikholkar Jan 16, 2018
efe3d69
fix minor errors
gaurikholkar Jan 16, 2018
ae4288f
Integrate dist-cloudabi into dist-various-2.
EdSchouten Jan 16, 2018
f81c2de
Allow a trailing comma in lint_array; fix #47428
mark-i-m Jan 15, 2018
dcf0cd0
Only enable CloudABI builds for x86-64 for now.
EdSchouten Jan 16, 2018
1606341
Document the mingw -lmsvcrt hack better
segevfiner Jan 16, 2018
6defae3
rustc: Spawn `cmd /c` for `.bat` scripts
alexcrichton Jan 16, 2018
eb3da09
Add secondary span pointing at the statement (error span)
estebank Jan 17, 2018
784cdd1
Rollup merge of #47250 - GuillaumeGomez:test-rustdoc-js, r=Mark-Simul…
kennytm Jan 17, 2018
3dc6f3c
Rollup merge of #47302 - andjo403:commentfix, r=michaelwoerister
kennytm Jan 17, 2018
41696f5
Rollup merge of #47313 - ollie27:rustdoc_record_extern_trait, r=Quiet…
kennytm Jan 17, 2018
67dac57
Rollup merge of #47387 - Rantanen:linkchecker-error-msg, r=steveklabnik
kennytm Jan 17, 2018
e8774b4
Rollup merge of #47404 - integer32llc:reexport-to-re-export, r=stevek…
kennytm Jan 17, 2018
9d5dc17
Rollup merge of #47407 - gaurikholkar:master, r=estebank
kennytm Jan 17, 2018
a37d098
Rollup merge of #47426 - varkor:default-mir-dump-dir, r=nikomatsakis
kennytm Jan 17, 2018
0a34e94
Rollup merge of #47427 - EdSchouten:cloudabi-ci, r=alexcrichton
kennytm Jan 17, 2018
2454799
Rollup merge of #47444 - etaoins:dont-include-bang-in-macro-suggestio…
kennytm Jan 17, 2018
b3ff458
Rollup merge of #47455 - michaelwoerister:cache-ty-collect, r=nikomat…
kennytm Jan 17, 2018
83c895a
Rollup merge of #47456 - chrisvittal:nll-tests, r=nikomatsakis
kennytm Jan 17, 2018
4b77463
Rollup merge of #47458 - mark-i-m:lint_array_comma, r=estebank
kennytm Jan 17, 2018
7c76dc0
Rollup merge of #47467 - arielb1:cleanup-shims, r=eddyb
kennytm Jan 17, 2018
73c06bf
Rollup merge of #47479 - zackmdavis:and_the_case_of_the_suggested_dou…
kennytm Jan 17, 2018
7d19bec
Rollup merge of #47481 - estebank:unused-args, r=arielb1
kennytm Jan 17, 2018
eaa7a1f
Rollup merge of #47483 - segevfiner:mingw64-build-hack, r=alexcrichton
kennytm Jan 17, 2018
ee636ed
Rollup merge of #47487 - Pulkit07:foo, r=kennytm
kennytm Jan 17, 2018
0af5b1d
Rollup merge of #47497 - goffrie:patch-1, r=dtolnay
kennytm Jan 17, 2018
6c3420b
Rollup merge of #47498 - dominikWin:missing-module-name, r=petrochenkov
kennytm Jan 17, 2018
5f5688a
Rollup merge of #47505 - alexcrichton:fix-bat-spawn-regression, r=est…
kennytm Jan 17, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Point at unused arguments for format string
Avoid overlapping spans by only pointing at the arguments that are not
being used in the argument string. Enable libsyntax to have diagnostics
with multiple primary spans by accepting `Into<MultiSpan>` instead of
`Span`.
  • Loading branch information
estebank committed Jan 16, 2018
commit a4660dfea230638dea504c24ca67b49a1d67e1a6
38 changes: 19 additions & 19 deletions src/libsyntax/ext/base.rs
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ pub use self::SyntaxExtension::*;
use ast::{self, Attribute, Name, PatKind, MetaItem};
use attr::HasAttrs;
use codemap::{self, CodeMap, Spanned, respan};
use syntax_pos::{Span, DUMMY_SP};
use syntax_pos::{Span, MultiSpan, DUMMY_SP};
use errors::DiagnosticBuilder;
use ext::expand::{self, Expansion, Invocation};
use ext::hygiene::{Mark, SyntaxContext};
@@ -754,22 +754,22 @@ impl<'a> ExtCtxt<'a> {
last_macro
}

pub fn struct_span_warn(&self,
sp: Span,
msg: &str)
-> DiagnosticBuilder<'a> {
pub fn struct_span_warn<S: Into<MultiSpan>>(&self,
sp: S,
msg: &str)
-> DiagnosticBuilder<'a> {
self.parse_sess.span_diagnostic.struct_span_warn(sp, msg)
}
pub fn struct_span_err(&self,
sp: Span,
msg: &str)
-> DiagnosticBuilder<'a> {
pub fn struct_span_err<S: Into<MultiSpan>>(&self,
sp: S,
msg: &str)
-> DiagnosticBuilder<'a> {
self.parse_sess.span_diagnostic.struct_span_err(sp, msg)
}
pub fn struct_span_fatal(&self,
sp: Span,
msg: &str)
-> DiagnosticBuilder<'a> {
pub fn struct_span_fatal<S: Into<MultiSpan>>(&self,
sp: S,
msg: &str)
-> DiagnosticBuilder<'a> {
self.parse_sess.span_diagnostic.struct_span_fatal(sp, msg)
}

@@ -785,7 +785,7 @@ impl<'a> ExtCtxt<'a> {
/// in most cases one can construct a dummy expression/item to
/// substitute; we never hit resolve/type-checking so the dummy
/// value doesn't have to match anything)
pub fn span_fatal(&self, sp: Span, msg: &str) -> ! {
pub fn span_fatal<S: Into<MultiSpan>>(&self, sp: S, msg: &str) -> ! {
panic!(self.parse_sess.span_diagnostic.span_fatal(sp, msg));
}

@@ -794,20 +794,20 @@ impl<'a> ExtCtxt<'a> {
///
/// Compilation will be stopped in the near future (at the end of
/// the macro expansion phase).
pub fn span_err(&self, sp: Span, msg: &str) {
pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
self.parse_sess.span_diagnostic.span_err(sp, msg);
}
pub fn mut_span_err(&self, sp: Span, msg: &str)
pub fn mut_span_err<S: Into<MultiSpan>>(&self, sp: S, msg: &str)
-> DiagnosticBuilder<'a> {
self.parse_sess.span_diagnostic.mut_span_err(sp, msg)
}
pub fn span_warn(&self, sp: Span, msg: &str) {
pub fn span_warn<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
self.parse_sess.span_diagnostic.span_warn(sp, msg);
}
pub fn span_unimpl(&self, sp: Span, msg: &str) -> ! {
pub fn span_unimpl<S: Into<MultiSpan>>(&self, sp: S, msg: &str) -> ! {
self.parse_sess.span_diagnostic.span_unimpl(sp, msg);
}
pub fn span_bug(&self, sp: Span, msg: &str) -> ! {
pub fn span_bug<S: Into<MultiSpan>>(&self, sp: S, msg: &str) -> ! {
self.parse_sess.span_diagnostic.span_bug(sp, msg);
}
pub fn trace_macros_diag(&mut self) {
25 changes: 15 additions & 10 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ use ast::{BinOpKind, UnOp};
use ast::{RangeEnd, RangeSyntax};
use {ast, attr};
use codemap::{self, CodeMap, Spanned, respan};
use syntax_pos::{self, Span, BytePos, FileName, DUMMY_SP};
use syntax_pos::{self, Span, MultiSpan, BytePos, FileName, DUMMY_SP};
use errors::{self, DiagnosticBuilder};
use parse::{self, classify, token};
use parse::common::SeqSep;
@@ -447,7 +447,9 @@ pub enum Error {
}

impl Error {
pub fn span_err(self, sp: Span, handler: &errors::Handler) -> DiagnosticBuilder {
pub fn span_err<S: Into<MultiSpan>>(self,
sp: S,
handler: &errors::Handler) -> DiagnosticBuilder {
match self {
Error::FileNotFoundForModule { ref mod_name,
ref default_path,
@@ -1266,13 +1268,16 @@ impl<'a> Parser<'a> {
pub fn fatal(&self, m: &str) -> DiagnosticBuilder<'a> {
self.sess.span_diagnostic.struct_span_fatal(self.span, m)
}
pub fn span_fatal(&self, sp: Span, m: &str) -> DiagnosticBuilder<'a> {
pub fn span_fatal<S: Into<MultiSpan>>(&self, sp: S, m: &str) -> DiagnosticBuilder<'a> {
self.sess.span_diagnostic.struct_span_fatal(sp, m)
}
pub fn span_fatal_err(&self, sp: Span, err: Error) -> DiagnosticBuilder<'a> {
pub fn span_fatal_err<S: Into<MultiSpan>>(&self, sp: S, err: Error) -> DiagnosticBuilder<'a> {
err.span_err(sp, self.diagnostic())
}
pub fn span_fatal_help(&self, sp: Span, m: &str, help: &str) -> DiagnosticBuilder<'a> {
pub fn span_fatal_help<S: Into<MultiSpan>>(&self,
sp: S,
m: &str,
help: &str) -> DiagnosticBuilder<'a> {
let mut err = self.sess.span_diagnostic.struct_span_fatal(sp, m);
err.help(help);
err
@@ -1283,21 +1288,21 @@ impl<'a> Parser<'a> {
pub fn warn(&self, m: &str) {
self.sess.span_diagnostic.span_warn(self.span, m)
}
pub fn span_warn(&self, sp: Span, m: &str) {
pub fn span_warn<S: Into<MultiSpan>>(&self, sp: S, m: &str) {
self.sess.span_diagnostic.span_warn(sp, m)
}
pub fn span_err(&self, sp: Span, m: &str) {
pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, m: &str) {
self.sess.span_diagnostic.span_err(sp, m)
}
pub fn struct_span_err(&self, sp: Span, m: &str) -> DiagnosticBuilder<'a> {
pub fn struct_span_err<S: Into<MultiSpan>>(&self, sp: S, m: &str) -> DiagnosticBuilder<'a> {
self.sess.span_diagnostic.struct_span_err(sp, m)
}
pub fn span_err_help(&self, sp: Span, m: &str, h: &str) {
pub fn span_err_help<S: Into<MultiSpan>>(&self, sp: S, m: &str, h: &str) {
let mut err = self.sess.span_diagnostic.mut_span_err(sp, m);
err.help(h);
err.emit();
}
pub fn span_bug(&self, sp: Span, m: &str) -> ! {
pub fn span_bug<S: Into<MultiSpan>>(&self, sp: S, m: &str) -> ! {
self.sess.span_diagnostic.span_bug(sp, m)
}
pub fn abort_if_errors(&self) {
12 changes: 2 additions & 10 deletions src/libsyntax_ext/format.rs
Original file line number Diff line number Diff line change
@@ -814,16 +814,8 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
let (sp, msg) = errs.into_iter().next().unwrap();
cx.ecx.struct_span_err(sp, msg)
} else {
let mut diag = cx.ecx.struct_span_err(cx.fmtsp,
"multiple unused formatting arguments");

// Ignoring message, as it gets repetitive
// Then use MultiSpan to not clutter up errors
for (sp, _) in errs {
diag.span_label(sp, "unused");
}

diag
cx.ecx.struct_span_err(errs.iter().map(|&(sp, _)| sp).collect::<Vec<Span>>(),
"multiple unused formatting arguments")
}
};

2 changes: 1 addition & 1 deletion src/test/ui/macros/format-foreign.rs
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
// except according to those terms.

fn main() {
println!("%.*3$s %s!\n", "Hello,", "World", 4);
println!("%.*3$s %s!\n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments
println!("%1$*2$.*3$f", 123.456); //~ ERROR never used

// This should *not* produce hints, on the basis that there's equally as
11 changes: 3 additions & 8 deletions src/test/ui/macros/format-foreign.stderr
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
error: multiple unused formatting arguments
--> $DIR/format-foreign.rs:12:5
--> $DIR/format-foreign.rs:12:30
|
12 | println!("%.*3$s %s!/n", "Hello,", "World", 4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^--------^^-------^^-^^
| | | |
| | | unused
| | unused
| unused
12 | println!("%.*3$s %s!/n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments
| ^^^^^^^^ ^^^^^^^ ^
|
= help: `%.*3$s` should be written as `{:.2$}`
= help: `%s` should be written as `{}`
= note: printf formatting not supported; see the documentation for `std::fmt`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: argument never used
--> $DIR/format-foreign.rs:13:29
5 changes: 3 additions & 2 deletions src/test/ui/macros/format-unused-lables.rs
Original file line number Diff line number Diff line change
@@ -10,17 +10,18 @@

fn main() {
println!("Test", 123, 456, 789);
//~^ ERROR multiple unused formatting arguments

println!("Test2",
123,
123, //~ ERROR multiple unused formatting arguments
456,
789
);

println!("Some stuff", UNUSED="args"); //~ ERROR named argument never used

println!("Some more $STUFF",
"woo!",
"woo!", //~ ERROR multiple unused formatting arguments
STUFF=
"things"
, UNUSED="args");
53 changes: 19 additions & 34 deletions src/test/ui/macros/format-unused-lables.stderr
Original file line number Diff line number Diff line change
@@ -1,53 +1,38 @@
error: multiple unused formatting arguments
--> $DIR/format-unused-lables.rs:12:5
--> $DIR/format-unused-lables.rs:12:22
|
12 | println!("Test", 123, 456, 789);
| ^^^^^^^^^^^^^^^^^---^^---^^---^^
| | | |
| | | unused
| | unused
| unused
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
| ^^^ ^^^ ^^^

error: multiple unused formatting arguments
--> $DIR/format-unused-lables.rs:14:5
|
14 | / println!("Test2",
15 | | 123,
| | --- unused
16 | | 456,
| | --- unused
17 | | 789
| | --- unused
18 | | );
| |______^
--> $DIR/format-unused-lables.rs:16:9
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
16 | 123, //~ ERROR multiple unused formatting arguments
| ^^^
17 | 456,
| ^^^
18 | 789
| ^^^

error: named argument never used
--> $DIR/format-unused-lables.rs:20:35
--> $DIR/format-unused-lables.rs:21:35
|
20 | println!("Some stuff", UNUSED="args"); //~ ERROR named argument never used
21 | println!("Some stuff", UNUSED="args"); //~ ERROR named argument never used
| ^^^^^^

error: multiple unused formatting arguments
--> $DIR/format-unused-lables.rs:22:5
--> $DIR/format-unused-lables.rs:24:9
|
22 | / println!("Some more $STUFF",
23 | | "woo!",
| | ------ unused
24 | | STUFF=
25 | | "things"
| | -------- unused
26 | | , UNUSED="args");
| |_______________________------_^
| |
| unused
24 | "woo!", //~ ERROR multiple unused formatting arguments
| ^^^^^^
25 | STUFF=
26 | "things"
| ^^^^^^^^
27 | , UNUSED="args");
| ^^^^^^
|
= help: `$STUFF` should be written as `{STUFF}`
= note: shell formatting not supported; see the documentation for `std::fmt`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: aborting due to 4 previous errors