Skip to content

Commit

Permalink
Auto merge of rust-lang#129665 - matthiaskrgr:rollup-hy23k7d, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#129507 (make it possible to enable const_precise_live_drops per-function)
 - rust-lang#129581 (exit: explain our expectations for the exit handlers registered in a Rust program)
 - rust-lang#129634 (Fix tidy to allow `edition = "2024"` in `Cargo.toml`)
 - rust-lang#129635 (Use unsafe extern blocks throughout the compiler)
 - rust-lang#129645 (Fix typos in floating-point primitive type docs)
 - rust-lang#129648 (More `unreachable_pub`)
 - rust-lang#129649 (ABI compat check: detect unadjusted ABI mismatches)
 - rust-lang#129652 (fix Pointer to reference conversion docs)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Aug 27, 2024
2 parents 600edc9 + ac0cc70 commit 2f09b1d
Show file tree
Hide file tree
Showing 128 changed files with 871 additions and 772 deletions.
4 changes: 3 additions & 1 deletion compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,9 @@ impl<FieldIdx: Idx, VariantIdx: Idx> LayoutS<FieldIdx, VariantIdx> {

/// Checks if these two `Layout` are equal enough to be considered "the same for all function
/// call ABIs". Note however that real ABIs depend on more details that are not reflected in the
/// `Layout`; the `PassMode` need to be compared as well.
/// `Layout`; the `PassMode` need to be compared as well. Also note that we assume
/// aggregates are passed via `PassMode::Indirect` or `PassMode::Cast`; more strict
/// checks would otherwise be required.
pub fn eq_abi(&self, other: &Self) -> bool {
// The one thing that we are not capturing here is that for unsized types, the metadata must
// also have the same ABI, and moreover that the same metadata leads to the same size. The
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(unsafe_extern_blocks))]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![feature(assert_matches)]
Expand Down
42 changes: 21 additions & 21 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,12 +564,12 @@ pub enum ArchiveKind {
}

