Skip to content

Rollup of 8 pull requests #127657

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

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e71d06b
On `target_os = "linux"`, ensure that only one Rust thread calls `lib…
zachs18 Jun 18, 2024
bff3531
fix rustdoc URL
zachs18 Jun 21, 2024
c36fdeb
Don't perform mitigation for thread-unsafe libc::exit under Miri.
zachs18 Jun 21, 2024
31851d4
Add `-Zdump-mir-exclude-alloc-bytes`
cuviper Jun 14, 2024
1a05cb2
Use `-Zdump-mir-exclude-alloc-bytes` in some mir-opt tests
cuviper Jun 14, 2024
7c3673f
Bless mir-opt for excluded alloc bytes
cuviper Jun 14, 2024
5e83faf
Use libc::pause instead of std::thread::park in wait-for-exit loop
zachs18 Jul 3, 2024
897fb6c
Use pthread_t instead of numeric thread id
zachs18 Jul 3, 2024
b512608
Remove Miri special-case
zachs18 Jul 3, 2024
b4149c6
Move unique_thread_exit call to lang_start_internal so it is not in a…
zachs18 Jul 3, 2024
81b1f92
CFI: Support provided methods on traits
maurer Jul 3, 2024
fe5581d
Fix import suggestion ice
chenyukang Jul 4, 2024
9de76e3
Update library/std/src/sys/pal/common/exit_guard.rs
zachs18 Jul 5, 2024
a609370
Move exit guard from sys::common::exit_guard to sys::exit_guard.
zachs18 Jul 5, 2024
5db1655
Attempt to fix CI
zachs18 Jul 5, 2024
9801076
Move/change declaration of `mod exit_guard;`
zachs18 Jul 7, 2024
8bcbab5
Attempt to fix CI
zachs18 Jul 8, 2024
87856c4
add lint for inline asm labels that look like binary
asquared31415 Jun 24, 2024
a3ef94e
Fire unsafe_code lint on unsafe extern blocks
spastorino Jul 9, 2024
2c8bbee
Remove fully_normalize
compiler-errors Jul 11, 2024
843f5dd
Add rustdoc support for use<> in (local) RPITs
compiler-errors Jul 11, 2024
bd135e4
Add rustdoc-json support for use<>
compiler-errors Jul 11, 2024
d18af83
Rollup merge of #126502 - cuviper:dump-mir-exclude-alloc-bytes, r=est…
matthiaskrgr Jul 12, 2024
cc0a918
Rollup merge of #126606 - zachs18:patch-2, r=joboet
matthiaskrgr Jul 12, 2024
1d7d63c
Rollup merge of #126922 - asquared31415:asm_binary_label, r=estebank
matthiaskrgr Jul 12, 2024
d401c47
Rollup merge of #127295 - maurer:default-impl-cfi, r=estebank
matthiaskrgr Jul 12, 2024
eb85988
Rollup merge of #127310 - chenyukang:yukang-fix-suggest-import-ice, r…
matthiaskrgr Jul 12, 2024
58ceb36
Rollup merge of #127535 - spastorino:unsafe_code-unsafe_extern_blocks…
matthiaskrgr Jul 12, 2024
2dc3d73
Rollup merge of #127631 - compiler-errors:yeet-fully-norm, r=lcnr
matthiaskrgr Jul 12, 2024
d15fdf4
Rollup merge of #127632 - compiler-errors:precise-capturing-rustdoc, …
matthiaskrgr Jul 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/rustc_lint/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ lint_builtin_unreachable_pub = unreachable `pub` {$what}

lint_builtin_unsafe_block = usage of an `unsafe` block

lint_builtin_unsafe_extern_block = usage of an `unsafe extern` block

lint_builtin_unsafe_impl = implementation of an `unsafe` trait

lint_builtin_unsafe_trait = declaration of an `unsafe` trait
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ impl EarlyLintPass for UnsafeCode {
self.report_unsafe(cx, it.span, BuiltinUnsafe::GlobalAsm);
}

ast::ItemKind::ForeignMod(ForeignMod { safety, .. }) => {
if let Safety::Unsafe(_) = safety {
self.report_unsafe(cx, it.span, BuiltinUnsafe::UnsafeExternBlock);
}
}

_ => {}
}
}
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_lint/src/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ pub enum BuiltinUnsafe {
AllowInternalUnsafe,
#[diag(lint_builtin_unsafe_block)]
UnsafeBlock,
#[diag(lint_builtin_unsafe_extern_block)]
UnsafeExternBlock,
#[diag(lint_builtin_unsafe_trait)]
UnsafeTrait,
#[diag(lint_builtin_unsafe_impl)]
Expand Down
14 changes: 14 additions & 0 deletions tests/ui/lint/unsafe_code/unsafe-extern-blocks.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#![feature(unsafe_extern_blocks)]
#![deny(unsafe_code)]

#[allow(unsafe_code)]
unsafe extern "C" {
fn foo();
}

unsafe extern "C" {
//~^ ERROR usage of an `unsafe extern` block [unsafe_code]
fn bar();
}

fn main() {}
17 changes: 17 additions & 0 deletions tests/ui/lint/unsafe_code/unsafe-extern-blocks.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
error: usage of an `unsafe extern` block
--> $DIR/unsafe-extern-blocks.rs:9:1
|
LL | / unsafe extern "C" {
LL | |
LL | | fn bar();
LL | | }
| |_^
|
note: the lint level is defined here
--> $DIR/unsafe-extern-blocks.rs:2:9
|
LL | #![deny(unsafe_code)]
| ^^^^^^^^^^^

error: aborting due to 1 previous error