| Age | Commit message (Collapse) | Author | Lines |
|
:sparkles:
|
|
|
|
|
|
|
|
During function type-checking, we normalize any associated types in
the function signature (argument types + return type), and then
create WF obligations for each of the normalized types. The HIR wf code
does not currently support this case, so any errors that we get have
imprecise spans.
This commit extends `ObligationCauseCode::WellFormed` to support
recording a function parameter, allowing us to get the corresponding
HIR type if an error occurs. Function typechecking is modified to
pass this information during signature normalization and WF checking.
The resulting code is fairly verbose, due to the fact that we can
no longer normalize the entire signature with a single function call.
As part of the refactoring, we now perform HIR-based WF checking
for several other 'typed items' (statics, consts, and inherent impls).
As a result, WF and projection errors in a function signature now
have a precise span, which points directly at the responsible type.
If a function signature is constructed via a macro, this will allow
the error message to point at the code 'most responsible' for the error
(e.g. a user-supplied macro argument).
|
|
|
|
|
|
|
|
|
|
involved
|
|
|
|
|
|
|
|
Add better diagnostic for unbounded Abst. Const
~~In the case where a generic abst. const requires a trivial where bound: `where TypeWithConst<const_fn(N)>: ,`,
instead of requiring a where bound, just check that only consts are being substituted in to skip over where check.~~
~~This is pretty sketchy, but I think it works. Presumably, if there is checking for type bounds added later, it can first check nested requirements, and see if they're satisfied by the current `ParamEnv`.~~
Changed the diagnostic to add a better example, which is more practical than what was previously proposed.
r? ```@lcnr```
|
|
Previously, it's not clear what exactly should be added in the suggested where clause,
so this adds an example to demonstrate.
|
|
|
|
Add error message for private fn
Attempts to add a more detailed error when a `const_evaluatable` fn from another scope is used inside of a scope which cannot access it.
r? ````@lcnr````
|
|
Bless tests
Update with changes from comments
|
|
const_evaluatable: stop looking into type aliases
see https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/const_evaluatable.3A.20type.20alias
r? ````@oli-obk````
|
|
add const_evaluatable_checked test
cc `````@oli-obk`````
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Part of #68490.
Care has been taken to leave the old consts where appropriate, for testing backcompat regressions, module shadowing, etc. The intrinsics docs were accidentally referring to some methods on f64 as std::f64, which I changed due to being contrary with how we normally disambiguate the shadow module from the primitive. In one other place I changed std::u8 to std::ops since it was just testing path handling in macros.
For places which have legitimate uses of the old consts, deprecated attributes have been optimistically inserted. Although currently unnecessary, they exist to emphasize to any future deprecation effort the necessity of these specific symbols and prevent them from being accidentally removed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2
3
|
|
|
|
const evaluatable: improve `TooGeneric` handling
Instead of emitting an error in `fulfill`, we now correctly stall on inference variables.
As `const_eval_resolve` returns `ErrorHandled::TooGeneric` when encountering generic parameters on which
we actually do want to error, we check for inference variables and eagerly emit an error if they don't exist, returning `ErrorHandled::Reported` instead.
Also contains a small bugfix for `ConstEquate` where we previously only stalled on type variables. This is probably a leftover from
when we did not yet support stalling on const inference variables.
r? @oli-obk cc @varkor @eddyb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|