We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This test case, derived from @sfackler's PR #36340, fails to compile incorrectly:
trait SliceExt<T> { type Item; fn get_me<I>(&self, index: I) -> &I::Output where I: SliceIndex<Self::Item>; } impl<T> SliceExt<T> for [T] { type Item = T; fn get_me<I>(&self, index: I) -> &I::Output where I: SliceIndex<T> { panic!() } } pub trait SliceIndex<T> { type Output: ?Sized; } impl<T> SliceIndex<T> for usize { type Output = T; } fn foo<'a>(split: &[&'a [u8]]) -> &'a [u8] { split.get_me(0) } fn main() { }
I get the error:
lunch-box. rustc --stage0 ~/tmp/issue-36340.rs error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements --> /home/nmatsakis/tmp/issue-36340.rs:27:11 | 27 | split.get_me(0) | ^^^^^^ | help: consider using an explicit lifetime parameter as shown: fn foo<'a>(split: &'a [&'a [u8]]) -> &'a [u8] --> /home/nmatsakis/tmp/issue-36340.rs:26:1 | 26 | fn foo<'a>(split: &[&'a [u8]]) -> &'a [u8] { | ^ error: aborting due to previous error
This is because coercion is going wrong, basically. Note that small changes (such as &**split.get_me(0)) work fine.
&**split.get_me(0)
The text was updated successfully, but these errors were encountered:
Explanation of error is here: #36340 (comment)
Sorry, something went wrong.
introduce a fudge_regions_if_ok to address false region edges
fudge_regions_if_ok
c428535
Fixes rust-lang#37655.
Rollup merge of rust-lang#37659 - nikomatsakis:sfackler-36340-fix, r=…
231cec5
…eddyb introduce a `fudge_regions_if_ok` to address false region edges Fixes rust-lang#37655. r? @eddyb cc @sfackler
7dd4d19
No branches or pull requests
This test case, derived from @sfackler's PR #36340, fails to compile incorrectly:
I get the error:
This is because coercion is going wrong, basically. Note that small changes (such as
&**split.get_me(0)
) work fine.The text was updated successfully, but these errors were encountered: