auto merge of #18840 : huonw/rust/tweaks, r=alexcrichton
Fix some old papercuts with diagnostics, e.g. tweaking spans, rewording messages. See individual commits.
This commit is contained in:
commit
bb2168c525
11 changed files with 129 additions and 32 deletions
1
src/test/compile-fail/.gitattributes
vendored
Normal file
1
src/test/compile-fail/.gitattributes
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
trailing-carriage-return-in-string.rs -text
|
||||
|
|
@ -11,4 +11,5 @@
|
|||
// Tests that the proper help is displayed in the error message
|
||||
|
||||
extern crate foo as bar;
|
||||
//~^ ERROR expected `;`, found `as`; perhaps you meant to enclose the crate name `foo` in a string?
|
||||
//~^ ERROR expected `;`, found `as`
|
||||
//~^^ HELP perhaps you meant to enclose the crate name `foo` in a string?
|
||||
|
|
|
|||
17
src/test/compile-fail/int-literal-too-large-span.rs
Normal file
17
src/test/compile-fail/int-literal-too-large-span.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// 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.
|
||||
|
||||
// issue #17123
|
||||
|
||||
fn main() {
|
||||
100000000000000000000000000000000 //~ ERROR int literal is too large
|
||||
|
||||
; // the span shouldn't point to this.
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file`
|
||||
//~^ HELP name the file either not_a_real_file.rs or not_a_real_file/mod.rs inside the directory
|
||||
|
||||
fn main() {
|
||||
assert_eq!(mod_file_aux::bar(), 10);
|
||||
|
|
|
|||
23
src/test/compile-fail/trailing-carriage-return-in-string.rs
Normal file
23
src/test/compile-fail/trailing-carriage-return-in-string.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// 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.
|
||||
|
||||
// ignore-tidy-cr
|
||||
// Issue #11669
|
||||
|
||||
fn main() {
|
||||
// \r\n
|
||||
let ok = "This is \
|
||||
a test";
|
||||
// \r only
|
||||
let bad = "This is \
a test";
|
||||
//~^ ERROR unknown character escape: \r
|
||||
//~^^ HELP this is an isolated carriage return
|
||||
|
||||
}
|
||||
11
src/test/run-make/mismatching-target-triples/Makefile
Normal file
11
src/test/run-make/mismatching-target-triples/Makefile
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
-include ../tools.mk
|
||||
|
||||
# Issue #10814
|
||||
#
|
||||
# these are no_std to avoid having to have the standard library or any
|
||||
# linkers/assemblers for the relevant platform
|
||||
|
||||
all:
|
||||
$(RUSTC) foo.rs --target=i686-unknown-linux-gnu
|
||||
$(RUSTC) bar.rs --target=x86_64-unknown-linux-gnu 2>&1 \
|
||||
| grep "couldn't find crate .foo. with expected target triple x86_64-unknown-linux-gnu"
|
||||
11
src/test/run-make/mismatching-target-triples/bar.rs
Executable file
11
src/test/run-make/mismatching-target-triples/bar.rs
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
// 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.
|
||||
#![no_std]
|
||||
extern crate foo;
|
||||
11
src/test/run-make/mismatching-target-triples/foo.rs
Executable file
11
src/test/run-make/mismatching-target-triples/foo.rs
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
// 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.
|
||||
#![no_std]
|
||||
#![crate_type = "lib"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue