Skip to content

Add ty_span query #143433

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add ty_span query #143433

wants to merge 1 commit into from

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jul 4, 2025

r? @compiler-errors

fixes diagnostic regressions from #142030

Also uses the new query in check_const_item

@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. labels Jul 4, 2025
@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 4, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 4, 2025
bors added a commit that referenced this pull request Jul 4, 2025
Add `ty_span` query

r? `@compiler-errors`

fixes diagnostic regressions from #142030

Also uses the new query in `check_const_item`
@bors
Copy link
Collaborator

bors commented Jul 4, 2025

⌛ Trying commit ccbaf66 with merge f2f6bec...

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/const-generics/defaults/wfness/wfness.stderr`
diff of stderr:

12    |
13    = help: the trait `Trait<2>` is not implemented for `()`
14            but trait `Trait<3>` is implemented for it
+ note: required by a bound in `WhereClause`
+   --> $DIR/wfness.rs:8:9
+    |
+ LL | struct WhereClause<const N: u8 = 2>
+    |        ----------- required by a bound in this struct
+ LL | where
+ LL |     (): Trait<N>;
+    |         ^^^^^^^^ required by this bound in `WhereClause`
15 
16 error[E0277]: the trait bound `(): Trait<1>` is not satisfied
17   --> $DIR/wfness.rs:18:13

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/const-generics/defaults/wfness.rs:8:9
+ note: required by a bound in `WhereClause`
+   --> $DIR/wfness.rs:8:9
+    |
+ LL | struct WhereClause<const N: u8 = 2>
+    |        ----------- required by a bound in this struct
+ LL | where
+ LL |     (): Trait<N>;
+    |         ^^^^^^^^ required by this bound in `WhereClause`


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args const-generics/defaults/wfness.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/rustc" "/checkout/tests/ui/const-generics/defaults/wfness.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" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/const-generics/defaults/wfness" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0080]: attempt to compute `u8::MAX + 1_u8`, which would overflow
##[error]  --> /checkout/tests/ui/const-generics/defaults/wfness.rs:1:33
   |
LL | struct Ooopsies<const N: u8 = { u8::MAX + 1 }>;
   |                                 ^^^^^^^^^^^ evaluation of `Ooopsies::{constant#0}` failed here

error[E0277]: the trait bound `(): Trait<2>` is not satisfied
##[error]  --> /checkout/tests/ui/const-generics/defaults/wfness.rs:8:9
   |
LL |     (): Trait<N>;
   |         ^^^^^^^^ the trait `Trait<2>` is not implemented for `()`
   |
   = help: the trait `Trait<2>` is not implemented for `()`
           but trait `Trait<3>` is implemented for it
note: required by a bound in `WhereClause`
  --> /checkout/tests/ui/const-generics/defaults/wfness.rs:8:9
   |
LL | struct WhereClause<const N: u8 = 2>
   |        ----------- required by a bound in this struct
LL | where
LL |     (): Trait<N>;
   |         ^^^^^^^^ required by this bound in `WhereClause`

error[E0277]: the trait bound `(): Trait<1>` is not satisfied
##[error]  --> /checkout/tests/ui/const-generics/defaults/wfness.rs:18:13
   |
LL | fn foo() -> DependentDefaultWfness {
   |             ^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<1>` is not implemented for `()`
   |
   = help: the trait `Trait<1>` is not implemented for `()`
           but trait `Trait<3>` is implemented for it
note: required by a bound in `WhereClause`
  --> /checkout/tests/ui/const-generics/defaults/wfness.rs:8:9
   |
LL | struct WhereClause<const N: u8 = 2>
   |        ----------- required by a bound in this struct
---
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/type/type-check-defaults/type-check-defaults.stderr`
diff of stderr:

29    |
30 LL | struct Bounds<T:Copy=String>(T);
31    |                 ^^^^ the trait `Copy` is not implemented for `String`
+    |
+ note: required by a bound in `Bounds`
+   --> $DIR/type-check-defaults.rs:11:17
+    |
+ LL | struct Bounds<T:Copy=String>(T);
+    |                 ^^^^ required by this bound in `Bounds`
32 
33 error[E0277]: the trait bound `String: Copy` is not satisfied
34   --> $DIR/type-check-defaults.rs:14:42

35    |
36 LL | struct WhereClause<T=String>(T) where T: Copy;
37    |                                          ^^^^ the trait `Copy` is not implemented for `String`
+    |
+ note: required by a bound in `WhereClause`
+   --> $DIR/type-check-defaults.rs:14:42
+    |
+ LL | struct WhereClause<T=String>(T) where T: Copy;
+    |                                          ^^^^ required by this bound in `WhereClause`
38 
39 error[E0277]: the trait bound `String: Copy` is not satisfied
40   --> $DIR/type-check-defaults.rs:17:20

41    |
42 LL | trait TraitBound<T:Copy=String> {}
43    |                    ^^^^ the trait `Copy` is not implemented for `String`
+    |
+ note: required by a bound in `TraitBound`
+   --> $DIR/type-check-defaults.rs:17:20
+    |
+ LL | trait TraitBound<T:Copy=String> {}
+    |                    ^^^^ required by this bound in `TraitBound`
44 
45 error[E0277]: the trait bound `T: Copy` is not satisfied
46   --> $DIR/type-check-defaults.rs:21:25

70              `&i32` implements `Add`
71              `i32` implements `Add<&i32>`
72              `i32` implements `Add`
+ note: required by a bound in `ProjectionPred`
+   --> $DIR/type-check-defaults.rs:24:66
+    |
+ LL | trait ProjectionPred<T:Iterator = IntoIter<i32>> where T::Item : Add<u8> {}
+    |                                                                  ^^^^^^^ required by this bound in `ProjectionPred`
73 
74 error: aborting due to 7 previous errors
75 

Note: some mismatched output was normalized before being compared
---
+    |
+ note: required by a bound in `Bounds`
+   --> $DIR/type-check-defaults.rs:11:17
+    |
+ LL | struct Bounds<T:Copy=String>(T);
+    |                 ^^^^ required by this bound in `Bounds`
+    |
+ note: required by a bound in `WhereClause`
+   --> $DIR/type-check-defaults.rs:14:42
+    |
+ LL | struct WhereClause<T=String>(T) where T: Copy;
+    |                                          ^^^^ required by this bound in `WhereClause`
+    |
+ note: required by a bound in `TraitBound`
+   --> $DIR/type-check-defaults.rs:17:20
+    |
+ LL | trait TraitBound<T:Copy=String> {}
+    |                    ^^^^ required by this bound in `TraitBound`
+ note: required by a bound in `ProjectionPred`
+   --> $DIR/type-check-defaults.rs:24:66
+    |
+ LL | trait ProjectionPred<T:Iterator = IntoIter<i32>> where T::Item : Add<u8> {}
+    |                                                                  ^^^^^^^ required by this bound in `ProjectionPred`


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args type/type-check-defaults.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/rustc" "/checkout/tests/ui/type/type-check-defaults.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" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/type/type-check-defaults" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32`
##[error]  --> /checkout/tests/ui/type/type-check-defaults.rs:6:23
   |
LL | struct WellFormed<Z = Foo<i32, i32>>(Z);
   |                       ^^^^^^^^^^^^^ value of type `i32` cannot be built from `std::iter::Iterator<Item=i32>`
   |
   = help: the trait `FromIterator<i32>` is not implemented for `i32`
note: required by a bound in `Foo`
  --> /checkout/tests/ui/type/type-check-defaults.rs:5:18
   |
LL | struct Foo<T, U: FromIterator<T>>(T, U);
   |                  ^^^^^^^^^^^^^^^ required by this bound in `Foo`

error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32`
##[error]  --> /checkout/tests/ui/type/type-check-defaults.rs:8:38
   |
LL | struct WellFormedNoBounds<Z:?Sized = Foo<i32, i32>>(Z);
   |                                      ^^^^^^^^^^^^^ value of type `i32` cannot be built from `std::iter::Iterator<Item=i32>`
   |
   = help: the trait `FromIterator<i32>` is not implemented for `i32`
note: required by a bound in `Foo`
  --> /checkout/tests/ui/type/type-check-defaults.rs:5:18
   |
LL | struct Foo<T, U: FromIterator<T>>(T, U);
   |                  ^^^^^^^^^^^^^^^ required by this bound in `Foo`

error[E0277]: the trait bound `String: Copy` is not satisfied
##[error]  --> /checkout/tests/ui/type/type-check-defaults.rs:11:17
   |
LL | struct Bounds<T:Copy=String>(T);
   |                 ^^^^ the trait `Copy` is not implemented for `String`
   |
note: required by a bound in `Bounds`
  --> /checkout/tests/ui/type/type-check-defaults.rs:11:17
   |
LL | struct Bounds<T:Copy=String>(T);
   |                 ^^^^ required by this bound in `Bounds`

error[E0277]: the trait bound `String: Copy` is not satisfied
##[error]  --> /checkout/tests/ui/type/type-check-defaults.rs:14:42
   |
LL | struct WhereClause<T=String>(T) where T: Copy;
   |                                          ^^^^ the trait `Copy` is not implemented for `String`
   |
note: required by a bound in `WhereClause`
  --> /checkout/tests/ui/type/type-check-defaults.rs:14:42
   |
LL | struct WhereClause<T=String>(T) where T: Copy;
   |                                          ^^^^ required by this bound in `WhereClause`

error[E0277]: the trait bound `String: Copy` is not satisfied
##[error]  --> /checkout/tests/ui/type/type-check-defaults.rs:17:20
   |
LL | trait TraitBound<T:Copy=String> {}
   |                    ^^^^ the trait `Copy` is not implemented for `String`
   |
note: required by a bound in `TraitBound`
  --> /checkout/tests/ui/type/type-check-defaults.rs:17:20
   |
LL | trait TraitBound<T:Copy=String> {}
   |                    ^^^^ required by this bound in `TraitBound`

error[E0277]: the trait bound `T: Copy` is not satisfied
##[error]  --> /checkout/tests/ui/type/type-check-defaults.rs:21:25
   |
LL | trait Base<T = String>: Super<T> { }
   |                         ^^^^^^^^ the trait `Copy` is not implemented for `T`
   |
note: required by a bound in `Super`
  --> /checkout/tests/ui/type/type-check-defaults.rs:20:16
   |
LL | trait Super<T: Copy> { }
   |                ^^^^ required by this bound in `Super`
help: consider further restricting type parameter `T` with trait `Copy`
   |
LL | trait Base<T = String>: Super<T> where T: std::marker::Copy { }
   |                                  ++++++++++++++++++++++++++

error[E0277]: cannot add `u8` to `i32`
##[error]  --> /checkout/tests/ui/type/type-check-defaults.rs:24:66
   |
LL | trait ProjectionPred<T:Iterator = IntoIter<i32>> where T::Item : Add<u8> {}
   |                                                                  ^^^^^^^ no implementation for `i32 + u8`
   |
   = help: the trait `Add<u8>` is not implemented for `i32`
   = help: the following other types implement trait `Add<Rhs>`:
             `&i32` implements `Add<i32>`
             `&i32` implements `Add`
             `i32` implements `Add<&i32>`
             `i32` implements `Add`
note: required by a bound in `ProjectionPred`
  --> /checkout/tests/ui/type/type-check-defaults.rs:24:66
   |
LL | trait ProjectionPred<T:Iterator = IntoIter<i32>> where T::Item : Add<u8> {}
   |                                                                  ^^^^^^^ required by this bound in `ProjectionPred`

error: aborting due to 7 previous errors

For more information about this error, try `rustc --explain E0277`.
------------------------------------------

@bors
Copy link
Collaborator

bors commented Jul 4, 2025

☀️ Try build successful - checks-actions
Build commit: f2f6bec (f2f6bec11ae99d06d909fb84e7765638196d92d5)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f2f6bec): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.6% [0.3%, 0.9%] 9
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.0% [-1.0%, -1.0%] 2
All ❌✅ (primary) 0.6% [0.3%, 0.9%] 9

Max RSS (memory usage)

Results (primary -1.8%, secondary -1.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.8% [-1.8%, -1.7%] 2
Improvements ✅
(secondary)
-1.5% [-2.1%, -0.8%] 2
All ❌✅ (primary) -1.8% [-1.8%, -1.7%] 2

Cycles

Results (primary 2.2%, secondary -0.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.2% [2.1%, 2.3%] 3
Regressions ❌
(secondary)
3.4% [3.4%, 3.5%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.1% [-3.9%, -0.6%] 6
All ❌✅ (primary) 2.2% [2.1%, 2.3%] 3

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 461.146s -> 461.095s (-0.01%)
Artifact size: 372.20 MiB -> 372.34 MiB (0.04%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants