Skip to content
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

Document some safety constraints and use more safe wrappers #135549

Merged
merged 3 commits into from
Feb 12, 2025

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jan 15, 2025

Lots of unsafe codegen_llvm code has safe wrappers already, so I used some of them and added some where applicable. I stopped here because this diff is large enough and should probably be reviewed independently of other changes.

@rustbot
Copy link
Collaborator

rustbot commented Jan 15, 2025

r? @cjgillot

rustbot has assigned @cjgillot.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 15, 2025
@oli-obk oli-obk force-pushed the push-tmxtpnrloyqu branch 2 times, most recently from 7465121 to adb21b5 Compare January 15, 2025 17:45
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jan 24, 2025

☔ The latest upstream changes (presumably #135947) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 27, 2025

r? compiler

@rustbot rustbot assigned compiler-errors and unassigned cjgillot Jan 27, 2025
@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Feb 6, 2025

📌 Commit 0a8da9b has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 6, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 6, 2025
…ler-errors

Document some safety constraints and use more safe wrappers

Lots of unsafe codegen_llvm code has safe wrappers already, so I used some of them and added some where applicable. I stopped here because this diff is large enough and should probably be reviewed independently of other changes.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 6, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#133925 (disallow `repr()` on invalid items)
 - rust-lang#135549 (Document some safety constraints and use more safe wrappers)
 - rust-lang#136069 (Simplify slice indexing in next trait solver)
 - rust-lang#136152 (Stabilize `map_many_mut` feature)
 - rust-lang#136219 (Misc. `rustc_hir` cleanups 🧹)
 - rust-lang#136580 (Couple of changes to run rustc in miri)
 - rust-lang#136636 (Couple of minor cleanups to the diagnostic infrastructure)
 - rust-lang#136645 (Clippy subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
@matthiaskrgr
Copy link
Member

@bors r-
I suspect this failed here #136654 (comment)

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 6, 2025
Comment on lines 1102 to 1095
llvm::get_linkage(val) == llvm::Linkage::ExternalLinkage
&& llvm::LLVMIsDeclaration(val) == 0
})
.filter_map(|val| {
// Exclude some symbols that we know are not Rust symbols.
let name = llvm::get_value_name(val);
if ignored(name) { None } else { Some((val, name)) }
})
.map(move |(val, name)| {
let mut imp_name = prefix.as_bytes().to_vec();
imp_name.extend(name);
let imp_name = CString::new(imp_name).unwrap();
(imp_name, val)
})
.collect::<Vec<_>>();
let ptr_ty = Type::ptr_llcx(llcx);
let globals = base::iter_globals(llmod)
.filter(|&val| {
llvm::get_linkage(val) == llvm::Linkage::ExternalLinkage && llvm::is_declaration(val)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops 🙈

@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 11, 2025

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Feb 11, 2025

📌 Commit dcf1e4d has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 11, 2025
fmease added a commit to fmease/rust that referenced this pull request Feb 11, 2025
…ler-errors

Document some safety constraints and use more safe wrappers

Lots of unsafe codegen_llvm code has safe wrappers already, so I used some of them and added some where applicable. I stopped here because this diff is large enough and should probably be reviewed independently of other changes.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 11, 2025
Rollup of 7 pull requests

Successful merges:

 - rust-lang#134090 (Stabilize target_feature_11)
 - rust-lang#134999 (Add cygwin target.)
 - rust-lang#135025 (Cast allocas to default address space)
 - rust-lang#135408 (x86: make SSE2 required for i686 hardfloat targets and use it to pass SIMD types)
 - rust-lang#135549 (Document some safety constraints and use more safe wrappers)
 - rust-lang#136193 (Implement pattern type ffi checks)
 - rust-lang#136699 (std: replace the `FromInner` implementation for addresses with private conversion functions)

Failed merges:

 - rust-lang#136758 (tests: `-Copt-level=3` instead of `-O` in assembly tests)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 11, 2025
…ler-errors

Document some safety constraints and use more safe wrappers

Lots of unsafe codegen_llvm code has safe wrappers already, so I used some of them and added some where applicable. I stopped here because this diff is large enough and should probably be reviewed independently of other changes.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 12, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#135549 (Document some safety constraints and use more safe wrappers)
 - rust-lang#135965 (In "specify type" suggestion, skip type params that are already known)
 - rust-lang#136193 (Implement pattern type ffi checks)
 - rust-lang#136646 (Add a TyPat in the AST to reuse the generic arg lowering logic)
 - rust-lang#136699 (std: replace the `FromInner` implementation for addresses with private conversion functions)
 - rust-lang#136874 (Change the issue number for `likely_unlikely` and `cold_path`)
 - rust-lang#136884 (Lower fn items as ZST valtrees and delay a bug)
 - rust-lang#136885 (i686-linux-android: increase CPU baseline to Pentium 4 (without an actual change)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 12, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#135549 (Document some safety constraints and use more safe wrappers)
 - rust-lang#135965 (In "specify type" suggestion, skip type params that are already known)
 - rust-lang#136193 (Implement pattern type ffi checks)
 - rust-lang#136646 (Add a TyPat in the AST to reuse the generic arg lowering logic)
 - rust-lang#136874 (Change the issue number for `likely_unlikely` and `cold_path`)
 - rust-lang#136884 (Lower fn items as ZST valtrees and delay a bug)
 - rust-lang#136885 (i686-linux-android: increase CPU baseline to Pentium 4 (without an actual change)
 - rust-lang#136891 (Check sig for errors before checking for unconstrained anonymous lifetime)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9e89fee into rust-lang:master Feb 12, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Feb 12, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 12, 2025
Rollup merge of rust-lang#135549 - oli-obk:push-tmxtpnrloyqu, r=compiler-errors

Document some safety constraints and use more safe wrappers

Lots of unsafe codegen_llvm code has safe wrappers already, so I used some of them and added some where applicable. I stopped here because this diff is large enough and should probably be reviewed independently of other changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants