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

[E0229] associated type bindings error #2367

Merged
merged 1 commit into from
Jul 4, 2023

Conversation

MahadMuhammad
Copy link
Contributor

@MahadMuhammad MahadMuhammad commented Jul 3, 2023

Associated type binding Error - E0229

Associated type binding outside of type
parameter Declaration and where Clause - E0229

Code Tested:

struct Foo<A, B>(A, B);

fn main() {
    let a;
    a = Foo::<A = i32, B = f32>(123f32);
    // { dg-error ErrorCode("E0229") "associated type bindings are not allowed here" "" { target *-*-* } .-1 }
    // { dg-error {Failed to resolve expression of function call} "" { target *-*-* } .-2 }
}

Output:

mahad@linux:~/Desktop/mahad/gccrs-build$ gcc/crab1 /home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/type-bindings1.rs -frust-incomplete-and-experimental-compiler-do-not-use
/home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/type-bindings1.rs:5:15: error: associated type bindings are not allowed here [E0229]
    5 |     a = Foo::<A = i32, B = f32>(123f32);
      |               ^        ~
/home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/type-bindings1.rs:5:9: error: Failed to resolve expression of function call
    5 |     a = Foo::<A = i32, B = f32>(123f32);
      |         ^~~

Analyzing compilation unit

Time variable                                   usr           sys          wall           GGC
 TOTAL                              :   0.00          0.00          0.00          146k
Extra diagnostic checks enabled; compiler may run slowly.
Configure with --enable-checking=release to disable checks.

gcc/rust/ChangeLog:

* typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args): called error function

Associated type binding outside of type
parameter Declaration and where Clause

gcc/rust/ChangeLog:

	* typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args):
	called error function

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
@MahadMuhammad MahadMuhammad changed the title gccrs: [E0229] associated type bindings error [E0229] associated type bindings error Jul 3, 2023
@philberty philberty added the diagnostic diagnostic static analysis label Jul 4, 2023
@philberty philberty added this to the GCC 14 Stage 3 milestone Jul 4, 2023
Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@philberty philberty added this pull request to the merge queue Jul 4, 2023
Merged via the queue into Rust-GCC:master with commit 28be497 Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostic diagnostic static analysis
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants