Skip to content

Commit 829eb70

Browse files
committed
Auto merge of #123335 - workingjubilee:rollup-4882hjs, r=workingjubilee
Rollup of 3 pull requests Successful merges: - #123320 (Fixup parsing of `rustc_never_type_options` attribute) - #123323 (std::thread: set_name change for solaris/illumos.) - #123327 (Update `ParamEnv` docs) r? `@ghost` `@rustbot` modify labels: rollup
2 parents b38b6ca + f31464b commit 829eb70

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,13 +416,13 @@ fn parse_never_type_options_attr(
416416
continue;
417417
}
418418

419-
if item.has_name(sym::diverging_block_default) && fallback.is_none() {
420-
let mode = item.value_str().unwrap();
421-
match mode {
419+
if item.has_name(sym::diverging_block_default) && block.is_none() {
420+
let default = item.value_str().unwrap();
421+
match default {
422422
sym::unit => block = Some(DivergingBlockBehavior::Unit),
423423
sym::never => block = Some(DivergingBlockBehavior::Never),
424424
_ => {
425-
tcx.dcx().span_err(item.span(), format!("unknown diverging block default: `{mode}` (supported: `unit` and `never`)"));
425+
tcx.dcx().span_err(item.span(), format!("unknown diverging block default: `{default}` (supported: `unit` and `never`)"));
426426
}
427427
};
428428
continue;
@@ -431,7 +431,7 @@ fn parse_never_type_options_attr(
431431
tcx.dcx().span_err(
432432
item.span(),
433433
format!(
434-
"unknown never type option: `{}` (supported: `fallback`)",
434+
"unknown or duplicate never type option: `{}` (supported: `fallback`, `diverging_block_default`)",
435435
item.name_or_empty()
436436
),
437437
);

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,9 +1034,11 @@ impl PlaceholderLike for PlaceholderConst {
10341034
}
10351035
}
10361036

1037-
/// When type checking, we use the `ParamEnv` to track
1038-
/// details about the set of where-clauses that are in scope at this
1039-
/// particular point.
1037+
/// When interacting with the type system we must provide information about the
1038+
/// environment. `ParamEnv` is the type that represents this information. See the
1039+
/// [dev guide chapter][param_env_guide] for more information.
1040+
///
1041+
/// [param_env_guide]: https://rustc-dev-guide.rust-lang.org/param_env/param_env_summary.html
10401042
#[derive(Copy, Clone, Hash, PartialEq, Eq)]
10411043
pub struct ParamEnv<'tcx> {
10421044
/// This packs both caller bounds and the reveal enum into one pointer.
@@ -1103,8 +1105,11 @@ impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for ParamEnv<'tcx> {
11031105
impl<'tcx> ParamEnv<'tcx> {
11041106
/// Construct a trait environment suitable for contexts where
11051107
/// there are no where-clauses in scope. Hidden types (like `impl
1106-
/// Trait`) are left hidden, so this is suitable for ordinary
1107-
/// type-checking.
1108+
/// Trait`) are left hidden. In majority of cases it is incorrect
1109+
/// to use an empty environment. See the [dev guide section][param_env_guide]
1110+
/// for information on what a `ParamEnv` is and how to acquire one.
1111+
///
1112+
/// [param_env_guide]: https://rustc-dev-guide.rust-lang.org/param_env/param_env_summary.html
11081113
#[inline]
11091114
pub fn empty() -> Self {
11101115
Self::new(List::empty(), Reveal::UserFacing)

library/std/src/sys/pal/unix/thread.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,11 @@ impl Thread {
182182

183183
if let Some(f) = pthread_setname_np.get() {
184184
#[cfg(target_os = "nto")]
185-
let name = truncate_cstr::<{ libc::_NTO_THREAD_NAME_MAX as usize }>(name);
185+
const THREAD_NAME_MAX: usize = libc::_NTO_THREAD_NAME_MAX as usize;
186+
#[cfg(any(target_os = "solaris", target_os = "illumos"))]
187+
const THREAD_NAME_MAX: usize = 32;
186188

189+
let name = truncate_cstr::<{ THREAD_NAME_MAX }>(name);
187190
let res = unsafe { f(libc::pthread_self(), name.as_ptr()) };
188191
debug_assert_eq!(res, 0);
189192
}

0 commit comments

Comments
 (0)