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
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
@@ -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"
@@ -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"
9 changes: 9 additions & 0 deletions compiler/rustc_abi/src/layout.rs
Original file line number Diff line number Diff line change
@@ -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> {
@@ -64,6 +67,7 @@ impl<F> LayoutCalculatorError<F> {
}
LayoutCalculatorError::SizeOverflow => LayoutCalculatorError::SizeOverflow,
LayoutCalculatorError::EmptyUnion => LayoutCalculatorError::EmptyUnion,
LayoutCalculatorError::ReprConflict => LayoutCalculatorError::ReprConflict,
}
}

@@ -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",
})
}
}
@@ -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 {
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};
@@ -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,
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::{
@@ -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);
@@ -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,
@@ -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
@@ -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());
}
}

5 changes: 4 additions & 1 deletion compiler/rustc_lint/src/levels.rs
Original file line number Diff line number Diff line change
@@ -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)`
2 changes: 1 addition & 1 deletion compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
@@ -156,7 +156,7 @@ declare_lint! {
///
/// ```rust
/// #![forbid(warnings)]
/// #![deny(bad_style)]
/// #![warn(bad_style)]
///
/// fn main() {}
/// ```
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
@@ -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(),
10 changes: 8 additions & 2 deletions compiler/rustc_ty_utils/src/layout.rs
Original file line number Diff line number Diff line change
@@ -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 };
@@ -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)
}
@@ -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)
}
Original file line number Diff line number Diff line change
@@ -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.
1 change: 0 additions & 1 deletion compiler/rustc_ty_utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
3 changes: 2 additions & 1 deletion src/bootstrap/configure.py
Original file line number Diff line number Diff line change
@@ -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')
43 changes: 39 additions & 4 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
@@ -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);
}
@@ -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" {
@@ -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);
}
@@ -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)
@@ -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");
}
@@ -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());
}
@@ -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");
}
22 changes: 22 additions & 0 deletions src/bootstrap/src/core/build_steps/run.rs
Original file line number Diff line number Diff line change
@@ -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
@@ -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
1 change: 1 addition & 0 deletions src/bootstrap/src/core/builder.rs
Original file line number Diff line number Diff line change
@@ -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)
41 changes: 40 additions & 1 deletion src/etc/installer/msi/rust.wxs
Original file line number Diff line number Diff line change
@@ -172,6 +172,11 @@
<!-- tool-rust-docs-end -->
<Directory Id="Cargo" Name="." />
<Directory Id="Std" Name="." />
<Directory Id="RustFmt" Name="." />
<Directory Id="RustAnalyzer" Name="." />
<Directory Id="Miri" Name="." />
<Directory Id="Analysis" Name="." />
<Directory Id="Clippy" Name="." />
</Directory>
</Directory>

@@ -279,7 +284,41 @@
<ComponentRef Id="PathEnvPerMachine" />
<ComponentRef Id="PathEnvPerUser" />
</Feature>

