Provide more context on type errors in const context#153881
Merged
rust-bors[bot] merged 6 commits intorust-lang:mainfrom Mar 15, 2026
Merged
Provide more context on type errors in const context#153881rust-bors[bot] merged 6 commits intorust-lang:mainfrom
rust-bors[bot] merged 6 commits intorust-lang:mainfrom
Conversation
Collaborator
|
r? @fee1-dead rustbot has assigned @fee1-dead. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
Kivooeo
reviewed
Mar 14, 2026
Kivooeo
approved these changes
Mar 14, 2026
This comment has been minimized.
This comment has been minimized.
- On `const` and `static` point at the type (like we do for let bindings) - On fn calls, point at const parameter in fn definition - On type, point at const parameter in type definition - On array type lengths, explain that array length is always `usize` - On enum variant discriminant, mention `repr`
…ers unless going through the type parameter
```
error[E0308]: mismatched types
--> $DIR/struct-type-parameter-with-default.rs:5:12
|
LL | struct Foo<T = String> {
| ---------- expected this type parameter
LL | x: T = String::new(),
| ^^^^^^^^^^^^^ expected type parameter `T`, found `String`
|
= note: expected type parameter `T`
found struct `String`
= note: the type of default fields referencing type parameters can't be assumed inside the struct defining them
```
Collaborator
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
Collaborator
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
Member
|
@bors r+ rollup |
Contributor
rust-bors Bot
pushed a commit
that referenced
this pull request
Mar 15, 2026
Rollup of 6 pull requests Successful merges: - #153870 (docs: remove stale reference to `check_let_chain`) - #153881 (Provide more context on type errors in const context) - #153887 (Turn label into structured suggestion for `.as_ref()` and `.as_mut()`) - #153897 (Use less `#[macro_use]` in the query system) - #153914 (add test for param-env shadowing) - #153917 (compiletest: show rustdoc logs when `--no-capture`)
github-actions Bot
pushed a commit
to rust-lang/miri
that referenced
this pull request
Mar 16, 2026
Rollup of 6 pull requests Successful merges: - rust-lang/rust#153870 (docs: remove stale reference to `check_let_chain`) - rust-lang/rust#153881 (Provide more context on type errors in const context) - rust-lang/rust#153887 (Turn label into structured suggestion for `.as_ref()` and `.as_mut()`) - rust-lang/rust#153897 (Use less `#[macro_use]` in the query system) - rust-lang/rust#153914 (add test for param-env shadowing) - rust-lang/rust#153917 (compiletest: show rustdoc logs when `--no-capture`)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
constandstaticpoint at the type (like we do for let bindings)usizerepr