From 71077482d58e807b9d09637237015df3f3d7d690 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Mon, 1 Apr 2024 10:56:33 +0000 Subject: [PATCH 1/4] Fixup parsing of `rustc_never_type_options` attribute Copy paste error strike again.. --- compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs index 74f27cfebbd22..05e7c5b2b4188 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs @@ -416,13 +416,13 @@ fn parse_never_type_options_attr( continue; } - if item.has_name(sym::diverging_block_default) && fallback.is_none() { - let mode = item.value_str().unwrap(); - match mode { + if item.has_name(sym::diverging_block_default) && block.is_none() { + let default = item.value_str().unwrap(); + match default { sym::unit => block = Some(DivergingBlockBehavior::Unit), sym::never => block = Some(DivergingBlockBehavior::Never), _ => { - tcx.dcx().span_err(item.span(), format!("unknown diverging block default: `{mode}` (supported: `unit` and `never`)")); + tcx.dcx().span_err(item.span(), format!("unknown diverging block default: `{default}` (supported: `unit` and `never`)")); } }; continue; @@ -431,7 +431,7 @@ fn parse_never_type_options_attr( tcx.dcx().span_err( item.span(), format!( - "unknown never type option: `{}` (supported: `fallback`)", + "unknown or duplicate never type option: `{}` (supported: `fallback`, `diverging_block_default`)", item.name_or_empty() ), ); From 61289a0945a968978404261ee91977410b366078 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Mon, 1 Apr 2024 14:28:37 +0100 Subject: [PATCH 2/4] std::thread: set_name change for solaris/illumos. truncate down to 32 (31 + 1) for solaris/illumos. --- library/std/src/sys/pal/unix/thread.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/std/src/sys/pal/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs index 77e31d802a38f..6f7045162835b 100644 --- a/library/std/src/sys/pal/unix/thread.rs +++ b/library/std/src/sys/pal/unix/thread.rs @@ -182,8 +182,11 @@ impl Thread { if let Some(f) = pthread_setname_np.get() { #[cfg(target_os = "nto")] - let name = truncate_cstr::<{ libc::_NTO_THREAD_NAME_MAX as usize }>(name); + const THREAD_NAME_MAX: usize = libc::_NTO_THREAD_NAME_MAX as usize; + #[cfg(any(target_os = "solaris", target_os = "illumos"))] + const THREAD_NAME_MAX: usize = 32; + let name = truncate_cstr::<{ THREAD_NAME_MAX }>(name); let res = unsafe { f(libc::pthread_self(), name.as_ptr()) }; debug_assert_eq!(res, 0); } From a91f6221b95dd21394fae4fd1ca45e56475b355f Mon Sep 17 00:00:00 2001 From: Boxy Date: Mon, 1 Apr 2024 17:29:34 +0100 Subject: [PATCH 3/4] Update `ParamEnv` docs --- compiler/rustc_middle/src/ty/mod.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 99da981b9d611..d7c6bffe284ff 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1034,9 +1034,11 @@ impl PlaceholderLike for PlaceholderConst { } } -/// When type checking, we use the `ParamEnv` to track -/// details about the set of where-clauses that are in scope at this -/// particular point. +/// When interacting with the type system we must provide information about the +/// environment. `ParamEnv` is the type that represents this information. See the +/// [dev guide chapter](param_env_guide) for more information. +/// +/// [param_env_guide]: https://rustc-dev-guide.rust-lang.org/param_env/param_env_summary.html #[derive(Copy, Clone, Hash, PartialEq, Eq)] pub struct ParamEnv<'tcx> { /// This packs both caller bounds and the reveal enum into one pointer. @@ -1103,8 +1105,11 @@ impl<'tcx> TypeVisitable> for ParamEnv<'tcx> { impl<'tcx> ParamEnv<'tcx> { /// Construct a trait environment suitable for contexts where /// there are no where-clauses in scope. Hidden types (like `impl - /// Trait`) are left hidden, so this is suitable for ordinary - /// type-checking. + /// Trait`) are left hidden. In majority of cases it is incorrect + /// to use an empty environment. See the [dev guide section][param_env_guide] + /// for information on what a `ParamEnv` is and how to acquire one. + /// + /// [param_env_guide]: https://rustc-dev-guide.rust-lang.org/param_env/param_env_summary.html #[inline] pub fn empty() -> Self { Self::new(List::empty(), Reveal::UserFacing) From 03dd3293550c68fcdd00b011fcaa4132084f8a03 Mon Sep 17 00:00:00 2001 From: Boxy Date: Mon, 1 Apr 2024 19:59:05 +0100 Subject: [PATCH 4/4] maybe --- compiler/rustc_middle/src/ty/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index d7c6bffe284ff..331daa87598de 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1036,7 +1036,7 @@ impl PlaceholderLike for PlaceholderConst { /// When interacting with the type system we must provide information about the /// environment. `ParamEnv` is the type that represents this information. See the -/// [dev guide chapter](param_env_guide) for more information. +/// [dev guide chapter][param_env_guide] for more information. /// /// [param_env_guide]: https://rustc-dev-guide.rust-lang.org/param_env/param_env_summary.html #[derive(Copy, Clone, Hash, PartialEq, Eq)]