mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Auto merge of #103954 - matthiaskrgr:rollup-tskpxnj, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #103825 (Remove let_underscore_must_use from list of uplifted lints) - #103884 (Add visit_fn_ret_ty to hir intravisit) - #103892 (Properly render asyncness for trait fns without default body) - #103905 (rustdoc: remove redundant mobile CSS `.sidebar-elems { background }`) - #103912 (Add howto for adding new targets) - #103915 (Improve use of ErrorGuaranteed and code cleanup) - #103930 (Move some tests from `src/test/ui` to more reasonable places) - #103931 (Add note to RELEASES.md regarding issue 102754.) - #103938 (rustdoc: clean up hardcoded CSS border color on search results) - #103940 (rustdoc: remove no-op CSS `#main-content > .item-info { margin-top: 0 }`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
2efb0cd4b2
@ -6,7 +6,7 @@ Language
|
||||
- [Error on `as` casts of enums with `#[non_exhaustive]` variants](https://github.com/rust-lang/rust/pull/92744/)
|
||||
- [Stabilize `let else`](https://github.com/rust-lang/rust/pull/93628/)
|
||||
- [Stabilize generic associated types (GATs)](https://github.com/rust-lang/rust/pull/96709/)
|
||||
- [Add lints `let_underscore_drop`, `let_underscore_lock`, and `let_underscore_must_use` from Clippy](https://github.com/rust-lang/rust/pull/97739/)
|
||||
- [Add lints `let_underscore_drop` and `let_underscore_lock` from Clippy](https://github.com/rust-lang/rust/pull/97739/)
|
||||
- [Stabilize `break`ing from arbitrary labeled blocks ("label-break-value")](https://github.com/rust-lang/rust/pull/99332/)
|
||||
- [Uninitialized integers, floats, and raw pointers are now considered immediate UB](https://github.com/rust-lang/rust/pull/98919/).
|
||||
Usage of `MaybeUninit` is the correct way to work with uninitialized memory.
|
||||
@ -87,6 +87,9 @@ Compatibility Notes
|
||||
This strengthens the forward compatibility lint deprecated_cfg_attr_crate_type_name to deny.
|
||||
- [`llvm-has-rust-patches` allows setting the build system to treat the LLVM as having Rust-specific patches](https://github.com/rust-lang/rust/pull/101072)
|
||||
This option may need to be set for distributions that are building Rust with a patched LLVM via `llvm-config`, not the built-in LLVM.
|
||||
- Combining three or more languages (e.g. Objective C, C++ and Rust) into one binary may hit linker limitations when using `lld`. For more information, see [issue 102754][102754].
|
||||
|
||||
[102754]: https://github.com/rust-lang/rust/issues/102754
|
||||
|
||||
Internal Changes
|
||||
----------------
|
||||
|
@ -4,7 +4,7 @@
|
||||
use rustc_hir::def::Namespace;
|
||||
use rustc_middle::ty::layout::{LayoutOf, PrimitiveExt, TyAndLayout};
|
||||
use rustc_middle::ty::print::{FmtPrinter, PrettyPrinter};
|
||||
use rustc_middle::ty::{ConstInt, DelaySpanBugEmitted, Ty};
|
||||
use rustc_middle::ty::{ConstInt, Ty};
|
||||
use rustc_middle::{mir, ty};
|
||||
use rustc_target::abi::{self, Abi, Align, HasDataLayout, Size, TagEncoding};
|
||||
use rustc_target::abi::{VariantIdx, Variants};
|
||||
@ -567,7 +567,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
ty::ConstKind::Param(_) | ty::ConstKind::Placeholder(..) => {
|
||||
throw_inval!(TooGeneric)
|
||||
}
|
||||
ty::ConstKind::Error(DelaySpanBugEmitted { reported, .. }) => {
|
||||
ty::ConstKind::Error(reported) => {
|
||||
throw_inval!(AlreadyReported(reported))
|
||||
}
|
||||
ty::ConstKind::Unevaluated(uv) => {
|
||||
|
@ -45,11 +45,10 @@ impl<'tcx> MirPass<'tcx> for PromoteTemps<'tcx> {
|
||||
// There's not really any point in promoting errorful MIR.
|
||||
//
|
||||
// This does not include MIR that failed const-checking, which we still try to promote.
|
||||
if body.return_ty().references_error() {
|
||||
tcx.sess.delay_span_bug(body.span, "PromoteTemps: MIR had errors");
|
||||
if let Err(_) = body.return_ty().error_reported() {
|
||||
debug!("PromoteTemps: MIR had errors");
|
||||
return;
|
||||
}
|
||||
|
||||
if body.source.promoted.is_some() {
|
||||
return;
|
||||
}
|
||||
|
@ -358,6 +358,9 @@ pub trait Visitor<'v>: Sized {
|
||||
fn visit_where_predicate(&mut self, predicate: &'v WherePredicate<'v>) {
|
||||
walk_where_predicate(self, predicate)
|
||||
}
|
||||
fn visit_fn_ret_ty(&mut self, ret_ty: &'v FnRetTy<'v>) {
|
||||
walk_fn_ret_ty(self, ret_ty)
|
||||
}
|
||||
fn visit_fn_decl(&mut self, fd: &'v FnDecl<'v>) {
|
||||
walk_fn_decl(self, fd)
|
||||
}
|
||||
@ -903,7 +906,7 @@ pub fn walk_fn_decl<'v, V: Visitor<'v>>(visitor: &mut V, function_declaration: &
|
||||
for ty in function_declaration.inputs {
|
||||
visitor.visit_ty(ty)
|
||||
}
|
||||
walk_fn_ret_ty(visitor, &function_declaration.output)
|
||||
visitor.visit_fn_ret_ty(&function_declaration.output)
|
||||
}
|
||||
|
||||
pub fn walk_fn_ret_ty<'v, V: Visitor<'v>>(visitor: &mut V, ret_ty: &'v FnRetTy<'v>) {
|
||||
|
@ -1979,7 +1979,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
}
|
||||
|
||||
err.emit()
|
||||
} else if let Some(reported) = qself_ty.error_reported() {
|
||||
} else if let Err(reported) = qself_ty.error_reported() {
|
||||
reported
|
||||
} else {
|
||||
// Don't print `TyErr` to the user.
|
||||
|
@ -23,9 +23,7 @@ pub(crate) fn orphan_check_impl(
|
||||
impl_def_id: LocalDefId,
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
|
||||
if let Some(err) = trait_ref.error_reported() {
|
||||
return Err(err);
|
||||
}
|
||||
trait_ref.error_reported()?;
|
||||
|
||||
let ret = do_orphan_check_impl(tcx, trait_ref, impl_def_id);
|
||||
if tcx.trait_is_auto(trait_ref.def_id) {
|
||||
|
@ -94,10 +94,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
debug!("pointer_kind({:?}, {:?})", t, span);
|
||||
|
||||
let t = self.resolve_vars_if_possible(t);
|
||||
|
||||
if let Some(reported) = t.error_reported() {
|
||||
return Err(reported);
|
||||
}
|
||||
t.error_reported()?;
|
||||
|
||||
if self.type_is_sized_modulo_regions(self.param_env, t, span) {
|
||||
return Ok(Some(PointerKind::Thin));
|
||||
@ -222,8 +219,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
|
||||
// inference is more completely known.
|
||||
match cast_ty.kind() {
|
||||
ty::Dynamic(_, _, ty::Dyn) | ty::Slice(..) => {
|
||||
let reported = check.report_cast_to_unsized_type(fcx);
|
||||
Err(reported)
|
||||
Err(check.report_cast_to_unsized_type(fcx))
|
||||
}
|
||||
_ => Ok(check),
|
||||
}
|
||||
@ -614,10 +610,11 @@ impl<'a, 'tcx> CastCheck<'tcx> {
|
||||
}
|
||||
|
||||
fn report_cast_to_unsized_type(&self, fcx: &FnCtxt<'a, 'tcx>) -> ErrorGuaranteed {
|
||||
if let Some(reported) =
|
||||
self.cast_ty.error_reported().or_else(|| self.expr_ty.error_reported())
|
||||
{
|
||||
return reported;
|
||||
if let Err(err) = self.cast_ty.error_reported() {
|
||||
return err;
|
||||
}
|
||||
if let Err(err) = self.expr_ty.error_reported() {
|
||||
return err;
|
||||
}
|
||||
|
||||
let tstr = fcx.ty_to_string(self.cast_ty);
|
||||
|
@ -262,7 +262,7 @@ pub fn ancestors<'tcx>(
|
||||
|
||||
if let Some(reported) = specialization_graph.has_errored {
|
||||
Err(reported)
|
||||
} else if let Some(reported) = tcx.type_of(start_from_impl).error_reported() {
|
||||
} else if let Err(reported) = tcx.type_of(start_from_impl).error_reported() {
|
||||
Err(reported)
|
||||
} else {
|
||||
Ok(Ancestors {
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! A subset of a mir body used for const evaluatability checking.
|
||||
use crate::mir;
|
||||
use crate::ty::visit::TypeVisitable;
|
||||
use crate::ty::{self, DelaySpanBugEmitted, EarlyBinder, SubstsRef, Ty, TyCtxt};
|
||||
use crate::ty::{self, EarlyBinder, SubstsRef, Ty, TyCtxt};
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use std::cmp;
|
||||
@ -43,7 +43,7 @@ impl<'tcx> AbstractConst<'tcx> {
|
||||
) -> Result<Option<AbstractConst<'tcx>>, ErrorGuaranteed> {
|
||||
match ct.kind() {
|
||||
ty::ConstKind::Unevaluated(uv) => AbstractConst::new(tcx, uv),
|
||||
ty::ConstKind::Error(DelaySpanBugEmitted { reported, .. }) => Err(reported),
|
||||
ty::ConstKind::Error(reported) => Err(reported),
|
||||
_ => Ok(None),
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ pub enum ConstKind<'tcx> {
|
||||
|
||||
/// A placeholder for a const which could not be computed; this is
|
||||
/// propagated to avoid useless error messages.
|
||||
Error(ty::DelaySpanBugEmitted),
|
||||
Error(ErrorGuaranteed),
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
|
@ -117,7 +117,7 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
|
||||
type BoundTy = ty::BoundTy;
|
||||
type PlaceholderType = ty::PlaceholderType;
|
||||
type InferTy = InferTy;
|
||||
type DelaySpanBugEmitted = DelaySpanBugEmitted;
|
||||
type ErrorGuaranteed = ErrorGuaranteed;
|
||||
type PredicateKind = ty::PredicateKind<'tcx>;
|
||||
type AllocId = crate::mir::interpret::AllocId;
|
||||
|
||||
@ -128,15 +128,6 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
|
||||
type PlaceholderRegion = ty::PlaceholderRegion;
|
||||
}
|
||||
|
||||
/// A type that is not publicly constructable. This prevents people from making [`TyKind::Error`]s
|
||||
/// except through the error-reporting functions on a [`tcx`][TyCtxt].
|
||||
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
|
||||
#[derive(TyEncodable, TyDecodable, HashStable)]
|
||||
pub struct DelaySpanBugEmitted {
|
||||
pub reported: ErrorGuaranteed,
|
||||
_priv: (),
|
||||
}
|
||||
|
||||
type InternedSet<'tcx, T> = ShardedHashMap<InternedInSet<'tcx, T>, ()>;
|
||||
|
||||
pub struct CtxtInterners<'tcx> {
|
||||
@ -1303,7 +1294,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
#[track_caller]
|
||||
pub fn ty_error_with_message<S: Into<MultiSpan>>(self, span: S, msg: &str) -> Ty<'tcx> {
|
||||
let reported = self.sess.delay_span_bug(span, msg);
|
||||
self.mk_ty(Error(DelaySpanBugEmitted { reported, _priv: () }))
|
||||
self.mk_ty(Error(reported))
|
||||
}
|
||||
|
||||
/// Like [TyCtxt::ty_error] but for constants.
|
||||
@ -1325,10 +1316,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
msg: &str,
|
||||
) -> Const<'tcx> {
|
||||
let reported = self.sess.delay_span_bug(span, msg);
|
||||
self.mk_const(ty::ConstS {
|
||||
kind: ty::ConstKind::Error(DelaySpanBugEmitted { reported, _priv: () }),
|
||||
ty,
|
||||
})
|
||||
self.mk_const(ty::ConstS { kind: ty::ConstKind::Error(reported), ty })
|
||||
}
|
||||
|
||||
pub fn consider_optimizing<T: Fn() -> String>(self, msg: T) -> bool {
|
||||
|
@ -80,7 +80,7 @@ pub use self::consts::{
|
||||
};
|
||||
pub use self::context::{
|
||||
tls, CanonicalUserType, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations,
|
||||
CtxtInterners, DeducedParamAttrs, DelaySpanBugEmitted, FreeRegionInfo, GeneratorDiagnosticData,
|
||||
CtxtInterners, DeducedParamAttrs, FreeRegionInfo, GeneratorDiagnosticData,
|
||||
GeneratorInteriorTypeCause, GlobalCtxt, Lift, OnDiskCache, TyCtxt, TypeckResults, UserType,
|
||||
UserTypeAnnotationIndex,
|
||||
};
|
||||
|
@ -240,7 +240,6 @@ TrivialTypeTraversalAndLiftImpls! {
|
||||
Field,
|
||||
interpret::Scalar,
|
||||
rustc_target::abi::Size,
|
||||
ty::DelaySpanBugEmitted,
|
||||
rustc_type_ir::DebruijnIndex,
|
||||
ty::BoundVar,
|
||||
ty::Placeholder<ty::BoundVar>,
|
||||
|
@ -95,11 +95,11 @@ pub trait TypeVisitable<'tcx>: fmt::Debug + Clone {
|
||||
fn references_error(&self) -> bool {
|
||||
self.has_type_flags(TypeFlags::HAS_ERROR)
|
||||
}
|
||||
fn error_reported(&self) -> Option<ErrorGuaranteed> {
|
||||
fn error_reported(&self) -> Result<(), ErrorGuaranteed> {
|
||||
if self.references_error() {
|
||||
Some(ErrorGuaranteed::unchecked_claim_error_was_emitted())
|
||||
Err(ErrorGuaranteed::unchecked_claim_error_was_emitted())
|
||||
} else {
|
||||
None
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
fn has_non_region_param(&self) -> bool {
|
||||
|
@ -122,7 +122,7 @@ mod rustc {
|
||||
|
||||
let c = c.eval(tcx, param_env);
|
||||
|
||||
if let Some(err) = c.error_reported() {
|
||||
if let Err(err) = c.error_reported() {
|
||||
return Some(Self {
|
||||
alignment: true,
|
||||
lifetimes: true,
|
||||
|
@ -413,7 +413,7 @@ fn issue33140_self_ty(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Ty<'_>> {
|
||||
/// Check if a function is async.
|
||||
fn asyncness(tcx: TyCtxt<'_>, def_id: DefId) -> hir::IsAsync {
|
||||
let node = tcx.hir().get_by_def_id(def_id.expect_local());
|
||||
if let Some(fn_kind) = node.fn_kind() { fn_kind.asyncness() } else { hir::IsAsync::NotAsync }
|
||||
node.fn_sig().map_or(hir::IsAsync::NotAsync, |sig| sig.header.asyncness)
|
||||
}
|
||||
|
||||
/// Don't call this directly: use ``tcx.conservative_is_privately_uninhabited`` instead.
|
||||
|
@ -45,7 +45,7 @@ pub trait Interner {
|
||||
type BoundTy: Clone + Debug + Hash + PartialEq + Eq + PartialOrd + Ord;
|
||||
type PlaceholderType: Clone + Debug + Hash + PartialEq + Eq + PartialOrd + Ord;
|
||||
type InferTy: Clone + Debug + Hash + PartialEq + Eq + PartialOrd + Ord;
|
||||
type DelaySpanBugEmitted: Clone + Debug + Hash + PartialEq + Eq + PartialOrd + Ord;
|
||||
type ErrorGuaranteed: Clone + Debug + Hash + PartialEq + Eq + PartialOrd + Ord;
|
||||
type PredicateKind: Clone + Debug + Hash + PartialEq + Eq;
|
||||
type AllocId: Clone + Debug + Hash + PartialEq + Eq + PartialOrd + Ord;
|
||||
|
||||
|
@ -217,7 +217,7 @@ pub enum TyKind<I: Interner> {
|
||||
|
||||
/// A placeholder for a type which could not be computed; this is
|
||||
/// propagated to avoid useless error messages.
|
||||
Error(I::DelaySpanBugEmitted),
|
||||
Error(I::ErrorGuaranteed),
|
||||
}
|
||||
|
||||
impl<I: Interner> TyKind<I> {
|
||||
@ -626,7 +626,7 @@ impl<I: Interner> fmt::Debug for TyKind<I> {
|
||||
// This is manually implemented because a derive would require `I: Encodable`
|
||||
impl<I: Interner, E: TyEncoder> Encodable<E> for TyKind<I>
|
||||
where
|
||||
I::DelaySpanBugEmitted: Encodable<E>,
|
||||
I::ErrorGuaranteed: Encodable<E>,
|
||||
I::AdtDef: Encodable<E>,
|
||||
I::SubstsRef: Encodable<E>,
|
||||
I::DefId: Encodable<E>,
|
||||
@ -645,7 +645,6 @@ where
|
||||
I::BoundTy: Encodable<E>,
|
||||
I::PlaceholderType: Encodable<E>,
|
||||
I::InferTy: Encodable<E>,
|
||||
I::DelaySpanBugEmitted: Encodable<E>,
|
||||
I::PredicateKind: Encodable<E>,
|
||||
I::AllocId: Encodable<E>,
|
||||
{
|
||||
@ -744,7 +743,7 @@ where
|
||||
// This is manually implemented because a derive would require `I: Decodable`
|
||||
impl<I: Interner, D: TyDecoder<I = I>> Decodable<D> for TyKind<I>
|
||||
where
|
||||
I::DelaySpanBugEmitted: Decodable<D>,
|
||||
I::ErrorGuaranteed: Decodable<D>,
|
||||
I::AdtDef: Decodable<D>,
|
||||
I::SubstsRef: Decodable<D>,
|
||||
I::DefId: Decodable<D>,
|
||||
@ -763,7 +762,6 @@ where
|
||||
I::BoundTy: Decodable<D>,
|
||||
I::PlaceholderType: Decodable<D>,
|
||||
I::InferTy: Decodable<D>,
|
||||
I::DelaySpanBugEmitted: Decodable<D>,
|
||||
I::PredicateKind: Decodable<D>,
|
||||
I::AllocId: Decodable<D>,
|
||||
{
|
||||
@ -829,7 +827,7 @@ where
|
||||
I::ParamTy: HashStable<CTX>,
|
||||
I::PlaceholderType: HashStable<CTX>,
|
||||
I::InferTy: HashStable<CTX>,
|
||||
I::DelaySpanBugEmitted: HashStable<CTX>,
|
||||
I::ErrorGuaranteed: HashStable<CTX>,
|
||||
{
|
||||
#[inline]
|
||||
fn hash_stable(
|
||||
|
@ -3,6 +3,7 @@
|
||||
## Table of Contents
|
||||
|
||||
* [General](#general)
|
||||
* [Adding a new target](#adding-a-new-target)
|
||||
* [Tier 3 target policy](#tier-3-target-policy)
|
||||
* [Tier 2 target policy](#tier-2-target-policy)
|
||||
* [Tier 2 with host tools](#tier-2-with-host-tools)
|
||||
@ -104,6 +105,30 @@ indicates something entirely optional, and does not indicate guidance or
|
||||
recommendations. This language is based on [IETF RFC
|
||||
2119](https://tools.ietf.org/html/rfc2119).
|
||||
|
||||
## Adding a new target
|
||||
|
||||
New targets typically start as Tier 3 and then can be promoted later.
|
||||
To propose addition of a new target, open a pull request on [`rust-lang/rust`]:
|
||||
|
||||
- Copy the [Tier 3 target policy](#tier-3-target-policy) to the description
|
||||
and fill it out, see [example][tier3example].
|
||||
- Add a new description for the target in `src/doc/rustc/src/platform-support`
|
||||
using the [template][platform_template].
|
||||
- Add the target to the [SUMMARY.md][summary] (allows wildcards) and
|
||||
[platform-support.md][platformsupport] (must name all targets verbatim).
|
||||
Link to the created description page.
|
||||
- Ensure the pull request is assigned to a member of the [Rust compiler team][rust_compiler_team] by commenting:
|
||||
```text
|
||||
r? compiler-team
|
||||
```
|
||||
|
||||
[tier3example]: https://github.com/rust-lang/rust/pull/94872
|
||||
[platform_template]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/TEMPLATE.md
|
||||
[summary]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/SUMMARY.md
|
||||
[platformsupport]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support.md
|
||||
[rust_compiler_team]: https://www.rust-lang.org/governance/teams/compiler
|
||||
[`rust-lang/rust`]: https://github.com/rust-lang/rust
|
||||
|
||||
## Tier 3 target policy
|
||||
|
||||
At this tier, the Rust project provides no official support for a target, so we
|
||||
|
@ -880,7 +880,7 @@ fn clean_fn_or_proc_macro<'tcx>(
|
||||
ProcMacroItem(ProcMacro { kind, helpers })
|
||||
}
|
||||
None => {
|
||||
let mut func = clean_function(cx, sig, generics, body_id);
|
||||
let mut func = clean_function(cx, sig, generics, FunctionArgs::Body(body_id));
|
||||
clean_fn_decl_legacy_const_generics(&mut func, attrs);
|
||||
FunctionItem(func)
|
||||
}
|
||||
@ -917,16 +917,28 @@ fn clean_fn_decl_legacy_const_generics(func: &mut Function, attrs: &[ast::Attrib
|
||||
}
|
||||
}
|
||||
|
||||
enum FunctionArgs<'tcx> {
|
||||
Body(hir::BodyId),
|
||||
Names(&'tcx [Ident]),
|
||||
}
|
||||
|
||||
fn clean_function<'tcx>(
|
||||
cx: &mut DocContext<'tcx>,
|
||||
sig: &hir::FnSig<'tcx>,
|
||||
generics: &hir::Generics<'tcx>,
|
||||
body_id: hir::BodyId,
|
||||
args: FunctionArgs<'tcx>,
|
||||
) -> Box<Function> {
|
||||
let (generics, decl) = enter_impl_trait(cx, |cx| {
|
||||
// NOTE: generics must be cleaned before args
|
||||
let generics = clean_generics(generics, cx);
|
||||
let args = clean_args_from_types_and_body_id(cx, sig.decl.inputs, body_id);
|
||||
let args = match args {
|
||||
FunctionArgs::Body(body_id) => {
|
||||
clean_args_from_types_and_body_id(cx, sig.decl.inputs, body_id)
|
||||
}
|
||||
FunctionArgs::Names(names) => {
|
||||
clean_args_from_types_and_names(cx, sig.decl.inputs, names)
|
||||
}
|
||||
};
|
||||
let mut decl = clean_fn_decl_with_args(cx, sig.decl, args);
|
||||
if sig.header.is_async() {
|
||||
decl.output = decl.sugared_async_return_type();
|
||||
@ -1051,18 +1063,12 @@ fn clean_trait_item<'tcx>(trait_item: &hir::TraitItem<'tcx>, cx: &mut DocContext
|
||||
),
|
||||
hir::TraitItemKind::Const(ty, None) => TyAssocConstItem(clean_ty(ty, cx)),
|
||||
hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Provided(body)) => {
|
||||
let m = clean_function(cx, sig, trait_item.generics, body);
|
||||
let m = clean_function(cx, sig, trait_item.generics, FunctionArgs::Body(body));
|
||||
MethodItem(m, None)
|
||||
}
|
||||
hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Required(names)) => {
|
||||
let (generics, decl) = enter_impl_trait(cx, |cx| {
|
||||
// NOTE: generics must be cleaned before args
|
||||
let generics = clean_generics(trait_item.generics, cx);
|
||||
let args = clean_args_from_types_and_names(cx, sig.decl.inputs, names);
|
||||
let decl = clean_fn_decl_with_args(cx, sig.decl, args);
|
||||
(generics, decl)
|
||||
});
|
||||
TyMethodItem(Box::new(Function { decl, generics }))
|
||||
let m = clean_function(cx, sig, trait_item.generics, FunctionArgs::Names(names));
|
||||
TyMethodItem(m)
|
||||
}
|
||||
hir::TraitItemKind::Type(bounds, Some(default)) => {
|
||||
let generics = enter_impl_trait(cx, |cx| clean_generics(trait_item.generics, cx));
|
||||
@ -1099,7 +1105,7 @@ pub(crate) fn clean_impl_item<'tcx>(
|
||||
AssocConstItem(clean_ty(ty, cx), default)
|
||||
}
|
||||
hir::ImplItemKind::Fn(ref sig, body) => {
|
||||
let m = clean_function(cx, sig, impl_.generics, body);
|
||||
let m = clean_function(cx, sig, impl_.generics, FunctionArgs::Body(body));
|
||||
let defaultness = cx.tcx.impl_defaultness(impl_.owner_id);
|
||||
MethodItem(m, Some(defaultness))
|
||||
}
|
||||
|
@ -694,13 +694,10 @@ impl Item {
|
||||
asyncness: hir::IsAsync::NotAsync,
|
||||
}
|
||||
}
|
||||
ItemKind::FunctionItem(_) | ItemKind::MethodItem(_, _) => {
|
||||
ItemKind::FunctionItem(_) | ItemKind::MethodItem(_, _) | ItemKind::TyMethodItem(_) => {
|
||||
let def_id = self.item_id.as_def_id().unwrap();
|
||||
build_fn_header(def_id, tcx, tcx.asyncness(def_id))
|
||||
}
|
||||
ItemKind::TyMethodItem(_) => {
|
||||
build_fn_header(self.item_id.as_def_id().unwrap(), tcx, hir::IsAsync::NotAsync)
|
||||
}
|
||||
_ => return None,
|
||||
};
|
||||
Some(header)
|
||||
|
@ -677,7 +677,6 @@ pre, .rustdoc.source .example-wrap {
|
||||
}
|
||||
|
||||
#main-content > .item-info {
|
||||
margin-top: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
@ -894,7 +893,7 @@ so that we can apply CSS-filters to change the arrow color in themes */
|
||||
/* A little margin ensures the browser's outlining of focused links has room to display. */
|
||||
margin-left: 2px;
|
||||
margin-right: 2px;
|
||||
border-bottom: 1px solid #aaa3;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.search-results > a > div {
|
||||
@ -1796,7 +1795,6 @@ in storage.js
|
||||
|
||||
.sidebar-elems {
|
||||
margin-top: 1em;
|
||||
background-color: var(--sidebar-background-color);
|
||||
}
|
||||
|
||||
.content {
|
||||
@ -1875,7 +1873,6 @@ in storage.js
|
||||
|
||||
/* Display an alternating layout on tablets and phones */
|
||||
.search-results > a {
|
||||
border-bottom: 1px solid #aaa9;
|
||||
padding: 5px 0px;
|
||||
}
|
||||
.search-results .result-name, .search-results div.desc {
|
||||
|
@ -75,6 +75,12 @@ assert-css: (
|
||||
{"color": "rgb(0, 150, 207)"},
|
||||
)
|
||||
|
||||
// Checking the color of the bottom border.
|
||||
assert-css: (
|
||||
".search-results > a",
|
||||
{"border-bottom-color": "rgb(92, 103, 115)"}
|
||||
)
|
||||
|
||||
// Checking the color of "keyword" text.
|
||||
assert-css: (
|
||||
"//*[@class='result-name']//*[text()='(keyword)']",
|
||||
@ -181,6 +187,12 @@ assert-css: (
|
||||
{"color": "rgb(221, 221, 221)"},
|
||||
)
|
||||
|
||||
// Checking the color of the bottom border.
|
||||
assert-css: (
|
||||
".search-results > a",
|
||||
{"border-bottom-color": "rgb(224, 224, 224)"}
|
||||
)
|
||||
|
||||
// Checking the color for "keyword" text.
|
||||
assert-css: (
|
||||
"//*[@class='result-name']//*[text()='(keyword)']",
|
||||
@ -272,6 +284,12 @@ assert-css: (
|
||||
{"color": "rgb(0, 0, 0)"},
|
||||
)
|
||||
|
||||
// Checking the color of the bottom border.
|
||||
assert-css: (
|
||||
".search-results > a",
|
||||
{"border-bottom-color": "rgb(224, 224, 224)"}
|
||||
)
|
||||
|
||||
// Checking the color for "keyword" text.
|
||||
assert-css: (
|
||||
"//*[@class='result-name']//*[text()='(keyword)']",
|
||||
|
14
src/test/rustdoc/async-trait-sig.rs
Normal file
14
src/test/rustdoc/async-trait-sig.rs
Normal file
@ -0,0 +1,14 @@
|
||||
// edition:2021
|
||||
|
||||
#![feature(async_fn_in_trait)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
pub trait Foo {
|
||||
// @has async_trait_sig/trait.Foo.html '//h4[@class="code-header"]' "async fn bar() -> i32"
|
||||
async fn bar() -> i32;
|
||||
|
||||
// @has async_trait_sig/trait.Foo.html '//h4[@class="code-header"]' "async fn baz() -> i32"
|
||||
async fn baz() -> i32 {
|
||||
1
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/rfc1623.rs:28:8
|
||||
--> $DIR/rfc1623-2.rs:28:8
|
||||
|
|
||||
LL | f: &id,
|
||||
| ^^^ one type is more general than the other
|
||||
@ -8,7 +8,7 @@ LL | f: &id,
|
||||
found trait `Fn<(&Foo<'_>,)>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/rfc1623.rs:28:8
|
||||
--> $DIR/rfc1623-2.rs:28:8
|
||||
|
|
||||
LL | f: &id,
|
||||
| ^^^ one type is more general than the other
|
||||
@ -17,7 +17,7 @@ LL | f: &id,
|
||||
found trait `Fn<(&Foo<'_>,)>`
|
||||
|
||||
error: implementation of `FnOnce` is not general enough
|
||||
--> $DIR/rfc1623.rs:28:8
|
||||
--> $DIR/rfc1623-2.rs:28:8
|
||||
|
|
||||
LL | f: &id,
|
||||
| ^^^ implementation of `FnOnce` is not general enough
|
||||
@ -26,7 +26,7 @@ LL | f: &id,
|
||||
= note: ...but it actually implements `FnOnce<(&'2 Foo<'_>,)>`, for some specific lifetime `'2`
|
||||
|
||||
error: implementation of `FnOnce` is not general enough
|
||||
--> $DIR/rfc1623.rs:28:8
|
||||
--> $DIR/rfc1623-2.rs:28:8
|
||||
|
|
||||
LL | f: &id,
|
||||
| ^^^ implementation of `FnOnce` is not general enough
|
@ -1,5 +1,5 @@
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/rfc1623-2.rs:8:42
|
||||
--> $DIR/rfc1623-3.rs:8:42
|
||||
|
|
||||
LL | static NON_ELIDABLE_FN: &fn(&u8, &u8) -> &u8 =
|
||||
| --- --- ^ expected named lifetime parameter
|
||||
@ -12,7 +12,7 @@ LL | static NON_ELIDABLE_FN: &for<'a> fn(&'a u8, &'a u8) -> &'a u8 =
|
||||
| +++++++ ++ ++ ++
|
||||
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/rfc1623-2.rs:10:39
|
||||
--> $DIR/rfc1623-3.rs:10:39
|
||||
|
|
||||
LL | &(non_elidable as fn(&u8, &u8) -> &u8);
|
||||
| --- --- ^ expected named lifetime parameter
|
||||
@ -24,7 +24,7 @@ LL | &(non_elidable as for<'a> fn(&'a u8, &'a u8) -> &'a u8);
|
||||
| +++++++ ++ ++ ++
|
||||
|
||||
error[E0605]: non-primitive cast: `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8 {non_elidable}` as `for<'a, 'b> fn(&'a u8, &'b u8) -> &u8`
|
||||
--> $DIR/rfc1623-2.rs:10:6
|
||||
--> $DIR/rfc1623-3.rs:10:6
|
||||
|
|
||||
LL | &(non_elidable as fn(&u8, &u8) -> &u8);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast
|
@ -7,7 +7,7 @@ use std::path::Path;
|
||||
|
||||
const ENTRY_LIMIT: usize = 1000;
|
||||
// FIXME: The following limits should be reduced eventually.
|
||||
const ROOT_ENTRY_LIMIT: usize = 948;
|
||||
const ROOT_ENTRY_LIMIT: usize = 941;
|
||||
const ISSUES_ENTRY_LIMIT: usize = 2117;
|
||||
|
||||
fn check_entries(path: &Path, bad: &mut bool) {
|
||||
|
Loading…
Reference in New Issue
Block a user