// LLVMRustThinLTOData
extern "C" {
unsafe extern "C" {
pub type ThinLTOData;
}

// LLVMRustThinLTOBuffer
extern "C" {
unsafe extern "C" {
pub type ThinLTOBuffer;
}

Expand Down Expand Up @@ -621,7 +621,7 @@ pub enum MemoryEffects {
InaccessibleMemOnly,
}

extern "C" {
unsafe extern "C" {
type Opaque;
}
#[repr(C)]
Expand All @@ -631,54 +631,54 @@ struct InvariantOpaque<'a> {
}

// Opaque pointer types
extern "C" {
unsafe extern "C" {
pub type Module;
}
extern "C" {
unsafe extern "C" {
pub type Context;
}
extern "C" {
unsafe extern "C" {
pub type Type;
}
extern "C" {
unsafe extern "C" {
pub type Value;
}
extern "C" {
unsafe extern "C" {
pub type ConstantInt;
}
extern "C" {
unsafe extern "C" {
pub type Attribute;
}
extern "C" {
unsafe extern "C" {
pub type Metadata;
}
extern "C" {
unsafe extern "C" {
pub type BasicBlock;
}
#[repr(C)]
pub struct Builder<'a>(InvariantOpaque<'a>);
#[repr(C)]
pub struct PassManager<'a>(InvariantOpaque<'a>);
extern "C" {
unsafe extern "C" {
pub type Pass;
}
extern "C" {
unsafe extern "C" {
pub type TargetMachine;
}
extern "C" {
unsafe extern "C" {
pub type Archive;
}
#[repr(C)]
pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
#[repr(C)]
pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
extern "C" {
unsafe extern "C" {
pub type Twine;
}
extern "C" {
unsafe extern "C" {
pub type DiagnosticInfo;
}
extern "C" {
unsafe extern "C" {
pub type SMDiagnostic;
}
#[repr(C)]
Expand All @@ -688,7 +688,7 @@ pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
#[repr(C)]
pub struct Linker<'a>(InvariantOpaque<'a>);

extern "C" {
unsafe extern "C" {
pub type DiagnosticHandler;
}

Expand Down Expand Up @@ -823,7 +823,7 @@ bitflags! {
}
}

extern "C" {
unsafe extern "C" {
pub type ModuleBuffer;
}

Expand All @@ -834,7 +834,7 @@ pub type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void);
pub type GetSymbolsCallback = unsafe extern "C" fn(*mut c_void, *const c_char) -> *mut c_void;
pub type GetSymbolsErrorCallback = unsafe extern "C" fn(*const c_char) -> *mut c_void;

extern "C" {
unsafe extern "C" {
// Create and destroy contexts.
pub fn LLVMContextDispose(C: &'static mut Context);
pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
Expand Down Expand Up @@ -1518,7 +1518,7 @@ extern "C" {
}

#[link(name = "llvm-wrapper", kind = "static")]
extern "C" {
unsafe extern "C" {
pub fn LLVMRustInstallErrorHandlers();
pub fn LLVMRustDisableSystemDialogsOnCrash();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ use super::check::Qualifs;
use super::ops::{self, NonConstOp};
use super::qualifs::{NeedsNonConstDrop, Qualif};
use super::ConstCx;
use crate::check_consts::rustc_allow_const_fn_unstable;

/// Returns `true` if we should use the more precise live drop checker that runs after drop
/// elaboration.
pub fn checking_enabled(ccx: &ConstCx<'_, '_>) -> bool {
// Const-stable functions must always use the stable live drop checker.
// Const-stable functions must always use the stable live drop checker...
if ccx.is_const_stable_const_fn() {
return false;
// ...except if they have the feature flag set via `rustc_allow_const_fn_unstable`.
return rustc_allow_const_fn_unstable(
ccx.tcx,
ccx.body.source.def_id().expect_local(),
sym::const_precise_live_drops,
);
}

ccx.tcx.features().const_precise_live_drops
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
#![cfg_attr(bootstrap, feature(unsafe_extern_blocks))]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![feature(decl_macro)]
Expand All @@ -15,6 +16,7 @@
#![feature(panic_update_hook)]
#![feature(result_flattening)]
#![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end

use std::cmp::max;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_driver_impl/src/signal_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{fmt, mem, ptr};

use rustc_interface::util::{DEFAULT_STACK_SIZE, STACK_SIZE};

extern "C" {
unsafe extern "C" {
fn backtrace_symbols_fd(buffer: *const *mut libc::c_void, size: libc::c_int, fd: libc::c_int);
}

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_error_codes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#![deny(rustdoc::invalid_codeblock_attributes)]
#![doc(rust_logo)]
#![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end

// This higher-order macro defines the error codes that are in use. It is used
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_error_messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#![feature(rustc_attrs)]
#![feature(rustdoc_internals)]
#![feature(type_alias_impl_trait)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end

use std::borrow::Cow;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ pub trait LintDiagnostic<'a, G: EmissionGuarantee> {
}

#[derive(Clone, Debug, Encodable, Decodable)]
pub struct DiagLocation {
pub(crate) struct DiagLocation {
file: Cow<'static, str>,
line: u32,
col: u32,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2387,7 +2387,7 @@ enum DisplaySuggestion {
impl FileWithAnnotatedLines {
/// Preprocess all the annotations so that they are grouped by file and by line number
/// This helps us quickly iterate over the whole message (including secondary file spans)
pub fn collect_annotations(
pub(crate) fn collect_annotations(
emitter: &dyn Emitter,
args: &FluentArgs<'_>,
msp: &MultiSpan,
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#![feature(trait_alias)]
#![feature(try_blocks)]
#![feature(yeet_expr)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end

extern crate self as rustc_errors;
Expand Down Expand Up @@ -1701,7 +1702,7 @@ impl DiagCtxtInner {
}

/// Translate `message` eagerly with `args` to `SubdiagMessage::Eager`.
pub fn eagerly_translate<'a>(
fn eagerly_translate<'a>(
&self,
message: DiagMessage,
args: impl Iterator<Item = DiagArg<'a>>,
Expand All @@ -1710,7 +1711,7 @@ impl DiagCtxtInner {
}

/// Translate `message` eagerly with `args` to `String`.
pub fn eagerly_translate_to_string<'a>(
fn eagerly_translate_to_string<'a>(
&self,
message: DiagMessage,
args: impl Iterator<Item = DiagArg<'a>>,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_errors/src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use std::any::Any;

#[cfg(windows)]
pub fn acquire_global_lock(name: &str) -> Box<dyn Any> {
pub(crate) fn acquire_global_lock(name: &str) -> Box<dyn Any> {
use std::ffi::CString;
use std::io;

Expand Down Expand Up @@ -80,6 +80,6 @@ pub fn acquire_global_lock(name: &str) -> Box<dyn Any> {
}

#[cfg(not(windows))]
pub fn acquire_global_lock(_name: &str) -> Box<dyn Any> {
pub(crate) fn acquire_global_lock(_name: &str) -> Box<dyn Any> {
Box::new(())
}
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/markdown/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ enum ParseOpt {
}

/// Parse a buffer
pub fn entrypoint(txt: &str) -> MdStream<'_> {
pub(crate) fn entrypoint(txt: &str) -> MdStream<'_> {
let ctx = Context { top_block: true, prev: Prev::Newline };
normalize(parse_recursive(txt.trim().as_bytes(), ctx), &mut Vec::new())
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_errors/src/markdown/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ thread_local! {
}

/// Print to terminal output to a buffer
pub fn entrypoint(stream: &MdStream<'_>, buf: &mut Buffer) -> io::Result<()> {
pub(crate) fn entrypoint(stream: &MdStream<'_>, buf: &mut Buffer) -> io::Result<()> {
#[cfg(not(test))]
if let Some((w, _)) = termize::dimensions() {
WIDTH.with(|c| c.set(std::cmp::min(w, DEFAULT_COLUMN_WIDTH)));
Expand Down Expand Up @@ -47,7 +47,7 @@ fn write_stream(
Ok(())
}

pub fn write_tt(tt: &MdTree<'_>, buf: &mut Buffer, indent: usize) -> io::Result<()> {
fn write_tt(tt: &MdTree<'_>, buf: &mut Buffer, indent: usize) -> io::Result<()> {
match tt {
MdTree::CodeBlock { txt, lang: _ } => {
buf.set_color(ColorSpec::new().set_dimmed(true))?;
Expand Down
Loading

0 comments on commit 2f09b1d

Please sign in to comment.