diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2017-04-11 04:40:31 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2017-04-12 01:10:48 -0700 |
| commit | 439ff69d909a0add54b1ea1e093bc838693d1e4e (patch) | |
| tree | 3a779dd6ae7d0fd40ad34002289b888285642c30 /src/test | |
| parent | d616f47cd03a65fed13be2ee5527f24f6a4f7f92 (diff) | |
| download | rust-439ff69d909a0add54b1ea1e093bc838693d1e4e.tar.gz rust-439ff69d909a0add54b1ea1e093bc838693d1e4e.zip | |
Add a way to get shorter spans until `char` for pointing at defs
```rust
error[E0072]: recursive type `X` has infinite size
--> file.rs:10:1
|
10 | struct X {
| ^^^^^^^^ recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `X` representable
```
vs
```rust
error[E0072]: recursive type `X` has infinite size
--> file.rs:10:1
|
10 | struct X {
| _^ starting here...
11 | | x: X,
12 | | }
| |_^ ...ending here: recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `X` representable
```
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/resolve/issue-3907-2.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/span/E0072.rs (renamed from src/test/compile-fail/E0072.rs) | 3 | ||||
| -rw-r--r-- | src/test/ui/span/E0072.stderr | 10 | ||||
| -rw-r--r-- | src/test/ui/span/multiline-span-E0072.rs | 20 | ||||
| -rw-r--r-- | src/test/ui/span/multiline-span-E0072.stderr | 16 |
5 files changed, 48 insertions, 3 deletions
diff --git a/src/test/ui/resolve/issue-3907-2.stderr b/src/test/ui/resolve/issue-3907-2.stderr index ef02250e21c..2ef8c830eb2 100644 --- a/src/test/ui/resolve/issue-3907-2.stderr +++ b/src/test/ui/resolve/issue-3907-2.stderr @@ -2,7 +2,7 @@ error[E0038]: the trait `issue_3907::Foo` cannot be made into an object --> $DIR/issue-3907-2.rs:20:1 | 20 | fn bar(_x: Foo) {} - | ^^^^^^^^^^^^^^^^^^ the trait `issue_3907::Foo` cannot be made into an object + | ^^^^^^^^^^^^^^^ the trait `issue_3907::Foo` cannot be made into an object | = note: method `bar` has no receiver diff --git a/src/test/compile-fail/E0072.rs b/src/test/ui/span/E0072.rs index e6de7921b30..18ade4f1ab6 100644 --- a/src/test/compile-fail/E0072.rs +++ b/src/test/ui/span/E0072.rs @@ -8,8 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct ListNode { //~ ERROR E0072 - //~| NOTE recursive type has infinite size +struct ListNode { head: u8, tail: Option<ListNode>, } diff --git a/src/test/ui/span/E0072.stderr b/src/test/ui/span/E0072.stderr new file mode 100644 index 00000000000..5204390ef9d --- /dev/null +++ b/src/test/ui/span/E0072.stderr @@ -0,0 +1,10 @@ +error[E0072]: recursive type `ListNode` has infinite size + --> $DIR/E0072.rs:11:1 + | +11 | struct ListNode { + | ^^^^^^^^^^^^^^^ recursive type has infinite size + | + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `ListNode` representable + +error: aborting due to previous error + diff --git a/src/test/ui/span/multiline-span-E0072.rs b/src/test/ui/span/multiline-span-E0072.rs new file mode 100644 index 00000000000..323e7fb5a42 --- /dev/null +++ b/src/test/ui/span/multiline-span-E0072.rs @@ -0,0 +1,20 @@ +// Copyright 2017 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. + +// It should just use the entire body instead of pointing at the next two lines +struct +ListNode +{ + head: u8, + tail: Option<ListNode>, +} + +fn main() { +} diff --git a/src/test/ui/span/multiline-span-E0072.stderr b/src/test/ui/span/multiline-span-E0072.stderr new file mode 100644 index 00000000000..58cdc502300 --- /dev/null +++ b/src/test/ui/span/multiline-span-E0072.stderr @@ -0,0 +1,16 @@ +error[E0072]: recursive type `ListNode` has infinite size + --> $DIR/multiline-span-E0072.rs:12:1 + | +12 | struct + | _^ starting here... +13 | | ListNode +14 | | { +15 | | head: u8, +16 | | tail: Option<ListNode>, +17 | | } + | |_^ ...ending here: recursive type has infinite size + | + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `ListNode` representable + +error: aborting due to previous error + |
