diff options
| author | bors <bors@rust-lang.org> | 2024-07-23 12:10:45 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-07-23 12:10:45 +0000 |
| commit | d53dc752d2bc0a9e7f7e2e5f82aff03a6d222614 (patch) | |
| tree | 3cb5fe0c2b203a1ee5840d4c4679961ac410dee3 /src | |
| parent | d111ccdb6186b368ead16c01f43c645a6e5f4a67 (diff) | |
| parent | f8373adcda33b3a8b5e836e28b2162b2bfe31ee8 (diff) | |
| download | rust-d53dc752d2bc0a9e7f7e2e5f82aff03a6d222614.tar.gz rust-d53dc752d2bc0a9e7f7e2e5f82aff03a6d222614.zip | |
Auto merge of #128093 - matthiaskrgr:rollup-1snye4b, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #125834 (treat `&raw (const|mut) UNSAFE_STATIC` implied deref as safe) - #127962 (Cleanup compiletest dylib name calculation) - #128049 (Reword E0626 to mention static coroutine, add structured suggestion for adding `static`) - #128067 (Get rid of `can_eq_shallow`) - #128076 (Get rid of `InferCtxtExt` from `error_reporting::traits`) - #128089 (std: Unsafe-wrap actually-universal platform code) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/eta_reduction.rs | 4 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 18 | ||||
| -rw-r--r-- | src/tools/miri/tests/fail/extern_static.rs | 2 | ||||
| -rw-r--r-- | src/tools/miri/tests/fail/extern_static.stderr | 4 | ||||
| -rw-r--r-- | src/tools/miri/tests/pass/static_mut.rs | 2 |
5 files changed, 13 insertions, 17 deletions
diff --git a/src/tools/clippy/clippy_lints/src/eta_reduction.rs b/src/tools/clippy/clippy_lints/src/eta_reduction.rs index d2a34c75583..0ed7859418b 100644 --- a/src/tools/clippy/clippy_lints/src/eta_reduction.rs +++ b/src/tools/clippy/clippy_lints/src/eta_reduction.rs @@ -15,7 +15,7 @@ use rustc_middle::ty::{ use rustc_session::declare_lint_pass; use rustc_span::symbol::sym; use rustc_target::spec::abi::Abi; -use rustc_trait_selection::error_reporting::traits::InferCtxtExt as _; +use rustc_trait_selection::error_reporting::InferCtxtErrorExt as _; declare_clippy_lint! { /// ### What it does @@ -178,7 +178,7 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction { // 'cuz currently nothing changes after deleting this check. local_used_in(cx, l, args) || local_used_after_expr(cx, l, expr) }) { - match cx.tcx.infer_ctxt().build().type_implements_fn_trait( + match cx.tcx.infer_ctxt().build().err_ctxt().type_implements_fn_trait( cx.param_env, Binder::bind_with_vars(callee_ty_adjusted, List::empty()), ty::PredicatePolarity::Positive, diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 53988203136..16c08f709df 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -82,26 +82,22 @@ fn disable_error_reporting<F: FnOnce() -> R, R>(f: F) -> R { } /// The platform-specific library name -fn get_lib_name(lib: &str, aux_type: AuxType) -> Option<String> { +fn get_lib_name(name: &str, aux_type: AuxType) -> Option<String> { match aux_type { AuxType::Bin => None, // In some cases (e.g. MUSL), we build a static // library, rather than a dynamic library. // In this case, the only path we can pass // with '--extern-meta' is the '.rlib' file - AuxType::Lib => Some(format!("lib{}.rlib", lib)), - AuxType::Dylib => Some(if cfg!(windows) { - format!("{}.dll", lib) - } else if cfg!(target_vendor = "apple") { - format!("lib{}.dylib", lib) - } else if cfg!(target_os = "aix") { - format!("lib{}.a", lib) - } else { - format!("lib{}.so", lib) - }), + AuxType::Lib => Some(format!("lib{name}.rlib")), + AuxType::Dylib => Some(dylib_name(name)), } } +fn dylib_name(name: &str) -> String { + format!("{}{name}.{}", std::env::consts::DLL_PREFIX, std::env::consts::DLL_EXTENSION) +} + pub fn run(config: Arc<Config>, testpaths: &TestPaths, revision: Option<&str>) { match &*config.target { "arm-linux-androideabi" diff --git a/src/tools/miri/tests/fail/extern_static.rs b/src/tools/miri/tests/fail/extern_static.rs index f8805db8d14..0cbf1646be9 100644 --- a/src/tools/miri/tests/fail/extern_static.rs +++ b/src/tools/miri/tests/fail/extern_static.rs @@ -5,5 +5,5 @@ extern "C" { } fn main() { - let _val = unsafe { std::ptr::addr_of!(FOO) }; //~ ERROR: is not supported by Miri + let _val = std::ptr::addr_of!(FOO); //~ ERROR: is not supported by Miri } diff --git a/src/tools/miri/tests/fail/extern_static.stderr b/src/tools/miri/tests/fail/extern_static.stderr index 21759f96019..c7ab128e2fe 100644 --- a/src/tools/miri/tests/fail/extern_static.stderr +++ b/src/tools/miri/tests/fail/extern_static.stderr @@ -1,8 +1,8 @@ error: unsupported operation: extern static `FOO` is not supported by Miri --> $DIR/extern_static.rs:LL:CC | -LL | let _val = unsafe { std::ptr::addr_of!(FOO) }; - | ^^^ extern static `FOO` is not supported by Miri +LL | let _val = std::ptr::addr_of!(FOO); + | ^^^ extern static `FOO` is not supported by Miri | = help: this is likely not a bug in the program; it indicates that the program performed an operation that Miri does not support = note: BACKTRACE: diff --git a/src/tools/miri/tests/pass/static_mut.rs b/src/tools/miri/tests/pass/static_mut.rs index 1b416cc4e9b..4488b5a09d5 100644 --- a/src/tools/miri/tests/pass/static_mut.rs +++ b/src/tools/miri/tests/pass/static_mut.rs @@ -2,7 +2,7 @@ use std::ptr::addr_of; static mut FOO: i32 = 42; -static BAR: Foo = Foo(unsafe { addr_of!(FOO) }); +static BAR: Foo = Foo(addr_of!(FOO)); #[allow(dead_code)] struct Foo(*const i32); |
