diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-05-24 00:00:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-24 00:00:42 +0200 |
| commit | ff48fc91eea7d7c3d224de054d6a9b47af4a6d18 (patch) | |
| tree | 8cb3d075de16ffb6fc66812299b74476ff1ea38a /src/test | |
| parent | 8970e8bcf6153d1ead2283f1a0ed7b192230eca6 (diff) | |
| parent | 1fad3b7a0535c4a4da046170d4080e0cd214ee42 (diff) | |
| download | rust-ff48fc91eea7d7c3d224de054d6a9b47af4a6d18.tar.gz rust-ff48fc91eea7d7c3d224de054d6a9b47af4a6d18.zip | |
Rollup merge of #71618 - ecstatic-morse:issue-71394, r=nikomatsakis
Preserve substitutions when making trait obligations for suggestions Resolves #71394. I *think* `map_bound_ref` is correct here. In any case, I think a lot of the diagnostic code is using `skip_binder` more aggressively than it should be, so I doubt that this is worse than the status quo. The assertion that `new_self_ty` has no escaping bound vars should be enough. r? @estebank cc @nikomatsakis Is the call to `skip_binder` on line 551 (and elsewhere in this file) appropriate? https://github.com/rust-lang/rust/blob/46ec74e60f238f694b46c976d6217e7cf8d4cf1a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs#L537-L565
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/suggestions/into-str.stderr | 1 | ||||
| -rw-r--r-- | src/test/ui/suggestions/issue-71394-no-from-impl.rs | 5 | ||||
| -rw-r--r-- | src/test/ui/suggestions/issue-71394-no-from-impl.stderr | 11 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/test/ui/suggestions/into-str.stderr b/src/test/ui/suggestions/into-str.stderr index 7414a7cc24c..f7affdbf1b4 100644 --- a/src/test/ui/suggestions/into-str.stderr +++ b/src/test/ui/suggestions/into-str.stderr @@ -8,7 +8,6 @@ LL | foo(String::new()); | ^^^ the trait `std::convert::From<std::string::String>` is not implemented for `&str` | = note: to coerce a `std::string::String` into a `&str`, use `&*` as a prefix - = note: `std::convert::From<std::string::String>` is implemented for `&mut str`, but not for `&str` = note: required because of the requirements on the impl of `std::convert::Into<&str>` for `std::string::String` error: aborting due to previous error diff --git a/src/test/ui/suggestions/issue-71394-no-from-impl.rs b/src/test/ui/suggestions/issue-71394-no-from-impl.rs new file mode 100644 index 00000000000..9ffcc3f7bc1 --- /dev/null +++ b/src/test/ui/suggestions/issue-71394-no-from-impl.rs @@ -0,0 +1,5 @@ +fn main() { + let data: &[u8] = &[0; 10]; + let _: &[i8] = data.into(); + //~^ ERROR the trait bound `&[i8]: std::convert::From<&[u8]>` is not satisfied +} diff --git a/src/test/ui/suggestions/issue-71394-no-from-impl.stderr b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr new file mode 100644 index 00000000000..84c73c2f67e --- /dev/null +++ b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr @@ -0,0 +1,11 @@ +error[E0277]: the trait bound `&[i8]: std::convert::From<&[u8]>` is not satisfied + --> $DIR/issue-71394-no-from-impl.rs:3:25 + | +LL | let _: &[i8] = data.into(); + | ^^^^ the trait `std::convert::From<&[u8]>` is not implemented for `&[i8]` + | + = note: required because of the requirements on the impl of `std::convert::Into<&[i8]>` for `&[u8]` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. |
