Skip to content
New issue

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

Delegation: one more ICE fix for MethodCall generation #138403

Merged
merged 1 commit into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions compiler/rustc_ast_lowering/src/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
.unwrap_or_default()
&& delegation.qself.is_none()
&& !has_generic_args
&& !args.is_empty()
{
let ast_segment = delegation.path.segments.last().unwrap();
let segment = self.lower_path_segment(
Expand Down
15 changes: 15 additions & 0 deletions tests/ui/delegation/ice-issue-138362.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#![feature(fn_delegation)]
#![allow(incomplete_features)]

trait HasSelf {
fn method(self);
}
trait NoSelf {
fn method();
}
impl NoSelf for u8 {
reuse HasSelf::method;
//~^ ERROR this function takes 1 argument but 0 arguments were supplied
}

fn main() {}
19 changes: 19 additions & 0 deletions tests/ui/delegation/ice-issue-138362.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
error[E0061]: this function takes 1 argument but 0 arguments were supplied
--> $DIR/ice-issue-138362.rs:11:20
|
LL | reuse HasSelf::method;
| ^^^^^^ argument #1 is missing
|
note: method defined here
--> $DIR/ice-issue-138362.rs:5:8
|
LL | fn method(self);
| ^^^^^^ ----
help: provide the argument
|
LL | reuse HasSelf::method(/* value */);
| +++++++++++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0061`.
Loading