File tree Expand file tree Collapse file tree 6 files changed +62
-3
lines changed
test/ui/cross-file-errors Expand file tree Collapse file tree 6 files changed +62
-3
lines changed Original file line number Diff line number Diff line change @@ -1013,8 +1013,19 @@ impl EmitterWriter {
10131013
10141014 // Then, the secondary file indicator
10151015 buffer. prepend ( buffer_msg_line_offset + 1 , "::: " , Style :: LineNumber ) ;
1016+ let loc = if let Some ( first_line) = annotated_file. lines . first ( ) {
1017+ let col = if let Some ( first_annotation) = first_line. annotations . first ( ) {
1018+ format ! ( ":{}" , first_annotation. start_col + 1 )
1019+ } else { "" . to_string ( ) } ;
1020+ format ! ( "{}:{}{}" ,
1021+ annotated_file. file. name,
1022+ cm. doctest_offset_line( first_line. line_index) ,
1023+ col)
1024+ } else {
1025+ annotated_file. file . name . to_string ( )
1026+ } ;
10161027 buffer. append ( buffer_msg_line_offset + 1 ,
1017- & annotated_file . file . name . to_string ( ) ,
1028+ & loc ,
10181029 Style :: LineAndColumn ) ;
10191030 for _ in 0 ..max_line_num_len {
10201031 buffer. prepend ( buffer_msg_line_offset + 1 , " " , Style :: NoStyle ) ;
Original file line number Diff line number Diff line change @@ -27,7 +27,8 @@ pub struct FileInfo {
2727
2828 /// The "primary file", if any, gets a `-->` marker instead of
2929 /// `>>>`, and has a line-number/column printed and not just a
30- /// filename. It appears first in the listing. It is known to
30+ /// filename (other files are not guaranteed to have line numbers
31+ /// or columns). It appears first in the listing. It is known to
3132 /// contain at least one primary span, though primary spans (which
3233 /// are designated with `^^^`) may also occur in other files.
3334 primary_span : Option < Span > ,
Original file line number Diff line number Diff line change 1+ // Copyright 2018 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+ #[ macro_use]
12+ mod underscore;
13+
14+ fn main ( ) {
15+ underscore ! ( ) ;
16+ }
Original file line number Diff line number Diff line change 1+ error: expected expression, found `_`
2+ --> $DIR/underscore.rs:18:9
3+ |
4+ 18 | _
5+ | ^
6+ |
7+ ::: $DIR/main.rs:15:5
8+ |
9+ 15 | underscore!();
10+ | -------------- in this macro invocation
11+
Original file line number Diff line number Diff line change 1+ // Copyright 2018 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+ // We want this file only so we can test cross-file error
12+ // messages, but we don't want it in an external crate.
13+ // ignore-test
14+ #![ crate_type = "lib" ]
15+
16+ macro_rules! underscore {
17+ ( ) => (
18+ _
19+ )
20+ }
Original file line number Diff line number Diff line change @@ -1402,7 +1402,7 @@ impl<'test> TestCx<'test> {
14021402 }
14031403
14041404 /// For each `aux-build: foo/bar` annotation, we check to find the
1405- /// file in a `aux ` directory relative to the test itself.
1405+ /// file in a `auxiliary ` directory relative to the test itself.
14061406 fn compute_aux_test_paths ( & self , rel_ab : & str ) -> TestPaths {
14071407 let test_ab = self . testpaths
14081408 . file
You can’t perform that action at this time.
0 commit comments