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

[E0282] type annotations needed #2524

Merged
merged 1 commit into from
Aug 9, 2023
Merged

Conversation

MahadMuhammad
Copy link
Contributor

@MahadMuhammad MahadMuhammad commented Aug 5, 2023

Compiler failed to infer type & asked for type annotation E0282


Code Tested:

fn main() {
    let arr = [];
    // { dg-error "type annotations needed" "" { target *-*-* } .-1 }
}

Output:

➜  gccrs-build gcc/crab1 /home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/array_empty_list.rs
/home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/array_empty_list.rs:2:15: error: type annotations needed [E0282]
    2 |     let arr = [];
      |               ^

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.

Running testcase:


gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): added errorcode.

type must be known at compile time.

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check.cc (TypeResolution::Resolve):
	added errorcode.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
@P-E-P P-E-P added enhancement diagnostic diagnostic static analysis labels Aug 7, 2023
@P-E-P P-E-P self-requested a review August 9, 2023 11:48
Copy link
Member

@P-E-P P-E-P left a comment

Choose a reason for hiding this comment

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

LGTM

@P-E-P P-E-P added this pull request to the merge queue Aug 9, 2023
Merged via the queue into Rust-GCC:master with commit a584856 Aug 9, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostic diagnostic static analysis enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants