Add DerefOfRawPointer and CallToFunctionWith to THIR unsafeck#85306
Closed
LeSeulArtichaut wants to merge 2 commits intorust-lang:masterfrom
Closed
Add DerefOfRawPointer and CallToFunctionWith to THIR unsafeck#85306LeSeulArtichaut wants to merge 2 commits intorust-lang:masterfrom
LeSeulArtichaut wants to merge 2 commits intorust-lang:masterfrom
Conversation
13 tasks
f1b4337 to
9ec1eb2
Compare
This comment has been minimized.
This comment has been minimized.
9ec1eb2 to
d7787bb
Compare
Contributor
nikomatsakis
left a comment
There was a problem hiding this comment.
r=me modulo the question below
| ExprKind::Call { fun, ty: _, args: _, from_hir_call: _, fn_span: _ } => { | ||
| if self.thir[fun].ty.fn_sig(self.tcx).unsafety() == hir::Unsafety::Unsafe { | ||
| self.requires_unsafe(expr.span, CallToUnsafeFunction); | ||
| } else if let &ty::FnDef(func_did, _) = self.thir[fun].ty.kind() { |
Contributor
There was a problem hiding this comment.
as far as I know, target features 1.1 is not stable #69098 -- is this instability enforced at the declaration site? I guess probably so.
Contributor
Author
There was a problem hiding this comment.
Yes, the check is here:
rust/compiler/rustc_typeck/src/collect.rs
Lines 2773 to 2781 in 1773f14
Contributor
|
@bors r+ |
Collaborator
|
📌 Commit d7787bb has been approved by |
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
May 21, 2021
…komatsakis Add DerefOfRawPointer and CallToFunctionWith to THIR unsafeck Extends THIR unsafeck to check for two more cases of unsafe operations: dereferences of raw pointers and calls to functions with `#[target_feature]` (RFC 2396). The check for the latter is pretty much copy-pasted from the existing MIR equivalent. This will clash with rust-lang#83842 and rust-lang#85273 which are arguably more important, let's maybe focus on getting those merged first, this can wait. r? `@nikomatsakis` cc rust-lang/project-thir-unsafeck#7
Contributor
Author
|
Whoops |
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
May 21, 2021
…komatsakis Check for more things in THIR unsafeck Reunion of rust-lang#85306, rust-lang#85381 and rust-lang#85419 with conflicts resolved. r? `@nikomatsakis`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extends THIR unsafeck to check for two more cases of unsafe operations: dereferences of raw pointers and calls to functions with
#[target_feature](RFC 2396). The check for the latter is pretty much copy-pasted from the existing MIR equivalent.This will clash with #83842 and #85273 which are arguably more important, let's maybe focus on getting those merged first, this can wait.
r? @nikomatsakis
cc rust-lang/project-thir-unsafeck#7