diff options
| author | bors <bors@rust-lang.org> | 2017-06-01 11:34:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-06-01 11:34:13 +0000 |
| commit | 4ed2edaafe82fb8d44e81e00ca3e4f7659855ba2 (patch) | |
| tree | bac575e79cb4c10b9ad04ddc752c1428735291e4 /src/test | |
| parent | afd4b81c8642016dcb3a641d45a1258193dab958 (diff) | |
| parent | 5fb37beecdb7827aada42a2ab4e7e0228d02c13a (diff) | |
| download | rust-4ed2edaafe82fb8d44e81e00ca3e4f7659855ba2.tar.gz rust-4ed2edaafe82fb8d44e81e00ca3e4f7659855ba2.zip | |
Auto merge of #42281 - eddyb:well-adjusted, r=nikomatsakis
Decompose Adjustment into smaller steps and remove the method map. The method map held method callee information for: * actual method calls (`x.f(...)`) * overloaded unary, binary, indexing and call operators * *every overloaded deref adjustment* (many can exist for each expression) That last one was a historical ~~accident~~ hack, and part of the motivation for this PR, along with: * a desire to compose adjustments more freely * containing the autoderef logic better to avoid mutation within an inference snapshot * not creating `TyFnDef` types which are incompatible with the original one * i.e. we used to take a`TyFnDef`'s `for<'a> &'a T -> &'a U` signature and instantiate `'a` using a region inference variable, *then* package the resulting `&'b T -> &'b U` signature in another `TyFnDef`, while keeping *the same* `DefId` and `Substs` * to fix #3548 by explicitly writing autorefs for the RHS of comparison operators Individual commits tell their own story, of "atomic" changes avoiding breaking semantics. Future work based on this PR could include: * removing the signature from `TyFnDef`, now that it's always "canonical" * some questions of variance remain, as subtyping *still* treats the signature differently * moving part of the typeck logic for methods, autoderef and coercion into `rustc::traits` * allowing LUB coercions (joining multiple expressions) to "stack up" many adjustments * transitive coercions (e.g. reify or unsize after multiple steps of autoderef) r? @nikomatsakis
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/impl-trait/equality.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/mismatched_types/binops.stderr | 28 | ||||
| -rw-r--r-- | src/test/ui/span/multiline-span-simple.stderr | 11 |
3 files changed, 19 insertions, 24 deletions
diff --git a/src/test/ui/impl-trait/equality.stderr b/src/test/ui/impl-trait/equality.stderr index a08e77a2151..2206234b777 100644 --- a/src/test/ui/impl-trait/equality.stderr +++ b/src/test/ui/impl-trait/equality.stderr @@ -8,10 +8,10 @@ error[E0308]: mismatched types found type `u32` error[E0277]: the trait bound `u32: std::ops::Add<impl Foo>` is not satisfied - --> $DIR/equality.rs:34:9 + --> $DIR/equality.rs:34:11 | 34 | n + sum_to(n - 1) - | ^^^^^^^^^^^^^^^^^ no implementation for `u32 + impl Foo` + | ^ no implementation for `u32 + impl Foo` | = help: the trait `std::ops::Add<impl Foo>` is not implemented for `u32` diff --git a/src/test/ui/mismatched_types/binops.stderr b/src/test/ui/mismatched_types/binops.stderr index d97c7813708..1faf72cd760 100644 --- a/src/test/ui/mismatched_types/binops.stderr +++ b/src/test/ui/mismatched_types/binops.stderr @@ -1,56 +1,56 @@ error[E0277]: the trait bound `{integer}: std::ops::Add<std::option::Option<{integer}>>` is not satisfied - --> $DIR/binops.rs:12:5 + --> $DIR/binops.rs:12:7 | 12 | 1 + Some(1); - | ^^^^^^^^^^^ no implementation for `{integer} + std::option::Option<{integer}>` + | ^ no implementation for `{integer} + std::option::Option<{integer}>` | = help: the trait `std::ops::Add<std::option::Option<{integer}>>` is not implemented for `{integer}` error[E0277]: the trait bound `usize: std::ops::Sub<std::option::Option<{integer}>>` is not satisfied - --> $DIR/binops.rs:13:5 + --> $DIR/binops.rs:13:16 | 13 | 2 as usize - Some(1); - | ^^^^^^^^^^^^^^^^^^^^ no implementation for `usize - std::option::Option<{integer}>` + | ^ no implementation for `usize - std::option::Option<{integer}>` | = help: the trait `std::ops::Sub<std::option::Option<{integer}>>` is not implemented for `usize` error[E0277]: the trait bound `{integer}: std::ops::Mul<()>` is not satisfied - --> $DIR/binops.rs:14:5 + --> $DIR/binops.rs:14:7 | 14 | 3 * (); - | ^^^^^^ no implementation for `{integer} * ()` + | ^ no implementation for `{integer} * ()` | = help: the trait `std::ops::Mul<()>` is not implemented for `{integer}` error[E0277]: the trait bound `{integer}: std::ops::Div<&str>` is not satisfied - --> $DIR/binops.rs:15:5 + --> $DIR/binops.rs:15:7 | 15 | 4 / ""; - | ^^^^^^ no implementation for `{integer} / &str` + | ^ no implementation for `{integer} / &str` | = help: the trait `std::ops::Div<&str>` is not implemented for `{integer}` error[E0277]: the trait bound `{integer}: std::cmp::PartialEq<std::string::String>` is not satisfied - --> $DIR/binops.rs:16:5 + --> $DIR/binops.rs:16:7 | 16 | 5 < String::new(); - | ^^^^^^^^^^^^^^^^^ can't compare `{integer}` with `std::string::String` + | ^ can't compare `{integer}` with `std::string::String` | = help: the trait `std::cmp::PartialEq<std::string::String>` is not implemented for `{integer}` error[E0277]: the trait bound `{integer}: std::cmp::PartialOrd<std::string::String>` is not satisfied - --> $DIR/binops.rs:16:5 + --> $DIR/binops.rs:16:7 | 16 | 5 < String::new(); - | ^^^^^^^^^^^^^^^^^ can't compare `{integer}` with `std::string::String` + | ^ can't compare `{integer}` with `std::string::String` | = help: the trait `std::cmp::PartialOrd<std::string::String>` is not implemented for `{integer}` error[E0277]: the trait bound `{integer}: std::cmp::PartialEq<std::result::Result<{integer}, _>>` is not satisfied - --> $DIR/binops.rs:17:5 + --> $DIR/binops.rs:17:7 | 17 | 6 == Ok(1); - | ^^^^^^^^^^ can't compare `{integer}` with `std::result::Result<{integer}, _>` + | ^^ can't compare `{integer}` with `std::result::Result<{integer}, _>` | = help: the trait `std::cmp::PartialEq<std::result::Result<{integer}, _>>` is not implemented for `{integer}` diff --git a/src/test/ui/span/multiline-span-simple.stderr b/src/test/ui/span/multiline-span-simple.stderr index 057f8fe6ee2..0224cef8da1 100644 --- a/src/test/ui/span/multiline-span-simple.stderr +++ b/src/test/ui/span/multiline-span-simple.stderr @@ -1,13 +1,8 @@ error[E0277]: the trait bound `u32: std::ops::Add<()>` is not satisfied - --> $DIR/multiline-span-simple.rs:23:9 + --> $DIR/multiline-span-simple.rs:23:18 | -23 | foo(1 as u32 + - | _________^ -24 | | -25 | | bar(x, -26 | | -27 | | y), - | |______________^ no implementation for `u32 + ()` +23 | foo(1 as u32 + + | ^ no implementation for `u32 + ()` | = help: the trait `std::ops::Add<()>` is not implemented for `u32` |