<Feature Id="RustFmt"
Title="Formatter for rust"
Display="7"
Level="1"
AllowAdvertise="no">
<ComponentGroupRef Id="RustFmtGroup" />
</Feature>
<Feature Id="Clippy"
Title="Formatter and checker for rust"
Display="8"
Level="1"
AllowAdvertise="no">
<ComponentGroupRef Id="ClippyGroup" />
</Feature>
<Feature Id="Miri"
Title="Soundness checker for rust"
Display="9"
Level="1"
AllowAdvertise="no">
<ComponentGroupRef Id="MiriGroup" />
</Feature>
<Feature Id="RustAnalyzer"
Title="Analyzer for rust"
Display="10"
Level="1"
AllowAdvertise="no">
<ComponentGroupRef Id="RustAnalyzerGroup" />
</Feature>
<Feature Id="Analysis"
Title="Analysis for rust"
Display="11"
Level="1"
AllowAdvertise="no">
<ComponentGroupRef Id="AnalysisGroup" />
</Feature>
<UIRef Id="RustUI" />
</Product>
</Wix>
4 changes: 2 additions & 2 deletions src/tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
@@ -338,8 +338,8 @@ pub struct Config {
/// created in `/<build_base>/rustfix_missing_coverage.txt`
pub rustfix_coverage: bool,

/// whether to run `tidy` when a rustdoc test fails
pub has_tidy: bool,
/// whether to run `tidy` (html-tidy) when a rustdoc test fails
pub has_html_tidy: bool,

/// whether to run `enzyme` autodiff tests
pub has_enzyme: bool,
6 changes: 3 additions & 3 deletions src/tools/compiletest/src/lib.rs
Original file line number Diff line number Diff line change
@@ -230,14 +230,14 @@ pub fn parse_config(args: Vec<String>) -> Config {
let run_ignored = matches.opt_present("ignored");
let with_debug_assertions = matches.opt_present("with-debug-assertions");
let mode = matches.opt_str("mode").unwrap().parse().expect("invalid mode");
let has_tidy = if mode == Mode::Rustdoc {
let has_html_tidy = if mode == Mode::Rustdoc {
Command::new("tidy")
.arg("--version")
.stdout(Stdio::null())
.status()
.map_or(false, |status| status.success())
} else {
// Avoid spawning an external command when we know tidy won't be used.
// Avoid spawning an external command when we know html-tidy won't be used.
false
};
let has_enzyme = matches.opt_present("has-enzyme");
@@ -336,7 +336,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
.opt_str("compare-mode")
.map(|s| s.parse().expect("invalid --compare-mode provided")),
rustfix_coverage: matches.opt_present("rustfix-coverage"),
has_tidy,
has_html_tidy,
has_enzyme,
channel: matches.opt_str("channel").unwrap(),
git_hash: matches.opt_present("git-hash"),
2 changes: 1 addition & 1 deletion src/tools/compiletest/src/main.rs
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ fn main() {

let config = Arc::new(parse_config(env::args().collect()));

if !config.has_tidy && config.mode == Mode::Rustdoc {
if !config.has_html_tidy && config.mode == Mode::Rustdoc {
eprintln!("warning: `tidy` (html-tidy.org) is not installed; diffs will not be generated");
}

4 changes: 1 addition & 3 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-filelength

use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
use std::ffi::OsString;
@@ -1897,7 +1895,7 @@ impl<'test> TestCx<'test> {
}

fn compare_to_default_rustdoc(&mut self, out_dir: &Path) {
if !self.config.has_tidy {
if !self.config.has_html_tidy {
return;
}
println!("info: generating a diff against nightly rustdoc");
1 change: 0 additions & 1 deletion src/tools/tidy/src/issues.txt
Original file line number Diff line number Diff line change
@@ -2758,7 +2758,6 @@ ui/lint/issue-63364.rs
ui/lint/issue-70819-dont-override-forbid-in-same-scope.rs
ui/lint/issue-79546-fuel-ice.rs
ui/lint/issue-79744.rs
ui/lint/issue-80988.rs
ui/lint/issue-81218.rs
ui/lint/issue-83477.rs
ui/lint/issue-87274-paren-parent.rs
2 changes: 1 addition & 1 deletion src/tools/unicode-table-generator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "unicode-bdd"
name = "unicode-table-generator"
version = "0.1.0"
edition = "2021"

6 changes: 2 additions & 4 deletions src/tools/unicode-table-generator/src/range_search.rs
Original file line number Diff line number Diff line change
@@ -16,16 +16,14 @@ const fn bitset_search<
let bucket_idx = (needle / 64) as usize;
let chunk_map_idx = bucket_idx / CHUNK_SIZE;
let chunk_piece = bucket_idx % CHUNK_SIZE;
// FIXME: const-hack: Revert to `slice::get` after `const_slice_index`
// feature stabilizes.
// FIXME(const-hack): Revert to `slice::get` when slice indexing becomes possible in const.
let chunk_idx = if chunk_map_idx < chunk_idx_map.len() {
chunk_idx_map[chunk_map_idx]
} else {
return false;
};
let idx = bitset_chunk_idx[chunk_idx as usize][chunk_piece] as usize;
// FIXME: const-hack: Revert to `slice::get` after `const_slice_index`
// feature stabilizes.
// FIXME(const-hack): Revert to `slice::get` when slice indexing becomes possible in const.
let word = if idx < bitset_canonical.len() {
bitset_canonical[idx]
} else {
7 changes: 7 additions & 0 deletions tests/crashes/131637.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//@ known-bug: #121637
#![feature(non_lifetime_binders)]
trait Trait<Type> {
type Type;

fn method(&self) -> impl for<T> Trait<impl Trait<T>>;
}
7 changes: 7 additions & 0 deletions tests/crashes/131648.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//@ known-bug: #131648
#![feature(return_type_notation)]

trait IntFactory {
fn stream(self) -> impl IntFactory<stream(..): Send>;
}
fn main() {}
12 changes: 12 additions & 0 deletions tests/crashes/131668.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@ known-bug: #131668

#![feature(generic_associated_types_extended)]
trait B {
type Y<const N: i16>;
}

struct Erase<T: B>(T);

fn make_static() {
Erase::<dyn for<'c> B<&'c ()>>(());
}
11 changes: 11 additions & 0 deletions tests/crashes/131758.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ known-bug: #131758
#![feature(unboxed_closures)]
trait Foo {}

impl<T: Fn<(i32,)>> Foo for T {}

fn baz<T: Foo>(_: T) {}

fn main() {
baz(|x| ());
}
9 changes: 9 additions & 0 deletions tests/crashes/131762.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//@ known-bug: #131762
// ignore-tidy-linelength

#![feature(generic_assert)]
struct FloatWrapper(f64);

fn main() {
assert!((0.0 / 0.0 >= 0.0) == (FloatWrapper(0.0 / 0.0) >= FloatWrapper(size_of::<u8>, size_of::<u16>, size_of::<usize> as fn() -> usize)))
}
5 changes: 5 additions & 0 deletions tests/crashes/131787.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//@ known-bug: #131787
#[track_caller]
static no_mangle: u32 = {
unimplemented!();
};
12 changes: 12 additions & 0 deletions tests/crashes/131886.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@ known-bug: #131886
//@ compile-flags: -Zvalidate-mir --crate-type=lib
#![feature(trait_upcasting, type_alias_impl_trait)]

type Tait = impl Sized;

trait Foo<'a>: Bar<'a, 'a, Tait> {}
trait Bar<'a, 'b, T> {}

fn test_correct3<'a>(x: &dyn Foo<'a>, _: Tait) {
let _ = x as &dyn Bar<'_, '_, ()>;
}
13 changes: 13 additions & 0 deletions tests/crashes/131915.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ known-bug: #131915

macro_rules! y {
( $($matcher:tt)*) => {
x
};
}

const _: A<
{
y! { test.tou8 }
},
>;
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
//@ known-bug: rust-lang/rust#126966
#![crate_type = "lib"]

mod assert {
use std::mem::{Assume, TransmuteFrom};
//~^ ERROR: use of unstable library feature 'transmutability'
//~| ERROR: use of unstable library feature 'transmutability'

pub fn is_transmutable<Src, Dst>()
where
Dst: TransmuteFrom<Src>,
//~^ ERROR: use of unstable library feature 'transmutability'
{
}
}
@@ -15,15 +19,18 @@ enum Ox00 {
}

#[repr(C, packed(2))]
//~^ ERROR: attribute should be applied to a struct
enum OxFF {
V = 0xFF,
}

fn test() {
union Superset {
a: Ox00,
//~^ ERROR: field must implement `Copy`
b: OxFF,
}

assert::is_transmutable::<Superset, Subset>();
//~^ ERROR: cannot find type `Subset`
}
68 changes: 68 additions & 0 deletions tests/ui/layout/thaw-transmute-invalid-enum.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
error[E0412]: cannot find type `Subset` in this scope
--> $DIR/thaw-transmute-invalid-enum.rs:34:41
|
LL | assert::is_transmutable::<Superset, Subset>();
| ^^^^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | fn test<Subset>() {
| ++++++++

error[E0517]: attribute should be applied to a struct or union
--> $DIR/thaw-transmute-invalid-enum.rs:21:11
|
LL | #[repr(C, packed(2))]
| ^^^^^^^^^
LL |
LL | / enum OxFF {
LL | | V = 0xFF,
LL | | }
| |_- not a struct or union

error[E0658]: use of unstable library feature 'transmutability'
--> $DIR/thaw-transmute-invalid-enum.rs:4:20
|
LL | use std::mem::{Assume, TransmuteFrom};
| ^^^^^^
|
= note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information
= help: add `#![feature(transmutability)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'transmutability'
--> $DIR/thaw-transmute-invalid-enum.rs:4:28
|
LL | use std::mem::{Assume, TransmuteFrom};
| ^^^^^^^^^^^^^
|
= note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information
= help: add `#![feature(transmutability)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'transmutability'
--> $DIR/thaw-transmute-invalid-enum.rs:10:14
|
LL | Dst: TransmuteFrom<Src>,
| ^^^^^^^^^^^^^^^^^^
|
= note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information
= help: add `#![feature(transmutability)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/thaw-transmute-invalid-enum.rs:29:9
|
LL | a: Ox00,
| ^^^^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | a: std::mem::ManuallyDrop<Ox00>,
| +++++++++++++++++++++++ +

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0412, E0517, E0658, E0740.
For more information about an error, try `rustc --explain E0412`.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//@ known-bug: rust-lang/rust#128870
//@ compile-flags: -Zvalidate-mir

#[repr(packed)]
#[repr(packed)] //~ ERROR: attribute should be applied to a struct
#[repr(u32)]
enum E {
A,
@@ -12,7 +11,7 @@ enum E {
fn main() {
union InvalidTag {
int: u32,
e: E,
e: E, //~ ERROR: field must implement `Copy`
}
let _invalid_tag = InvalidTag { int: 4 };
}
29 changes: 29 additions & 0 deletions tests/ui/layout/thaw-validate-invalid-enum.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
error[E0517]: attribute should be applied to a struct or union
--> $DIR/thaw-validate-invalid-enum.rs:3:8
|
LL | #[repr(packed)]
| ^^^^^^
LL | #[repr(u32)]
LL | / enum E {
LL | | A,
LL | | B,
LL | | C,
LL | | }
| |_- not a struct or union

error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/thaw-validate-invalid-enum.rs:14:9
|
LL | e: E,
| ^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | e: std::mem::ManuallyDrop<E>,
| +++++++++++++++++++++++ +

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0517, E0740.
For more information about an error, try `rustc --explain E0517`.
7 changes: 7 additions & 0 deletions tests/ui/lint/auxiliary/allow-macro.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[macro_export]
macro_rules! emit_allow {
() => {
#[allow(unsafe_code)]
let _so_safe = 0;
};
}
7 changes: 7 additions & 0 deletions tests/ui/lint/auxiliary/deny-macro.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[macro_export]
macro_rules! emit_deny {
() => {
#[deny(unsafe_code)]
let _so_safe = 0;
};
}
7 changes: 7 additions & 0 deletions tests/ui/lint/auxiliary/forbid-macro.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[macro_export]
macro_rules! emit_forbid {
() => {
#[forbid(unsafe_code)]
let _so_safe = 0;
};
}
7 changes: 7 additions & 0 deletions tests/ui/lint/auxiliary/warn-macro.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[macro_export]
macro_rules! emit_warn {
() => {
#[warn(unsafe_code)]
let _so_safe = 0;
};
}
35 changes: 35 additions & 0 deletions tests/ui/lint/deny-inside-forbid-ignored.cli_forbid.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
error[E0453]: allow(unsafe_code) incompatible with previous forbid
--> $DIR/deny-inside-forbid-ignored.rs:12:17
|
LL | #[forbid(unsafe_code)] // NO UNSAFE CODE IN HERE!!
| ----------- `forbid` level set here
...
LL | #[allow(unsafe_code)] // let's have some unsafe code in here
| ^^^^^^^^^^^ overruled by previous forbid

error[E0453]: allow(unsafe_code) incompatible with previous forbid
--> $DIR/deny-inside-forbid-ignored.rs:12:17
|
LL | #[forbid(unsafe_code)] // NO UNSAFE CODE IN HERE!!
| ----------- `forbid` level set here
...
LL | #[allow(unsafe_code)] // let's have some unsafe code in here
| ^^^^^^^^^^^ overruled by previous forbid
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: usage of an `unsafe` block
--> $DIR/deny-inside-forbid-ignored.rs:16:13
|
LL | unsafe { /* ≽^•⩊•^≼ */ }
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/deny-inside-forbid-ignored.rs:8:10
|
LL | #[forbid(unsafe_code)] // NO UNSAFE CODE IN HERE!!
| ^^^^^^^^^^^

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0453`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
error[E0453]: allow(unsafe_code) incompatible with previous forbid
--> $DIR/deny-inside-forbid-ignored.rs:12:17
|
LL | #[forbid(unsafe_code)] // NO UNSAFE CODE IN HERE!!
| ----------- `forbid` level set here
...
LL | #[allow(unsafe_code)] // let's have some unsafe code in here
| ^^^^^^^^^^^ overruled by previous forbid

error[E0453]: allow(unsafe_code) incompatible with previous forbid
--> $DIR/deny-inside-forbid-ignored.rs:12:17
|
LL | #[forbid(unsafe_code)] // NO UNSAFE CODE IN HERE!!
| ----------- `forbid` level set here
...
LL | #[allow(unsafe_code)] // let's have some unsafe code in here
| ^^^^^^^^^^^ overruled by previous forbid
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: usage of an `unsafe` block
--> $DIR/deny-inside-forbid-ignored.rs:16:13
|
LL | unsafe { /* ≽^•⩊•^≼ */ }
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/deny-inside-forbid-ignored.rs:8:10
|
LL | #[forbid(unsafe_code)] // NO UNSAFE CODE IN HERE!!
| ^^^^^^^^^^^

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0453`.
20 changes: 20 additions & 0 deletions tests/ui/lint/deny-inside-forbid-ignored.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//! Ensure that using deny inside forbid is treated as a no-op, and does not override the level to
//! deny.
//@ revisions: source_only cli_forbid cli_forbid_warnings
//@[cli_forbid] compile-flags: -F unsafe_code
//@[cli_forbid_warnings] compile-flags: -F warnings

#[forbid(unsafe_code)] // NO UNSAFE CODE IN HERE!!
fn main() {
#[deny(unsafe_code)] // m-m-maybe we can have unsafe code in here?
{
#[allow(unsafe_code)] // let's have some unsafe code in here
//~^ ERROR allow(unsafe_code) incompatible with previous forbid
//~| ERROR allow(unsafe_code) incompatible with previous forbid
{
unsafe { /* ≽^•⩊•^≼ */ }
//~^ ERROR usage of an `unsafe` block
}
}
}
35 changes: 35 additions & 0 deletions tests/ui/lint/deny-inside-forbid-ignored.source_only.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
error[E0453]: allow(unsafe_code) incompatible with previous forbid
--> $DIR/deny-inside-forbid-ignored.rs:12:17
|
LL | #[forbid(unsafe_code)] // NO UNSAFE CODE IN HERE!!
| ----------- `forbid` level set here
...
LL | #[allow(unsafe_code)] // let's have some unsafe code in here
| ^^^^^^^^^^^ overruled by previous forbid

error[E0453]: allow(unsafe_code) incompatible with previous forbid
--> $DIR/deny-inside-forbid-ignored.rs:12:17
|
LL | #[forbid(unsafe_code)] // NO UNSAFE CODE IN HERE!!
| ----------- `forbid` level set here
...
LL | #[allow(unsafe_code)] // let's have some unsafe code in here
| ^^^^^^^^^^^ overruled by previous forbid
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: usage of an `unsafe` block
--> $DIR/deny-inside-forbid-ignored.rs:16:13
|
LL | unsafe { /* ≽^•⩊•^≼ */ }
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/deny-inside-forbid-ignored.rs:8:10
|
LL | #[forbid(unsafe_code)] // NO UNSAFE CODE IN HERE!!
| ^^^^^^^^^^^

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0453`.
26 changes: 26 additions & 0 deletions tests/ui/lint/forbid-macro-with-deny.allow.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
error[E0453]: allow(unsafe_code) incompatible with previous forbid
--> $DIR/forbid-macro-with-deny.rs:39:5
|
LL | #![forbid(unsafe_code)]
| ----------- `forbid` level set here
...
LL | allow_macro::emit_allow! {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ overruled by previous forbid
|
= note: this error originates in the macro `allow_macro::emit_allow` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0453]: allow(unsafe_code) incompatible with previous forbid
--> $DIR/forbid-macro-with-deny.rs:39:5
|
LL | #![forbid(unsafe_code)]
| ----------- `forbid` level set here
...
LL | allow_macro::emit_allow! {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ overruled by previous forbid
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the macro `allow_macro::emit_allow` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0453`.
45 changes: 45 additions & 0 deletions tests/ui/lint/forbid-macro-with-deny.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//! Ensure that when a macro (or normal code) does `#[deny]` inside a `#[forbid]` context, no error
//! is emitted, as both parties agree on the treatment of the lint.
//!
//! However, still emit an error if the macro does `#[allow]` or `#[warn]`.
//@ revisions: forbid deny warn allow
//@[forbid] aux-build:forbid-macro.rs
//@[deny] aux-build:deny-macro.rs
//@[warn] aux-build:warn-macro.rs
//@[allow] aux-build:allow-macro.rs

//@[forbid] check-pass
//@[deny] check-pass

#![forbid(unsafe_code)]

#[cfg(allow)]
extern crate allow_macro;
#[cfg(deny)]
extern crate deny_macro;
#[cfg(forbid)]
extern crate forbid_macro;
#[cfg(warn)]
extern crate warn_macro;

fn main() {
#[cfg(forbid)]
forbid_macro::emit_forbid! {} // OK

#[cfg(deny)]
deny_macro::emit_deny! {} // OK

#[cfg(warn)]
warn_macro::emit_warn! {}
//[warn]~^ ERROR warn(unsafe_code) incompatible with previous forbid
//[warn]~| ERROR warn(unsafe_code) incompatible with previous forbid

#[cfg(allow)]
allow_macro::emit_allow! {}
//[allow]~^ ERROR allow(unsafe_code) incompatible with previous forbid
//[allow]~| ERROR allow(unsafe_code) incompatible with previous forbid

#[deny(unsafe_code)] // OK
let _ = 0;
}
26 changes: 26 additions & 0 deletions tests/ui/lint/forbid-macro-with-deny.warn.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
error[E0453]: warn(unsafe_code) incompatible with previous forbid
--> $DIR/forbid-macro-with-deny.rs:34:5
|
LL | #![forbid(unsafe_code)]
| ----------- `forbid` level set here
...
LL | warn_macro::emit_warn! {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ overruled by previous forbid
|
= note: this error originates in the macro `warn_macro::emit_warn` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0453]: warn(unsafe_code) incompatible with previous forbid
--> $DIR/forbid-macro-with-deny.rs:34:5
|
LL | #![forbid(unsafe_code)]
| ----------- `forbid` level set here
...
LL | warn_macro::emit_warn! {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ overruled by previous forbid
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the macro `warn_macro::emit_warn` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0453`.
Original file line number Diff line number Diff line change
@@ -19,9 +19,9 @@
fn forbid_first(num: i32) -> i32 {
#![forbid(unused)]
#![deny(unused)]
//~^ ERROR: deny(unused) incompatible with previous forbid
//~| WARNING being phased out
#![warn(unused)]
//~^ ERROR: warn(unused) incompatible with previous forbid
//~| WARNING being phased out
#![allow(unused)]

num * num
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
error: deny(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:21:13
error: warn(unused) incompatible with previous forbid
--> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13
|
LL | #![forbid(unused)]
| ------ `forbid` level set here
LL | #![deny(unused)]
LL | #![warn(unused)]
| ^^^^^^ overruled by previous forbid
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
10 changes: 0 additions & 10 deletions tests/ui/lint/issue-80988.rs

This file was deleted.

15 changes: 0 additions & 15 deletions tests/ui/lint/issue-80988.stderr

This file was deleted.

9 changes: 9 additions & 0 deletions triagebot.toml
Original file line number Diff line number Diff line change
@@ -679,6 +679,15 @@ instead.
"""
cc = ["@calebzulawski", "@programmerjake"]

[mentions."library/core/src/unicode/unicode_data.rs"]
message = """
`library/core/src/unicode/unicode_data.rs` is generated by
`src/tools/unicode-table-generator` via `./x run
src/tools/unicode-table-generator`. If you want to modify `unicode_data.rs`,
please modify the tool then regenerate the library source file with the tool
instead of editing the library source file manually.
"""

[mentions."src/librustdoc/clean/types.rs"]
cc = ["@camelid"]