Esteban Küber
6efddac288
Provide more context on derived obligation error primary label
...
Expand the primary span of E0277 when the immediate unmet bound is not what the user wrote:
```
error[E0277]: the trait bound `i32: Bar` is not satisfied
--> f100.rs:6:6
|
6 | <i32 as Foo>::foo();
| ^^^ the trait `Bar` is not implemented for `i32`, which is required by `i32: Foo`
|
help: this trait has no implementations, consider adding one
--> f100.rs:2:1
|
2 | trait Bar {}
| ^^^^^^^^^
note: required for `i32` to implement `Foo`
--> f100.rs:3:14
|
3 | impl<T: Bar> Foo for T {}
| --- ^^^ ^
| |
| unsatisfied trait bound introduced here
```
Fix #40120 .
2024-01-30 21:28:18 +00:00
Guillaume Gomez
f7043a41ce
Rollup merge of #120400 - estebank:bound-error-cleanup, r=oli-obk
...
Bound errors span label cleanup
Consolidate span labels for "this type doesn't satisfy a bound" for more compact diagnostic output.
2024-01-30 11:19:15 +01:00
Esteban Küber
7df4a09fc4
Use single label for method not found due to unmet bound
2024-01-26 20:47:19 +00:00
Oli Scherer
db7cd57091
Remove track_errors entirely
2024-01-23 15:23:22 +00:00
Oli Scherer
9454b51b05
Make generic const type mismatches not hide trait impls from the trait solver
2024-01-22 13:23:45 +00:00
bors
5378c1cf07
Auto merge of #119821 - oli-obk:reveal_all_const_evals, r=lcnr
...
Always use RevealAll for const eval queries
implements what is described in https://github.com/rust-lang/rust/pull/116803#discussion_r1364089471
Using `UserFacing` for const eval does not make sense anymore, unless we significantly change things like avoiding revealing opaque types.
New tests are copied from https://github.com/rust-lang/rust/pull/101478
2024-01-20 04:57:51 +00:00
Oli Scherer
867831a170
Always use RevealAll for const eval queries
2024-01-19 11:32:34 +00:00
Matthias Krüger
0891cb4d81
Rollup merge of #119963 - clubby789:spec-allow-internal-unstable, r=compiler-errors
...
Fix `allow_internal_unstable` for `(min_)specialization`
Fixes #119950
Blocked on #119949 (comment doesn't make sense until that merges)
I'd like to follow this up and look for more instances of not properly checking spans for features but I wanted to fix the motivating issue.
2024-01-15 08:44:49 +01:00
clubby789
0529ccf341
Fix allow_internal_unstable
for (min_)specialization
2024-01-14 13:50:02 +00:00
George-lewis
d56cdd48cb
Bless tests
...
Update tests
2024-01-13 12:46:58 -05:00
bors
5113ed28ea
Auto merge of #118297 - shepmaster:warn-dead-tuple-fields, r=WaffleLapkin
...
Merge `unused_tuple_struct_fields` into `dead_code`
This implicitly upgrades the lint from `allow` to `warn` and places it into the `unused` lint group.
[Discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Moving.20.60unused_tuple_struct_fields.60.20from.20allow.20to.20warn )
2024-01-05 04:51:55 +00:00
Jake Goulding
53eca9fa87
Adjust compiler tests for unused_tuple_struct_fields -> dead_code
2024-01-02 15:34:37 -05:00
Oli Scherer
cd4c352fb4
Reorder check_item_type
diagnostics so they occur next to the corresponding check_well_formed
diagnostics
2024-01-02 14:17:56 +00:00
León Orell Valerian Liehr
3eb48a35c8
Introduce const Trait
(always-const trait bounds)
2023-12-27 12:51:32 +01:00
lcnr
11d16c4082
update use of feature flags
2023-12-14 15:22:37 +01:00
surechen
40ae34194c
remove redundant imports
...
detects redundant imports that can be eliminated.
for #117772 :
In order to facilitate review and modification, split the checking code and
removing redundant imports code into two PR.
2023-12-10 10:56:22 +08:00
Nilstrieb
41e8d152dc
Show number in error message even for one error
...
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
Oli Scherer
beaf46f7e5
Work around the fact that check_mod_type_wf
may spuriously return ErrorGuaranteed
, even if that error is only emitted by check_modwitem_types
2023-10-25 12:04:54 +00:00
Michael Goulet
592163fb71
Extend impl's def_span to include where clauses
2023-10-09 11:47:02 +00:00
Michael Goulet
82e7cec16d
Tweak expected message to explain what it's actually signifying
2023-09-23 00:57:17 +00:00
Michael Goulet
30e6cea0ae
Point out if a local trait has no implementations
2023-09-10 21:20:36 +00:00
Michael Goulet
0f7ef1a202
Adjust inner span of implicit self ref argument
2023-06-28 17:51:01 +00:00
Michael Goulet
aabdeedc7c
bless coherence test
2023-06-06 18:43:20 +00:00
Dylan DPC
f748bb1402
Rollup merge of #111252 - matthewjasper:min-spec-improvements, r=compiler-errors
...
Min specialization improvements
- Don't allow specialization impls with no items, such implementations are probably not correct and only occur as mistakes in the compiler and standard library
- Fix a missing normalization call
- Adds spans for lifetime errors from overly general specializations
Closes #79457
Closes #109815
2023-05-09 12:33:46 +05:30
Matthew Jasper
f46eabb9e5
Report nicer lifetime errors for specialization
...
Add an obligation cause for these error so that the error points to the
implementations that caused the error.
2023-05-05 22:19:56 +01:00
Matthew Jasper
fafe9e71d5
Normalize consistently for specializations
2023-05-05 16:19:18 +01:00
Matthew Jasper
bd928a0b5e
Disallow (min) specialization imps with no items
...
Such implementations are usually mistakes and are not used in the
compiler or standard library (after this commit) so forbid them with
`min_specialization`.
2023-05-05 16:19:18 +01:00
Takayuki Maeda
0a64dac604
remove unnecessary attribute from a diagnostic
2023-05-05 17:28:52 +09:00
whtahy
fcf8468efc
add known-bug test for unsound issue 105782
2023-04-26 22:34:39 -04:00
whtahy
bfdd1c4e35
add known-bug test for unsound issue 40582
2023-04-26 22:34:29 -04:00
Deadbeef
4c6ddc036b
fix library and rustdoc tests
2023-04-16 11:38:52 +00:00
Esteban Küber
5b40aa5eb4
Tweak output for 'add line' suggestion
2023-04-12 22:50:10 +00:00
Michael Goulet
6c6bd01421
Note type mismatch on ConstArgHasType
2023-03-23 19:09:34 +00:00
Michael Goulet
9174edbae9
Delay overlap errors if errors are involved
2023-03-19 03:45:47 +00:00
Michael Goulet
322c7b6269
Constrain const vars to error if const types are mismatched
2023-03-19 03:45:47 +00:00
Michael Goulet
9574f39c2d
Use param's real type in try_eval_lit_or_param
2023-03-09 20:49:11 +00:00
Camille GILLOT
facecf6e1b
Fetch less HIR in signature check.
2023-02-14 20:26:03 +00:00
Esteban Küber
62ba3e70a1
Modify primary span label for E0308
...
The previous output was unintuitive to users.
2023-01-30 20:12:19 +00:00
Michael Goulet
5924c2511e
Only point at impl self ty in WF if trait predicate shares self ty
2023-01-12 22:25:30 +00:00
Michael Goulet
2aabb0fd5d
Point at impl self type for impl wf obligations
2023-01-12 20:44:47 +00:00
Michael Goulet
d76e168f01
Point at HIR types when impl trait ref doesn't normalize
2023-01-12 20:44:47 +00:00
Michael Goulet
9a39d7e441
Note predicate span on ImplDerivedObligation
2023-01-11 19:46:45 +00:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests
2023-01-11 09:32:08 +00:00