-
Notifications
You must be signed in to change notification settings - Fork 0
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
Check other rvalues #19
Check other rvalues #19
Conversation
2943e65
to
5b8a13d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lookin' good. Two nits.
@@ -59,7 +59,7 @@ pub fn type_check<'a, 'gcx, 'tcx>( | |||
} | |||
|
|||
fn mirbug(tcx: TyCtxt, span: Span, msg: &str) { | |||
tcx.sess.diagnostic().span_bug(span, msg); | |||
tcx.sess.diagnostic().delay_span_bug(span, msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe worth a comment here -- something like:
// We sometimes see MIR failures (notably predicate failures) due to
// the fact that we check rvalue sized predicates here. So use `delay_span_bug`
// to avoid reporting bugs in those cases.
|
||
AggregateKind::Closure(def_id, substs) | | ||
AggregateKind::Generator(def_id, substs, _) => { | ||
tcx.predicates_of(*def_id).instantiate(tcx, substs.substs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized that this code should probably move into this match arm
5b8a13d
to
0aeff1a
Compare
@nikomatsakis addressed both things |
0aeff1a
to
152b96c
Compare
self.prove_aggregate_predicates(aggregate_kind, location); | ||
|
||
match aggregate_kind { | ||
if *aggregate_kind == AggregateKind::Tuple { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: if we are going to "return early" for tuples, we should have bug!
cases for the prove_aggregate_predicates
function etc. Otherwise if people tried to add code there there might be confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other thing we could do is to leave prove_aggregate_predicates before the early return as it was ... so if you want to handle Tuples there you can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either would be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
152b96c
to
bdcabf8
Compare
75b045a
to
9e93966
Compare
Otherwise, `run-pass/typeck-fn-to-unsafe-fn-ptr.rs` fails the MIR type checker.
These tests had FIXMEs for errors that were not previously being reported.
#15 but done on top of
nll-master
This should close rust-lang#45827 and rust-lang#45959.