Auto merge of #97126 - JohnTitor:rollup-7gdt2aw, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #96647 (rustdoc-json: Fix HRTBs for WherePredicate::BoundPredicate) - #96651 (Omit unnecessary help to add `#[cfg(test)]` when already annotated) - #96761 (rustdoc: don't build `rayon` for non-windows targets) - #97096 (Types with reachable constructors are reachable) - #97097 (Add tmm_reg clobbers) - #97113 (Search GUI fixes) - #97116 (interpret/validity: reject references to uninhabited types) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
77972d2d01
@ -592,7 +592,7 @@ fn reg_to_gcc(reg: InlineAsmRegOrRegClass) -> ConstraintOrRegister {
|
||||
InlineAsmRegClass::X86(X86InlineAsmRegClass::kreg0) => unimplemented!(),
|
||||
InlineAsmRegClass::Wasm(WasmInlineAsmRegClass::local) => unimplemented!(),
|
||||
InlineAsmRegClass::X86(
|
||||
X86InlineAsmRegClass::x87_reg | X86InlineAsmRegClass::mmx_reg,
|
||||
X86InlineAsmRegClass::x87_reg | X86InlineAsmRegClass::mmx_reg | X86InlineAsmRegClass::tmm_reg,
|
||||
) => unreachable!("clobber-only"),
|
||||
InlineAsmRegClass::SpirV(SpirVInlineAsmRegClass::reg) => {
|
||||
bug!("GCC backend does not support SPIR-V")
|
||||
@ -656,6 +656,7 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl
|
||||
InlineAsmRegClass::X86(X86InlineAsmRegClass::x87_reg) => unimplemented!(),
|
||||
InlineAsmRegClass::X86(X86InlineAsmRegClass::kreg) => cx.type_i16(),
|
||||
InlineAsmRegClass::X86(X86InlineAsmRegClass::kreg0) => cx.type_i16(),
|
||||
InlineAsmRegClass::X86(X86InlineAsmRegClass::tmm_reg) => unimplemented!(),
|
||||
InlineAsmRegClass::Wasm(WasmInlineAsmRegClass::local) => cx.type_i32(),
|
||||
InlineAsmRegClass::SpirV(SpirVInlineAsmRegClass::reg) => {
|
||||
bug!("LLVM backend does not support SPIR-V")
|
||||
@ -787,7 +788,7 @@ fn modifier_to_gcc(arch: InlineAsmArch, reg: InlineAsmRegClass, modifier: Option
|
||||
},
|
||||
InlineAsmRegClass::X86(X86InlineAsmRegClass::kreg) => None,
|
||||
InlineAsmRegClass::X86(X86InlineAsmRegClass::kreg0) => None,
|
||||
InlineAsmRegClass::X86(X86InlineAsmRegClass::x87_reg | X86InlineAsmRegClass::mmx_reg) => {
|
||||
InlineAsmRegClass::X86(X86InlineAsmRegClass::x87_reg | X86InlineAsmRegClass::mmx_reg | X86InlineAsmRegClass::tmm_reg) => {
|
||||
unreachable!("clobber-only")
|
||||
}
|
||||
InlineAsmRegClass::Wasm(WasmInlineAsmRegClass::local) => unimplemented!(),
|
||||
|
@ -604,7 +604,8 @@ fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'_>>) ->
|
||||
InlineAsmRegClass::X86(
|
||||
X86InlineAsmRegClass::x87_reg
|
||||
| X86InlineAsmRegClass::mmx_reg
|
||||
| X86InlineAsmRegClass::kreg0,
|
||||
| X86InlineAsmRegClass::kreg0
|
||||
| X86InlineAsmRegClass::tmm_reg,
|
||||
) => unreachable!("clobber-only"),
|
||||
InlineAsmRegClass::Wasm(WasmInlineAsmRegClass::local) => "r",
|
||||
InlineAsmRegClass::Bpf(BpfInlineAsmRegClass::reg) => "r",
|
||||
@ -692,7 +693,8 @@ fn modifier_to_llvm(
|
||||
InlineAsmRegClass::X86(
|
||||
X86InlineAsmRegClass::x87_reg
|
||||
| X86InlineAsmRegClass::mmx_reg
|
||||
| X86InlineAsmRegClass::kreg0,
|
||||
| X86InlineAsmRegClass::kreg0
|
||||
| X86InlineAsmRegClass::tmm_reg,
|
||||
) => {
|
||||
unreachable!("clobber-only")
|
||||
}
|
||||
@ -766,7 +768,8 @@ fn dummy_output_type<'ll>(cx: &CodegenCx<'ll, '_>, reg: InlineAsmRegClass) -> &'
|
||||
InlineAsmRegClass::X86(
|
||||
X86InlineAsmRegClass::x87_reg
|
||||
| X86InlineAsmRegClass::mmx_reg
|
||||
| X86InlineAsmRegClass::kreg0,
|
||||
| X86InlineAsmRegClass::kreg0
|
||||
| X86InlineAsmRegClass::tmm_reg,
|
||||
) => {
|
||||
unreachable!("clobber-only")
|
||||
}
|
||||
|
@ -412,22 +412,27 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
|
||||
self.path,
|
||||
err_ub!(AlignmentCheckFailed { required, has }) =>
|
||||
{
|
||||
"an unaligned {} (required {} byte alignment but found {})",
|
||||
kind,
|
||||
"an unaligned {kind} (required {} byte alignment but found {})",
|
||||
required.bytes(),
|
||||
has.bytes()
|
||||
},
|
||||
err_ub!(DanglingIntPointer(0, _)) =>
|
||||
{ "a null {}", kind },
|
||||
{ "a null {kind}" },
|
||||
err_ub!(DanglingIntPointer(i, _)) =>
|
||||
{ "a dangling {} (address 0x{:x} is unallocated)", kind, i },
|
||||
{ "a dangling {kind} (address 0x{i:x} is unallocated)" },
|
||||
err_ub!(PointerOutOfBounds { .. }) =>
|
||||
{ "a dangling {} (going beyond the bounds of its allocation)", kind },
|
||||
{ "a dangling {kind} (going beyond the bounds of its allocation)" },
|
||||
// This cannot happen during const-eval (because interning already detects
|
||||
// dangling pointers), but it can happen in Miri.
|
||||
err_ub!(PointerUseAfterFree(..)) =>
|
||||
{ "a dangling {} (use-after-free)", kind },
|
||||
{ "a dangling {kind} (use-after-free)" },
|
||||
);
|
||||
// Do not allow pointers to uninhabited types.
|
||||
if place.layout.abi.is_uninhabited() {
|
||||
throw_validation_failure!(self.path,
|
||||
{ "a {kind} pointing to uninhabited type {}", place.layout.ty }
|
||||
)
|
||||
}
|
||||
// Recursive checking
|
||||
if let Some(ref mut ref_tracking) = self.ref_tracking {
|
||||
// Proceed recursively even for ZST, no reason to skip them!
|
||||
|
@ -775,7 +775,14 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> {
|
||||
}
|
||||
// Corner case: if the variant is reachable, but its
|
||||
// enum is not, make the enum reachable as well.
|
||||
self.update(item.def_id, variant_level);
|
||||
self.reach(item.def_id, variant_level).ty();
|
||||
}
|
||||
if let Some(hir_id) = variant.data.ctor_hir_id() {
|
||||
let ctor_def_id = self.tcx.hir().local_def_id(hir_id);
|
||||
let ctor_level = self.get(ctor_def_id);
|
||||
if ctor_level.is_some() {
|
||||
self.reach(item.def_id, ctor_level).ty();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -803,6 +810,13 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> {
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(hir_id) = struct_def.ctor_hir_id() {
|
||||
let ctor_def_id = self.tcx.hir().local_def_id(hir_id);
|
||||
let ctor_level = self.get(ctor_def_id);
|
||||
if ctor_level.is_some() {
|
||||
self.reach(item.def_id, ctor_level).ty();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -315,21 +315,28 @@ impl Resolver<'_> {
|
||||
"remove the unused import"
|
||||
};
|
||||
|
||||
let parent_module = visitor.r.get_nearest_non_block_module(
|
||||
visitor.r.local_def_id(unused.use_tree_id).to_def_id(),
|
||||
);
|
||||
let test_module_span = match module_to_string(parent_module) {
|
||||
Some(module)
|
||||
if module == "test"
|
||||
|| module == "tests"
|
||||
|| module.starts_with("test_")
|
||||
|| module.starts_with("tests_")
|
||||
|| module.ends_with("_test")
|
||||
|| module.ends_with("_tests") =>
|
||||
{
|
||||
Some(parent_module.span)
|
||||
// If we are in the `--test` mode, suppress a help that adds the `#[cfg(test)]`
|
||||
// attribute; however, if not, suggest adding the attribute. There is no way to
|
||||
// retrieve attributes here because we do not have a `TyCtxt` yet.
|
||||
let test_module_span = if visitor.r.session.opts.test {
|
||||
None
|
||||
} else {
|
||||
let parent_module = visitor.r.get_nearest_non_block_module(
|
||||
visitor.r.local_def_id(unused.use_tree_id).to_def_id(),
|
||||
);
|
||||
match module_to_string(parent_module) {
|
||||
Some(module)
|
||||
if module == "test"
|
||||
|| module == "tests"
|
||||
|| module.starts_with("test_")
|
||||
|| module.starts_with("tests_")
|
||||
|| module.ends_with("_test")
|
||||
|| module.ends_with("_tests") =>
|
||||
{
|
||||
Some(parent_module.span)
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
|
||||
visitor.r.lint_buffer.buffer_lint_with_diagnostic(
|
||||
|
@ -1408,6 +1408,7 @@ symbols! {
|
||||
thread_local_macro,
|
||||
thumb2,
|
||||
thumb_mode: "thumb-mode",
|
||||
tmm_reg,
|
||||
todo_macro,
|
||||
tool_attributes,
|
||||
tool_lints,
|
||||
|
@ -912,6 +912,7 @@ impl InlineAsmClobberAbi {
|
||||
|
||||
mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7,
|
||||
st0, st1, st2, st3, st4, st5, st6, st7,
|
||||
tmm0, tmm1, tmm2, tmm3, tmm4, tmm5, tmm6, tmm7,
|
||||
}
|
||||
},
|
||||
InlineAsmClobberAbi::X86_64Win => clobbered_regs! {
|
||||
@ -931,6 +932,7 @@ impl InlineAsmClobberAbi {
|
||||
|
||||
mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7,
|
||||
st0, st1, st2, st3, st4, st5, st6, st7,
|
||||
tmm0, tmm1, tmm2, tmm3, tmm4, tmm5, tmm6, tmm7,
|
||||
}
|
||||
},
|
||||
InlineAsmClobberAbi::AArch64 => clobbered_regs! {
|
||||
|
@ -17,6 +17,7 @@ def_reg_class! {
|
||||
kreg0,
|
||||
mmx_reg,
|
||||
x87_reg,
|
||||
tmm_reg,
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,6 +42,7 @@ impl X86InlineAsmRegClass {
|
||||
Self::xmm_reg | Self::ymm_reg | Self::zmm_reg => &['x', 'y', 'z'],
|
||||
Self::kreg | Self::kreg0 => &[],
|
||||
Self::mmx_reg | Self::x87_reg => &[],
|
||||
Self::tmm_reg => &[],
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,6 +82,7 @@ impl X86InlineAsmRegClass {
|
||||
},
|
||||
Self::kreg | Self::kreg0 => None,
|
||||
Self::mmx_reg | Self::x87_reg => None,
|
||||
Self::tmm_reg => None,
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,6 +101,7 @@ impl X86InlineAsmRegClass {
|
||||
Self::zmm_reg => Some(('z', "zmm0")),
|
||||
Self::kreg | Self::kreg0 => None,
|
||||
Self::mmx_reg | Self::x87_reg => None,
|
||||
Self::tmm_reg => None,
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,6 +139,7 @@ impl X86InlineAsmRegClass {
|
||||
},
|
||||
Self::kreg0 => &[],
|
||||
Self::mmx_reg | Self::x87_reg => &[],
|
||||
Self::tmm_reg => &[],
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -320,6 +325,14 @@ def_regs! {
|
||||
st5: x87_reg = ["st(5)"],
|
||||
st6: x87_reg = ["st(6)"],
|
||||
st7: x87_reg = ["st(7)"],
|
||||
tmm0: tmm_reg = ["tmm0"] % x86_64_only,
|
||||
tmm1: tmm_reg = ["tmm1"] % x86_64_only,
|
||||
tmm2: tmm_reg = ["tmm2"] % x86_64_only,
|
||||
tmm3: tmm_reg = ["tmm3"] % x86_64_only,
|
||||
tmm4: tmm_reg = ["tmm4"] % x86_64_only,
|
||||
tmm5: tmm_reg = ["tmm5"] % x86_64_only,
|
||||
tmm6: tmm_reg = ["tmm6"] % x86_64_only,
|
||||
tmm7: tmm_reg = ["tmm7"] % x86_64_only,
|
||||
#error = ["bp", "bpl", "ebp", "rbp"] =>
|
||||
"the frame pointer cannot be used as an operand for inline asm",
|
||||
#error = ["sp", "spl", "esp", "rsp"] =>
|
||||
|
@ -1 +1 @@
|
||||
0.9.1
|
||||
0.9.2
|
@ -12,7 +12,6 @@ askama = { version = "0.11", default-features = false, features = ["config"] }
|
||||
atty = "0.2"
|
||||
pulldown-cmark = { version = "0.9", default-features = false }
|
||||
minifier = "0.0.43"
|
||||
rayon = "1.5.1"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
smallvec = "1.6.1"
|
||||
@ -29,6 +28,9 @@ version = "0.3.3"
|
||||
default-features = false
|
||||
features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"]
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
rayon = "1.5.1"
|
||||
|
||||
[dev-dependencies]
|
||||
expect-test = "1.0"
|
||||
|
||||
|
@ -54,7 +54,8 @@ impl DocFS {
|
||||
where
|
||||
E: PathError,
|
||||
{
|
||||
if !self.sync_only && cfg!(windows) {
|
||||
#[cfg(windows)]
|
||||
if !self.sync_only {
|
||||
// A possible future enhancement after more detailed profiling would
|
||||
// be to create the file sync so errors are reported eagerly.
|
||||
let sender = self.errors.clone().expect("can't write after closing");
|
||||
@ -68,6 +69,10 @@ impl DocFS {
|
||||
} else {
|
||||
fs::write(&path, contents).map_err(|e| E::new(e, path))?;
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fs::write(&path, contents).map_err(|e| E::new(e, path))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -897,7 +897,7 @@ table,
|
||||
margin-left: 0.25em;
|
||||
padding-left: 0.3125em;
|
||||
padding-right: 23px;
|
||||
border: 0;
|
||||
border: 1px solid;
|
||||
border-radius: 4px;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
@ -2010,7 +2010,6 @@ details.rustdoc-toggle[open] > summary.hideme::after {
|
||||
|
||||
#crate-search {
|
||||
border-radius: 4px;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.docblock {
|
||||
|
@ -236,8 +236,8 @@ details.undocumented > summary::before {
|
||||
|
||||
#crate-search, .search-input {
|
||||
background-color: #141920;
|
||||
border-color: #424c57;
|
||||
color: #c5c5c5;
|
||||
/* Without the `!important`, the border-color is ignored for `<select>`... */
|
||||
border-color: #424c57 !important;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
|
@ -217,7 +217,8 @@ details.undocumented > summary::before {
|
||||
#crate-search, .search-input {
|
||||
color: #111;
|
||||
background-color: #f0f0f0;
|
||||
border-color: #000;
|
||||
/* Without the `!important`, the border-color is ignored for `<select>`... */
|
||||
border-color: #f0f0f0 !important;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
|
@ -209,9 +209,9 @@ details.undocumented > summary::before {
|
||||
}
|
||||
|
||||
#crate-search, .search-input {
|
||||
color: #555;
|
||||
background-color: white;
|
||||
border-color: #e0e0e0;
|
||||
/* Without the `!important`, the border-color is ignored for `<select>`... */
|
||||
border-color: #e0e0e0 !important;
|
||||
}
|
||||
|
||||
.search-input:focus {
|
||||
|
@ -1738,7 +1738,7 @@ function initSearch(rawSearchIndex) {
|
||||
|
||||
let output = "<div id=\"search-settings\">" +
|
||||
`<h1 class="search-results-title">Results for ${escape(results.query.userQuery)}` +
|
||||
`${typeFilter}</h1> in ${crates} </div>`;
|
||||
`${typeFilter}</h1>${crates}</div>`;
|
||||
if (results.query.error !== null) {
|
||||
output += `<h3>Query parser error: "${results.query.error}".</h3>`;
|
||||
output += "<div id=\"titles\">" +
|
||||
|
@ -350,10 +350,16 @@ impl FromWithTcx<clean::WherePredicate> for WherePredicate {
|
||||
fn from_tcx(predicate: clean::WherePredicate, tcx: TyCtxt<'_>) -> Self {
|
||||
use clean::WherePredicate::*;
|
||||
match predicate {
|
||||
BoundPredicate { ty, bounds, .. } => WherePredicate::BoundPredicate {
|
||||
BoundPredicate { ty, bounds, bound_params } => WherePredicate::BoundPredicate {
|
||||
type_: ty.into_tcx(tcx),
|
||||
bounds: bounds.into_iter().map(|x| x.into_tcx(tcx)).collect(),
|
||||
// FIXME: add `bound_params` to rustdoc-json-params?
|
||||
generic_params: bound_params
|
||||
.into_iter()
|
||||
.map(|x| GenericParamDef {
|
||||
name: x.0.to_string(),
|
||||
kind: GenericParamDefKind::Lifetime { outlives: vec![] },
|
||||
})
|
||||
.collect(),
|
||||
},
|
||||
RegionPredicate { lifetime, bounds } => WherePredicate::RegionPredicate {
|
||||
lifetime: lifetime.0.to_string(),
|
||||
|
@ -9,7 +9,7 @@ use std::path::PathBuf;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// rustdoc format-version.
|
||||
pub const FORMAT_VERSION: u32 = 14;
|
||||
pub const FORMAT_VERSION: u32 = 15;
|
||||
|
||||
/// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information
|
||||
/// about the language items in the local crate, as well as info about external items to allow
|
||||
@ -391,6 +391,14 @@ pub enum WherePredicate {
|
||||
#[serde(rename = "type")]
|
||||
type_: Type,
|
||||
bounds: Vec<GenericBound>,
|
||||
/// Used for Higher-Rank Trait Bounds (HRTBs)
|
||||
/// ```plain
|
||||
/// where for<'a> &'a T: Iterator,"
|
||||
/// ^^^^^^^
|
||||
/// |
|
||||
/// this part
|
||||
/// ```
|
||||
generic_params: Vec<GenericParamDef>,
|
||||
},
|
||||
RegionPredicate {
|
||||
lifetime: String,
|
||||
@ -408,7 +416,13 @@ pub enum GenericBound {
|
||||
TraitBound {
|
||||
#[serde(rename = "trait")]
|
||||
trait_: Type,
|
||||
/// Used for HRTBs
|
||||
/// Used for Higher-Rank Trait Bounds (HRTBs)
|
||||
/// ```plain
|
||||
/// where F: for<'a, 'b> Fn(&'a u8, &'b u8)
|
||||
/// ^^^^^^^^^^^
|
||||
/// |
|
||||
/// this part
|
||||
/// ```
|
||||
generic_params: Vec<GenericParamDef>,
|
||||
modifier: TraitBoundModifier,
|
||||
},
|
||||
@ -487,6 +501,13 @@ pub enum Type {
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
pub struct FunctionPointer {
|
||||
pub decl: FnDecl,
|
||||
/// Used for Higher-Rank Trait Bounds (HRTBs)
|
||||
/// ```plain
|
||||
/// for<'c> fn(val: &'c i32) -> i32
|
||||
/// ^^^^^^^
|
||||
/// |
|
||||
/// this part
|
||||
/// ```
|
||||
pub generic_params: Vec<GenericParamDef>,
|
||||
pub header: Header,
|
||||
}
|
||||
|
@ -6,21 +6,21 @@
|
||||
use std::arch::asm;
|
||||
|
||||
// CHECK-LABEL: @clobber_sysv64
|
||||
// CHECK: ={ax},={cx},={dx},={si},={di},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{dirflag},~{fpsr},~{flags},~{memory}
|
||||
// CHECK: ={ax},={cx},={dx},={si},={di},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{tmm0},~{tmm1},~{tmm2},~{tmm3},~{tmm4},~{tmm5},~{tmm6},~{tmm7},~{dirflag},~{fpsr},~{flags},~{memory}
|
||||
#[no_mangle]
|
||||
pub unsafe fn clobber_sysv64() {
|
||||
asm!("", clobber_abi("sysv64"));
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @clobber_win64
|
||||
// CHECK: ={ax},={cx},={dx},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{dirflag},~{fpsr},~{flags},~{memory}
|
||||
// CHECK: ={ax},={cx},={dx},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{tmm0},~{tmm1},~{tmm2},~{tmm3},~{tmm4},~{tmm5},~{tmm6},~{tmm7},~{dirflag},~{fpsr},~{flags},~{memory}
|
||||
#[no_mangle]
|
||||
pub unsafe fn clobber_win64() {
|
||||
asm!("", clobber_abi("win64"));
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @clobber_sysv64
|
||||
// CHECK: =&{dx},={ax},={cx},={si},={di},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{dirflag},~{fpsr},~{flags},~{memory}
|
||||
// CHECK: =&{dx},={ax},={cx},={si},={di},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{tmm0},~{tmm1},~{tmm2},~{tmm3},~{tmm4},~{tmm5},~{tmm6},~{tmm7},~{dirflag},~{fpsr},~{flags},~{memory}
|
||||
#[no_mangle]
|
||||
pub unsafe fn clobber_sysv64_edx() {
|
||||
let foo: i32;
|
||||
@ -28,7 +28,7 @@ pub unsafe fn clobber_sysv64_edx() {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @clobber_win64
|
||||
// CHECK: =&{dx},={ax},={cx},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{dirflag},~{fpsr},~{flags},~{memory}
|
||||
// CHECK: =&{dx},={ax},={cx},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{tmm0},~{tmm1},~{tmm2},~{tmm3},~{tmm4},~{tmm5},~{tmm6},~{tmm7},~{dirflag},~{fpsr},~{flags},~{memory}
|
||||
#[no_mangle]
|
||||
pub unsafe fn clobber_win64_edx() {
|
||||
let foo: i32;
|
||||
|
@ -6,6 +6,13 @@
|
||||
|
||||
use std::arch::asm;
|
||||
|
||||
// CHECK-LABEL: @amx_clobber
|
||||
// base: call void asm sideeffect inteldialect "", "~{tmm0}"()
|
||||
#[no_mangle]
|
||||
pub unsafe fn amx_clobber() {
|
||||
asm!("", out("tmm0") _, options(nostack, nomem, preserves_flags));
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @avx512_clobber
|
||||
// base: call void asm sideeffect inteldialect "", "~{xmm31}"()
|
||||
// avx512: call float asm sideeffect inteldialect "", "=&{xmm31}"()
|
||||
|
@ -45,3 +45,37 @@ goto: file://|DOC_PATH|/test_docs/index.html?search=test&filter-crate=lib2
|
||||
wait-for: "#crate-search"
|
||||
assert-property: ("#crate-search", {"value": "lib2"})
|
||||
assert-false: "#results .externcrate"
|
||||
|
||||
// Checking that the text for the "title" is correct (the "All" comes from the "<select>").
|
||||
assert-text: ("#search-settings", "Results for test in All", STARTS_WITH)
|
||||
|
||||
// Checking the display of the crate filter.
|
||||
// We start with the light theme.
|
||||
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
|
||||
reload:
|
||||
|
||||
timeout: 2000
|
||||
wait-for: "#crate-search"
|
||||
assert-css: ("#crate-search", {
|
||||
"border": "1px solid rgb(224, 224, 224)",
|
||||
"color": "rgb(0, 0, 0)",
|
||||
"background-color": "rgb(255, 255, 255)",
|
||||
})
|
||||
|
||||
// We now check the dark theme.
|
||||
click: "#settings-menu"
|
||||
wait-for: "#settings"
|
||||
click: "#theme-dark"
|
||||
wait-for-css: ("#crate-search", {
|
||||
"border": "1px solid rgb(240, 240, 240)",
|
||||
"color": "rgb(17, 17, 17)",
|
||||
"background-color": "rgb(240, 240, 240)",
|
||||
})
|
||||
|
||||
// And finally we check the ayu theme.
|
||||
click: "#theme-ayu"
|
||||
wait-for-css: ("#crate-search", {
|
||||
"border": "1px solid rgb(66, 76, 87)",
|
||||
"color": "rgb(197, 197, 197)",
|
||||
"background-color": "rgb(20, 25, 32)",
|
||||
})
|
||||
|
14
src/test/rustdoc-json/fn_pointer/generics.rs
Normal file
14
src/test/rustdoc-json/fn_pointer/generics.rs
Normal file
@ -0,0 +1,14 @@
|
||||
// ignore-tidy-linelength
|
||||
|
||||
#![feature(no_core)]
|
||||
#![no_core]
|
||||
|
||||
// @count generics.json "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[*]" 1
|
||||
// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[0][0]" '"val"'
|
||||
// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[0][1].kind" '"borrowed_ref"'
|
||||
// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[0][1].inner.lifetime" \"\'c\"
|
||||
// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.output" '{ "kind": "primitive", "inner": "i32" }'
|
||||
// @count - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.generic_params[*]" 1
|
||||
// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.generic_params[0].name" \"\'c\"
|
||||
// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
|
||||
pub type WithHigherRankTraitBounds = for<'c> fn(val: &'c i32) -> i32;
|
@ -6,6 +6,9 @@
|
||||
// @set foo = generic_args.json "$.index[*][?(@.name=='Foo')].id"
|
||||
pub trait Foo {}
|
||||
|
||||
// @set generic_foo = generic_args.json "$.index[*][?(@.name=='GenericFoo')].id"
|
||||
pub trait GenericFoo<'a> {}
|
||||
|
||||
// @is - "$.index[*][?(@.name=='generics')].inner.generics.where_predicates" "[]"
|
||||
// @count - "$.index[*][?(@.name=='generics')].inner.generics.params[*]" 1
|
||||
// @is - "$.index[*][?(@.name=='generics')].inner.generics.params[0].name" '"F"'
|
||||
@ -29,19 +32,40 @@ pub fn generics<F: Foo>(f: F) {}
|
||||
// @is - "$.index[*][?(@.name=='impl_trait')].inner.decl.inputs[0][1].inner[0].trait_bound.trait.inner.id" $foo
|
||||
pub fn impl_trait(f: impl Foo) {}
|
||||
|
||||
// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.params[*]" 1
|
||||
// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.params[*]" 3
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.params[0].name" '"F"'
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.params[0].kind" '{"type": {"bounds": [], "default": null, "synthetic": false}}'
|
||||
// @count - "$.index[*][?(@.name=='where_clase')].inner.decl.inputs[*]" 1
|
||||
// @count - "$.index[*][?(@.name=='where_clase')].inner.decl.inputs[*]" 3
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.decl.inputs[0][0]" '"f"'
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.decl.inputs[0][1].kind" '"generic"'
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.decl.inputs[0][1].inner" '"F"'
|
||||
// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[*]" 1
|
||||
// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[*]" 3
|
||||
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[0].bound_predicate.type" '{"inner": "F", "kind": "generic"}'
|
||||
// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[0].bound_predicate.bounds[*]" 1
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[0].bound_predicate.bounds[0].trait_bound.trait.inner.id" $foo
|
||||
pub fn where_clase<F>(f: F)
|
||||
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[1].bound_predicate.type" '{"inner": "G", "kind": "generic"}'
|
||||
// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[1].bound_predicate.bounds[*]" 1
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.trait.inner.id" $generic_foo
|
||||
// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[*]" 1
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[0].name" \"\'a\"
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[1].bound_predicate.generic_params" "[]"
|
||||
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.type.kind" '"borrowed_ref"'
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.type.inner.lifetime" \"\'b\"
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.type.inner.type" '{"inner": "H", "kind": "generic"}'
|
||||
// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.bounds[*]" 1
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.bounds[0].trait_bound.trait.inner.id" $foo
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.bounds[0].trait_bound.generic_params" "[]"
|
||||
// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.generic_params[*]" 1
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.generic_params[0].name" \"\'b\"
|
||||
// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
|
||||
pub fn where_clase<F, G, H>(f: F, g: G, h: H)
|
||||
where
|
||||
F: Foo,
|
||||
G: for<'a> GenericFoo<'a>,
|
||||
for<'b> &'b H: Foo,
|
||||
{
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/ub-uninhabit.rs:18:1
|
||||
|
|
||||
LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>: encountered a value of uninhabited type Bar
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a reference pointing to uninhabited type Bar
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 4, align: 4) {
|
||||
|
@ -11,7 +11,7 @@ error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/ub-uninhabit.rs:18:1
|
||||
|
|
||||
LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>: encountered a value of uninhabited type Bar
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a reference pointing to uninhabited type Bar
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 8, align: 8) {
|
||||
|
@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/validate_never_arrays.rs:4:1
|
||||
|
|
||||
LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered a value of the never type `!`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a reference pointing to uninhabited type [!; 1]
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 4, align: 4) {
|
||||
|
@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/validate_never_arrays.rs:4:1
|
||||
|
|
||||
LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered a value of the never type `!`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a reference pointing to uninhabited type [!; 1]
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 8, align: 8) {
|
||||
|
84
src/test/ui/imports/unused-imports-in-test-mode.rs
Normal file
84
src/test/ui/imports/unused-imports-in-test-mode.rs
Normal file
@ -0,0 +1,84 @@
|
||||
// compile-flags: --test
|
||||
|
||||
#![deny(unused_imports)]
|
||||
|
||||
use std::io::BufRead; //~ ERROR unused import: `std::io::BufRead`
|
||||
|
||||
fn a() {}
|
||||
fn b() {}
|
||||
|
||||
mod test {
|
||||
use super::a; //~ ERROR unused import: `super::a`
|
||||
|
||||
fn foo() {
|
||||
use crate::b; //~ ERROR unused import: `crate::b`
|
||||
}
|
||||
}
|
||||
|
||||
mod tests {
|
||||
use super::a; //~ ERROR unused import: `super::a`
|
||||
|
||||
fn foo() {
|
||||
use crate::b; //~ ERROR unused import: `crate::b`
|
||||
}
|
||||
}
|
||||
|
||||
mod test_a {
|
||||
use super::a; //~ ERROR unused import: `super::a`
|
||||
|
||||
fn foo() {
|
||||
use crate::b; //~ ERROR unused import: `crate::b`
|
||||
}
|
||||
}
|
||||
|
||||
mod a_test {
|
||||
use super::a; //~ ERROR unused import: `super::a`
|
||||
|
||||
fn foo() {
|
||||
use crate::b; //~ ERROR unused import: `crate::b`
|
||||
}
|
||||
}
|
||||
|
||||
mod tests_a {
|
||||
use super::a; //~ ERROR unused import: `super::a`
|
||||
|
||||
fn foo() {
|
||||
use crate::b; //~ ERROR unused import: `crate::b`
|
||||
}
|
||||
}
|
||||
|
||||
mod a_tests {
|
||||
use super::a; //~ ERROR unused import: `super::a`
|
||||
|
||||
fn foo() {
|
||||
use crate::b; //~ ERROR unused import: `crate::b`
|
||||
}
|
||||
}
|
||||
|
||||
mod fastest_search {
|
||||
use super::a; //~ ERROR unused import: `super::a`
|
||||
|
||||
fn foo() {
|
||||
use crate::b; //~ ERROR unused import: `crate::b`
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_has_attr {
|
||||
use super::a; //~ ERROR unused import: `super::a`
|
||||
|
||||
fn foo() {
|
||||
use crate::b; //~ ERROR unused import: `crate::b`
|
||||
}
|
||||
}
|
||||
|
||||
mod test_has_no_attr {
|
||||
#[cfg(test)]
|
||||
use super::a; //~ ERROR unused import: `super::a`
|
||||
|
||||
fn foo() {
|
||||
use crate::b; //~ ERROR unused import: `crate::b`
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
122
src/test/ui/imports/unused-imports-in-test-mode.stderr
Normal file
122
src/test/ui/imports/unused-imports-in-test-mode.stderr
Normal file
@ -0,0 +1,122 @@
|
||||
error: unused import: `std::io::BufRead`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:5:5
|
||||
|
|
||||
LL | use std::io::BufRead;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/unused-imports-in-test-mode.rs:3:9
|
||||
|
|
||||
LL | #![deny(unused_imports)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unused import: `super::a`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:11:9
|
||||
|
|
||||
LL | use super::a;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `crate::b`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:14:13
|
||||
|
|
||||
LL | use crate::b;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `super::a`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:19:9
|
||||
|
|
||||
LL | use super::a;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `crate::b`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:22:13
|
||||
|
|
||||
LL | use crate::b;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `super::a`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:27:9
|
||||
|
|
||||
LL | use super::a;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `crate::b`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:30:13
|
||||
|
|
||||
LL | use crate::b;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `super::a`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:35:9
|
||||
|
|
||||
LL | use super::a;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `crate::b`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:38:13
|
||||
|
|
||||
LL | use crate::b;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `super::a`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:43:9
|
||||
|
|
||||
LL | use super::a;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `crate::b`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:46:13
|
||||
|
|
||||
LL | use crate::b;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `super::a`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:51:9
|
||||
|
|
||||
LL | use super::a;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `crate::b`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:54:13
|
||||
|
|
||||
LL | use crate::b;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `super::a`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:59:9
|
||||
|
|
||||
LL | use super::a;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `crate::b`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:62:13
|
||||
|
|
||||
LL | use crate::b;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `super::a`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:68:9
|
||||
|
|
||||
LL | use super::a;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `crate::b`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:71:13
|
||||
|
|
||||
LL | use crate::b;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `super::a`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:77:9
|
||||
|
|
||||
LL | use super::a;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unused import: `crate::b`
|
||||
--> $DIR/unused-imports-in-test-mode.rs:80:13
|
||||
|
|
||||
LL | use crate::b;
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to 19 previous errors
|
||||
|
25
src/test/ui/privacy/auxiliary/ctor_aux.rs
Normal file
25
src/test/ui/privacy/auxiliary/ctor_aux.rs
Normal file
@ -0,0 +1,25 @@
|
||||
// edition:2021
|
||||
//! Missing docs lint warns about undocumented exported items.
|
||||
//! Use the lint to additionally verify that items are reachable
|
||||
//! but not exported.
|
||||
#![allow(non_camel_case_types)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
mod hidden {
|
||||
pub struct s;
|
||||
pub enum e { x, y, z }
|
||||
pub use e::*;
|
||||
impl s {
|
||||
pub fn f(&self) {}
|
||||
}
|
||||
impl e {
|
||||
pub fn g(&self) {}
|
||||
}
|
||||
}
|
||||
// Hide all type definitions while reexporting their constructors:
|
||||
mod e {}
|
||||
mod x {}
|
||||
mod y {}
|
||||
mod z {}
|
||||
mod s {}
|
||||
pub use hidden::*;
|
16
src/test/ui/privacy/ctor.rs
Normal file
16
src/test/ui/privacy/ctor.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// Verify that a type is considered reachable when its constructor is
|
||||
// reachable. The auxiliary library is constructed so that all types are
|
||||
// shadowed and cannot be named directly, while their constructors are
|
||||
// reexported. Regression test for issue #96934.
|
||||
//
|
||||
// aux-build:ctor_aux.rs
|
||||
// edition:2021
|
||||
// build-pass
|
||||
|
||||
extern crate ctor_aux;
|
||||
|
||||
fn main() {
|
||||
ctor_aux::s.f();
|
||||
ctor_aux::x.g();
|
||||
ctor_aux::y.g();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user