Skip to content

Commit a6c6a8d

Browse files
authored
Rollup merge of #105711 - compiler-errors:rpitit-references-errors, r=eholk
bail in `collect_trait_impl_trait_tys` if signatures reference errors Fixes #105290
2 parents 86bbc20 + bcaf210 commit a6c6a8d

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

compiler/rustc_hir_analysis/src/check/compare_method.rs

+2
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ pub fn collect_trait_impl_trait_tys<'tcx>(
405405
tcx.fn_sig(impl_m.def_id),
406406
),
407407
);
408+
impl_sig.error_reported()?;
408409
let impl_return_ty = impl_sig.output();
409410

410411
// Normalize the trait signature with liberated bound vars, passing it through
@@ -419,6 +420,7 @@ pub fn collect_trait_impl_trait_tys<'tcx>(
419420
)
420421
.fold_with(&mut collector);
421422
let trait_sig = ocx.normalize(&norm_cause, param_env, unnormalized_trait_sig);
423+
trait_sig.error_reported()?;
422424
let trait_return_ty = trait_sig.output();
423425

424426
let wf_tys = FxIndexSet::from_iter(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// edition:2021
2+
3+
#![feature(async_fn_in_trait)]
4+
//~^ WARN the feature `async_fn_in_trait` is incomplete
5+
6+
trait MyTrait {
7+
async fn bar(&abc self);
8+
//~^ ERROR expected identifier, found keyword `self`
9+
//~| ERROR expected one of `:`, `@`, or `|`, found keyword `self`
10+
}
11+
12+
impl MyTrait for () {
13+
async fn bar(&self) {}
14+
}
15+
16+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error: expected identifier, found keyword `self`
2+
--> $DIR/bad-signatures.rs:7:23
3+
|
4+
LL | async fn bar(&abc self);
5+
| ^^^^ expected identifier, found keyword
6+
7+
error: expected one of `:`, `@`, or `|`, found keyword `self`
8+
--> $DIR/bad-signatures.rs:7:23
9+
|
10+
LL | async fn bar(&abc self);
11+
| -----^^^^
12+
| | |
13+
| | expected one of `:`, `@`, or `|`
14+
| help: declare the type after the parameter binding: `<identifier>: <type>`
15+
16+
warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
17+
--> $DIR/bad-signatures.rs:3:12
18+
|
19+
LL | #![feature(async_fn_in_trait)]
20+
| ^^^^^^^^^^^^^^^^^
21+
|
22+
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
23+
= note: `#[warn(incomplete_features)]` on by default
24+
25+
error: aborting due to 2 previous errors; 1 warning emitted
26+

0 commit comments

Comments
 (0)