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:
bors 2014-11-14 08:17:19 +00:00
commit bb2168c525
11 changed files with 129 additions and 32 deletions

1
src/test/compile-fail/.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
trailing-carriage-return-in-string.rs -text

View file

@ -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?

View 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.
}

View file

@ -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);

View 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
}

View 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"

View 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;

View 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"]