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

PowerPC test failures due to "similarly named associated type" #126260

Open
nikic opened this issue Jun 11, 2024 · 7 comments
Open

PowerPC test failures due to "similarly named associated type" #126260

nikic opened this issue Jun 11, 2024 · 7 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. O-PowerPC Target: PowerPC processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@nikic
Copy link
Contributor

nikic commented Jun 11, 2024

There are a number of tests that fail on PowerPC, because the emit an additional "there is a similarly named associated type" note. This happens for tests where an unknown single-character associated type is used.

The reason this only happens on PowerPC is, apparently, that core::core_arch::powerpc::altivec::sealed::VectorRl happens to define a single-character associated type, which is considered "similar" to any other single character type.

I'm not sure what the best fix for this is -- adjust tests to use longer names? Adjust VectorRl::B to use a longer name? Make the note less aggressive?

---- [ui] tests/ui/associated-consts/assoc-const-eq-missing.rs stdout ----
diff of stderr:
8	  --> $DIR/assoc-const-eq-missing.rs:16:16
9	   |
10	LL | fn foo2<F: Foo<Z = usize>>() {}
-	   |                ^ associated type `Z` not found
+	   |                ^ there is a similarly named associated type `B` in the trait `core::core_arch::powerpc::altivec::sealed::VectorRl`
12	
13	error[E0220]: associated constant `Z` not found for `Foo`
14	  --> $DIR/assoc-const-eq-missing.rs:18:16


---- [ui] tests/ui/error-codes/E0220.rs stdout ----
diff of stderr:
2	  --> $DIR/E0220.rs:5:22
3	   |
4	LL | type Foo = dyn Trait<F=i32>;
-	   |                      ^ help: `Trait` has the following associated type: `Bar`
+	   |                      ^ there is a similarly named associated type `B` in the trait `core::core_arch::powerpc::altivec::sealed::VectorRl`
6	
7	error[E0191]: the value of the associated type `Bar` in `Trait` must be specified
8	  --> $DIR/E0220.rs:5:16

---- [ui] tests/ui/lifetimes/issue-95023.rs stdout ----
diff of stderr:
54	  --> $DIR/issue-95023.rs:8:44
55	   |
56	LL |     fn foo<const N: usize>(&self) -> Self::B<{ N }>;
-	   |                                            ^ help: `Self` has the following associated type: `Output`
+	   |                                            ^ there is an associated type `B` in the trait `core::core_arch::powerpc::altivec::sealed::VectorRl`
58	
59	error[E0220]: associated type `B` not found for `Self`
60	  --> $DIR/issue-95023.rs:8:44
61	   |
62	LL |     fn foo<const N: usize>(&self) -> Self::B<{ N }>;
-	   |                                            ^ help: `Self` has the following associated type: `Output`
+	   |                                            ^ there is an associated type `B` in the trait `core::core_arch::powerpc::altivec::sealed::VectorRl`
64	   |
65	   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


---- [ui] tests/rustdoc-ui/issues/issue-79465.rs stdout ----
diff of stderr:
2	  --> $DIR/issue-79465.rs:1:20
3	   |
4	LL | pub fn f1<T>(x: T::A) {}
-	   |                    ^ associated type `A` not found
+	   |                    ^ there is a similarly named associated type `B` in the trait `core::core_arch::powerpc::altivec::sealed::VectorRl`
+	   |
+	help: consider restricting type parameter `T`
+	   |
+	LL | pub fn f1<T: core::core_arch::powerpc::altivec::sealed::VectorRl>(x: T::A) {}
+	   |            +++++++++++++++++++++++++++++++++++++++++++++++++++++
+	help: and also change the associated type name
+	   |
+	LL | pub fn f1<T>(x: T::B) {}
+	   |                    ~
6	
7	error: aborting due to 1 previous error
8	
@nikic nikic added the C-bug Category: This is a bug. label Jun 11, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 11, 2024
@jieyouxu jieyouxu added A-testsuite Area: The testsuite used to check the correctness of rustc O-PowerPC Target: PowerPC processors T-libs Relevant to the library team, which will review and decide on the PR/issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jun 11, 2024
@workingjubilee
Copy link
Member

cc @lu-zero

@lu-zero
Copy link
Contributor

lu-zero commented Jun 11, 2024

The intrinsics document name those parameters a, b, c, r, I can rename the associated types, but the diagnostic is digging very deep to hit that, would be good to add a knob to prevent it from going that far by default anyway?

@jieyouxu jieyouxu added the A-diagnostics Area: Messages for errors, warnings, and lints label Jun 11, 2024
@workingjubilee
Copy link
Member

Yes, I think the levenshtein algorithm needs tuning.

@glaubitz
Copy link
Contributor

glaubitz commented Jun 26, 2024

Which PowerPC target triplet is this? I observed a high increase of testsuite failures on powerpc-unknown-linux-gnu after #118709.

Edit: I have filed #126989 for this.

@awilfox
Copy link
Contributor

awilfox commented Jul 31, 2024

I'm seeing this on powerpc64-*-linux-musl, but only on tests/ui/lifetimes/issue-95023.rs.

@nikic
Copy link
Contributor Author

nikic commented Jul 31, 2024

The stdarch submodule hasn't been updated yet since this was fixed. #117468 should pull this in.

@awilfox
Copy link
Contributor

awilfox commented Aug 1, 2024

Indeed, rust-lang/stdarch#1582 fixes that test when applied manually. Thanks for the pointer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. O-PowerPC Target: PowerPC processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants