Auto merge of #131970 - matthiaskrgr:rollup-nr32ksd, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #121560 (Allow `#[deny]` inside `#[forbid]` as a no-op)
 - #131365 (Fix missing rustfmt in msi installer #101993)
 - #131647 (Register `src/tools/unicode-table-generator` as a runnable tool)
 - #131843 (compiler: Error on layout of enums with invalid reprs)
 - #131926 (Align boolean option descriptions in `configure.py`)
 - #131961 (compiletest: tidy up how `tidy` and `tidy` (html version) are disambiguated)
 - #131962 (Make `llvm::set_section` take a `&CStr`)
 - #131964 (add latest crash tests)
 - #131965 (remove outdated comment)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-10-20 16:34:35 +00:00
commit de977a5acf
52 changed files with 606 additions and 83 deletions

View File

@ -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"

View File

@ -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 @@ pub fn without_payload(&self) -> LayoutCalculatorError<()> {
}
LayoutCalculatorError::SizeOverflow => LayoutCalculatorError::SizeOverflow,
LayoutCalculatorError::EmptyUnion => LayoutCalculatorError::EmptyUnion,
LayoutCalculatorError::ReprConflict => LayoutCalculatorError::ReprConflict,
}
}
@ -77,6 +81,7 @@ pub fn fallback_fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
LayoutCalculatorError::SizeOverflow => "size overflow",
LayoutCalculatorError::EmptyUnion => "type is a union with no fields",
LayoutCalculatorError::ReprConflict => "type has an invalid repr",
})
}
}
@ -514,6 +519,10 @@ struct TmpLayout<FieldIdx: Idx, VariantIdx: Idx> {
}
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 {

View File

@ -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,

View File

@ -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")
}

View File

@ -210,10 +210,9 @@ pub fn create_attr(self, llcx: &Context) -> &Attribute {
}
}
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());
}
}

View File

@ -493,7 +493,10 @@ fn insert_spec(&mut self, id: LintId, (level, src): LevelAndSource) {
//
// 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)`

View File

@ -156,7 +156,7 @@
///
/// ```rust
/// #![forbid(warnings)]
/// #![deny(bad_style)]
/// #![warn(bad_style)]
///
/// fn main() {}
/// ```

View File

@ -437,9 +437,6 @@ fn into_args(self) -> (DefId, SimplifiedType) {
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(),

View File

@ -30,7 +30,8 @@
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)
}

View File

@ -5,7 +5,7 @@
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.

View File

@ -29,7 +29,6 @@
mod implied_bounds;
mod instance;
mod layout;
mod layout_sanity_check;
mod needs_drop;
mod opaque_types;
mod representability;

View File

@ -193,7 +193,8 @@ if '--help' in sys.argv or '-h' in sys.argv:
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')

View File

@ -1591,9 +1591,15 @@ fn filter(contents: &str, marker: &str) -> String {
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 @@ fn filter(contents: &str, marker: &str) -> String {
"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 @@ fn filter(contents: &str, marker: &str) -> String {
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 @@ fn filter(contents: &str, marker: &str) -> String {
.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 @@ fn filter(contents: &str, marker: &str) -> String {
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 @@ fn filter(contents: &str, marker: &str) -> String {
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 @@ fn filter(contents: &str, marker: &str) -> String {
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");
}

View File

@ -283,3 +283,25 @@ fn make_run(run: RunConfig<'_>) {
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);
}
}

View File

@ -360,6 +360,7 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
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

View File

@ -1010,6 +1010,7 @@ macro_rules! describe {
run::GenerateCopyright,
run::GenerateWindowsSys,
run::GenerateCompletions,
run::UnicodeTableGenerator,
),
Kind::Setup => {
describe!(setup::Profile, setup::Hook, setup::Link, setup::Editor)

View File

@ -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>

View File

@ -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,

View File

@ -230,14 +230,14 @@ fn make_absolute(path: PathBuf) -> PathBuf {
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 @@ fn make_absolute(path: PathBuf) -> PathBuf {
.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"),

View File

@ -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");
}

View File

@ -1,5 +1,3 @@
// ignore-tidy-filelength
use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
use std::ffi::OsString;
@ -1897,7 +1895,7 @@ fn charset() -> &'static str {
}
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");

View File

@ -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

View File

@ -1,5 +1,5 @@
[package]
name = "unicode-bdd"
name = "unicode-table-generator"
version = "0.1.0"
edition = "2021"

View File

@ -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
tests/crashes/131637.rs Normal file
View File

@ -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
tests/crashes/131648.rs Normal file
View File

@ -0,0 +1,7 @@
//@ known-bug: #131648
#![feature(return_type_notation)]
trait IntFactory {
fn stream(self) -> impl IntFactory<stream(..): Send>;
}
fn main() {}

12
tests/crashes/131668.rs Normal file
View File

@ -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
tests/crashes/131758.rs Normal file
View File

@ -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
tests/crashes/131762.rs Normal file
View File

@ -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
tests/crashes/131787.rs Normal file
View File

@ -0,0 +1,5 @@
//@ known-bug: #131787
#[track_caller]
static no_mangle: u32 = {
unimplemented!();
};

12
tests/crashes/131886.rs Normal file
View File

@ -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
tests/crashes/131915.rs Normal file
View File

@ -0,0 +1,13 @@
//@ known-bug: #131915
macro_rules! y {
( $($matcher:tt)*) => {
x
};
}
const _: A<
{
y! { test.tou8 }
},
>;

View File

@ -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,6 +19,7 @@ enum Ox00 {
}
#[repr(C, packed(2))]
//~^ ERROR: attribute should be applied to a struct
enum OxFF {
V = 0xFF,
}
@ -22,8 +27,10 @@ enum OxFF {
fn test() {
union Superset {
a: Ox00,
//~^ ERROR: field must implement `Copy`
b: OxFF,
}
assert::is_transmutable::<Superset, Subset>();
//~^ ERROR: cannot find type `Subset`
}

View File

@ -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`.

View File

@ -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 };
}

View File

@ -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`.

View File

@ -0,0 +1,7 @@
#[macro_export]
macro_rules! emit_allow {
() => {
#[allow(unsafe_code)]
let _so_safe = 0;
};
}

View File

@ -0,0 +1,7 @@
#[macro_export]
macro_rules! emit_deny {
() => {
#[deny(unsafe_code)]
let _so_safe = 0;
};
}

View File

@ -0,0 +1,7 @@
#[macro_export]
macro_rules! emit_forbid {
() => {
#[forbid(unsafe_code)]
let _so_safe = 0;
};
}

View File

@ -0,0 +1,7 @@
#[macro_export]
macro_rules! emit_warn {
() => {
#[warn(unsafe_code)]
let _so_safe = 0;
};
}

View File

@ -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`.

View File

@ -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`.

View File

@ -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
}
}
}

View File

@ -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`.

View File

@ -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`.

View File

@ -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;
}

View File

@ -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`.

View File

@ -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

View File

@ -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!

View File

@ -1,10 +0,0 @@
// Regression test for #80988
//
//@ check-pass
#![forbid(warnings)]
#[deny(warnings)]
//~^ WARNING incompatible with previous forbid
//~| WARNING being phased out
fn main() {}

View File

@ -1,15 +0,0 @@
warning: deny(warnings) incompatible with previous forbid
--> $DIR/issue-80988.rs:7:8
|
LL | #![forbid(warnings)]
| -------- `forbid` level set here
LL |
LL | #[deny(warnings)]
| ^^^^^^^^ 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!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>
= note: `#[warn(forbidden_lint_groups)]` on by default
warning: 1 warning emitted

View File

@ -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"]