Skip to content

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

Closed
@nikic

Description

@nikic

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	

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-testsuiteArea: The testsuite used to check the correctness of rustcC-bugCategory: This is a bug.O-PowerPCTarget: PowerPC processorsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions