Skip to content

Rollup of 9 pull requests #131970

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

Merged
merged 24 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d21aa86
unicode-table-generator: match bin name with tool name
jieyouxu Oct 13, 2024
3748c5e
bootstrap: register `src/tools/unicode-table-generator` as a runnable…
jieyouxu Oct 13, 2024
75a9c86
unicode-table-generator: sync comments
jieyouxu Oct 13, 2024
be89da5
triagebot: add reminder for `library/core/src/unicode/unicode_data.rs…
jieyouxu Oct 13, 2024
f5577a8
fix missing rustfmt and clippy for msi
heiseish Oct 7, 2024
2316749
fix missing rustfmt for apple darwin
heiseish Oct 7, 2024
e78d788
Allow `#[deny(..)]` inside `#[forbid(..)]` as a no-op with a warning
Noratrieb Oct 17, 2024
1af9d11
Expand test coverage for deny-inside-forbid interactions
jieyouxu Oct 18, 2024
28fce83
Align boolean option descriptions in `configure.py`
clubby789 Oct 19, 2024
3310419
Make `llvm::set_section` take a `&CStr`
Zalathar Oct 18, 2024
e32a5be
compiletest: disambiguate between `tidy` and `tidy` (html version)
jieyouxu Oct 20, 2024
eca5359
add latest crash tests
matthiaskrgr Oct 20, 2024
ef5a56f
Remove outdated comment
ChrisDenton Oct 20, 2024
68d1fd9
compiler: pre-move code for fixing enum layout ICEs
workingjubilee Oct 17, 2024
9f4c915
compiler: Reject impossible reprs during enum layout
workingjubilee Oct 20, 2024
7b714d4
Rollup merge of #121560 - Noratrieb:stop-lint-macro-nonsense, r=jieyouxu
matthiaskrgr Oct 20, 2024
17ac4c8
Rollup merge of #131365 - heiseish:fix-issue-101993, r=Mark-Simulacrum
matthiaskrgr Oct 20, 2024
fb42a45
Rollup merge of #131647 - jieyouxu:unicode-table-generator, r=Mark-Si…
matthiaskrgr Oct 20, 2024
6d43de6
Rollup merge of #131843 - workingjubilee:thaw-impossible-reprs, r=luk…
matthiaskrgr Oct 20, 2024
2f77343
Rollup merge of #131926 - clubby789:configure-enable, r=Kobzol
matthiaskrgr Oct 20, 2024
0d4cf05
Rollup merge of #131961 - jieyouxu:dirty, r=Zalathar
matthiaskrgr Oct 20, 2024
da8a115
Rollup merge of #131962 - Zalathar:llvm-set-section, r=Swatinem,worki…
matthiaskrgr Oct 20, 2024
5533c96
Rollup merge of #131964 - matthiaskrgr:crashes2010, r=jieyouxu
matthiaskrgr Oct 20, 2024
a860657
Rollup merge of #131965 - ChrisDenton:outdated-comment, r=jieyouxu
matthiaskrgr Oct 20, 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
14 changes: 7 additions & 7 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5570,13 +5570,6 @@ dependencies = [
"version_check",
]

[[package]]
name = "unicode-bdd"
version = "0.1.0"
dependencies = [
"ucd-parse",
]

[[package]]
name = "unicode-bidi"
version = "0.3.15"
Expand Down Expand Up @@ -5626,6 +5619,13 @@ version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"

[[package]]
name = "unicode-table-generator"
version = "0.1.0"
dependencies = [
"ucd-parse",
]

[[package]]
name = "unicode-width"
version = "0.1.14"
Expand Down
9 changes: 9 additions & 0 deletions compiler/rustc_abi/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ pub enum LayoutCalculatorError<F> {

/// A union had no fields.
EmptyUnion,

/// The fields or variants have irreconcilable reprs
ReprConflict,
}

impl<F> LayoutCalculatorError<F> {
Expand All @@ -64,6 +67,7 @@ impl<F> LayoutCalculatorError<F> {
}
LayoutCalculatorError::SizeOverflow => LayoutCalculatorError::SizeOverflow,
LayoutCalculatorError::EmptyUnion => LayoutCalculatorError::EmptyUnion,
LayoutCalculatorError::ReprConflict => LayoutCalculatorError::ReprConflict,
}
}

