Skip to content
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

Rollup of 8 pull requests #129665

Merged
merged 36 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5412499
make it possible to enable const_precise_live_drops per-function
RalfJung Aug 25, 2024
21dd88f
exit: explain our expectations for the exit handlers registered in a …
RalfJung Aug 25, 2024
56d8611
Fix tidy
compiler-errors Jul 22, 2024
38e62b9
Use unsafe extern blocks throughout the compiler
compiler-errors Aug 26, 2024
e81fad2
Add `warn(unreachable_pub)` to `rustc_driver_impl`.
nnethercote Aug 27, 2024
d607cfb
Add `warn(unreachable_pub)` to `rustc_error_codes`.
nnethercote Aug 27, 2024
2b56212
Add `warn(unreachable_pub)` to `rustc_error_messages`.
nnethercote Aug 27, 2024
5fd503a
Add `warn(unreachable_pub)` to `rustc_errors`.
nnethercote Aug 27, 2024
df5fbf0
Add `warn(unreachable_pub)` to `rustc_expand`.
nnethercote Aug 27, 2024
0d8d05c
Add `warn(unreachable_pub)` to `rustc_feature`.
nnethercote Aug 27, 2024
a510813
Add `warn(unreachable_pub)` to `rustc_fluent_macro`.
nnethercote Aug 27, 2024
fa18140
Add `warn(unreachable_pub)` to `rustc_graphviz`.
nnethercote Aug 27, 2024
bffa224
Add `warn(unreachable_pub)` to `rustc_hir`.
nnethercote Aug 27, 2024
5acf4e7
Add `warn(unreachable_pub)` to `rustc_hir_analysis`.
nnethercote Aug 27, 2024
3aae994
Add `warn(unreachable_pub)` to `rustc_hir_pretty`.
nnethercote Aug 27, 2024
7fc0444
Add `warn(unreachable_pub)` to `rustc_hir_typeck`.
nnethercote Aug 27, 2024
969f970
Fix typos in floating-point primitive type docs
beetrees Aug 27, 2024
d054835
Reflow a couple of paragraphs in floating-point primitive docs
beetrees Aug 27, 2024
37becf7
Add `warn(unreachable_pub)` to `rustc_incremental`.
nnethercote Aug 27, 2024
46fe09f
Add `warn(unreachable_pub)` to `rustc_index`.
nnethercote Aug 27, 2024
6887927
Add `warn(unreachable_pub)` to `rustc_infer`.
nnethercote Aug 27, 2024
a941a4b
Add `warn(unreachable_pub)` to `rustc_interface`.
nnethercote Aug 27, 2024
6c84c55
Add `warn(unreachable_pub)` to `rustc_lexer`.
nnethercote Aug 27, 2024
f102841
Add `warn(unreachable_pub)` to `rustc_lint`.
nnethercote Aug 27, 2024
e7f1922
Add `warn(unreachable_pub)` to `rustc_lint_defs`.
nnethercote Aug 27, 2024
22cdd63
Add `warn(unreachable_pub)` to `rustc_llvm`.
nnethercote Aug 27, 2024
ab7b03e
ABI compat check: detect unadjusted ABI mismatches
RalfJung Aug 27, 2024
ab4a743
fix Pointer to reference conversion docs
RalfJung Aug 27, 2024
849c240
Rollup merge of #129507 - RalfJung:per-fn-const_precise_live_drops, r…
matthiaskrgr Aug 27, 2024
6ab1805
Rollup merge of #129581 - RalfJung:exit, r=joshtriplett
matthiaskrgr Aug 27, 2024
df9c87c
Rollup merge of #129634 - compiler-errors:tidy-2024, r=albertlarsan68
matthiaskrgr Aug 27, 2024
3299e30
Rollup merge of #129635 - compiler-errors:unsafe-blocks, r=spastorino
matthiaskrgr Aug 27, 2024
0249125
Rollup merge of #129645 - beetrees:fix-float-docs, r=tgross35
matthiaskrgr Aug 27, 2024
489eb23
Rollup merge of #129648 - nnethercote:unreachable_pub-2, r=Urgau
matthiaskrgr Aug 27, 2024
5e226dd
Rollup merge of #129649 - RalfJung:unadjusted-abi-mismatch, r=petroch…
matthiaskrgr Aug 27, 2024
ac0cc70
Rollup merge of #129652 - RalfJung:ptr-to-ref, r=traviscross
matthiaskrgr Aug 27, 2024
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
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
Loading