Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2414357
fix assertion failed for break_last_token and trailing token
chenyukang Oct 20, 2022
717bf35
Different suggestions for when associated functions are referred to
clubby789 Oct 21, 2022
3f1e999
Update UI tests
clubby789 Oct 21, 2022
e025306
Don't ICE on regions from anonymous_lifetime_in_impl_trait
compiler-errors Oct 22, 2022
8f8f74d
Name impl trait in region bound suggestion
compiler-errors Oct 22, 2022
45a9d18
rustdoc: remove no-op CSS `.source pre.rust { white-space: pre }`
notriddle Oct 24, 2022
e3a091a
Remove redundant sentence
jruderman Oct 24, 2022
c2bc3bc
Document link to unstable book
camsteffen Oct 22, 2022
1dff99f
Use functions in highlight-colors rustdoc GUI test
GuillaumeGomez Oct 24, 2022
4e1abcd
rustdoc: remove unused `.sidebar-logo` DOM on source pages
notriddle Oct 24, 2022
f0f0a7d
rustdoc: remove redundant CSS `a.test-arrow:hover`
notriddle Oct 24, 2022
5e624bf
rustdoc: Use `unix_sigpipe` instead of `rustc_driver::set_sigpipe_han…
Enselic Oct 24, 2022
fa5cf90
Delay span bug when we can't map lifetimes back in collect_trait_impl…
compiler-errors Oct 24, 2022
560f7b9
Rollup merge of #103333 - chenyukang:yukang/fix-103143, r=wesleywiser
Oct 24, 2022
a1c5e37
Rollup merge of #103350 - clubby789:refer-to-assoc-method, r=wesleywiser
Oct 24, 2022
e94f815
Rollup merge of #103382 - compiler-errors:anon-apit-lt-region-ice, r=…
Oct 24, 2022
5852dd0
Rollup merge of #103409 - compiler-errors:rpitit-signature-mismatch, …
Oct 24, 2022
7ec50ba
Rollup merge of #103410 - camsteffen:link-unstable-book, r=JohnTitor
Oct 24, 2022
b66e5eb
Rollup merge of #103416 - compiler-errors:rpit-named, r=cjgillot
Oct 24, 2022
42e697f
Rollup merge of #103462 - notriddle:notriddle/source-pre-rust-white-s…
Oct 24, 2022
a039293
Rollup merge of #103465 - jruderman:patch-1, r=compiler-errors
Oct 24, 2022
da6f8fb
Rollup merge of #103486 - GuillaumeGomez:cleanup-rustdoc-gui-highligh…
Oct 24, 2022
0baad5f
Rollup merge of #103493 - notriddle:notriddle/source-sidebar-logo, r=…
Oct 24, 2022
58a2a93
Rollup merge of #103494 - notriddle:notriddle/test-arrow-hover, r=Gui…
Oct 24, 2022
f5f62d8
Rollup merge of #103495 - Enselic:rustdoc-unix_sigpipe, r=notriddle
Oct 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions compiler/rustc_hir_analysis/src/check/compare_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,16 @@ pub fn collect_trait_impl_trait_tys<'tcx>(
let num_impl_substs = tcx.generics_of(impl_m.container_id(tcx)).params.len();
let ty = tcx.fold_regions(ty, |region, _| {
let ty::ReFree(_) = region.kind() else { return region; };
let ty::ReEarlyBound(e) = map[&region.into()].expect_region().kind()
else { bug!("expected ReFree to map to ReEarlyBound"); };
let Some(ty::ReEarlyBound(e)) = map.get(&region.into()).map(|r| r.expect_region().kind())
else {
tcx
.sess
.delay_span_bug(
return_span,
"expected ReFree to map to ReEarlyBound"
);
return tcx.lifetimes.re_static;
};
tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion {
def_id: e.def_id,
name: e.name,
Expand Down
21 changes: 21 additions & 0 deletions src/test/ui/impl-trait/in-trait/signature-mismatch.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// edition:2021

#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]

use std::future::Future;

pub trait AsyncTrait {
fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>;
}

pub struct Struct;

impl AsyncTrait for Struct {
fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
//~^ ERROR `impl` item signature doesn't match `trait` item signature
async move { buff.to_vec() }
}
}

fn main() {}
16 changes: 16 additions & 0 deletions src/test/ui/impl-trait/in-trait/signature-mismatch.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error: `impl` item signature doesn't match `trait` item signature
--> $DIR/signature-mismatch.rs:15:5
|
LL | fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>;
| ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + 'static`
...
LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2`
|
= note: expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + 'static`
found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2`
= help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`
= help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output

error: aborting due to previous error