| Age | Commit message (Collapse) | Author | Lines |
|
Logarithmus:feature/99255-omit-const-generic-suffixes, r=petrochenkov
feat: omit suffixes in const generics (e.g. `1_i32`)
Closes #99255
|
|
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
|
|
Closes #99255
|
|
r=cjgillot
gather body owners
Issue #96341
|
|
Better error message for generic_const_exprs inference failure
Fixes #90531
This code:
```rs
#![feature(generic_const_exprs)]
fn foo<const N: usize>(_arr: [u64; N + 1]) where [u64; N + 1]: {}
fn main() {
let arr = [5; 5];
foo(arr);
}
```
Will now emit the following error:
```rs
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
--> test.rs:1:12
|
1 | #![feature(generic_const_exprs)]
| ^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
error[E0284]: type annotations needed
--> test.rs:8:7
|
8 | foo(arr);
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
note: required by a bound in `foo`
--> test.rs:3:56
|
3 | fn foo<const N: usize>(_arr: [u64; N + 1]) where [u64; N + 1]: {}
| ^^^^^ required by this bound in `foo`
help: consider specifying the generic argument
|
8 | foo::<N>(arr);
| +++++
error: aborting due to previous error; 1 warning emitted
```
cc: `@lcnr` thanks a lot again for the help on this
|
|
Move abstract const to middle
Moves AbstractConst (and all associated methods) to rustc middle for use in `rustc_infer`.
This allows for const resolution in infer to use abstract consts to walk consts and check if
they are resolvable.
This attempts to resolve the issue where `Foo<{ concrete const }, generic T>` is incorrectly marked as conflicting, and is independent from the other issue where nested abstract consts must be resolved.
r? `@lcnr`
|
|
|
|
|
|
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
|
|
Add regression test for #74713
closes #74713
|
|
|
|
|
|
Track implicit `Sized` obligations in type params
When we evaluate `ty::GenericPredicates` we introduce the implicit
`Sized` predicate of type params, but we do so with only the `Predicate`
its `Span` as context, we don't have an `Obligation` or
`ObligationCauseCode` we could influence. To try and carry this
information through, we add a new field to `ty::GenericPredicates` that
tracks both which predicates come from a type param and whether that
param has any bounds already (to use in suggestions).
We also suggest adding a `?Sized` bound if appropriate on E0599.
Address part of #98539.
|
|
On partial uninit error point at where we need init
When a binding is declared without a value, borrowck verifies that all
codepaths have *one* assignment to them to initialize them fully. If
there are any cases where a condition can be met that leaves the binding
uninitialized or we attempt to initialize a field of an uninitialized
binding, we emit E0381.
We now look at all the statements that initialize the binding, and use
them to explore branching code paths that *don't* and point at them. If
we find *no* potential places where an assignment to the binding might
be missing, we display the spans of all the existing initializers to
provide some context.
Fix https://github.com/rust-lang/rust/issues/97956.
|
|
|
|
|
|
When a binding is declared without a value, borrowck verifies that all
codepaths have *one* assignment to them to initialize them fully. If
there are any cases where a condition can be met that leaves the binding
uninitialized or we attempt to initialize a field of an unitialized
binding, we emit E0381.
We now look at all the statements that initialize the binding, and use
them to explore branching code paths that *don't* and point at them. If
we find *no* potential places where an assignment to the binding might
be missing, we display the spans of all the existing initializers to
provide some context.
|
|
Suggest adding a `?Sized` bound if appropriate on E0599 by inspecting
the HIR Generics. (Fix #98539)
|
|
Add a test for #70408
closes #70408
|
|
|
|
|
|
add ice test for #97047
Fixes #97047
|
|
Rollup of 5 pull requests
Successful merges:
- #97249 (`<details>`/`<summary>` UI fixes)
- #98418 (Allow macOS to build LLVM as shared library)
- #98460 (Use CSS variables to handle theming)
- #98497 (Improve some inference diagnostics)
- #98708 (rustdoc: fix 98690 Panic if invalid path for -Z persist-doctests)
Failed merges:
- #98761 (more `need_type_info` improvements)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
trait predicate
|
|
|
|
|
|
add ice test for 46511
Fixes #46511
r? ``@compiler-errors``
|
|
Fixes #97047
|
|
Rollup of 6 pull requests
Successful merges:
- #96727 (Make TAIT behave exactly like RPIT)
- #98681 (rustdoc-json: Make default value of blanket impl assoc types work)
- #98682 (add tests for ICE 94432)
- #98683 (add test for ice 68875)
- #98685 (Replace `sort_modules_alphabetically` boolean with enum)
- #98687 (add test for 47814)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
add test for ice 68875
Fixes #68875
|
|
interpret: adjust error from constructing an invalid value
|
|
Fixes #46511
|
|
Fixes #68875
|
|
Improve pretty printing of valtrees for references
This implements the changes outlined in https://github.com/rust-lang/rust/issues/66451#issuecomment-1168859638.
r? `@lcnr`
Fixes #66451
|
|
|
|
Erase regions in New Abstract Consts
When an abstract const is constructed, we previously included lifetimes in the set of substitutes, so it was not able to unify two abstract consts if their lifetimes did not match but the values did, despite the values not depending on the lifetimes. This caused code that should have compiled to not compile.
Fixes #98452
r? ```@lcnr```
|
|
|
|
|
|
|
|
|
|
Only keep a single query for well-formed checking
There are currently 3 queries to perform wf checks on different item-likes. This complexity is not required.
This PR replaces the query by:
- one query per item;
- one query to invoke it for a whole module.
This allows to remove HIR `ParItemLikeVisitor`.
|
|
Use correct substs in enum discriminant cast
Fixes https://github.com/rust-lang/rust/issues/97634
r? ```@lcnr```
|
|
r=compiler-errors
Point to type parameter definition when not finding variant, method and associated item
fixes #77391
|
|
|
|
|
|
Point at return expression for RPIT-related error
Certainly this needs some diagnostic refining, but I wanted to show that it was possible first and foremost. Not sure if this is the right approach. Open to feedback.
Fixes #80583
|
|
use `def_ident_span` , `body_owner_def_id` instead of `in_progress_typeck_results`, `guess_head_span`
use `body_id.owner` directly
add description to label
|
|
|
|
|
|
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
|