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

Rollup of 9 pull requests #98605

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift click to select a range
6ef2033
Fix FFI-unwind unsoundness with mixed panic mode
nbdd0121 May 18, 2022
77fd0cc
Handle panic runtime specially
nbdd0121 May 19, 2022
bc5afd9
Ensure ffi_unwind_calls lint is gated behind c_unwind
nbdd0121 May 19, 2022
1750a2f
Add tests for mixed panic mode restriction and lints
nbdd0121 May 20, 2022
9e6c044
Use is_fn_like instead of matching on DefKind
nbdd0121 May 23, 2022
14d155a
Rename `panic_strategy` query to `required_panic_strategy`
nbdd0121 Jun 8, 2022
ce774e3
Add a explanation about required panic strategy computation
nbdd0121 Jun 8, 2022
4c4152b
remove `span_lint_and_sugg_for_edges` from clippy utils
WaffleLapkin Jun 19, 2022
e251247
remove last use of MAX_SUGGESTION_HIGHLIGHT_LINES
WaffleLapkin Jun 19, 2022
ffb593b
remove MAX_SUGGESTION_HIGHLIGHT_LINES
WaffleLapkin Jun 19, 2022
a0eba66
[RFC 2011] Optimize non-consuming operators
c410-f3r Jun 21, 2022
c416307
Fixed RSS reporting on macOS
rdzhaafar Jun 22, 2022
f954f7b
Hermit: Fix initializing lazy locks
mkroening Jun 26, 2022
0c88602
Hermit: Make Mutex::init a no-op
mkroening Jun 26, 2022
871c879
lint: fix condition in diagnostic lints
davidtwco Jun 22, 2022
ae61224
various: add `rustc_lint_diagnostics` to diag fns
davidtwco Jun 22, 2022
be9ebfd
privacy: port "field is private" diag
davidtwco Jun 22, 2022
cb90a4f
privacy: port "item is private" diag
davidtwco Jun 22, 2022
0557d02
privacy: port unnamed "item is private" diag
davidtwco Jun 22, 2022
74f3a96
privacy: port "in public interface" diag
davidtwco Jun 22, 2022
15d61d7
privacy: deny diagnostic migration lints
davidtwco Jun 22, 2022
c24f063
Remove a back-compat hack on lazy TAIT
JohnTitor May 24, 2022
6400736
Implement `Send` and `Sync` for `ThinBox<T>`
cuviper Jun 27, 2022
f5a38d1
Remove unstable CStr/CString change from 1.62 release note
wwylele Jun 27, 2022
87a3821
Rollup merge of #97235 - nbdd0121:unwind, r=Amanieu
Dylan-DPC Jun 28, 2022
86eb0e5
Rollup merge of #97346 - JohnTitor:remove-back-compat-hacks, r=oli-obk
Dylan-DPC Jun 28, 2022
da898bf
Rollup merge of #98261 - WaffleLapkin:attempt_to_remove_max_suggestio…
Dylan-DPC Jun 28, 2022
9ed32b1
Rollup merge of #98337 - c410-f3r:assert-compiler, r=oli-obk
Dylan-DPC Jun 28, 2022
cfda49b
Rollup merge of #98384 - rdzhaafar:fix-macos-rss-reporting, r=davidtw…
Dylan-DPC Jun 28, 2022
a0a5cff
Rollup merge of #98420 - davidtwco:translation-lint-fixes-and-more-mi…
Dylan-DPC Jun 28, 2022
6de107a
Rollup merge of #98555 - mkroening:hermit-lock-init, r=m-ou-se
Dylan-DPC Jun 28, 2022
674c1fc
Rollup merge of #98595 - cuviper:send-sync-thinbox, r=m-ou-se
Dylan-DPC Jun 28, 2022
18c086f
Rollup merge of #98597 - wwylele:patch-1, r=Mark-Simulacrum
Dylan-DPC Jun 28, 2022
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
Prev Previous commit
Next Next commit
Rename panic_strategy query to required_panic_strategy
  • Loading branch information
