diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2017-05-31 23:48:19 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2017-05-31 23:48:19 -0700 |
| commit | 4142d7bb890b631bae5d7872dce3e1c1a6816e9f (patch) | |
| tree | f72b559e7103bc886e7a036bb4a1806f2611aaf8 /src/test/ui/span | |
| parent | 4ed2edaafe82fb8d44e81e00ca3e4f7659855ba2 (diff) | |
| download | rust-4142d7bb890b631bae5d7872dce3e1c1a6816e9f.tar.gz rust-4142d7bb890b631bae5d7872dce3e1c1a6816e9f.zip | |
Use callsite's span for macro calls on suggestion
When suggesting an appropriate mutability for a macro call, use the call span instead of the expanded macro's span.
Diffstat (limited to 'src/test/ui/span')
| -rw-r--r-- | src/test/ui/span/coerce-suggestions.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/span/coerce-suggestions.stderr | 11 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/span/coerce-suggestions.rs b/src/test/ui/span/coerce-suggestions.rs index bc3122bf71c..32d80069f00 100644 --- a/src/test/ui/span/coerce-suggestions.rs +++ b/src/test/ui/span/coerce-suggestions.rs @@ -43,4 +43,12 @@ fn main() { //~| NOTE cyclic type of infinite size //~| NOTE expected type `_` //~| NOTE found type `Box<_>` + + let s = &mut String::new(); + s = format!("foo"); + //~^ ERROR E0308 + //~| NOTE expected mutable reference, found struct `std::string::String` + //~| NOTE expected type `&mut std::string::String` + //~| HELP try with `&mut format!("foo")` + //~| NOTE this error originates in a macro outside of the current crate } diff --git a/src/test/ui/span/coerce-suggestions.stderr b/src/test/ui/span/coerce-suggestions.stderr index 47ede6f2eb1..e3bc64a2cfd 100644 --- a/src/test/ui/span/coerce-suggestions.stderr +++ b/src/test/ui/span/coerce-suggestions.stderr @@ -47,5 +47,16 @@ error[E0308]: mismatched types = note: expected type `_` found type `std::boxed::Box<_>` +error[E0308]: mismatched types + --> $DIR/coerce-suggestions.rs:48:9 + | +48 | s = format!("foo"); + | ^^^^^^^^^^^^^^ expected mutable reference, found struct `std::string::String` + | + = note: expected type `&mut std::string::String` + found type `std::string::String` + = help: try with `&mut format!("foo")` + = note: this error originates in a macro outside of the current crate + error: aborting due to previous error(s) |
