Skip to content
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

Rollup of 12 pull requests #47870

Merged
merged 38 commits into from
Jan 30, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c2e2612
Punctuation and clarity fixes.
jimmantooth Jan 17, 2018
c4befe1
Run rustfmt and add comments
mark-i-m Jan 19, 2018
49431d4
Add a bunch of doc comments
mark-i-m Jan 19, 2018
ca0c080
Fix typos
mark-i-m Jan 21, 2018
831ff77
implement Send for process::Command on unix
little-dude Jan 25, 2018
9e6ed17
make Command.argv Send on unix platforms
little-dude Jan 26, 2018
0ac4659
Add line numbers and columns to error messages spanning multiple files
varkor Jan 26, 2018
077d343
add test checking that process::Command is Send
little-dude Jan 26, 2018
aa6cc6e
Fix test in macro_backtrace
varkor Jan 26, 2018
ac0c16d
Run rustfmt on /libsyntax/ext/tt/macro_parser.rs
mark-i-m Jan 20, 2018
0d7f193
Added a bunch of comments to macro_parser.rs
mark-i-m Jan 20, 2018
6d4ed65
Added lots of comments + minor reorganization
mark-i-m Jan 25, 2018
b01b481
Added/improved comments
mark-i-m Jan 25, 2018
02d1d92
Still more comments
mark-i-m Jan 25, 2018
e2d558a
A few more comments
mark-i-m Jan 25, 2018
a21b7b3
Improve formatting of else block
varkor Jan 27, 2018
2497d10
Whitelist aes x86 feature flag
gnzlbg Jan 28, 2018
b32dbbc
Whitelist v7 feature for ARM and AARCH64.
gnzlbg Jan 28, 2018
7b4cbbd
Document that `Index` ops can panic on `HashMap` & `BTreeMap`.
frewsxcv Jan 29, 2018
e09a8bd
Add per-stage RUSTFLAGS: RUSTFLAGS_STAGE_{0,1,2} and RUSTFLAGS_STAGE_…
Mark-Simulacrum Jan 29, 2018
8389b66
Increase test coverage of use_nested_groups
pietroalbini Jan 29, 2018
898fdcc
Make run-pass/env-home-dir.rs test more robust
malbarbo Jan 24, 2018
adeb0ae
move comment right onto the line in question
nikomatsakis Jan 29, 2018
ae98f4c
rustdoc: Fix link title rendering with hoedown
ollie27 Jan 29, 2018
2184400
Update comment
mark-i-m Jan 29, 2018
5762942
fix typos
mark-i-m Jan 29, 2018
19aac09
Rollup merge of #47515 - jimmantooth:patch-1, r=QuietMisdreavus
kennytm Jan 30, 2018
3e39180
Rollup merge of #47603 - mark-i-m:markim_comments_0000, r=jseyfried
kennytm Jan 30, 2018
fccc85a
Rollup merge of #47718 - malbarbo:env-home-dir, r=nikomatsakis
kennytm Jan 30, 2018
f06a391
Rollup merge of #47732 - mark-i-m:markim_comments_0001, r=jseyfried
kennytm Jan 30, 2018
4dbfc8d
Rollup merge of #47760 - little-dude:master, r=alexcrichton
kennytm Jan 30, 2018
44b9641
Rollup merge of #47780 - varkor:cross-file-errors-line-col, r=estebank
kennytm Jan 30, 2018
003254e
Rollup merge of #47822 - gnzlbg:patch-1, r=alexcrichton
kennytm Jan 30, 2018
16d3fdb
Rollup merge of #47826 - gnzlbg:patch-2, r=alexcrichton
kennytm Jan 30, 2018
e8868bd
Rollup merge of #47836 - Mark-Simulacrum:stage-flags, r=alexcrichton
kennytm Jan 30, 2018
95572df
Rollup merge of #47839 - frewsxcv:frewsxcv-map-index, r=QuietMisdreavus
kennytm Jan 30, 2018
b83fb0f
Rollup merge of #47853 - rust-lang:increase-nested-groups-test-covera…
kennytm Jan 30, 2018
393a199
Rollup merge of #47855 - ollie27:rustdoc_hoedown_link_title, r=QuietM…
kennytm Jan 30, 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
Add line numbers and columns to error messages spanning multiple files
If an error message is emitted that spans several files, only the
primary file currently has line and column data attached. This is
useful information, even in files other than the one in which the error
occurs. We can often work out which line and column the error
corresponds to in other files — in this case it is helpful to add them
(in the case of ambiguity, the first relevant line/column is picked,
which is still helpful than none).
  • Loading branch information
varkor committed Jan 26, 2018
commit 0ac465924e6ae4380b25c38cbc14f425796fa2af
13 changes: 12 additions & 1 deletion src/librustc_errors/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1013,8 +1013,19 @@ impl EmitterWriter {

// Then, the secondary file indicator
buffer.prepend(buffer_msg_line_offset + 1, "::: ", Style::LineNumber);
let loc = if let Some(first_line) = annotated_file.lines.first() {
let col = if let Some(first_annotation) = first_line.annotations.first() {
format!(":{}", first_annotation.start_col + 1)
} else { "".to_string() };
format!("{}:{}{}",
annotated_file.file.name,
cm.doctest_offset_line(first_line.line_index),
col)
} else {
annotated_file.file.name.to_string()
};
buffer.append(buffer_msg_line_offset + 1,
&annotated_file.file.name.to_string(),
&loc,
Style::LineAndColumn);
for _ in 0..max_line_num_len {
buffer.prepend(buffer_msg_line_offset + 1, " ", Style::NoStyle);
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_errors/snippet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ pub struct FileInfo {

/// The "primary file", if any, gets a `-->` marker instead of
/// `>>>`, and has a line-number/column printed and not just a
/// filename. It appears first in the listing. It is known to
/// filename (other files are not guaranteed to have line numbers
/// or columns). It appears first in the listing. It is known to
/// contain at least one primary span, though primary spans (which
/// are designated with `^^^`) may also occur in other files.
primary_span: Option<Span>,
Expand Down
16 changes: 16 additions & 0 deletions src/test/ui/cross-file-errors/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2018 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.

#[macro_use]
mod underscore;

fn main() {
underscore!();
}
11 changes: 11 additions & 0 deletions src/test/ui/cross-file-errors/main.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error: expected expression, found `_`
--> $DIR/underscore.rs:18:9
|
18 | _
| ^
|
::: $DIR/main.rs:15:5
|
15 | underscore!();
| -------------- in this macro invocation

20 changes: 20 additions & 0 deletions src/test/ui/cross-file-errors/underscore.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2018 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.

// We want this file only so we can test cross-file error
// messages, but we don't want it in an external crate.
// ignore-test
#![crate_type = "lib"]

macro_rules! underscore {
() => (
_
)
}
2 changes: 1 addition & 1 deletion src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ impl<'test> TestCx<'test> {
}

/// For each `aux-build: foo/bar` annotation, we check to find the
/// file in a `aux` directory relative to the test itself.
/// file in a `auxiliary` directory relative to the test itself.
fn compute_aux_test_paths(&self, rel_ab: &str) -> TestPaths {
let test_ab = self.testpaths
.file
Expand Down