nbdd0121 committed Jun 8, 2022
commit 14d155a3dc42b35856e45fd9f4212ac0c432cd10
2 changes: 1 addition & 1 deletion compiler/rustc_metadata/src/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 744,7 @@ impl<'a> CrateLoader<'a> {
if !data.is_panic_runtime() {
self.sess.err(&format!("the crate `{}` is not a panic runtime", name));
}
if data.panic_strategy() != Some(desired_strategy) {
if data.required_panic_strategy() != Some(desired_strategy) {
self.sess.err(&format!(
"the crate `{}` does not have the panic \
strategy `{}`",
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_metadata/src/dependency_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 368,7 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
}
panic_runtime = Some((
cnum,
tcx.panic_strategy(cnum).unwrap_or_else(|| {
tcx.required_panic_strategy(cnum).unwrap_or_else(|| {
bug!("cannot determine panic strategy of a panic runtime");
}),
));
Expand Down Expand Up @@ -406,7 406,7 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
continue;
}

if let Some(found_strategy) = tcx.panic_strategy(cnum) && desired_strategy != found_strategy {
if let Some(found_strategy) = tcx.required_panic_strategy(cnum) && desired_strategy != found_strategy {
sess.err(&format!(
"the crate `{}` requires \
panic strategy `{}` which is \
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_metadata/src/rmeta/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1759,8 1759,8 @@ impl CrateMetadata {
self.dep_kind.with_lock(|dep_kind| *dep_kind = f(*dep_kind))
}

pub(crate) fn panic_strategy(&self) -> Option<PanicStrategy> {
self.root.panic_strategy
pub(crate) fn required_panic_strategy(&self) -> Option<PanicStrategy> {
self.root.required_panic_strategy
}

pub(crate) fn needs_panic_runtime(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 246,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
has_global_allocator => { cdata.root.has_global_allocator }
has_panic_handler => { cdata.root.has_panic_handler }
is_profiler_runtime => { cdata.root.profiler_runtime }
panic_strategy => { cdata.root.panic_strategy }
required_panic_strategy => { cdata.root.required_panic_strategy }
panic_in_drop_strategy => { cdata.root.panic_in_drop_strategy }
extern_crate => {
let r = *cdata.extern_crate.lock();
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 665,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
triple: tcx.sess.opts.target_triple.clone(),
hash: tcx.crate_hash(LOCAL_CRATE),
stable_crate_id: tcx.def_path_hash(LOCAL_CRATE.as_def_id()).stable_crate_id(),
panic_strategy: tcx.required_panic_strategy(()),
required_panic_strategy: tcx.required_panic_strategy(LOCAL_CRATE),
panic_in_drop_strategy: tcx.sess.opts.debugging_opts.panic_in_drop,
edition: tcx.sess.edition(),
has_global_allocator: tcx.has_global_allocator(LOCAL_CRATE),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_metadata/src/rmeta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 217,7 @@ pub(crate) struct CrateRoot {
extra_filename: String,
hash: Svh,
stable_crate_id: StableCrateId,
panic_strategy: Option<PanicStrategy>,
required_panic_strategy: Option<PanicStrategy>,
panic_in_drop_strategy: PanicStrategy,
edition: Edition,
has_global_allocator: bool,
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1369,10 1369,7 @@ rustc_queries! {
desc { |tcx| "check if `{}` contains FFI-unwind calls", tcx.def_path_str(key.to_def_id()) }
cache_on_disk_if { true }
}
query required_panic_strategy(_: ()) -> Option<PanicStrategy> {
desc { "compute the required panic strategy for the current crate" }
}
query panic_strategy(_: CrateNum) -> Option<PanicStrategy> {
query required_panic_strategy(_: CrateNum) -> Option<PanicStrategy> {
fatal_cycle
desc { "query a crate's required panic strategy" }
separate_provide_extern
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_mir_transform/src/ffi_unwind_calls.rs
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
use rustc_hir::def_id::{LocalDefId, LOCAL_CRATE};
use rustc_hir::def_id::{CrateNum, LocalDefId, LOCAL_CRATE};
use rustc_middle::mir::*;
use rustc_middle::ty::layout;
use rustc_middle::ty::query::Providers;
Expand Down Expand Up @@ -123,7 123,9 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool {
tainted
}

fn required_panic_strategy(tcx: TyCtxt<'_>, (): ()) -> Option<PanicStrategy> {
fn required_panic_strategy(tcx: TyCtxt<'_>, cnum: CrateNum) -> Option<PanicStrategy> {
assert_eq!(cnum, LOCAL_CRATE);

if tcx.is_panic_runtime(LOCAL_CRATE) {
return Some(tcx.sess.panic_strategy());
}
Expand Down