Skip to content

Commit 8d28328

Browse files
authored
Rollup merge of rust-lang#138403 - Bryanskiy:delegation-ice-2, r=petrochenkov
Delegation: one more ICE fix for `MethodCall` generation self-explanatory Fixes rust-lang#138362 r? `@petrochenkov`
2 parents 84a2b68 + 7bfe213 commit 8d28328

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

compiler/rustc_ast_lowering/src/delegation.rs

+1
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
330330
.unwrap_or_default()
331331
&& delegation.qself.is_none()
332332
&& !has_generic_args
333+
&& !args.is_empty()
333334
{
334335
let ast_segment = delegation.path.segments.last().unwrap();
335336
let segment = self.lower_path_segment(
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![feature(fn_delegation)]
2+
#![allow(incomplete_features)]
3+
4+
trait HasSelf {
5+
fn method(self);
6+
}
7+
trait NoSelf {
8+
fn method();
9+
}
10+
impl NoSelf for u8 {
11+
reuse HasSelf::method;
12+
//~^ ERROR this function takes 1 argument but 0 arguments were supplied
13+
}
14+
15+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0061]: this function takes 1 argument but 0 arguments were supplied
2+
--> $DIR/ice-issue-138362.rs:11:20
3+
|
4+
LL | reuse HasSelf::method;
5+
| ^^^^^^ argument #1 is missing
6+
|
7+
note: method defined here
8+
--> $DIR/ice-issue-138362.rs:5:8
9+
|
10+
LL | fn method(self);
11+
| ^^^^^^ ----
12+
help: provide the argument
13+
|
14+
LL | reuse HasSelf::method(/* value */);
15+
| +++++++++++++
16+
17+
error: aborting due to 1 previous error
18+
19+
For more information about this error, try `rustc --explain E0061`.

0 commit comments

Comments
 (0)