-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
NLL may be mishandling _
within type-ascription expression form
#57731
Comments
I had a brief look, the annotation is dropped before we get to NLL. Probably here: rust/src/librustc_typeck/check/mod.rs Lines 2442 to 2446 in f613dc1
|
This also applies to casts, so it is visble on stable: fn coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 {
let ((y, _z),) = ((s, _x),): (PairCoupledTypes<_>,);
y //~ ERROR unsatisfied lifetime constraints
} |
type ascription is feature-gated though, no? |
(or did you mean to use |
Yes, it should be |
[NLL] Clean up handling of type annotations * Renames (Canonical)?UserTypeAnnotation -> (Canonical)?UserType so that the name CanonicalUserTypeAnnotation is free. * Keep the inferred type associated to user type annotations in the MIR, so that it can be compared against the annotated type, even when the annotated expression gets removed from the MIR. (#54943) * Use the inferred type to allow infallible handling of user type projections (#57531) * Uses revisions for the tests in #56993 * Check the types of `Unevaluated` constants with no annotations (#46702) * Some drive-by cleanup Closes #46702 Closes #54943 Closes #57531 Closes #57731 cc #56993 leaving this open to track the underlying issue: we are not running tests with full NLL enabled on CI at the moment r? @nikomatsakis
Adapted from examples given on #55748. Note that observing this bug requires use of
feature(type_ascription)
and therefore is not high priority.consider the following code (play):
Right now, as written, this compiles without error. (Note that
fn coupled_types_rhs
is not included; that function will error with and without NLL.)If you remove the
nll
in the feature declaration, the code forfn coupled_wilds_rhs
is rejected.This is an indication that either:
_
in the type-ascription expression formEXPR: TYPE
, orfn coupled_wilds_rhs
should be accepted (and that NLL is correct in accepting it), but I do not see how such an argument exists that would not also imply that we should be seeing the same behavior infn coupled_types_rhs
.The text was updated successfully, but these errors were encountered: