-
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
Move effect-checking to MIR #44700
Move effect-checking to MIR #44700
Conversation
459e6ca
to
f64623c
Compare
LGTM. Unsure about having a separate vector for visibility scope information (and I'd rename them to "lexical" or "source" scopes). r? @nikomatsakis |
src/librustc/mir/mod.rs
Outdated
|
||
impl<T> serialize::Decodable for ClearOnDecode<T> { | ||
fn decode<D: serialize::Decoder>(d: &mut D) -> Result<Self, D::Error> { | ||
serialize::Decodable::decode(d).map(|_v: ()| ClearOnDecode::Clear) |
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.
.map(|()| ...)
is possible here. (()
matches the only val of type ()
src/librustc/ich/impls_mir.rs
Outdated
@@ -75,6 +76,22 @@ for mir::Terminator<'gcx> { | |||
} | |||
} | |||
|
|||
impl<'a, 'gcx, 'tcx, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::ClearOnDecode<T> |
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.
StableHashingContext
now only takes one lifetime: StableHashingContext<'gcx>
.
f64623c
to
09030aa
Compare
☔ The latest upstream changes (presumably #44505) made this pull request unmergeable. Please resolve the merge conflicts. |
09030aa
to
9be1ef7
Compare
src/librustc/mir/mod.rs
Outdated
/// The *lexical* visibility scope the local is defined | ||
/// in. If the local was defined in a let-statement, this | ||
/// is *within* the let-statement, rather than outside | ||
/// of iit. |
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.
(typo, "iit")
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.
hate that keyboard. should get a new one that is actually good.
src/librustc_driver/driver.rs
Outdated
@@ -1004,15 +1004,16 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, | |||
// FIXME: ariel points SimplifyBranches should run after |
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.
... we can remove the FIXME as part of this PR, right?
(LGTM too.) |
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.
This looks pretty awesome. r=me but I'm not sure what's up with the THIS IS A TEST comment.
@@ -487,6 +487,16 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { | |||
|
|||
if self.is_box_free(func) { | |||
self.check_box_free_inputs(mir, term, &sig, args); | |||
// THIS IS A TEST. TEST TEST. |
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.
what does this comment mean?
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 wanted to see that lints worked before I actually used them to implement effect checking.
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.
oops. this should never have reached github. removing.
f4b3b24
to
48466b7
Compare
@bors r=nikomatsakis |
📌 Commit 48466b7 has been approved by |
⌛ Testing commit 48466b75cf16294f1d3bef913f2ac4c34cb80a94 with merge 3a3144bc996f5950bc3415dd6c7325ed87ebbd2c... |
💔 Test failed - status-appveyor |
src/test/compile-fail/issue-43733.rs
Outdated
@@ -16,6 +16,8 @@ type Foo = std::cell::RefCell<String>; | |||
#[cfg(target_thread_local)] | |||
static __KEY: std::thread::__FastLocalKeyInner<Foo> = | |||
std::thread::__FastLocalKeyInner::new(); | |||
//~^^ ERROR Sync` is not satisfied | |||
//~^^^ ERROR Sync` is not satisfied |
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.
check x86_64-pc-windows-gnu
failed, can't find these two errors.
Windows aren't cfg(target_thread_local)
IIRC.
---- [compile-fail] compile-fail\issue-43733.rs stdout ----
error: C:/projects/rust/src/test/compile-fail/issue-43733.rs:17: expected error not found: Sync` is not satisfied
error: C:/projects/rust/src/test/compile-fail/issue-43733.rs:17: expected error not found: Sync` is not satisfied
error: 0 unexpected errors found, 2 expected errors not found
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.
Only mingw windows. MSVC windows does have cfg(target_thread_local)
.
However... this error shouldn't be there, I think I forgot to put #[thread_local]
on it when I wrote the test? Or maybe I wrote the test, then later changed #[thread_local]
and forgot to update the test (because it didn't give these errors because MIR checks run far too late :/).
Anyway, just adding #[thread_local]
should work.
48466b7
to
516534f
Compare
@bors r=nikomatsakis |
📌 Commit 516534f has been approved by |
Move effect-checking to MIR This allows emitting lints from MIR and moves the effect-checking pass to work on it. I'll make `repr(packed)` misuse unsafe in a separate PR. r? @eddyb
☀️ Test successful - status-appveyor, status-travis |
This allows emitting lints from MIR and moves the effect-checking pass to work on it.
I'll make
repr(packed)
misuse unsafe in a separate PR.r? @eddyb