Auto merge of #102809 - matthiaskrgr:rollup-qq62vuv, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #101520 (Allow transmutes between the same types after erasing lifetimes)
 - #102675 (Remove `mir::CastKind::Misc`)
 - #102778 (Fix MIR inlining of asm_unwind)
 - #102785 (Remove `DefId` from some `SelectionCandidate` variants)
 - #102788 (Update rustc-dev-guide)
 - #102789 (Update browser UI test version)
 - #102797 (rustdoc: remove no-op CSS `.rightside { position: initial }`)
 - #102798 (rustdoc: add main-heading and example-wrap link CSS to big selector)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-10-08 14:58:11 +00:00
commit c27948d255
118 changed files with 492 additions and 289 deletions

View File

@ -2209,25 +2209,104 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
}
}
}
CastKind::Misc => {
CastKind::IntToInt => {
let ty_from = op.ty(body, tcx);
let cast_ty_from = CastTy::from_ty(ty_from);
let cast_ty_to = CastTy::from_ty(*ty);
// Misc casts are either between floats and ints, or one ptr type to another.
match (cast_ty_from, cast_ty_to) {
(
Some(CastTy::Int(_) | CastTy::Float),
Some(CastTy::Int(_) | CastTy::Float),
)
| (Some(CastTy::Ptr(_) | CastTy::FnPtr), Some(CastTy::Ptr(_))) => (),
(Some(CastTy::Int(_)), Some(CastTy::Int(_))) => (),
_ => {
span_mirbug!(
self,
rvalue,
"Invalid Misc cast {:?} -> {:?}",
"Invalid IntToInt cast {:?} -> {:?}",
ty_from,
ty,
ty
)
}
}
}
CastKind::IntToFloat => {
let ty_from = op.ty(body, tcx);
let cast_ty_from = CastTy::from_ty(ty_from);
let cast_ty_to = CastTy::from_ty(*ty);
match (cast_ty_from, cast_ty_to) {
(Some(CastTy::Int(_)), Some(CastTy::Float)) => (),
_ => {
span_mirbug!(
self,
rvalue,
"Invalid IntToFloat cast {:?} -> {:?}",
ty_from,
ty
)
}
}
}
CastKind::FloatToInt => {
let ty_from = op.ty(body, tcx);
let cast_ty_from = CastTy::from_ty(ty_from);
let cast_ty_to = CastTy::from_ty(*ty);
match (cast_ty_from, cast_ty_to) {
(Some(CastTy::Float), Some(CastTy::Int(_))) => (),
_ => {
span_mirbug!(
self,
rvalue,
"Invalid FloatToInt cast {:?} -> {:?}",
ty_from,
ty
)
}
}
}
CastKind::FloatToFloat => {
let ty_from = op.ty(body, tcx);
let cast_ty_from = CastTy::from_ty(ty_from);
let cast_ty_to = CastTy::from_ty(*ty);
match (cast_ty_from, cast_ty_to) {
(Some(CastTy::Float), Some(CastTy::Float)) => (),
_ => {
span_mirbug!(
self,
rvalue,
"Invalid FloatToFloat cast {:?} -> {:?}",
ty_from,
ty
)
}
}
}
CastKind::FnPtrToPtr => {
let ty_from = op.ty(body, tcx);
let cast_ty_from = CastTy::from_ty(ty_from);
let cast_ty_to = CastTy::from_ty(*ty);
match (cast_ty_from, cast_ty_to) {
(Some(CastTy::FnPtr), Some(CastTy::Ptr(_))) => (),
_ => {
span_mirbug!(
self,
rvalue,
"Invalid FnPtrToPtr cast {:?} -> {:?}",
ty_from,
ty
)
}
}
}
CastKind::PtrToPtr => {
let ty_from = op.ty(body, tcx);
let cast_ty_from = CastTy::from_ty(ty_from);
let cast_ty_to = CastTy::from_ty(*ty);
match (cast_ty_from, cast_ty_to) {
(Some(CastTy::Ptr(_)), Some(CastTy::Ptr(_))) => (),
_ => {
span_mirbug!(
self,
rvalue,
"Invalid PtrToPtr cast {:?} -> {:?}",
ty_from,
ty
)
}
}

View File

@ -633,7 +633,12 @@ fn codegen_stmt<'tcx>(
lval.write_cvalue(fx, operand.cast_pointer_to(to_layout));
}
Rvalue::Cast(
CastKind::Misc
CastKind::IntToInt
| CastKind::FloatToFloat
| CastKind::FloatToInt
| CastKind::IntToFloat
| CastKind::FnPtrToPtr
| CastKind::PtrToPtr
| CastKind::PointerExposeAddress
| CastKind::PointerFromExposedAddress,
ref operand,

View File

@ -490,7 +490,16 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
match &stmt.kind {
StatementKind::Assign(local_and_rvalue) if &local_and_rvalue.0 == place => {
match &local_and_rvalue.1 {
Rvalue::Cast(CastKind::Misc, operand, ty) => {
Rvalue::Cast(
CastKind::IntToInt
| CastKind::FloatToFloat
| CastKind::FloatToInt
| CastKind::IntToFloat
| CastKind::FnPtrToPtr
| CastKind::PtrToPtr,
operand,
ty,
) => {
if computed_const_val.is_some() {
return None; // local assigned twice
}

View File

@ -250,7 +250,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
OperandValue::Pair(lldata, llextra)
}
mir::CastKind::Pointer(PointerCast::MutToConstPointer)
| mir::CastKind::Misc
| mir::CastKind::PtrToPtr
if bx.cx().is_backend_scalar_pair(operand.layout) =>
{
if let OperandValue::Pair(data_ptr, meta) = operand.val {
@ -290,7 +290,13 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
mir::CastKind::Pointer(
PointerCast::MutToConstPointer | PointerCast::ArrayToPointer,
)
| mir::CastKind::Misc
| mir::CastKind::IntToInt
| mir::CastKind::FloatToInt
| mir::CastKind::FloatToFloat
| mir::CastKind::IntToFloat
| mir::CastKind::PtrToPtr
| mir::CastKind::FnPtrToPtr
// Since int2ptr can have arbitrary integer types as input (so we have to do
// sign extension and all that), it is currently best handled in the same code
// path as the other integer-to-X casts.

View File

@ -42,8 +42,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
let res = self.pointer_from_exposed_address_cast(&src, cast_ty)?;
self.write_immediate(res, dest)?;
}
Misc => {
// FIXME: We shouldn't use `misc_cast` for these but handle them separately.
IntToInt | FloatToInt | FloatToFloat | IntToFloat | FnPtrToPtr | PtrToPtr => {
let src = self.read_immediate(src)?;
let res = self.misc_cast(&src, cast_ty)?;
self.write_immediate(res, dest)?;

View File

@ -553,7 +553,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
unimplemented!()
}
Rvalue::Cast(CastKind::Misc, _, _) => {}
Rvalue::Cast(_, _, _) => {}
Rvalue::NullaryOp(NullOp::SizeOf | NullOp::AlignOf, _) => {}
Rvalue::ShallowInitBox(_, _) => {}

View File

@ -557,7 +557,14 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
}
Rvalue::Cast(kind, operand, target_type) => {
match kind {
CastKind::Misc => {
CastKind::DynStar => {
// FIXME(dyn-star): make sure nothing needs to be done here.
}
// Nothing to check here
CastKind::PointerFromExposedAddress
| CastKind::PointerExposeAddress
| CastKind::Pointer(_) => {}
_ => {
let op_ty = operand.ty(self.body, self.tcx);
if op_ty.is_enum() {
self.fail(
@ -568,13 +575,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
);
}
}
CastKind::DynStar => {
// FIXME(dyn-star): make sure nothing needs to be done here.
}
// Nothing to check here
CastKind::PointerFromExposedAddress
| CastKind::PointerExposeAddress
| CastKind::Pointer(_) => {}
}
}
Rvalue::Repeat(_, _)

View File

@ -44,13 +44,23 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
pub fn check_transmute(&self, from: Ty<'tcx>, to: Ty<'tcx>, hir_id: HirId) {
let tcx = self.tcx;
let span = tcx.hir().span(hir_id);
let convert = |ty: Ty<'tcx>| {
let normalize = |ty| {
let ty = self.resolve_vars_if_possible(ty);
let ty = tcx.normalize_erasing_regions(self.param_env, ty);
(SizeSkeleton::compute(ty, tcx, self.param_env), ty)
self.tcx.normalize_erasing_regions(self.param_env, ty)
};
let (sk_from, from) = convert(from);
let (sk_to, to) = convert(to);
let from = normalize(from);
let to = normalize(to);
trace!(?from, ?to);
// Transmutes that are only changing lifetimes are always ok.
if from == to {
return;
}
let skel = |ty| SizeSkeleton::compute(ty, tcx, self.param_env);
let sk_from = skel(from);
let sk_to = skel(to);
trace!(?sk_from, ?sk_to);
// Check for same size using the skeletons.
if let (Ok(sk_from), Ok(sk_to)) = (sk_from, sk_to) {

View File

@ -1834,7 +1834,14 @@ impl<'tcx> Rvalue<'tcx> {
| Rvalue::AddressOf(_, _)
| Rvalue::Len(_)
| Rvalue::Cast(
CastKind::Misc | CastKind::Pointer(_) | CastKind::PointerFromExposedAddress,
CastKind::IntToInt
| CastKind::FloatToInt
| CastKind::FloatToFloat
| CastKind::IntToFloat
| CastKind::FnPtrToPtr
| CastKind::PtrToPtr
| CastKind::Pointer(_)
| CastKind::PointerFromExposedAddress,
_,
_,
)

View File

@ -1149,8 +1149,12 @@ pub enum CastKind {
Pointer(PointerCast),
/// Cast into a dyn* object.
DynStar,
/// Remaining unclassified casts.
Misc,
IntToInt,
FloatToInt,
FloatToFloat,
IntToFloat,
PtrToPtr,
FnPtrToPtr,
}
#[derive(Clone, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]

View File

@ -115,7 +115,7 @@ pub enum SelectionCandidate<'tcx> {
ParamCandidate(ty::PolyTraitPredicate<'tcx>),
ImplCandidate(DefId),
AutoImplCandidate(DefId),
AutoImplCandidate,
/// This is a trait matching with a projected type as `Self`, and we found
/// an applicable bound in the trait definition. The `usize` is an index
@ -143,7 +143,7 @@ pub enum SelectionCandidate<'tcx> {
/// Builtin implementation of `Pointee`.
PointeeCandidate,
TraitAliasCandidate(DefId),
TraitAliasCandidate,
/// Matching `dyn Trait` with a supertrait of `Trait`. The index is the
/// position in the iterator returned by

View File

@ -2,6 +2,7 @@
// typeck and codegen.
use crate::ty::{self, Ty};
use rustc_middle::mir;
use rustc_macros::HashStable;
@ -75,3 +76,28 @@ impl<'tcx> CastTy<'tcx> {
}
}
}
/// Returns `mir::CastKind` from the given parameters.
pub fn mir_cast_kind<'tcx>(from_ty: Ty<'tcx>, cast_ty: Ty<'tcx>) -> mir::CastKind {
let from = CastTy::from_ty(from_ty);
let cast = CastTy::from_ty(cast_ty);
let cast_kind = match (from, cast) {
(Some(CastTy::Ptr(_) | CastTy::FnPtr), Some(CastTy::Int(_))) => {
mir::CastKind::PointerExposeAddress
}
(Some(CastTy::Int(_)), Some(CastTy::Ptr(_))) => mir::CastKind::PointerFromExposedAddress,
(_, Some(CastTy::DynStar)) => mir::CastKind::DynStar,
(Some(CastTy::Int(_)), Some(CastTy::Int(_))) => mir::CastKind::IntToInt,
(Some(CastTy::FnPtr), Some(CastTy::Ptr(_))) => mir::CastKind::FnPtrToPtr,
(Some(CastTy::Float), Some(CastTy::Int(_))) => mir::CastKind::FloatToInt,
(Some(CastTy::Int(_)), Some(CastTy::Float)) => mir::CastKind::IntToFloat,
(Some(CastTy::Float), Some(CastTy::Float)) => mir::CastKind::FloatToFloat,
(Some(CastTy::Ptr(_)), Some(CastTy::Ptr(_))) => mir::CastKind::PtrToPtr,
(_, _) => {
bug!("Attempting to cast non-castable types {:?} and {:?}", from_ty, cast_ty)
}
};
cast_kind
}

View File

@ -12,7 +12,7 @@ use rustc_middle::mir::AssertKind;
use rustc_middle::mir::Place;
use rustc_middle::mir::*;
use rustc_middle::thir::*;
use rustc_middle::ty::cast::CastTy;
use rustc_middle::ty::cast::{mir_cast_kind, CastTy};
use rustc_middle::ty::{self, Ty, UpvarSubsts};
use rustc_span::Span;
@ -217,16 +217,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let from_ty = CastTy::from_ty(ty);
let cast_ty = CastTy::from_ty(expr.ty);
debug!("ExprKind::Cast from_ty={from_ty:?}, cast_ty={:?}/{cast_ty:?}", expr.ty,);
let cast_kind = match (from_ty, cast_ty) {
(Some(CastTy::Ptr(_) | CastTy::FnPtr), Some(CastTy::Int(_))) => {
CastKind::PointerExposeAddress
}
(Some(CastTy::Int(_)), Some(CastTy::Ptr(_))) => {
CastKind::PointerFromExposedAddress
}
(_, Some(CastTy::DynStar)) => CastKind::DynStar,
(_, _) => CastKind::Misc,
};
let cast_kind = mir_cast_kind(ty, expr.ty);
block.and(Rvalue::Cast(cast_kind, source, expr.ty))
}
ExprKind::Pointer { cast, source } => {

View File

@ -823,9 +823,10 @@ where
// tmp = &raw mut P;
// cur = tmp as *mut T;
// end = Offset(cur, len);
let mir_cast_kind = ty::cast::mir_cast_kind(iter_ty, tmp_ty);
vec![
self.assign(tmp, Rvalue::AddressOf(Mutability::Mut, self.place)),
self.assign(cur, Rvalue::Cast(CastKind::Misc, Operand::Move(tmp), iter_ty)),
self.assign(cur, Rvalue::Cast(mir_cast_kind, Operand::Move(tmp), iter_ty)),
self.assign(
length_or_end,
Rvalue::BinaryOp(

View File

@ -977,6 +977,21 @@ impl Integrator<'_, '_> {
trace!("mapping block `{:?}` to `{:?}`", block, new);
new
}
fn map_unwind(&self, unwind: Option<BasicBlock>) -> Option<BasicBlock> {
if self.in_cleanup_block {
if unwind.is_some() {
bug!("cleanup on cleanup block");
}
return unwind;
}
match unwind {
Some(target) => Some(self.map_block(target)),
// Add an unwind edge to the original call's cleanup block
None => self.cleanup_block,
}
}
}
impl<'tcx> MutVisitor<'tcx> for Integrator<'_, 'tcx> {
@ -1085,35 +1100,17 @@ impl<'tcx> MutVisitor<'tcx> for Integrator<'_, 'tcx> {
TerminatorKind::Drop { ref mut target, ref mut unwind, .. }
| TerminatorKind::DropAndReplace { ref mut target, ref mut unwind, .. } => {
*target = self.map_block(*target);
if let Some(tgt) = *unwind {
*unwind = Some(self.map_block(tgt));
} else if !self.in_cleanup_block {
// Unless this drop is in a cleanup block, add an unwind edge to
// the original call's cleanup block
*unwind = self.cleanup_block;
}
*unwind = self.map_unwind(*unwind);
}
TerminatorKind::Call { ref mut target, ref mut cleanup, .. } => {
if let Some(ref mut tgt) = *target {
*tgt = self.map_block(*tgt);
}
if let Some(tgt) = *cleanup {
*cleanup = Some(self.map_block(tgt));
} else if !self.in_cleanup_block {
// Unless this call is in a cleanup block, add an unwind edge to
// the original call's cleanup block
*cleanup = self.cleanup_block;
}
*cleanup = self.map_unwind(*cleanup);
}
TerminatorKind::Assert { ref mut target, ref mut cleanup, .. } => {
*target = self.map_block(*target);
if let Some(tgt) = *cleanup {
*cleanup = Some(self.map_block(tgt));
} else if !self.in_cleanup_block {
// Unless this assert is in a cleanup block, add an unwind edge to
// the original call's cleanup block
*cleanup = self.cleanup_block;
}
*cleanup = self.map_unwind(*cleanup);
}
TerminatorKind::Return => {
terminator.kind = if let Some(tgt) = self.callsite.target {
@ -1141,11 +1138,8 @@ impl<'tcx> MutVisitor<'tcx> for Integrator<'_, 'tcx> {
TerminatorKind::InlineAsm { ref mut destination, ref mut cleanup, .. } => {
if let Some(ref mut tgt) = *destination {
*tgt = self.map_block(*tgt);
} else if !self.in_cleanup_block {
// Unless this inline asm is in a cleanup block, add an unwind edge to
// the original call's cleanup block
*cleanup = self.cleanup_block;
}
*cleanup = self.map_unwind(*cleanup);
}
}
}

View File

@ -625,7 +625,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
}
_ => candidates.vec.push(AutoImplCandidate(def_id)),
_ => candidates.vec.push(AutoImplCandidate),
}
}
}
@ -914,7 +914,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
let def_id = obligation.predicate.def_id();
if self.tcx().is_trait_alias(def_id) {
candidates.vec.push(TraitAliasCandidate(def_id));
candidates.vec.push(TraitAliasCandidate);
}
}

View File

@ -64,8 +64,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
ImplSource::UserDefined(self.confirm_impl_candidate(obligation, impl_def_id))
}
AutoImplCandidate(trait_def_id) => {
let data = self.confirm_auto_impl_candidate(obligation, trait_def_id);
AutoImplCandidate => {
let data = self.confirm_auto_impl_candidate(obligation);
ImplSource::AutoImpl(data)
}
@ -100,8 +100,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
PointeeCandidate => ImplSource::Pointee(ImplSourcePointeeData),
TraitAliasCandidate(alias_def_id) => {
let data = self.confirm_trait_alias_candidate(obligation, alias_def_id);
TraitAliasCandidate => {
let data = self.confirm_trait_alias_candidate(obligation);
ImplSource::TraitAlias(data)
}
@ -317,13 +317,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
fn confirm_auto_impl_candidate(
&mut self,
obligation: &TraitObligation<'tcx>,
trait_def_id: DefId,
) -> ImplSourceAutoImplData<PredicateObligation<'tcx>> {
debug!(?obligation, ?trait_def_id, "confirm_auto_impl_candidate");
debug!(?obligation, "confirm_auto_impl_candidate");
let self_ty = self.infcx.shallow_resolve(obligation.predicate.self_ty());
let types = self.constituent_types_for_ty(self_ty);
self.vtable_auto_impl(obligation, trait_def_id, types)
self.vtable_auto_impl(obligation, obligation.predicate.def_id(), types)
}
/// See `confirm_auto_impl_candidate`.
@ -658,10 +657,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
fn confirm_trait_alias_candidate(
&mut self,
obligation: &TraitObligation<'tcx>,
alias_def_id: DefId,
) -> ImplSourceTraitAliasData<'tcx, PredicateObligation<'tcx>> {
debug!(?obligation, ?alias_def_id, "confirm_trait_alias_candidate");
debug!(?obligation, "confirm_trait_alias_candidate");
let alias_def_id = obligation.predicate.def_id();
let predicate = self.infcx().replace_bound_vars_with_placeholders(obligation.predicate);
let trait_ref = predicate.trait_ref;
let trait_def_id = trait_ref.def_id;

View File

@ -1150,7 +1150,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// const projection
ProjectionCandidate(_, ty::BoundConstness::ConstIfConst) => {}
// auto trait impl
AutoImplCandidate(..) => {}
AutoImplCandidate => {}
// generator, this will raise error in other places
// or ignore error with const_async_blocks feature
GeneratorCandidate => {}
@ -1568,7 +1568,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// This is a fix for #53123 and prevents winnowing from accidentally extending the
// lifetime of a variable.
match (&other.candidate, &victim.candidate) {
(_, AutoImplCandidate(..)) | (AutoImplCandidate(..), _) => {
(_, AutoImplCandidate) | (AutoImplCandidate, _) => {
bug!(
"default implementations shouldn't be recorded \
when there are other valid candidates"
@ -1638,7 +1638,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| BuiltinUnsizeCandidate
| TraitUpcastingUnsizeCandidate(_)
| BuiltinCandidate { .. }
| TraitAliasCandidate(..)
| TraitAliasCandidate
| ObjectCandidate(_)
| ProjectionCandidate(..),
) => !is_global(cand),
@ -1656,7 +1656,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| BuiltinUnsizeCandidate
| TraitUpcastingUnsizeCandidate(_)
| BuiltinCandidate { has_nested: true }
| TraitAliasCandidate(..),
| TraitAliasCandidate,
ParamCandidate(ref cand),
) => {
// Prefer these to a global where-clause bound
@ -1686,7 +1686,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| BuiltinUnsizeCandidate
| TraitUpcastingUnsizeCandidate(_)
| BuiltinCandidate { .. }
| TraitAliasCandidate(..),
| TraitAliasCandidate,
) => true,
(
@ -1698,7 +1698,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| BuiltinUnsizeCandidate
| TraitUpcastingUnsizeCandidate(_)
| BuiltinCandidate { .. }
| TraitAliasCandidate(..),
| TraitAliasCandidate,
ObjectCandidate(_) | ProjectionCandidate(..),
) => false,
@ -1779,7 +1779,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| BuiltinUnsizeCandidate
| TraitUpcastingUnsizeCandidate(_)
| BuiltinCandidate { has_nested: true }
| TraitAliasCandidate(..),
| TraitAliasCandidate,
ImplCandidate(_)
| ClosureCandidate
| GeneratorCandidate
@ -1788,7 +1788,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| BuiltinUnsizeCandidate
| TraitUpcastingUnsizeCandidate(_)
| BuiltinCandidate { has_nested: true }
| TraitAliasCandidate(..),
| TraitAliasCandidate,
) => false,
}
}

@ -1 +1 @@
Subproject commit f587d6e7cddeaa3cf0a33ec1e368df1a408fa0aa
Subproject commit 9a86c0467bbe42056f73fdf5b03fff757d7c4a9b

View File

@ -163,9 +163,6 @@ h1.fqn {
padding-bottom: 6px;
margin-bottom: 15px;
}
.main-heading a:hover {
text-decoration: underline;
}
#toggle-all-docs {
text-decoration: none;
}
@ -584,10 +581,6 @@ pre.example-line-numbers {
border-bottom-left-radius: 5px;
}
.example-wrap > pre.rust a:hover {
text-decoration: underline;
}
.src-line-numbers {
text-align: right;
}
@ -767,6 +760,8 @@ h2.small-section-header > .anchor {
content: '§';
}
.main-heading a:hover,
.example-wrap > pre.rust a:hover,
.all-items a:hover,
.docblock a:not(.test-arrow):not(.scrape-help):hover,
.docblock-short a:not(.test-arrow):not(.scrape-help):hover,
@ -1093,7 +1088,6 @@ so that we can apply CSS-filters to change the arrow color in themes */
.rightside {
padding-left: 12px;
padding-right: 2px;
position: initial;
float: right;
}

View File

@ -14,10 +14,10 @@
bb0: {
StorageLive(_1); // scope 0 at $DIR/cast.rs:+1:9: +1:10
- _1 = const 42_u8 as u32 (Misc); // scope 0 at $DIR/cast.rs:+1:13: +1:24
- _1 = const 42_u8 as u32 (IntToInt); // scope 0 at $DIR/cast.rs:+1:13: +1:24
+ _1 = const 42_u32; // scope 0 at $DIR/cast.rs:+1:13: +1:24
StorageLive(_2); // scope 1 at $DIR/cast.rs:+3:9: +3:10
- _2 = const 42_u32 as u8 (Misc); // scope 1 at $DIR/cast.rs:+3:13: +3:24
- _2 = const 42_u32 as u8 (IntToInt); // scope 1 at $DIR/cast.rs:+3:13: +3:24
+ _2 = const 42_u8; // scope 1 at $DIR/cast.rs:+3:13: +3:24
_0 = const (); // scope 0 at $DIR/cast.rs:+0:11: +4:2
StorageDead(_2); // scope 1 at $DIR/cast.rs:+4:1: +4:2

View File

@ -13,7 +13,7 @@
bb0: {
StorageLive(_1); // scope 0 at $DIR/indirect.rs:+1:9: +1:10
StorageLive(_2); // scope 0 at $DIR/indirect.rs:+1:13: +1:25
- _2 = const 2_u32 as u8 (Misc); // scope 0 at $DIR/indirect.rs:+1:13: +1:25
- _2 = const 2_u32 as u8 (IntToInt); // scope 0 at $DIR/indirect.rs:+1:13: +1:25
- _3 = CheckedAdd(_2, const 1_u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29
- assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
+ _2 = const 2_u8; // scope 0 at $DIR/indirect.rs:+1:13: +1:25

View File

@ -7,7 +7,7 @@ fn bar(_1: Bar) -> usize {
bb0: {
_2 = discriminant(_1); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
_0 = move _2 as usize (Misc); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
_0 = move _2 as usize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
}
}

View File

@ -7,7 +7,7 @@ fn boo(_1: Boo) -> usize {
bb0: {
_2 = discriminant(_1); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
_0 = move _2 as usize (Misc); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
_0 = move _2 as usize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
}
}

View File

@ -26,7 +26,7 @@ fn droppy() -> () {
FakeRead(ForLet(None), _2); // scope 0 at $DIR/enum_cast.rs:+2:13: +2:14
StorageLive(_3); // scope 3 at $DIR/enum_cast.rs:+5:13: +5:14
_4 = discriminant(_2); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
_3 = move _4 as usize (Misc); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
_3 = move _4 as usize (IntToInt); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
FakeRead(ForLet(None), _3); // scope 3 at $DIR/enum_cast.rs:+5:13: +5:14
_1 = const (); // scope 0 at $DIR/enum_cast.rs:+1:5: +6:6
StorageDead(_3); // scope 1 at $DIR/enum_cast.rs:+6:5: +6:6

View File

@ -7,7 +7,7 @@ fn foo(_1: Foo) -> usize {
bb0: {
_2 = discriminant(_1); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
_0 = move _2 as usize (Misc); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
_0 = move _2 as usize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
}
}

View File

@ -91,7 +91,7 @@
StorageLive(_15); // scope 3 at $DIR/funky_arms.rs:+15:59: +15:75
StorageLive(_16); // scope 3 at $DIR/funky_arms.rs:+15:59: +15:68
_16 = _10; // scope 3 at $DIR/funky_arms.rs:+15:59: +15:68
_15 = move _16 as u32 (Misc); // scope 3 at $DIR/funky_arms.rs:+15:59: +15:75
_15 = move _16 as u32 (IntToInt); // scope 3 at $DIR/funky_arms.rs:+15:59: +15:75
StorageDead(_16); // scope 3 at $DIR/funky_arms.rs:+15:74: +15:75
_14 = Add(move _15, const 1_u32); // scope 3 at $DIR/funky_arms.rs:+15:59: +15:79
StorageDead(_15); // scope 3 at $DIR/funky_arms.rs:+15:78: +15:79

View File

@ -31,7 +31,7 @@
StorageLive(_6); // scope 1 at $DIR/if-condition-int.rs:+4:23: +4:31
StorageLive(_7); // scope 1 at $DIR/if-condition-int.rs:+4:23: +4:24
_7 = _2; // scope 1 at $DIR/if-condition-int.rs:+4:23: +4:24
_6 = move _7 as i32 (Misc); // scope 1 at $DIR/if-condition-int.rs:+4:23: +4:31
_6 = move _7 as i32 (IntToInt); // scope 1 at $DIR/if-condition-int.rs:+4:23: +4:31
StorageDead(_7); // scope 1 at $DIR/if-condition-int.rs:+4:30: +4:31
_0 = Add(const 100_i32, move _6); // scope 1 at $DIR/if-condition-int.rs:+4:17: +4:31
StorageDead(_6); // scope 1 at $DIR/if-condition-int.rs:+4:30: +4:31
@ -43,7 +43,7 @@
StorageLive(_4); // scope 1 at $DIR/if-condition-int.rs:+3:23: +3:31
StorageLive(_5); // scope 1 at $DIR/if-condition-int.rs:+3:23: +3:24
_5 = _2; // scope 1 at $DIR/if-condition-int.rs:+3:23: +3:24
_4 = move _5 as i32 (Misc); // scope 1 at $DIR/if-condition-int.rs:+3:23: +3:31
_4 = move _5 as i32 (IntToInt); // scope 1 at $DIR/if-condition-int.rs:+3:23: +3:31
StorageDead(_5); // scope 1 at $DIR/if-condition-int.rs:+3:30: +3:31
_0 = Add(const 10_i32, move _4); // scope 1 at $DIR/if-condition-int.rs:+3:18: +3:31
StorageDead(_4); // scope 1 at $DIR/if-condition-int.rs:+3:30: +3:31

View File

@ -0,0 +1,22 @@
// Tests inlining of `may_unwind` inline assembly.
//
// ignore-wasm32-bare compiled with panic=abort by default
// needs-asm-support
#![feature(asm_unwind)]
struct D;
impl Drop for D {
fn drop(&mut self) {}
}
#[inline(always)]
fn foo() {
let _d = D;
unsafe { std::arch::asm!("", options(may_unwind)) };
}
// EMIT_MIR asm_unwind.main.Inline.diff
pub fn main() {
foo();
}

View File

@ -0,0 +1,45 @@
- // MIR for `main` before Inline
+ // MIR for `main` after Inline
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/asm-unwind.rs:+0:15: +0:15
let _1: (); // in scope 0 at $DIR/asm-unwind.rs:+1:5: +1:10
+ scope 1 (inlined foo) { // at $DIR/asm-unwind.rs:21:5: 21:10
+ let _2: D; // in scope 1 at $DIR/asm-unwind.rs:15:9: 15:11
+ scope 2 {
+ debug _d => _2; // in scope 2 at $DIR/asm-unwind.rs:15:9: 15:11
+ scope 3 {
+ }
+ }
+ }
bb0: {
StorageLive(_1); // scope 0 at $DIR/asm-unwind.rs:+1:5: +1:10
- _1 = foo() -> bb1; // scope 0 at $DIR/asm-unwind.rs:+1:5: +1:10
- // mir::Constant
- // + span: $DIR/asm-unwind.rs:21:5: 21:8
- // + literal: Const { ty: fn() {foo}, val: Value(<ZST>) }
+ StorageLive(_2); // scope 1 at $DIR/asm-unwind.rs:15:9: 15:11
+ asm!("", options(MAY_UNWIND)) -> [return: bb1, unwind: bb3]; // scope 3 at $DIR/asm-unwind.rs:16:14: 16:54
}
bb1: {
+ drop(_2) -> bb2; // scope 1 at $DIR/asm-unwind.rs:17:1: 17:2
+ }
+
+ bb2: {
+ StorageDead(_2); // scope 1 at $DIR/asm-unwind.rs:17:1: 17:2
StorageDead(_1); // scope 0 at $DIR/asm-unwind.rs:+1:10: +1:11
_0 = const (); // scope 0 at $DIR/asm-unwind.rs:+0:15: +2:2
return; // scope 0 at $DIR/asm-unwind.rs:+2:2: +2:2
+ }
+
+ bb3 (cleanup): {
+ drop(_2) -> bb4; // scope 1 at $DIR/asm-unwind.rs:17:1: 17:2
+ }
+
+ bb4 (cleanup): {
+ resume; // scope 1 at $DIR/asm-unwind.rs:14:1: 17:2
}
}

View File

@ -25,7 +25,7 @@
bb1: {
StorageLive(_4); // scope 0 at $DIR/inline-diverging.rs:+2:9: +2:10
_4 = _1; // scope 0 at $DIR/inline-diverging.rs:+2:9: +2:10
_0 = move _4 as u32 (Misc); // scope 0 at $DIR/inline-diverging.rs:+2:9: +2:17
_0 = move _4 as u32 (IntToInt); // scope 0 at $DIR/inline-diverging.rs:+2:9: +2:17
StorageDead(_4); // scope 0 at $DIR/inline-diverging.rs:+2:16: +2:17
StorageDead(_2); // scope 0 at $DIR/inline-diverging.rs:+5:5: +5:6
return; // scope 0 at $DIR/inline-diverging.rs:+6:2: +6:2

View File

@ -90,9 +90,9 @@
StorageDead(_16); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
StorageDead(_6); // scope 0 at $DIR/issue-101973.rs:+1:57: +1:58
StorageDead(_4); // scope 0 at $DIR/issue-101973.rs:+1:57: +1:58
_2 = move _3 as i32 (Misc); // scope 0 at $DIR/issue-101973.rs:+1:5: +1:65
_2 = move _3 as i32 (IntToInt); // scope 0 at $DIR/issue-101973.rs:+1:5: +1:65
StorageDead(_3); // scope 0 at $DIR/issue-101973.rs:+1:64: +1:65
_0 = move _2 as i64 (Misc); // scope 0 at $DIR/issue-101973.rs:+1:5: +1:72
_0 = move _2 as i64 (IntToInt); // scope 0 at $DIR/issue-101973.rs:+1:5: +1:72
StorageDead(_2); // scope 0 at $DIR/issue-101973.rs:+1:71: +1:72
return; // scope 0 at $DIR/issue-101973.rs:+2:2: +2:2
}

View File

@ -36,7 +36,7 @@
_7 = &_1; // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:33
_6 = &raw const (*_7); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:33
_5 = _6; // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:45
_4 = move _5 as *const i32 (Misc); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:59
_4 = move _5 as *const i32 (PtrToPtr); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:59
StorageDead(_5); // scope 3 at $DIR/lower_intrinsics.rs:+4:58: +4:59
StorageLive(_8); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:91
StorageLive(_9); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:79
@ -45,7 +45,7 @@
_11 = &mut _2; // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:69
_10 = &raw mut (*_11); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:69
_9 = _10; // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:79
_8 = move _9 as *mut i32 (Misc); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:91
_8 = move _9 as *mut i32 (PtrToPtr); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:91
StorageDead(_9); // scope 3 at $DIR/lower_intrinsics.rs:+4:90: +4:91
- _3 = copy_nonoverlapping::<i32>(move _4, move _8, const 0_usize) -> bb1; // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95
- // mir::Constant

View File

@ -84,7 +84,7 @@ fn std::ptr::drop_in_place(_1: *mut [String]) -> () {
bb13: {
_15 = &raw mut (*_1); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
_9 = move _15 as *mut std::string::String (Misc); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
_9 = move _15 as *mut std::string::String (PtrToPtr); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
_10 = Offset(_9, move _3); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
goto -> bb12; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
}

View File

@ -4,7 +4,7 @@
// anchor and the `impl Foo`. If there were a gap, this would cause an annoying
// problem: you hover `impl Foo` to see the anchor, then when you move your
// mouse to the left, the anchor disappears before you reach it.
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
// We check that ".item-info" is bigger than its content.
move-cursor-to: ".impl"
assert-property: (".impl > a.anchor", {"offsetWidth": "8"})

View File

@ -1,5 +1,5 @@
// This test is to ensure that the anchors (`§`) have the expected color and position.
goto: file://|DOC_PATH|/staged_api/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"
// This is needed to ensure that the text color is computed.
show-text: true
@ -36,7 +36,7 @@ assert-css: (
{"color": "rgb(56, 115, 173)", "text-decoration": "none solid rgb(56, 115, 173)"},
)
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
assert-css: ("#top-doc-prose-title", {"color": "rgb(0, 0, 0)"})
@ -57,7 +57,7 @@ assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})
// We do the same checks with the dark theme now.
//
local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
goto: file://|DOC_PATH|/staged_api/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"
assert-css: ("#toggle-all-docs", {"color": "rgb(221, 221, 221)"})
assert-css: (".fqn a:nth-of-type(1)", {"color": "rgb(221, 221, 221)"})
@ -86,7 +86,7 @@ assert-css: (
{"color": "rgb(210, 153, 29)", "text-decoration": "none solid rgb(210, 153, 29)"},
)
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
assert-css: ("#top-doc-prose-title", {"color": "rgb(221, 221, 221)"})
@ -107,7 +107,7 @@ assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})
// We do the same checks with the ayu theme now.
//
local-storage: {"rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false"}
goto: file://|DOC_PATH|/staged_api/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"
assert-css: ("#toggle-all-docs", {"color": "rgb(197, 197, 197)"})
assert-css: (".fqn a:nth-of-type(1)", {"color": "rgb(255, 255, 255)"})
@ -136,7 +136,7 @@ assert-css: (
{"color": "rgb(57, 175, 215)", "text-decoration": "none solid rgb(57, 175, 215)"},
)
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
assert-css: ("#top-doc-prose-title", {"color": "rgb(255, 255, 255)"})

View File

@ -1,5 +1,5 @@
// Checks that the setting "auto hide trait implementations" is working as expected.
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
// By default, the trait implementations are not collapsed.
assert-attribute: ("#trait-implementations-list > details", {"open": ""}, ALL)

View File

@ -1,3 +1,3 @@
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
click: ".srclink"
assert-count: (".src-line-numbers", 1)

View File

@ -1,4 +1,4 @@
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert: ("#functions")
goto: ./struct.Foo.html
goto: "./struct.Foo.html"
assert: ("div.item-decl")

View File

@ -1,5 +1,5 @@
// This test ensures that the docblock elements have the appropriate left margin.
goto: file://|DOC_PATH|/test_docs/fn.foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
// The top docblock elements shouldn't have left margin...
assert-css: ("#main-content .item-decl", {"margin-left": "0px"})
// ... but all the others should!

View File

@ -1,6 +1,6 @@
// This test checks that using `.stab` attributes in `.docblock` elements doesn't
// create scrollable paragraphs.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
// Needs the text to be display to check for scrollable content.
show-text: true
size: (786, 600)

View File

@ -1,7 +1,7 @@
// This test checks the position of the information on the code blocks (like
// `compile_fail` or `ignore`).
goto: file://|DOC_PATH|/test_docs/index.html
goto: ./fn.check_list_code_block.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
goto: "./fn.check_list_code_block.html"
// If the codeblock is the first element of the docblock, the information tooltip must have
// have some top margin to avoid going over the toggle (the "[+]").
assert-css: (".docblock > .example-wrap.compile_fail .tooltip", { "margin-top": "16px" })

View File

@ -1,5 +1,5 @@
// This test ensures that codeblocks content don't overflow.
goto: file://|DOC_PATH|/lib2/sub_mod/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/lib2/sub_mod/struct.Foo.html"
size: (1080, 600)
// There should be two codeblocks: a rust one and a non-rust one.
assert-count: (".docblock > .example-wrap", 2)

View File

@ -2,7 +2,7 @@
// check that the rule isn't applied on other "<code>" elements.
//
// While we're at it, we also check it for the other themes.
goto: file://|DOC_PATH|/test_docs/fn.foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
// If the text isn't displayed, the browser doesn't compute color style correctly...
show-text: true
// Set the theme to dark.

View File

@ -1,5 +1,5 @@
// This test checks that the source code pages sidebar toggle is working as expected.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
click: ".srclink"
wait-for: "#sidebar-toggle"
click: "#sidebar-toggle"

View File

@ -1,5 +1,5 @@
// This test ensures that items and documentation code blocks are wrapped in <pre><code>
goto: file://|DOC_PATH|/test_docs/fn.foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
size: (1080, 600)
// There should be four doc codeblocks.
// Check that their content is inside <pre><code>
@ -7,14 +7,14 @@ assert-count: (".example-wrap pre > code", 4)
// Check that function signature is inside <pre><code>
assert: "pre.rust.fn > code"
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
assert: "pre.rust.struct > code"
goto: file://|DOC_PATH|/test_docs/enum.AnEnum.html
goto: "file://" + |DOC_PATH| + "/test_docs/enum.AnEnum.html"
assert: "pre.rust.enum > code"
goto: file://|DOC_PATH|/test_docs/trait.AnotherOne.html
goto: "file://" + |DOC_PATH| + "/test_docs/trait.AnotherOne.html"
assert: "pre.rust.trait > code"
goto: file://|DOC_PATH|/test_docs/type.SomeType.html
goto: "file://" + |DOC_PATH| + "/test_docs/type.SomeType.html"
assert: "pre.rust.typedef > code"

View File

@ -1,5 +1,5 @@
// Checking the colors of the codeblocks tooltips.
goto: file://|DOC_PATH|/test_docs/fn.foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
show-text: true
// Dark theme.

View File

@ -2,7 +2,7 @@
//
// The "settings" crate uses "ayu" as default setting, which is what we will
// check.
goto: file://|DOC_PATH|/settings/index.html
goto: "file://" + |DOC_PATH| + "/settings/index.html"
// Wait a bit to be sure the default theme is applied.
// If the theme isn't applied, the command will time out.
wait-for-css: ("body", {"background-color": "rgb(15, 20, 25)"})

View File

@ -1,7 +1,7 @@
// If we have a long `<code>`, we need to ensure that it'll be fully displayed on mobile, meaning
// that it'll be on two lines.
emulate: "iPhone 8" // it has the following size: (375, 667)
goto: file://|DOC_PATH|/test_docs/long_code_block/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/long_code_block/index.html"
// We now check that the block is on two lines:
show-text: true // We need to enable text draw to be able to have the "real" size
// Little explanations for this test: if the text wasn't displayed on two lines, it would take

View File

@ -1,5 +1,5 @@
// Checks that the setting "line numbers" is working as expected.
goto: file://|DOC_PATH|/test_docs/fn.foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
// We check that without this setting, there is no line number displayed.
assert-false: "pre.example-line-numbers"

View File

@ -1,5 +1,5 @@
// This ensures that the `<details>`/`<summary>` elements are displayed as expected.
goto: file://|DOC_PATH|/test_docs/details/struct.Details.html
goto: "file://" + |DOC_PATH| + "/test_docs/details/struct.Details.html"
show-text: true
local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
reload:

View File

@ -1,5 +1,5 @@
// This test ensures that the type declaration content overflow is handled inside the <pre> directly.
goto: file://|DOC_PATH|/lib2/long_table/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/lib2/long_table/struct.Foo.html"
// We set a fixed size so there is no chance of "random" resize.
size: (1100, 800)
// Logically, the ".docblock" and the "<p>" should have the same scroll width.

View File

@ -1,4 +1,4 @@
goto: file://|DOC_PATH|/test_docs/doc_block_table/struct.DocBlockTable.html#method.func
goto: "file://" + |DOC_PATH| + "/test_docs/doc_block_table/struct.DocBlockTable.html#method.func"
compare-elements-css: (".impl-items .docblock table th", ".top-doc .docblock table th", ["border"])
compare-elements-css: (".impl-items .docblock table td", ".top-doc .docblock table td", ["border"])

View File

@ -1,5 +1,5 @@
// This test ensures that there is no macro duplicates in the sidebar.
goto: file://|DOC_PATH|/test_docs/macro.a.html
goto: "file://" + |DOC_PATH| + "/test_docs/macro.a.html"
// Waiting for the elements in the sidebar to be rendered.
wait-for: ".sidebar-elems .macro"
// Check there is only one macro named "a" listed in the sidebar.

View File

@ -1,6 +1,6 @@
// This test ensures that the "Escape" shortcut is handled correctly based on the
// current content displayed.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
// First, we check that the search results are hidden when the Escape key is pressed.
write: (".search-input", "test")
// To be SURE that the search will be run.

View File

@ -1,5 +1,5 @@
// This test checks that the font weight is correctly applied.
goto: file://|DOC_PATH|/lib2/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html"
assert-css: ("//*[@class='item-decl']//a[text()='Alias']", {"font-weight": "400"})
assert-css: (
"//*[@class='structfield small-section-header']//a[text()='Alias']",
@ -9,13 +9,13 @@ assert-css: ("#method\.a_method > .code-header", {"font-weight": "600"})
assert-css: ("#associatedtype\.X > .code-header", {"font-weight": "600"})
assert-css: ("#associatedconstant\.Y > .code-header", {"font-weight": "600"})
goto: file://|DOC_PATH|/test_docs/type.SomeType.html
goto: "file://" + |DOC_PATH| + "/test_docs/type.SomeType.html"
assert-css: (".top-doc .docblock p", {"font-weight": "400"}, ALL)
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
assert-css: (".impl-items .method > .code-header", {"font-weight": "600"}, ALL)
goto: file://|DOC_PATH|/lib2/trait.Trait.html
goto: "file://" + |DOC_PATH| + "/lib2/trait.Trait.html"
// This is a complex selector, so here's how it works:
//

View File

@ -1,5 +1,5 @@
// This test ensures that the element corresponding to the hash is displayed.
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.borrow
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.borrow"
// In the blanket implementations list, "Borrow" is the second one, hence the ":nth(2)".
assert-attribute: ("#blanket-implementations-list > details:nth-child(2)", {"open": ""})
// We first check that the impl block is open by default.

View File

@ -1,5 +1,5 @@
// This test check for headers text and background colors for the different themes.
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
// This is needed so that the text color is computed.
show-text: true
@ -23,23 +23,23 @@ assert-css: (
ALL,
)
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#impl-Foo
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo"
assert-css: (
"#impl-Foo",
{"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"},
)
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use"
assert-css: (
"#method\.must_use",
{"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"},
ALL,
)
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-css: (".small-section-header a", {"color": "rgb(197, 197, 197)"}, ALL)
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
// We select headings (h2, h3, h...).
assert-css: (".docblock > :not(p) > a", {"color": "rgb(57, 175, 215)"}, ALL)
@ -49,7 +49,7 @@ local-storage: {
"rustdoc-preferred-dark-theme": "dark",
"rustdoc-use-system-theme": "false",
}
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
assert-css: (
".impl",
@ -62,23 +62,23 @@ assert-css: (
ALL,
)
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#impl-Foo
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo"
assert-css: (
"#impl-Foo",
{"color": "rgb(221, 221, 221)", "background-color": "rgb(73, 74, 61)"},
)
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use"
assert-css: (
"#method\.must_use",
{"color": "rgb(221, 221, 221)", "background-color": "rgb(73, 74, 61)"},
ALL,
)
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-css: (".small-section-header a", {"color": "rgb(221, 221, 221)"}, ALL)
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
// We select headings (h2, h3, h...).
assert-css: (".docblock > :not(p) > a", {"color": "rgb(210, 153, 29)"}, ALL)
@ -86,7 +86,7 @@ assert-css: (".docblock > :not(p) > a", {"color": "rgb(210, 153, 29)"}, ALL)
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
reload:
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
assert-css: (
".impl",
@ -99,19 +99,19 @@ assert-css: (
ALL,
)
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#impl-Foo
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo"
assert-css: ("#impl-Foo", {"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"})
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use"
assert-css: (
"#method\.must_use",
{"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"},
ALL,
)
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-css: (".small-section-header a", {"color": "rgb(0, 0, 0)"}, ALL)
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
// We select headings (h2, h3, h...).
assert-css: (".docblock > :not(p) > a", {"color": "rgb(56, 115, 173)"}, ALL)

View File

@ -11,7 +11,7 @@
// 18px 1.125em
// 16px 1rem
// 14px 0.875rem
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
assert-css: ("h1.fqn", {"font-size": "24px"})
@ -50,7 +50,7 @@ assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"font-size": "14px"})
assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"border-bottom-width": "0px"})
assert-css: ("h6#sub-sub-heading-for-struct-impl-item-doc", {"font-size": "14px"})
goto: file://|DOC_PATH|/test_docs/enum.HeavilyDocumentedEnum.html
goto: "file://" + |DOC_PATH| + "/test_docs/enum.HeavilyDocumentedEnum.html"
assert-css: ("h1.fqn", {"font-size": "24px"})
@ -109,7 +109,7 @@ assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"border-bottom-width"
assert-text: (".sidebar .mod h3", "Modules")
assert-css: (".sidebar .mod h3", {"border-bottom-width": "0px"}, ALL)
goto: file://|DOC_PATH|/test_docs/union.HeavilyDocumentedUnion.html
goto: "file://" + |DOC_PATH| + "/test_docs/union.HeavilyDocumentedUnion.html"
assert-css: ("h1.fqn", {"font-size": "24px"})
@ -141,7 +141,7 @@ assert-css: ("h5#title-for-union-impl-item-doc", {"border-bottom-width": "0px"})
assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"font-size": "14px"})
assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"border-bottom-width": "0px"})
goto: file://|DOC_PATH|/test_docs/macro.heavily_documented_macro.html
goto: "file://" + |DOC_PATH| + "/test_docs/macro.heavily_documented_macro.html"
assert-css: ("h1.fqn", {"font-size": "24px"})
@ -153,7 +153,7 @@ assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
// Checking colors now.
show-text: true
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
assert-css: (
".top-doc .docblock h2",
{"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
@ -246,7 +246,7 @@ assert-css: (
)
local-storage: {"rustdoc-theme": "light"}
goto: file://|DOC_PATH|/staged_api/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"
assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
local-storage: {"rustdoc-theme": "dark"}

View File

@ -1,6 +1,6 @@
// Make sure that the last two entries are more than 12 pixels apart and not stacked on each other.
goto: file://|DOC_PATH|/test_docs/huge_amount_of_consts/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/huge_amount_of_consts/index.html"
compare-elements-position-near-false: (
"//*[@class='item-table']//div[last()-1]",

View File

@ -1,3 +1,3 @@
// This test ensures that the impl blocks are open by default.
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
assert-attribute: ("#implementations-list details.implementors-toggle", {"open": ""})

View File

@ -1,6 +1,6 @@
// The goal of this test is to check that the external trait implementors, generated with JS,
// have the same display than the "local" ones.
goto: file://|DOC_PATH|/implementors/trait.Whatever.html
goto: "file://" + |DOC_PATH| + "/implementors/trait.Whatever.html"
assert: "#implementors-list"
// There are supposed to be two implementors listed.
assert-count: ("#implementors-list .impl", 2)
@ -15,7 +15,7 @@ assert-attribute: ("#implementors-list .impl:nth-child(2)", {"id": "impl-Whateve
assert-attribute: ("#implementors-list .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"})
assert: "#implementors-list .impl:nth-child(2) > .code-header"
goto: file://|DOC_PATH|/test_docs/struct.HasEmptyTraits.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HasEmptyTraits.html"
compare-elements-position-near-false: (
"#impl-EmptyTrait1-for-HasEmptyTraits",
"#impl-EmptyTrait2-for-HasEmptyTraits",
@ -29,7 +29,7 @@ compare-elements-position-near: (
// Now check that re-exports work correctly.
// There should be exactly one impl shown on both of these pages.
goto: file://|DOC_PATH|/lib2/trait.TraitToReexport.html
goto: "file://" + |DOC_PATH| + "/lib2/trait.TraitToReexport.html"
assert-count: ("#implementors-list .impl", 1)
goto: file://|DOC_PATH|/implementors/trait.TraitToReexport.html
goto: "file://" + |DOC_PATH| + "/implementors/trait.TraitToReexport.html"
assert-count: ("#implementors-list .impl", 1)

View File

@ -1,6 +1,6 @@
// This test ensures that the "item-info" looks about the same
// whether or not it's inside a toggle.
goto: file://|DOC_PATH|/lib2/struct.ItemInfoAlignmentTest.html
goto: "file://" + |DOC_PATH| + "/lib2/struct.ItemInfoAlignmentTest.html"
// First, we try it in "desktop" mode.
size: (1200, 870)

View File

@ -1,5 +1,5 @@
// This test ensures that the "item-info" elements don't overflow.
goto: file://|DOC_PATH|/lib2/struct.LongItemInfo.html
goto: "file://" + |DOC_PATH| + "/lib2/struct.LongItemInfo.html"
// We set a fixed size so there is no chance of "random" resize.
size: (1200, 870)
// Logically, the "item-decl" and the "item-info" should have the same scroll width.
@ -13,7 +13,7 @@ assert-text: (
)
// Checking the "item-info" on an impl block as well:
goto: file://|DOC_PATH|/lib2/struct.LongItemInfo2.html
goto: "file://" + |DOC_PATH| + "/lib2/struct.LongItemInfo2.html"
compare-elements-property: (
"#impl-SimpleTrait-for-LongItemInfo2 .item-info",
"#impl-SimpleTrait-for-LongItemInfo2 + .docblock",

View File

@ -1,5 +1,5 @@
// This test ensures a few things for item info elements.
goto: file://|DOC_PATH|/lib2/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html"
// Ensuring that the item information don't take 100% of the width if unnecessary.
// We set a fixed size so there is no chance of "random" resize.
size: (1100, 800)
@ -9,7 +9,7 @@ assert-css: (".item-info .stab", {"width": "289px"})
assert-position: (".item-info .stab", {"x": 245})
// Now we ensure that they're not rendered on the same line.
goto: file://|DOC_PATH|/lib2/trait.Trait.html
goto: "file://" + |DOC_PATH| + "/lib2/trait.Trait.html"
// We first ensure that there are two item info on the trait.
assert-count: ("#main-content > .item-info .stab", 2)
// They should not have the same `y` position!

View File

@ -1,5 +1,5 @@
// This test ensures that <table> elements aren't display in items summary.
goto: file://|DOC_PATH|/lib2/summary_table/index.html
goto: "file://" + |DOC_PATH| + "/lib2/summary_table/index.html"
// We check that we picked the right item first.
assert-text: (".item-table .item-left", "Foo")
// Then we check that its summary is empty.

View File

@ -2,5 +2,5 @@
// can't be used without JS.
javascript: false
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
assert-css: (".sub", {"display": "none"})

View File

@ -1,5 +1,5 @@
// We check the background color on the jump to definition links in the source code page.
goto: file://|DOC_PATH|/src/link_to_definition/lib.rs.html
goto: "file://" + |DOC_PATH| + "/src/link_to_definition/lib.rs.html"
// Set the theme to dark.
local-storage: {

View File

@ -1,6 +1,6 @@
// These tests verify that labels like "UNIX" and "Deprecated" stay on the same line as their symbol.
// It also verifies the staggered layout on mobile.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
// Desktop view
size: (1080, 600)

View File

@ -1,5 +1,5 @@
// This test checks links colors.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
// This is needed so that the text color is computed.
show-text: true

View File

@ -1,4 +1,4 @@
// This test checks that code blocks in list are supported.
goto: file://|DOC_PATH|/test_docs/index.html
goto: ./fn.check_list_code_block.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
goto: "./fn.check_list_code_block.html"
assert: ("pre.rust.fn")

View File

@ -1,5 +1,5 @@
// Test various properties of the mobile UI
goto: file://|DOC_PATH|/staged_api/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"
size: (400, 600)
font-size: 18
@ -24,7 +24,7 @@ assert-css-false: (".content .out-of-band .since::before", { "content": "\"Since
// On the settings page, the theme buttons should not line-wrap. Instead, they should
// all be placed as a group on a line below the setting name "Theme."
goto: file://|DOC_PATH|/settings.html
goto: "file://" + |DOC_PATH| + "/settings.html"
size: (400, 600)
// Ignored for now https://github.com/rust-lang/rust/issues/93784.
// compare-elements-position-near-false: ("#preferred-light-theme .setting-name", "#preferred-light-theme .choice", {"y": 16})

View File

@ -1,5 +1,5 @@
// This test checks that the correct font is used on module items (in index.html pages).
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-css: (
".item-table .module-item a",
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},

View File

@ -1,8 +1,8 @@
// This test checks that there are margins applied to methods with no docblocks.
goto: file://|DOC_PATH|/test_docs/trait.TraitWithNoDocblocks.html
goto: "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithNoDocblocks.html"
// Check that the two methods are more than 24px apart.
compare-elements-position-near-false: ("//*[@id='tymethod.first_fn']", "//*[@id='tymethod.second_fn']", {"y": 24})
goto: file://|DOC_PATH|/test_docs/struct.TypeWithNoDocblocks.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.TypeWithNoDocblocks.html"
// Check that the two methods are more than 24px apart.
compare-elements-position-near-false: ("//*[@id='method.first_fn']", "//*[@id='method.second_fn']", {"y": 24})

View File

@ -1,5 +1,5 @@
// This test checks the position of the `i` for the notable traits.
goto: file://|DOC_PATH|/test_docs/struct.NotableStructWithLongName.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html"
show-text: true
// We start with a wide screen.
size: (1100, 600)

View File

@ -1,7 +1,7 @@
// The goal of this test is to ensure that the tooltip `.information` class doesn't
// have overflow and max-width CSS rules set because they create a bug in firefox on
// mac. For more information: https://github.com/rust-lang/rust/issues/89185
goto: file://|DOC_PATH|/test_docs/fn.foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
assert-css: (".docblock > .example-wrap .tooltip", {
"overflow-x": "visible",
"max-width": "none"

View File

@ -1,5 +1,5 @@
// This test ensures that the "pocket menus" are working as expected.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
// First we check that the help menu doesn't exist yet.
assert-false: "#help-button .popover"
// Then we display the help menu.

View File

@ -1,7 +1,7 @@
// Example code blocks sometimes have a "Run" button to run them on the
// Playground. That button is hidden until the user hovers over the code block.
// This test checks that it is hidden, and that it shows on hover.
goto: file://|DOC_PATH|/test_docs/fn.foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
assert-css: (".test-arrow", {"visibility": "hidden"})
move-cursor-to: ".example-wrap"
assert-css: (".test-arrow", {"visibility": "visible"})

View File

@ -1,5 +1,5 @@
// This test ensures that the correct style is applied to the rust logo in the sidebar.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
// First we start with the dark theme.
local-storage: {
@ -15,7 +15,7 @@ assert-css: (
)
// In the source view page now.
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
local-storage: {
"rustdoc-theme": "dark",
@ -43,7 +43,7 @@ assert-css: (
)
// In the source view page now.
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
local-storage: {
"rustdoc-theme": "ayu",
@ -67,7 +67,7 @@ assert-css: (
)
// In the source view page now.
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
reload:

View File

@ -1,5 +1,5 @@
// Checks that the crate search filtering is handled correctly and changes the results.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
show-text: true
write: (".search-input", "test")
// To be SURE that the search will be run.
@ -43,7 +43,7 @@ wait-for: "#titles"
assert-property: ("#crate-search", {"value": "all crates"})
// Checking that the URL parameter is taken into account for crate filtering.
goto: file://|DOC_PATH|/test_docs/index.html?search=test&filter-crate=lib2
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"

View File

@ -1,5 +1,5 @@
// This test ensures that the elements in ".search-form" have the expected display.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
show-text: true
// Ayu theme

View File

@ -1,6 +1,6 @@
// Test to ensure that you can click on the search input, whatever the width.
// The PR which fixed it is: https://github.com/rust-lang/rust/pull/81592
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
size: (463, 700)
// We first check that the search input isn't already focused.
assert-false: ("input.search-input:focus")

View File

@ -1,6 +1,6 @@
// Checks that the reexports are present in the search index, can have
// doc aliases and are highligted when their ID is the hash of the page.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
reload:
// First we check that the reexport has the correct ID and no background color.

View File

@ -1,5 +1,5 @@
// The goal of this test is to ensure the color of the text is the one expected.
goto: file://|DOC_PATH|/test_docs/index.html?search=coo
goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=coo"
// This is needed so that the text color is computed.
show-text: true
@ -826,7 +826,7 @@ assert-css: (
)
// Check the alias more specifically in the dark theme.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
// We set the theme so we're sure that the correct values will be used, whatever the computer
// this test is running on.
local-storage: {

View File

@ -1,5 +1,5 @@
// This test is to ensure that the codeblocks are correctly rendered in the search results.
goto: file://|DOC_PATH|/test_docs/index.html?search=some_more_function
goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=some_more_function"
// Waiting for the search results to appear...
wait-for: "#titles"
assert-text: (".search-results .desc code", "format!")

View File

@ -1,5 +1,5 @@
// Checks that the search results have the expected width.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
size: (900, 1000)
write: (".search-input", "test")
// To be SURE that the search will be run.

View File

@ -2,11 +2,11 @@
// First, we check that the first page doesn't have the string we're looking for to ensure
// that the feature is changing page as expected.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-text-false: (".fqn", "Struct test_docs::Foo")
// We now check that we land on the search result page if "go_to_first" isn't set.
goto: file://|DOC_PATH|/test_docs/index.html?search=struct%3AFoo
goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=struct%3AFoo"
// Waiting for the search results to appear...
wait-for: "#titles"
assert-text-false: (".fqn", "Struct test_docs::Foo")
@ -14,6 +14,6 @@ assert-text-false: (".fqn", "Struct test_docs::Foo")
assert-css: ("#main-content", {"display": "none"})
// Now we can check that the feature is working as expected!
goto: file://|DOC_PATH|/test_docs/index.html?search=struct%3AFoo&go_to_first=true
goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=struct%3AFoo&go_to_first=true"
// Waiting for the page to load...
wait-for-text: (".fqn", "Struct test_docs::Foo")

View File

@ -1,5 +1,5 @@
// Checks that the "keyword" results have the expected text alongside them.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
write: (".search-input", "CookieMonster")
// To be SURE that the search will be run.
press-key: 'Enter'

View File

@ -1,6 +1,6 @@
// Checks that the search tab results work correctly with function signature syntax
// First, try a search-by-name
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
write: (".search-input", "Foo")
// To be SURE that the search will be run.
press-key: 'Enter'
@ -22,7 +22,7 @@ press-key: "ArrowLeft"
wait-for-attribute: ("#titles > button:nth-of-type(3)", {"class": "selected"})
// Now try search-by-return
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
write: (".search-input", "-> String")
// To be SURE that the search will be run.
press-key: 'Enter'
@ -44,7 +44,7 @@ press-key: "ArrowLeft"
wait-for-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
// Try with a search-by-return with no results
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
write: (".search-input", "-> Something")
// To be SURE that the search will be run.
press-key: 'Enter'
@ -54,7 +54,7 @@ assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
assert-text: ("#titles > button:nth-of-type(1)", "In Function Return Types", STARTS_WITH)
// Try with a search-by-parameter
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
write: (".search-input", "usize pattern")
// To be SURE that the search will be run.
press-key: 'Enter'
@ -64,7 +64,7 @@ assert-attribute: ("#titles > button:nth-of-type(1)", {"class": "selected"})
assert-text: ("#titles > button:nth-of-type(1)", "In Function Parameters", STARTS_WITH)
// Try with a search-by-parameter-and-return
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
write: (".search-input", "pattern -> str")
// To be SURE that the search will be run.
press-key: 'Enter'

View File

@ -1,5 +1,5 @@
// This test ensures that the settings menu display is working as expected.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
show-text: true // needed when we check for colors below.
// First, we check that the settings page doesn't exist.
assert-false: "#settings"
@ -138,7 +138,7 @@ wait-for-css: ("#help-button .popover", {"display": "block"})
assert-css: ("#settings-menu .popover", {"display": "none"})
// Now we go to the settings page to check that the CSS is loaded as expected.
goto: file://|DOC_PATH|/settings.html
goto: "file://" + |DOC_PATH| + "/settings.html"
wait-for: "#settings"
assert-css: (".setting-line .toggle .slider", {"width": "45px", "margin-right": "20px"})

View File

@ -1,5 +1,5 @@
// Check that the various shortcuts are working.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
// We first check that the search input isn't already focused.
assert-false: "input.search-input:focus"
press-key: "s"

View File

@ -1,5 +1,5 @@
// This test checks links colors in sidebar before and after hover.
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
// This is needed so that the text color is computed.
show-text: true

View File

@ -1,5 +1,5 @@
// This test ensures that the reexport of a macro doesn't make the original macro
// displayed twice in the sidebar.
goto: file://|DOC_PATH|/test_docs/macro.repro.html
goto: "file://" + |DOC_PATH| + "/test_docs/macro.repro.html"
wait-for: ".sidebar-elems .macro .macro"
assert-count: ("//*[@class='sidebar-elems']//*[@class='block macro']//a[text()='repro']", 1)

View File

@ -1,5 +1,5 @@
// This test ensures that the mobile sidebar preserves scroll position.
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
// Switching to "mobile view" by reducing the width to 600px.
size: (600, 600)
assert-css: (".sidebar", {"display": "block", "left": "-1000px"})

View File

@ -1,7 +1,7 @@
// This test ensure that the sidebar isn't "hidden" on mobile but instead moved out of the viewport.
// This is especially important for devices for "text-first" content (like for users with
// sight issues).
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
// Switching to "mobile view" by reducing the width to 600px.
size: (600, 600)
assert-css: (".sidebar", {"display": "block", "left": "-1000px"})

View File

@ -1,6 +1,6 @@
// This test ensures that the elements in the sidebar are displayed correctly.
javascript: false
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
// Since the javascript is disabled, there shouldn't be a toggle.
assert-false: "#sidebar-toggle"
wait-for-css: (".sidebar > *", {"visibility": "hidden"})
@ -22,7 +22,7 @@ wait-for-css: ("#sidebar-toggle", {"visibility": "visible"})
wait-for-css: (".sidebar", {"width": "300px"})
assert-local-storage: {"rustdoc-source-sidebar-show": "true"}
click: ".sidebar a.selected"
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
wait-for-css: (".sidebar", {"width": "300px"})
assert-local-storage: {"rustdoc-source-sidebar-show": "true"}
@ -250,7 +250,7 @@ click: "#sidebar-toggle"
wait-for-css: ("#source-sidebar", {"visibility": "visible"})
assert-local-storage: {"rustdoc-source-sidebar-show": "true"}
click: ".sidebar a.selected"
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
wait-for-css: ("#source-sidebar", {"visibility": "hidden"})
assert-local-storage: {"rustdoc-source-sidebar-show": "false"}
// Resize back to desktop size, to check that the sidebar doesn't spontaneously open.

View File

@ -1,6 +1,6 @@
// The goal of this test is to ensure that the sidebar is working as expected in the source
// code pages.
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
// First: desktop mode.
size: (1100, 800)
// We check that the sidebar isn't expanded and has the expected width.
@ -17,7 +17,7 @@ wait-for: "html:not(.expanded)"
assert: "nav.sidebar"
// Checking that only the path to the current file is "open".
goto: file://|DOC_PATH|/src/lib2/another_folder/sub_mod/mod.rs.html
goto: "file://" + |DOC_PATH| + "/src/lib2/another_folder/sub_mod/mod.rs.html"
// First we expand the sidebar again.
click: (10, 10)
// We wait for the sidebar to be expanded.

View File

@ -1,5 +1,5 @@
// Checks multiple things on the sidebar display (width of its elements, colors, etc).
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-property: (".sidebar", {"clientWidth": "200"})
show-text: true
local-storage: {"rustdoc-theme": "light"}
@ -39,13 +39,13 @@ click: ".sidebar h2.location a"
assert-property: ("html", {"scrollTop": "0"})
// We now go back to the crate page to click on the "lib2" crate link.
goto: file://|DOC_PATH|/test_docs/index.html
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-property: (".sidebar", {"clientWidth": "200"})
assert-css: (".sidebar-elems .crate > ul > li:first-child > a", {"color": "rgb(53, 109, 164)"})
click: ".sidebar-elems .crate > ul > li:first-child > a"
// PAGE: lib2/index.html
goto: file://|DOC_PATH|/lib2/index.html
goto: "file://" + |DOC_PATH| + "/lib2/index.html"
assert-property: (".sidebar", {"clientWidth": "200"})
assert-text: (".sidebar > .location", "Crate lib2")
// We check that we have the crates list and that the "current" on is now "lib2".
@ -67,13 +67,13 @@ assert-text: (".sidebar .sidebar-elems .location", "In lib2")
// We check that we don't have the crate list.
assert-false: ".sidebar-elems > .crate"
goto: ./module/index.html
goto: "./module/index.html"
assert-property: (".sidebar", {"clientWidth": "200"})
assert-text: (".sidebar > .location", "Module module")
// We check that we don't have the crate list.
assert-false: ".sidebar-elems > .crate"
goto: ./sub_module/sub_sub_module/index.html
goto: "./sub_module/sub_sub_module/index.html"
assert-property: (".sidebar", {"clientWidth": "200"})
assert-text: (".sidebar > .location", "Module sub_sub_module")
// We check that we don't have the crate list.
@ -82,13 +82,13 @@ assert-text: (".sidebar-elems > section ul > li:nth-child(1)", "Functions")
assert-text: ("#functions + .item-table .item-left > a", "foo")
// Links to trait implementations in the sidebar should not wrap even if they are long.
goto: file://|DOC_PATH|/lib2/struct.HasALongTraitWithParams.html
goto: "file://" + |DOC_PATH| + "/lib2/struct.HasALongTraitWithParams.html"
assert-property: (".sidebar", {"clientWidth": "200"})
assert-property: (".sidebar-elems section .block li > a", {"offsetHeight": 29})
// Test that clicking on of the "In <module>" headings in the sidebar links to the
// appropriate anchor in index.html.
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
assert-property: (".sidebar", {"clientWidth": "200"})
click: ".block.mod h3 a"
// PAGE: index.html

View File

@ -1,6 +1,6 @@
// We check that when the anchor changes and is output of the displayed content,
// the page is scrolled to it.
goto: file://|DOC_PATH|/src/link_to_definition/lib.rs.html
goto: "file://" + |DOC_PATH| + "/src/link_to_definition/lib.rs.html"
// We reduce the window size to make it easier to make an element "out of the page".
size: (600, 800)

Some files were not shown because too many files have changed in this diff Show More