Expand All @@ -77,6 +81,7 @@ impl<F> LayoutCalculatorError<F> {
}
LayoutCalculatorError::SizeOverflow => "size overflow",
LayoutCalculatorError::EmptyUnion => "type is a union with no fields",
LayoutCalculatorError::ReprConflict => "type has an invalid repr",
})
}
}
Expand Down Expand Up @@ -514,6 +519,10 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
}

let dl = self.cx.data_layout();
// bail if the enum has an incoherent repr that cannot be computed
if repr.packed() {
return Err(LayoutCalculatorError::ReprConflict);
}

let calculate_niche_filling_layout = || -> Option<TmpLayout<FieldIdx, VariantIdx>> {
if dont_niche_optimize_enum {
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::ffi::CStr;

use itertools::Itertools as _;
use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, ConstCodegenMethods};
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
Expand Down Expand Up @@ -305,7 +307,7 @@ fn generate_coverage_map<'ll>(
/// specific, well-known section and name.
fn save_function_record(
cx: &CodegenCx<'_, '_>,
covfun_section_name: &str,
covfun_section_name: &CStr,
mangled_function_name: &str,
source_hash: u64,
filenames_ref: u64,
Expand Down
18 changes: 9 additions & 9 deletions compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::cell::RefCell;
use std::ffi::CString;
use std::ffi::{CStr, CString};

use libc::c_uint;
use rustc_codegen_ssa::traits::{
Expand Down Expand Up @@ -292,10 +292,10 @@ pub(crate) fn save_cov_data_to_mod<'ll, 'tcx>(
.unwrap();
debug!("covmap var name: {:?}", covmap_var_name);

let covmap_section_name = llvm::build_string(|s| unsafe {
let covmap_section_name = CString::new(llvm::build_byte_buffer(|s| unsafe {
llvm::LLVMRustCoverageWriteMapSectionNameToString(cx.llmod, s);
})
.expect("Rust Coverage section name failed UTF-8 conversion");
}))
.expect("covmap section name should not contain NUL");
debug!("covmap section name: {:?}", covmap_section_name);

let llglobal = llvm::add_global(cx.llmod, cx.val_ty(cov_data_val), &covmap_var_name);
Expand All @@ -310,7 +310,7 @@ pub(crate) fn save_cov_data_to_mod<'ll, 'tcx>(

pub(crate) fn save_func_record_to_mod<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
covfun_section_name: &str,
covfun_section_name: &CStr,
func_name_hash: u64,
func_record_val: &'ll llvm::Value,
is_used: bool,
Expand Down Expand Up @@ -354,9 +354,9 @@ pub(crate) fn save_func_record_to_mod<'ll, 'tcx>(
/// - `__llvm_covfun` on Linux
/// - `__LLVM_COV,__llvm_covfun` on macOS (includes `__LLVM_COV,` segment prefix)
/// - `.lcovfun$M` on Windows (includes `$M` sorting suffix)
pub(crate) fn covfun_section_name(cx: &CodegenCx<'_, '_>) -> String {
llvm::build_string(|s| unsafe {
pub(crate) fn covfun_section_name(cx: &CodegenCx<'_, '_>) -> CString {
CString::new(llvm::build_byte_buffer(|s| unsafe {
llvm::LLVMRustCoverageWriteFuncSectionNameToString(cx.llmod, s);
})
.expect("Rust Coverage function record section name failed UTF-8 conversion")
}))
.expect("covfun section name should not contain NUL")
}
5 changes: 2 additions & 3 deletions compiler/rustc_codegen_llvm/src/llvm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,9 @@ impl MemoryEffects {
}
}

pub fn set_section(llglobal: &Value, section_name: &str) {
let section_name_cstr = CString::new(section_name).expect("unexpected CString error");
pub fn set_section(llglobal: &Value, section_name: &CStr) {
unsafe {
LLVMSetSection(llglobal, section_name_cstr.as_ptr());
LLVMSetSection(llglobal, section_name.as_ptr());
}
}

Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_lint/src/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,10 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
//
// This means that this only errors if we're truly lowering the lint
// level from forbid.
if self.lint_added_lints && level != Level::Forbid && old_level == Level::Forbid {
if self.lint_added_lints && level == Level::Deny && old_level == Level::Forbid {
// Having a deny inside a forbid is fine and is ignored, so we skip this check.
return;
} else if self.lint_added_lints && level != Level::Forbid && old_level == Level::Forbid {
// Backwards compatibility check:
//
// We used to not consider `forbid(lint_group)`
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ declare_lint! {
///
/// ```rust
/// #![forbid(warnings)]
/// #![deny(bad_style)]
/// #![warn(bad_style)]
///
/// fn main() {}
/// ```
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,6 @@ provide! { tcx, def_id, other, cdata,

pub(in crate::rmeta) fn provide(providers: &mut Providers) {
provide_cstore_hooks(providers);
// FIXME(#44234) - almost all of these queries have no sub-queries and
// therefore no actual inputs, they're just reading tables calculated in
// resolve! Does this work? Unsure! That's what the issue is about
providers.queries = rustc_middle::query::Providers {
allocator_kind: |tcx, ()| CStore::from_tcx(tcx).allocator_kind(),
alloc_error_handler_kind: |tcx, ()| CStore::from_tcx(tcx).alloc_error_handler_kind(),
Expand Down
10 changes: 8 additions & 2 deletions compiler/rustc_ty_utils/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ use {rustc_abi as abi, rustc_hir as hir};
use crate::errors::{
MultipleArrayFieldsSimdType, NonPrimitiveSimdType, OversizedSimdType, ZeroLengthSimdType,
};
use crate::layout_sanity_check::sanity_check_layout;

mod invariant;

pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { layout_of, ..*providers };
Expand Down Expand Up @@ -79,7 +80,7 @@ fn layout_of<'tcx>(
record_layout_for_printing(&cx, layout);
}

sanity_check_layout(&cx, &layout);
invariant::partially_check_layout(&cx, &layout);

Ok(layout)
}
Expand Down Expand Up @@ -115,6 +116,11 @@ fn map_error<'tcx>(
cx.tcx().dcx().delayed_bug(format!("computed layout of empty union: {ty:?}"));
LayoutError::Unknown(ty)
}
LayoutCalculatorError::ReprConflict => {
// packed enums are the only known trigger of this, but others might arise
cx.tcx().dcx().delayed_bug(format!("computed impossible repr (packed enum?): {ty:?}"));
LayoutError::Unknown(ty)
}
};
error(cx, err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rustc_middle::ty::layout::{HasTyCtxt, LayoutCx, TyAndLayout};
use rustc_target::abi::*;

/// Enforce some basic invariants on layouts.
pub(super) fn sanity_check_layout<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLayout<'tcx>) {
pub(super) fn partially_check_layout<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLayout<'tcx>) {
let tcx = cx.tcx();

// Type-level uninhabitedness should always imply ABI uninhabitedness.
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_ty_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ mod errors;
mod implied_bounds;
mod instance;
mod layout;
mod layout_sanity_check;
mod needs_drop;
mod opaque_types;
mod representability;
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ def is_value_list(key):
if option.value:
print('\t{:30} {}'.format('--{}=VAL'.format(option.name), option.desc))
else:
print('\t{:30} {}'.format('--enable-{} OR --disable-{}'.format(option.name, option.name), option.desc))
print('\t--enable-{:25} OR --disable-{}'.format(option.name, option.name))
print('\t\t' + option.desc)
print('')
print('This configure script is a thin configuration shim over the true')
print('configuration system, `config.toml`. You can explore the comments')
Expand Down
43 changes: 39 additions & 4 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1591,9 +1591,15 @@ impl Step for Extended {
prepare("cargo");
prepare("rust-std");
prepare("rust-analysis");
prepare("clippy");
prepare("rust-analyzer");
for tool in &["rust-docs", "miri", "rustc-codegen-cranelift"] {

for tool in &[
"clippy",
"rustfmt",
"rust-analyzer",
"rust-docs",
"miri",
"rustc-codegen-cranelift",
] {
if built_tools.contains(tool) {
prepare(tool);
}
Expand Down Expand Up @@ -1633,6 +1639,8 @@ impl Step for Extended {
"rust-analyzer-preview".to_string()
} else if name == "clippy" {
"clippy-preview".to_string()
} else if name == "rustfmt" {
"rustfmt-preview".to_string()
} else if name == "miri" {
"miri-preview".to_string()
} else if name == "rustc-codegen-cranelift" {
Expand All @@ -1652,7 +1660,7 @@ impl Step for Extended {
prepare("cargo");
prepare("rust-analysis");
prepare("rust-std");
for tool in &["clippy", "rust-analyzer", "rust-docs", "miri"] {
for tool in &["clippy", "rustfmt", "rust-analyzer", "rust-docs", "miri"] {
if built_tools.contains(tool) {
prepare(tool);
}
Expand Down Expand Up @@ -1770,6 +1778,24 @@ impl Step for Extended {
.arg(etc.join("msi/remove-duplicates.xsl"))
.run(builder);
}
if built_tools.contains("rustfmt") {
command(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rustfmt")
.args(heat_flags)
.arg("-cg")
.arg("RustFmtGroup")
.arg("-dr")
.arg("RustFmt")
.arg("-var")
.arg("var.RustFmtDir")
.arg("-out")
.arg(exe.join("RustFmtGroup.wxs"))
.arg("-t")
.arg(etc.join("msi/remove-duplicates.xsl"))
.run(builder);
}
if built_tools.contains("miri") {
command(&heat)
.current_dir(&exe)
Expand Down Expand Up @@ -1841,6 +1867,9 @@ impl Step for Extended {
if built_tools.contains("clippy") {
cmd.arg("-dClippyDir=clippy");
}
if built_tools.contains("rustfmt") {
cmd.arg("-dRustFmtDir=rustfmt");
}
if built_tools.contains("rust-docs") {
cmd.arg("-dDocsDir=rust-docs");
}
Expand All @@ -1867,6 +1896,9 @@ impl Step for Extended {
if built_tools.contains("clippy") {
candle("ClippyGroup.wxs".as_ref());
}
if built_tools.contains("rustfmt") {
candle("RustFmtGroup.wxs".as_ref());
}
if built_tools.contains("miri") {
candle("MiriGroup.wxs".as_ref());
}
Expand Down Expand Up @@ -1905,6 +1937,9 @@ impl Step for Extended {
if built_tools.contains("clippy") {
cmd.arg("ClippyGroup.wixobj");
}
if built_tools.contains("rustfmt") {
cmd.arg("RustFmtGroup.wixobj");
}
if built_tools.contains("miri") {
cmd.arg("MiriGroup.wixobj");
}
Expand Down
22 changes: 22 additions & 0 deletions src/bootstrap/src/core/build_steps/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,25 @@ impl Step for GenerateCompletions {
run.builder.ensure(GenerateCompletions);
}
}

#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct UnicodeTableGenerator;

impl Step for UnicodeTableGenerator {
type Output = ();
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/tools/unicode-table-generator")
}

fn make_run(run: RunConfig<'_>) {
run.builder.ensure(UnicodeTableGenerator);
}

fn run(self, builder: &Builder<'_>) {
let mut cmd = builder.tool_cmd(Tool::UnicodeTableGenerator);
cmd.arg(builder.src.join("library/core/src/unicode/unicode_data.rs"));
cmd.run(builder);
}
}
1 change: 1 addition & 0 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ bootstrap_tool!(
CoverageDump, "src/tools/coverage-dump", "coverage-dump";
RustcPerfWrapper, "src/tools/rustc-perf-wrapper", "rustc-perf-wrapper";
WasmComponentLd, "src/tools/wasm-component-ld", "wasm-component-ld", is_unstable_tool = true, allow_features = "min_specialization";
UnicodeTableGenerator, "src/tools/unicode-table-generator", "unicode-table-generator";
);

/// These are the submodules that are required for rustbook to work due to
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/core/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,7 @@ impl<'a> Builder<'a> {
run::GenerateCopyright,
run::GenerateWindowsSys,
run::GenerateCompletions,
run::UnicodeTableGenerator,
),
Kind::Setup => {
describe!(setup::Profile, setup::Hook, setup::Link, setup::Editor)
Expand Down
Loading
Loading