Skip to content

Conversation

@oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Oct 30, 2025

any follow-up errors are going to either be duplicates or often disappear if the error itself is fixed.

in this PR it mostly silences dyn-compat errors as all the other errors are already deduplicated outside of the test suite. The dyn compat errors are independent errors and I think if the dyn compatiblity depended on an error type it would not actually show, so this is PR is actually silencing independent errors, too.

I am opening this PR because I am seeing lots of {type error}: const Trait errors when adding more const checking. So instead of targetting just those specific errors, I wanted to try out fully avoiding such errors near the trait solver.

cc @rust-lang/types for thoughts

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Oct 30, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 30, 2025

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
30 
- error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
-   --> $DIR/invalid_const_in_lifetime_position.rs:4:26
-    |
- LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
-    |                          ^ expected 1 lifetime argument
-    |
- note: associated type defined here, with 1 lifetime parameter: `'a`
-   --> $DIR/invalid_const_in_lifetime_position.rs:2:10
-    |
- LL |     type Y<'a>;
-    |          ^ --
-    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
- help: add missing lifetime argument
-    |
- LL | fn f<'a>(arg : Box<dyn X<Y<'_, 1> = &'a ()>>) {}
-    |                            +++
+ error: aborting due to 2 previous errors
47 
- error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
-   --> $DIR/invalid_const_in_lifetime_position.rs:4:26
-    |
- LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
-    |                          ^--- help: remove the unnecessary generics
-    |                          |
-    |                          expected 0 generic arguments
-    |
- note: associated type defined here, with 0 generic parameters
-   --> $DIR/invalid_const_in_lifetime_position.rs:2:10
-    |
- LL |     type Y<'a>;
-    |          ^
-    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
- 
- error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
-   --> $DIR/invalid_const_in_lifetime_position.rs:4:26
-    |
- LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
-    |                          ^ expected 1 lifetime argument
-    |
- note: associated type defined here, with 1 lifetime parameter: `'a`
-   --> $DIR/invalid_const_in_lifetime_position.rs:2:10
-    |
- LL |     type Y<'a>;
-    |          ^ --
-    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
- help: add missing lifetime argument
-    |
- LL | fn f<'a>(arg : Box<dyn X<Y<'_, 1> = &'a ()>>) {}
-    |                            +++
- 
- error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
-   --> $DIR/invalid_const_in_lifetime_position.rs:4:26
-    |
- LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
-    |                          ^--- help: remove the unnecessary generics
-    |                          |
-    |                          expected 0 generic arguments
-    |
- note: associated type defined here, with 0 generic parameters
-   --> $DIR/invalid_const_in_lifetime_position.rs:2:10
-    |
- LL |     type Y<'a>;
-    |          ^
-    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
- 
- error[E0038]: the trait `X` is not dyn compatible
-   --> $DIR/invalid_const_in_lifetime_position.rs:4:20
-    |
- LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
-    |                    ^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible
-    |
- note: for a trait to be dyn compatible it needs to allow building a vtable
-       for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-   --> $DIR/invalid_const_in_lifetime_position.rs:2:10
-    |
- LL | trait X {
-    |       - this trait is not dyn compatible...
- LL |     type Y<'a>;
-    |          ^ ...because it contains the generic associated type `Y`
-    = help: consider moving `Y` to another trait
- 
- error: aborting due to 7 previous errors
- 
- Some errors have detailed explanations: E0038, E0107.
- For more information about an error, try `rustc --explain E0038`.
---
To only update this specific test, also pass `--test-args invalid_const_in_lifetime_position.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustdoc" "/checkout/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-o" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/rustdoc-ui/invalid_const_in_lifetime_position" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Cdebuginfo=0"
stdout: none
--- stderr -------------------------------
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
##[error]  --> /checkout/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs:4:26
   |
LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
   |                          ^ expected 1 lifetime argument
   |
note: associated type defined here, with 1 lifetime parameter: `'a`
  --> /checkout/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs:2:10
   |
LL |     type Y<'a>;
   |          ^ --
help: add missing lifetime argument
   |
LL | fn f<'a>(arg : Box<dyn X<Y<'_, 1> = &'a ()>>) {}
   |                            +++

error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
##[error]  --> /checkout/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs:4:26
   |
LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
   |                          ^--- help: remove the unnecessary generics
   |                          |
   |                          expected 0 generic arguments
   |
note: associated type defined here, with 0 generic parameters
  --> /checkout/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs:2:10

@jackh726
Copy link
Member

Seems reasonable - the presence of an error type means that there will be some diagnostic emitted, and that's likely going to be closer to the "root cause"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants