Skip to content

Rollup of 3 pull requests #123335

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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()
),
);
Expand Down
15 changes: 10 additions & 5 deletions compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -1103,8 +1105,11 @@ impl<'tcx> TypeVisitable<TyCtxt<'tcx>> 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)
Expand Down
5 changes: 4 additions & 1 deletion library/std/src/sys/pal/unix/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down