Auto merge of #139938 - matthiaskrgr:rollup-19ddpus, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #139084 (hygiene: Rename semi-transparent to semi-opaque)
 - #139236 (Use a session counter to make anon dep nodes unique)
 - #139650 (Fix `register_group_alias` for tools)
 - #139770 (Rename `LifetimeName` as `LifetimeKind`.)
 - #139846 (Remove `kw::Empty` uses in rustdoc)
 - #139891 (Include optional dso_local marker for functions in `enum-match.rs`)
 - #139908 (parser: Remove old diagnostic notes for type ascription syntax)
 - #139917 (fix for multiple `#[repr(align(N))]` on functions)

Failed merges:

 - #139615 (Remove `name_or_empty`)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2025-04-17 01:38:17 +00:00
commit 79a272c640
66 changed files with 265 additions and 302 deletions

View File

@ -1767,21 +1767,21 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
) -> &'hir hir::Lifetime { ) -> &'hir hir::Lifetime {
let res = self.resolver.get_lifetime_res(id).unwrap_or(LifetimeRes::Error); let res = self.resolver.get_lifetime_res(id).unwrap_or(LifetimeRes::Error);
let res = match res { let res = match res {
LifetimeRes::Param { param, .. } => hir::LifetimeName::Param(param), LifetimeRes::Param { param, .. } => hir::LifetimeKind::Param(param),
LifetimeRes::Fresh { param, .. } => { LifetimeRes::Fresh { param, .. } => {
debug_assert_eq!(ident.name, kw::UnderscoreLifetime); debug_assert_eq!(ident.name, kw::UnderscoreLifetime);
let param = self.local_def_id(param); let param = self.local_def_id(param);
hir::LifetimeName::Param(param) hir::LifetimeKind::Param(param)
} }
LifetimeRes::Infer => { LifetimeRes::Infer => {
debug_assert_eq!(ident.name, kw::UnderscoreLifetime); debug_assert_eq!(ident.name, kw::UnderscoreLifetime);
hir::LifetimeName::Infer hir::LifetimeKind::Infer
} }
LifetimeRes::Static { .. } => { LifetimeRes::Static { .. } => {
debug_assert!(matches!(ident.name, kw::StaticLifetime | kw::UnderscoreLifetime)); debug_assert!(matches!(ident.name, kw::StaticLifetime | kw::UnderscoreLifetime));
hir::LifetimeName::Static hir::LifetimeKind::Static
} }
LifetimeRes::Error => hir::LifetimeName::Error, LifetimeRes::Error => hir::LifetimeKind::Error,
LifetimeRes::ElidedAnchor { .. } => { LifetimeRes::ElidedAnchor { .. } => {
panic!("Unexpected `ElidedAnchar` {:?} at {:?}", ident, ident.span); panic!("Unexpected `ElidedAnchar` {:?} at {:?}", ident, ident.span);
} }
@ -2388,7 +2388,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
let r = hir::Lifetime::new( let r = hir::Lifetime::new(
self.next_id(), self.next_id(),
Ident::new(kw::UnderscoreLifetime, self.lower_span(span)), Ident::new(kw::UnderscoreLifetime, self.lower_span(span)),
hir::LifetimeName::ImplicitObjectLifetimeDefault, hir::LifetimeKind::ImplicitObjectLifetimeDefault,
IsAnonInPath::No, IsAnonInPath::No,
); );
debug!("elided_dyn_bound: r={:?}", r); debug!("elided_dyn_bound: r={:?}", r);

View File

@ -20,7 +20,7 @@ impl SingleAttributeParser for TransparencyParser {
fn convert(cx: &AcceptContext<'_>, args: &ArgParser<'_>) -> Option<AttributeKind> { fn convert(cx: &AcceptContext<'_>, args: &ArgParser<'_>) -> Option<AttributeKind> {
match args.name_value().and_then(|nv| nv.value_as_str()) { match args.name_value().and_then(|nv| nv.value_as_str()) {
Some(sym::transparent) => Some(Transparency::Transparent), Some(sym::transparent) => Some(Transparency::Transparent),
Some(sym::semitransparent) => Some(Transparency::SemiTransparent), Some(sym::semiopaque | sym::semitransparent) => Some(Transparency::SemiOpaque),
Some(sym::opaque) => Some(Transparency::Opaque), Some(sym::opaque) => Some(Transparency::Opaque),
Some(other) => { Some(other) => {
cx.dcx().span_err(cx.attr_span, format!("unknown macro transparency: `{other}`")); cx.dcx().span_err(cx.attr_span, format!("unknown macro transparency: `{other}`"));

View File

@ -888,7 +888,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
// Skip `async` desugaring `impl Future`. // Skip `async` desugaring `impl Future`.
} }
if let TyKind::TraitObject(_, lt) = alias_ty.kind { if let TyKind::TraitObject(_, lt) = alias_ty.kind {
if lt.res == hir::LifetimeName::ImplicitObjectLifetimeDefault { if lt.kind == hir::LifetimeKind::ImplicitObjectLifetimeDefault {
spans_suggs.push((lt.ident.span.shrink_to_hi(), " + 'a".to_string())); spans_suggs.push((lt.ident.span.shrink_to_hi(), " + 'a".to_string()));
} else { } else {
spans_suggs.push((lt.ident.span, "'a".to_string())); spans_suggs.push((lt.ident.span, "'a".to_string()));

View File

@ -114,7 +114,8 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
AttributeKind::Repr(reprs) => { AttributeKind::Repr(reprs) => {
codegen_fn_attrs.alignment = reprs codegen_fn_attrs.alignment = reprs
.iter() .iter()
.find_map(|(r, _)| if let ReprAlign(x) = r { Some(*x) } else { None }); .filter_map(|(r, _)| if let ReprAlign(x) = r { Some(*x) } else { None })
.max();
} }
_ => {} _ => {}

View File

@ -767,7 +767,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
), ),
rustc_attr!( rustc_attr!(
rustc_macro_transparency, Normal, rustc_macro_transparency, Normal,
template!(NameValueStr: "transparent|semitransparent|opaque"), ErrorFollowing, template!(NameValueStr: "transparent|semiopaque|opaque"), ErrorFollowing,
EncodeCrossCrate::Yes, "used internally for testing macro hygiene", EncodeCrossCrate::Yes, "used internally for testing macro hygiene",
), ),
rustc_attr!( rustc_attr!(

View File

@ -42,7 +42,7 @@ pub enum IsAnonInPath {
} }
/// A lifetime. The valid field combinations are non-obvious. The following /// A lifetime. The valid field combinations are non-obvious. The following
/// example shows some of them. See also the comments on `LifetimeName`. /// example shows some of them. See also the comments on `LifetimeKind`.
/// ``` /// ```
/// #[repr(C)] /// #[repr(C)]
/// struct S<'a>(&'a u32); // res=Param, name='a, IsAnonInPath::No /// struct S<'a>(&'a u32); // res=Param, name='a, IsAnonInPath::No
@ -84,7 +84,7 @@ pub struct Lifetime {
pub ident: Ident, pub ident: Ident,
/// Semantics of this lifetime. /// Semantics of this lifetime.
pub res: LifetimeName, pub kind: LifetimeKind,
/// Is the lifetime anonymous and in a path? Used only for error /// Is the lifetime anonymous and in a path? Used only for error
/// suggestions. See `Lifetime::suggestion` for example use. /// suggestions. See `Lifetime::suggestion` for example use.
@ -130,7 +130,7 @@ impl ParamName {
} }
#[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable_Generic)] #[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable_Generic)]
pub enum LifetimeName { pub enum LifetimeKind {
/// User-given names or fresh (synthetic) names. /// User-given names or fresh (synthetic) names.
Param(LocalDefId), Param(LocalDefId),
@ -160,16 +160,16 @@ pub enum LifetimeName {
Static, Static,
} }
impl LifetimeName { impl LifetimeKind {
fn is_elided(&self) -> bool { fn is_elided(&self) -> bool {
match self { match self {
LifetimeName::ImplicitObjectLifetimeDefault | LifetimeName::Infer => true, LifetimeKind::ImplicitObjectLifetimeDefault | LifetimeKind::Infer => true,
// It might seem surprising that `Fresh` counts as not *elided* // It might seem surprising that `Fresh` counts as not *elided*
// -- but this is because, as far as the code in the compiler is // -- but this is because, as far as the code in the compiler is
// concerned -- `Fresh` variants act equivalently to "some fresh name". // concerned -- `Fresh` variants act equivalently to "some fresh name".
// They correspond to early-bound regions on an impl, in other words. // They correspond to early-bound regions on an impl, in other words.
LifetimeName::Error | LifetimeName::Param(..) | LifetimeName::Static => false, LifetimeKind::Error | LifetimeKind::Param(..) | LifetimeKind::Static => false,
} }
} }
} }
@ -184,10 +184,10 @@ impl Lifetime {
pub fn new( pub fn new(
hir_id: HirId, hir_id: HirId,
ident: Ident, ident: Ident,
res: LifetimeName, kind: LifetimeKind,
is_anon_in_path: IsAnonInPath, is_anon_in_path: IsAnonInPath,
) -> Lifetime { ) -> Lifetime {
let lifetime = Lifetime { hir_id, ident, res, is_anon_in_path }; let lifetime = Lifetime { hir_id, ident, kind, is_anon_in_path };
// Sanity check: elided lifetimes form a strict subset of anonymous lifetimes. // Sanity check: elided lifetimes form a strict subset of anonymous lifetimes.
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
@ -202,7 +202,7 @@ impl Lifetime {
} }
pub fn is_elided(&self) -> bool { pub fn is_elided(&self) -> bool {
self.res.is_elided() self.kind.is_elided()
} }
pub fn is_anonymous(&self) -> bool { pub fn is_anonymous(&self) -> bool {
@ -1014,7 +1014,7 @@ pub struct WhereRegionPredicate<'hir> {
impl<'hir> WhereRegionPredicate<'hir> { impl<'hir> WhereRegionPredicate<'hir> {
/// Returns `true` if `param_def_id` matches the `lifetime` of this predicate. /// Returns `true` if `param_def_id` matches the `lifetime` of this predicate.
fn is_param_bound(&self, param_def_id: LocalDefId) -> bool { fn is_param_bound(&self, param_def_id: LocalDefId) -> bool {
self.lifetime.res == LifetimeName::Param(param_def_id) self.lifetime.kind == LifetimeKind::Param(param_def_id)
} }
} }

View File

@ -57,7 +57,7 @@ fn trait_object_roundtrips_impl(syntax: TraitObjectSyntax) {
Lifetime { Lifetime {
hir_id: HirId::INVALID, hir_id: HirId::INVALID,
ident: Ident::new(sym::name, DUMMY_SP), ident: Ident::new(sym::name, DUMMY_SP),
res: LifetimeName::Static, kind: LifetimeKind::Static,
is_anon_in_path: IsAnonInPath::No, is_anon_in_path: IsAnonInPath::No,
} }
}, },

View File

@ -16,7 +16,7 @@ use rustc_errors::ErrorGuaranteed;
use rustc_hir::def::{DefKind, Res}; use rustc_hir::def::{DefKind, Res};
use rustc_hir::intravisit::{self, InferKind, Visitor, VisitorExt}; use rustc_hir::intravisit::{self, InferKind, Visitor, VisitorExt};
use rustc_hir::{ use rustc_hir::{
self as hir, AmbigArg, GenericArg, GenericParam, GenericParamKind, HirId, LifetimeName, Node, self as hir, AmbigArg, GenericArg, GenericParam, GenericParamKind, HirId, LifetimeKind, Node,
}; };
use rustc_macros::extension; use rustc_macros::extension;
use rustc_middle::hir::nested_filter; use rustc_middle::hir::nested_filter;
@ -646,14 +646,14 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
arg: &'tcx hir::PreciseCapturingArg<'tcx>, arg: &'tcx hir::PreciseCapturingArg<'tcx>,
) -> Self::Result { ) -> Self::Result {
match *arg { match *arg {
hir::PreciseCapturingArg::Lifetime(lt) => match lt.res { hir::PreciseCapturingArg::Lifetime(lt) => match lt.kind {
LifetimeName::Param(def_id) => { LifetimeKind::Param(def_id) => {
self.resolve_lifetime_ref(def_id, lt); self.resolve_lifetime_ref(def_id, lt);
} }
LifetimeName::Error => {} LifetimeKind::Error => {}
LifetimeName::ImplicitObjectLifetimeDefault LifetimeKind::ImplicitObjectLifetimeDefault
| LifetimeName::Infer | LifetimeKind::Infer
| LifetimeName::Static => { | LifetimeKind::Static => {
self.tcx.dcx().emit_err(errors::BadPreciseCapture { self.tcx.dcx().emit_err(errors::BadPreciseCapture {
span: lt.ident.span, span: lt.ident.span,
kind: "lifetime", kind: "lifetime",
@ -774,26 +774,26 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
); );
} }
}); });
match lifetime.res { match lifetime.kind {
LifetimeName::ImplicitObjectLifetimeDefault => { LifetimeKind::ImplicitObjectLifetimeDefault => {
// If the user does not write *anything*, we // If the user does not write *anything*, we
// use the object lifetime defaulting // use the object lifetime defaulting
// rules. So e.g., `Box<dyn Debug>` becomes // rules. So e.g., `Box<dyn Debug>` becomes
// `Box<dyn Debug + 'static>`. // `Box<dyn Debug + 'static>`.
self.resolve_object_lifetime_default(&*lifetime) self.resolve_object_lifetime_default(&*lifetime)
} }
LifetimeName::Infer => { LifetimeKind::Infer => {
// If the user writes `'_`, we use the *ordinary* elision // If the user writes `'_`, we use the *ordinary* elision
// rules. So the `'_` in e.g., `Box<dyn Debug + '_>` will be // rules. So the `'_` in e.g., `Box<dyn Debug + '_>` will be
// resolved the same as the `'_` in `&'_ Foo`. // resolved the same as the `'_` in `&'_ Foo`.
// //
// cc #48468 // cc #48468
} }
LifetimeName::Param(..) | LifetimeName::Static => { LifetimeKind::Param(..) | LifetimeKind::Static => {
// If the user wrote an explicit name, use that. // If the user wrote an explicit name, use that.
self.visit_lifetime(&*lifetime); self.visit_lifetime(&*lifetime);
} }
LifetimeName::Error => {} LifetimeKind::Error => {}
} }
} }
hir::TyKind::Ref(lifetime_ref, ref mt) => { hir::TyKind::Ref(lifetime_ref, ref mt) => {
@ -873,17 +873,17 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
#[instrument(level = "debug", skip(self))] #[instrument(level = "debug", skip(self))]
fn visit_lifetime(&mut self, lifetime_ref: &'tcx hir::Lifetime) { fn visit_lifetime(&mut self, lifetime_ref: &'tcx hir::Lifetime) {
match lifetime_ref.res { match lifetime_ref.kind {
hir::LifetimeName::Static => { hir::LifetimeKind::Static => {
self.insert_lifetime(lifetime_ref, ResolvedArg::StaticLifetime) self.insert_lifetime(lifetime_ref, ResolvedArg::StaticLifetime)
} }
hir::LifetimeName::Param(param_def_id) => { hir::LifetimeKind::Param(param_def_id) => {
self.resolve_lifetime_ref(param_def_id, lifetime_ref) self.resolve_lifetime_ref(param_def_id, lifetime_ref)
} }
// If we've already reported an error, just ignore `lifetime_ref`. // If we've already reported an error, just ignore `lifetime_ref`.
hir::LifetimeName::Error => {} hir::LifetimeKind::Error => {}
// Those will be resolved by typechecking. // Those will be resolved by typechecking.
hir::LifetimeName::ImplicitObjectLifetimeDefault | hir::LifetimeName::Infer => {} hir::LifetimeKind::ImplicitObjectLifetimeDefault | hir::LifetimeKind::Infer => {}
} }
} }
@ -1063,15 +1063,15 @@ fn object_lifetime_default(tcx: TyCtxt<'_>, param_def_id: LocalDefId) -> ObjectL
for bound in bound.bounds { for bound in bound.bounds {
if let hir::GenericBound::Outlives(lifetime) = bound { if let hir::GenericBound::Outlives(lifetime) = bound {
set.insert(lifetime.res); set.insert(lifetime.kind);
} }
} }
} }
match set { match set {
Set1::Empty => ObjectLifetimeDefault::Empty, Set1::Empty => ObjectLifetimeDefault::Empty,
Set1::One(hir::LifetimeName::Static) => ObjectLifetimeDefault::Static, Set1::One(hir::LifetimeKind::Static) => ObjectLifetimeDefault::Static,
Set1::One(hir::LifetimeName::Param(param_def_id)) => { Set1::One(hir::LifetimeKind::Param(param_def_id)) => {
ObjectLifetimeDefault::Param(param_def_id.to_def_id()) ObjectLifetimeDefault::Param(param_def_id.to_def_id())
} }
_ => ObjectLifetimeDefault::Ambiguous, _ => ObjectLifetimeDefault::Ambiguous,
@ -1241,7 +1241,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
// Fresh lifetimes in APIT used to be allowed in async fns and forbidden in // Fresh lifetimes in APIT used to be allowed in async fns and forbidden in
// regular fns. // regular fns.
if let Some(hir::PredicateOrigin::ImplTrait) = where_bound_origin if let Some(hir::PredicateOrigin::ImplTrait) = where_bound_origin
&& let hir::LifetimeName::Param(param_id) = lifetime_ref.res && let hir::LifetimeKind::Param(param_id) = lifetime_ref.kind
&& let Some(generics) = && let Some(generics) =
self.tcx.hir_get_generics(self.tcx.local_parent(param_id)) self.tcx.hir_get_generics(self.tcx.local_parent(param_id))
&& let Some(param) = generics.params.iter().find(|p| p.def_id == param_id) && let Some(param) = generics.params.iter().find(|p| p.def_id == param_id)
@ -2440,7 +2440,7 @@ fn is_late_bound_map(
} }
fn visit_lifetime(&mut self, lifetime_ref: &'v hir::Lifetime) { fn visit_lifetime(&mut self, lifetime_ref: &'v hir::Lifetime) {
if let hir::LifetimeName::Param(def_id) = lifetime_ref.res { if let hir::LifetimeKind::Param(def_id) = lifetime_ref.kind {
self.regions.insert(def_id); self.regions.insert(def_id);
} }
} }
@ -2453,7 +2453,7 @@ fn is_late_bound_map(
impl<'tcx> Visitor<'tcx> for AllCollector { impl<'tcx> Visitor<'tcx> for AllCollector {
fn visit_lifetime(&mut self, lifetime_ref: &'tcx hir::Lifetime) { fn visit_lifetime(&mut self, lifetime_ref: &'tcx hir::Lifetime) {
if let hir::LifetimeName::Param(def_id) = lifetime_ref.res { if let hir::LifetimeKind::Param(def_id) = lifetime_ref.kind {
self.regions.insert(def_id); self.regions.insert(def_id);
} }
} }

View File

@ -415,7 +415,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
self.lower_lifetime(lifetime, RegionInferReason::ExplicitObjectLifetime) self.lower_lifetime(lifetime, RegionInferReason::ExplicitObjectLifetime)
} else { } else {
let reason = let reason =
if let hir::LifetimeName::ImplicitObjectLifetimeDefault = lifetime.res { if let hir::LifetimeKind::ImplicitObjectLifetimeDefault = lifetime.kind {
if let hir::Node::Ty(hir::Ty { if let hir::Node::Ty(hir::Ty {
kind: hir::TyKind::Ref(parent_lifetime, _), kind: hir::TyKind::Ref(parent_lifetime, _),
.. ..

View File

@ -83,11 +83,6 @@ enum TargetLint {
Ignored, Ignored,
} }
pub enum FindLintError {
NotFound,
Removed,
}
struct LintAlias { struct LintAlias {
name: &'static str, name: &'static str,
/// Whether deprecation warnings should be suppressed for this alias. /// Whether deprecation warnings should be suppressed for this alias.
@ -231,13 +226,24 @@ impl LintStore {
} }
} }
pub fn register_group_alias(&mut self, lint_name: &'static str, alias: &'static str) { fn insert_group(&mut self, name: &'static str, group: LintGroup) {
self.lint_groups.insert( let previous = self.lint_groups.insert(name, group);
if previous.is_some() {
bug!("group {name:?} already exists");
}
}
pub fn register_group_alias(&mut self, group_name: &'static str, alias: &'static str) {
let Some(LintGroup { lint_ids, .. }) = self.lint_groups.get(group_name) else {
bug!("group alias {alias:?} points to unregistered group {group_name:?}")
};
self.insert_group(
alias, alias,
LintGroup { LintGroup {
lint_ids: vec![], lint_ids: lint_ids.clone(),
is_externally_loaded: false, is_externally_loaded: false,
depr: Some(LintAlias { name: lint_name, silent: true }), depr: Some(LintAlias { name: group_name, silent: true }),
}, },
); );
} }
@ -249,24 +255,17 @@ impl LintStore {
deprecated_name: Option<&'static str>, deprecated_name: Option<&'static str>,
to: Vec<LintId>, to: Vec<LintId>,
) { ) {
let new = self
.lint_groups
.insert(name, LintGroup { lint_ids: to, is_externally_loaded, depr: None })
.is_none();
if let Some(deprecated) = deprecated_name { if let Some(deprecated) = deprecated_name {
self.lint_groups.insert( self.insert_group(
deprecated, deprecated,
LintGroup { LintGroup {
lint_ids: vec![], lint_ids: to.clone(),
is_externally_loaded, is_externally_loaded,
depr: Some(LintAlias { name, silent: false }), depr: Some(LintAlias { name, silent: false }),
}, },
); );
} }
self.insert_group(name, LintGroup { lint_ids: to, is_externally_loaded, depr: None });
if !new {
bug!("duplicate specification of lint group {}", name);
}
} }
/// This lint should give no warning and have no effect. /// This lint should give no warning and have no effect.
@ -292,23 +291,15 @@ impl LintStore {
self.by_name.insert(name.into(), Removed(reason.into())); self.by_name.insert(name.into(), Removed(reason.into()));
} }
pub fn find_lints(&self, mut lint_name: &str) -> Result<Vec<LintId>, FindLintError> { pub fn find_lints(&self, lint_name: &str) -> Option<&[LintId]> {
match self.by_name.get(lint_name) { match self.by_name.get(lint_name) {
Some(&Id(lint_id)) => Ok(vec![lint_id]), Some(Id(lint_id)) => Some(slice::from_ref(lint_id)),
Some(&Renamed(_, lint_id)) => Ok(vec![lint_id]), Some(Renamed(_, lint_id)) => Some(slice::from_ref(lint_id)),
Some(&Removed(_)) => Err(FindLintError::Removed), Some(Removed(_)) => None,
Some(&Ignored) => Ok(vec![]), Some(Ignored) => Some(&[]),
None => loop { None => match self.lint_groups.get(lint_name) {
return match self.lint_groups.get(lint_name) { Some(LintGroup { lint_ids, .. }) => Some(lint_ids),
Some(LintGroup { lint_ids, depr, .. }) => { None => None,
if let Some(LintAlias { name, .. }) = depr {
lint_name = name;
continue;
}
Ok(lint_ids.clone())
}
None => Err(FindLintError::Removed),
};
}, },
} }
} }
@ -374,8 +365,12 @@ impl LintStore {
CheckLintNameResult::MissingTool CheckLintNameResult::MissingTool
}; };
} }
Some(LintGroup { lint_ids, .. }) => { Some(LintGroup { lint_ids, depr, .. }) => {
return CheckLintNameResult::Tool(lint_ids, None); return if let &Some(LintAlias { name, silent: false }) = depr {
CheckLintNameResult::Tool(lint_ids, Some(name.to_string()))
} else {
CheckLintNameResult::Tool(lint_ids, None)
};
} }
}, },
Some(Id(id)) => return CheckLintNameResult::Tool(slice::from_ref(id), None), Some(Id(id)) => return CheckLintNameResult::Tool(slice::from_ref(id), None),
@ -393,15 +388,11 @@ impl LintStore {
None => self.check_tool_name_for_backwards_compat(&complete_name, "clippy"), None => self.check_tool_name_for_backwards_compat(&complete_name, "clippy"),
Some(LintGroup { lint_ids, depr, .. }) => { Some(LintGroup { lint_ids, depr, .. }) => {
// Check if the lint group name is deprecated // Check if the lint group name is deprecated
if let Some(LintAlias { name, silent }) = depr { if let &Some(LintAlias { name, silent: false }) = depr {
let LintGroup { lint_ids, .. } = self.lint_groups.get(name).unwrap(); CheckLintNameResult::Tool(lint_ids, Some(name.to_string()))
return if *silent { } else {
CheckLintNameResult::Ok(lint_ids) CheckLintNameResult::Ok(lint_ids)
} else {
CheckLintNameResult::Tool(lint_ids, Some((*name).to_string()))
};
} }
CheckLintNameResult::Ok(lint_ids)
} }
}, },
Some(Id(id)) => CheckLintNameResult::Ok(slice::from_ref(id)), Some(Id(id)) => CheckLintNameResult::Ok(slice::from_ref(id)),
@ -412,7 +403,7 @@ impl LintStore {
fn no_lint_suggestion(&self, lint_name: &str, tool_name: &str) -> CheckLintNameResult<'_> { fn no_lint_suggestion(&self, lint_name: &str, tool_name: &str) -> CheckLintNameResult<'_> {
let name_lower = lint_name.to_lowercase(); let name_lower = lint_name.to_lowercase();
if lint_name.chars().any(char::is_uppercase) && self.find_lints(&name_lower).is_ok() { if lint_name.chars().any(char::is_uppercase) && self.find_lints(&name_lower).is_some() {
// First check if the lint name is (partly) in upper case instead of lower case... // First check if the lint name is (partly) in upper case instead of lower case...
return CheckLintNameResult::NoLint(Some((Symbol::intern(&name_lower), false))); return CheckLintNameResult::NoLint(Some((Symbol::intern(&name_lower), false)));
} }
@ -455,18 +446,8 @@ impl LintStore {
None => match self.lint_groups.get(&*complete_name) { None => match self.lint_groups.get(&*complete_name) {
// Now we are sure, that this lint exists nowhere // Now we are sure, that this lint exists nowhere
None => self.no_lint_suggestion(lint_name, tool_name), None => self.no_lint_suggestion(lint_name, tool_name),
Some(LintGroup { lint_ids, depr, .. }) => { Some(LintGroup { lint_ids, .. }) => {
// Reaching this would be weird, but let's cover this case anyway CheckLintNameResult::Tool(lint_ids, Some(complete_name))
if let Some(LintAlias { name, silent }) = depr {
let LintGroup { lint_ids, .. } = self.lint_groups.get(name).unwrap();
if *silent {
CheckLintNameResult::Tool(lint_ids, Some(complete_name))
} else {
CheckLintNameResult::Tool(lint_ids, Some((*name).to_string()))
}
} else {
CheckLintNameResult::Tool(lint_ids, Some(complete_name))
}
} }
}, },
Some(Id(id)) => CheckLintNameResult::Tool(slice::from_ref(id), Some(complete_name)), Some(Id(id)) => CheckLintNameResult::Tool(slice::from_ref(id), Some(complete_name)),

View File

@ -517,11 +517,11 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
let lint_flag_val = Symbol::intern(lint_name); let lint_flag_val = Symbol::intern(lint_name);
let Ok(ids) = self.store.find_lints(lint_name) else { let Some(ids) = self.store.find_lints(lint_name) else {
// errors already handled above // errors already handled above
continue; continue;
}; };
for id in ids { for &id in ids {
// ForceWarn and Forbid cannot be overridden // ForceWarn and Forbid cannot be overridden
if let Some(LevelAndSource { level: Level::ForceWarn | Level::Forbid, .. }) = if let Some(LevelAndSource { level: Level::ForceWarn | Level::Forbid, .. }) =
self.current_specs().get(&id) self.current_specs().get(&id)

View File

@ -124,9 +124,7 @@ use unused::*;
#[rustfmt::skip] #[rustfmt::skip]
pub use builtin::{MissingDoc, SoftLints}; pub use builtin::{MissingDoc, SoftLints};
pub use context::{ pub use context::{CheckLintNameResult, EarlyContext, LateContext, LintContext, LintStore};
CheckLintNameResult, EarlyContext, FindLintError, LateContext, LintContext, LintStore,
};
pub use early::{EarlyCheckNode, check_ast_node}; pub use early::{EarlyCheckNode, check_ast_node};
pub use late::{check_crate, late_lint_mod, unerased_lint_store}; pub use late::{check_crate, late_lint_mod, unerased_lint_store};
pub use levels::LintLevelsBuilder; pub use levels::LintLevelsBuilder;

View File

@ -578,8 +578,8 @@ impl<'v> hir::intravisit::Visitor<'v> for TraitObjectVisitor<'v> {
match ty.kind { match ty.kind {
hir::TyKind::TraitObject(_, tagged_ptr) hir::TyKind::TraitObject(_, tagged_ptr)
if let hir::Lifetime { if let hir::Lifetime {
res: kind:
hir::LifetimeName::ImplicitObjectLifetimeDefault | hir::LifetimeName::Static, hir::LifetimeKind::ImplicitObjectLifetimeDefault | hir::LifetimeKind::Static,
.. ..
} = tagged_ptr.pointer() => } = tagged_ptr.pointer() =>
{ {

View File

@ -806,9 +806,6 @@ parse_trait_alias_cannot_be_unsafe = trait aliases cannot be `unsafe`
parse_transpose_dyn_or_impl = `for<...>` expected after `{$kw}`, not before parse_transpose_dyn_or_impl = `for<...>` expected after `{$kw}`, not before
.suggestion = move `{$kw}` before the `for<...>` .suggestion = move `{$kw}` before the `for<...>`
parse_type_ascription_removed =
if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
parse_unclosed_unicode_escape = unterminated unicode escape parse_unclosed_unicode_escape = unterminated unicode escape
.label = missing a closing `{"}"}` .label = missing a closing `{"}"}`
.terminate = terminate the unicode escape .terminate = terminate the unicode escape

View File

@ -1598,9 +1598,6 @@ pub(crate) struct PathSingleColon {
#[suggestion(applicability = "machine-applicable", code = ":", style = "verbose")] #[suggestion(applicability = "machine-applicable", code = ":", style = "verbose")]
pub suggestion: Span, pub suggestion: Span,
#[note(parse_type_ascription_removed)]
pub type_ascription: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@ -1617,9 +1614,6 @@ pub(crate) struct ColonAsSemi {
#[primary_span] #[primary_span]
#[suggestion(applicability = "machine-applicable", code = ";", style = "verbose")] #[suggestion(applicability = "machine-applicable", code = ";", style = "verbose")]
pub span: Span, pub span: Span,
#[note(parse_type_ascription_removed)]
pub type_ascription: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]

View File

@ -1943,10 +1943,7 @@ impl<'a> Parser<'a> {
&& self.token == token::Colon && self.token == token::Colon
&& self.look_ahead(1, |next| line_idx(self.token.span) < line_idx(next.span)) && self.look_ahead(1, |next| line_idx(self.token.span) < line_idx(next.span))
{ {
self.dcx().emit_err(ColonAsSemi { self.dcx().emit_err(ColonAsSemi { span: self.token.span });
span: self.token.span,
type_ascription: self.psess.unstable_features.is_nightly_build(),
});
self.bump(); self.bump();
return true; return true;
} }

View File

@ -273,7 +273,6 @@ impl<'a> Parser<'a> {
self.dcx().emit_err(PathSingleColon { self.dcx().emit_err(PathSingleColon {
span: self.prev_token.span, span: self.prev_token.span,
suggestion: self.prev_token.span.shrink_to_hi(), suggestion: self.prev_token.span.shrink_to_hi(),
type_ascription: self.psess.unstable_features.is_nightly_build(),
}); });
} }
continue; continue;
@ -348,7 +347,6 @@ impl<'a> Parser<'a> {
err = self.dcx().create_err(PathSingleColon { err = self.dcx().create_err(PathSingleColon {
span: self.token.span, span: self.token.span,
suggestion: self.prev_token.span.shrink_to_hi(), suggestion: self.prev_token.span.shrink_to_hi(),
type_ascription: self.psess.unstable_features.is_nightly_build(),
}); });
} }
// Attempt to find places where a missing `>` might belong. // Attempt to find places where a missing `>` might belong.

View File

@ -771,10 +771,6 @@ impl<'a> Parser<'a> {
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );
} }
if self.psess.unstable_features.is_nightly_build() {
// FIXME(Nilstrieb): Remove this again after a few months.
err.note("type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>");
}
} }
} }

View File

@ -1174,8 +1174,7 @@ pub(super) struct CurrentDepGraph<D: Deps> {
/// ID from the previous session. In order to side-step this problem, we make /// ID from the previous session. In order to side-step this problem, we make
/// sure that anonymous `NodeId`s allocated in different sessions don't overlap. /// sure that anonymous `NodeId`s allocated in different sessions don't overlap.
/// This is implemented by mixing a session-key into the ID fingerprint of /// This is implemented by mixing a session-key into the ID fingerprint of
/// each anon node. The session-key is just a random number generated when /// each anon node. The session-key is a hash of the number of previous sessions.
/// the `DepGraph` is created.
anon_id_seed: Fingerprint, anon_id_seed: Fingerprint,
/// These are simple counters that are for profiling and /// These are simple counters that are for profiling and
@ -1193,12 +1192,8 @@ impl<D: Deps> CurrentDepGraph<D> {
record_stats: bool, record_stats: bool,
previous: Arc<SerializedDepGraph>, previous: Arc<SerializedDepGraph>,
) -> Self { ) -> Self {
use std::time::{SystemTime, UNIX_EPOCH};
let duration = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
let nanos = duration.as_nanos();
let mut stable_hasher = StableHasher::new(); let mut stable_hasher = StableHasher::new();
nanos.hash(&mut stable_hasher); previous.session_count().hash(&mut stable_hasher);
let anon_id_seed = stable_hasher.finish(); let anon_id_seed = stable_hasher.finish();
#[cfg(debug_assertions)] #[cfg(debug_assertions)]

View File

@ -92,6 +92,9 @@ pub struct SerializedDepGraph {
/// Stores a map from fingerprints to nodes per dep node kind. /// Stores a map from fingerprints to nodes per dep node kind.
/// This is the reciprocal of `nodes`. /// This is the reciprocal of `nodes`.
index: Vec<UnhashMap<PackedFingerprint, SerializedDepNodeIndex>>, index: Vec<UnhashMap<PackedFingerprint, SerializedDepNodeIndex>>,
/// The number of previous compilation sessions. This is used to generate
/// unique anon dep nodes per session.
session_count: u64,
} }
impl SerializedDepGraph { impl SerializedDepGraph {
@ -146,6 +149,11 @@ impl SerializedDepGraph {
pub fn node_count(&self) -> usize { pub fn node_count(&self) -> usize {
self.nodes.len() self.nodes.len()
} }
#[inline]
pub fn session_count(&self) -> u64 {
self.session_count
}
} }
/// A packed representation of an edge's start index and byte width. /// A packed representation of an edge's start index and byte width.
@ -252,6 +260,8 @@ impl SerializedDepGraph {
.map(|_| UnhashMap::with_capacity_and_hasher(d.read_u32() as usize, Default::default())) .map(|_| UnhashMap::with_capacity_and_hasher(d.read_u32() as usize, Default::default()))
.collect(); .collect();
let session_count = d.read_u64();
for (idx, node) in nodes.iter_enumerated() { for (idx, node) in nodes.iter_enumerated() {
if index[node.kind.as_usize()].insert(node.hash, idx).is_some() { if index[node.kind.as_usize()].insert(node.hash, idx).is_some() {
// Side effect nodes can have duplicates // Side effect nodes can have duplicates
@ -273,6 +283,7 @@ impl SerializedDepGraph {
edge_list_indices, edge_list_indices,
edge_list_data, edge_list_data,
index, index,
session_count,
}) })
} }
} }
@ -603,7 +614,7 @@ impl<D: Deps> EncoderState<D> {
stats: _, stats: _,
kind_stats, kind_stats,
marker: _, marker: _,
previous: _, previous,
} = self; } = self;
let node_count = total_node_count.try_into().unwrap(); let node_count = total_node_count.try_into().unwrap();
@ -614,6 +625,8 @@ impl<D: Deps> EncoderState<D> {
count.encode(&mut encoder); count.encode(&mut encoder);
} }
previous.session_count.checked_add(1).unwrap().encode(&mut encoder);
debug!(?node_count, ?edge_count); debug!(?node_count, ?edge_count);
debug!("position: {:?}", encoder.position()); debug!("position: {:?}", encoder.position());
IntEncodedWithFixedSize(node_count).encode(&mut encoder); IntEncodedWithFixedSize(node_count).encode(&mut encoder);

View File

@ -2007,16 +2007,16 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
result, result,
result.map(|r| r.expn_data()) result.map(|r| r.expn_data())
); );
// Then find the last semi-transparent mark from the end if it exists. // Then find the last semi-opaque mark from the end if it exists.
for (mark, transparency) in iter { for (mark, transparency) in iter {
if transparency == Transparency::SemiTransparent { if transparency == Transparency::SemiOpaque {
result = Some(mark); result = Some(mark);
} else { } else {
break; break;
} }
} }
debug!( debug!(
"resolve_crate_root: found semi-transparent mark {:?} {:?}", "resolve_crate_root: found semi-opaque mark {:?} {:?}",
result, result,
result.map(|r| r.expn_data()) result.map(|r| r.expn_data())
); );

View File

@ -63,10 +63,10 @@ struct SyntaxContextData {
outer_expn: ExpnId, outer_expn: ExpnId,
outer_transparency: Transparency, outer_transparency: Transparency,
parent: SyntaxContext, parent: SyntaxContext,
/// This context, but with all transparent and semi-transparent expansions filtered away. /// This context, but with all transparent and semi-opaque expansions filtered away.
opaque: SyntaxContext, opaque: SyntaxContext,
/// This context, but with all transparent expansions filtered away. /// This context, but with all transparent expansions filtered away.
opaque_and_semitransparent: SyntaxContext, opaque_and_semiopaque: SyntaxContext,
/// Name of the crate to which `$crate` with this context would resolve. /// Name of the crate to which `$crate` with this context would resolve.
dollar_crate_name: Symbol, dollar_crate_name: Symbol,
} }
@ -75,14 +75,14 @@ impl SyntaxContextData {
fn new( fn new(
(parent, outer_expn, outer_transparency): SyntaxContextKey, (parent, outer_expn, outer_transparency): SyntaxContextKey,
opaque: SyntaxContext, opaque: SyntaxContext,
opaque_and_semitransparent: SyntaxContext, opaque_and_semiopaque: SyntaxContext,
) -> SyntaxContextData { ) -> SyntaxContextData {
SyntaxContextData { SyntaxContextData {
outer_expn, outer_expn,
outer_transparency, outer_transparency,
parent, parent,
opaque, opaque,
opaque_and_semitransparent, opaque_and_semiopaque,
dollar_crate_name: kw::DollarCrate, dollar_crate_name: kw::DollarCrate,
} }
} }
@ -93,7 +93,7 @@ impl SyntaxContextData {
outer_transparency: Transparency::Opaque, outer_transparency: Transparency::Opaque,
parent: SyntaxContext::root(), parent: SyntaxContext::root(),
opaque: SyntaxContext::root(), opaque: SyntaxContext::root(),
opaque_and_semitransparent: SyntaxContext::root(), opaque_and_semiopaque: SyntaxContext::root(),
dollar_crate_name: kw::DollarCrate, dollar_crate_name: kw::DollarCrate,
} }
} }
@ -204,13 +204,13 @@ pub enum Transparency {
/// Identifier produced by a transparent expansion is always resolved at call-site. /// Identifier produced by a transparent expansion is always resolved at call-site.
/// Call-site spans in procedural macros, hygiene opt-out in `macro` should use this. /// Call-site spans in procedural macros, hygiene opt-out in `macro` should use this.
Transparent, Transparent,
/// Identifier produced by a semi-transparent expansion may be resolved /// Identifier produced by a semi-opaque expansion may be resolved
/// either at call-site or at definition-site. /// either at call-site or at definition-site.
/// If it's a local variable, label or `$crate` then it's resolved at def-site. /// If it's a local variable, label or `$crate` then it's resolved at def-site.
/// Otherwise it's resolved at call-site. /// Otherwise it's resolved at call-site.
/// `macro_rules` macros behave like this, built-in macros currently behave like this too, /// `macro_rules` macros behave like this, built-in macros currently behave like this too,
/// but that's an implementation detail. /// but that's an implementation detail.
SemiTransparent, SemiOpaque,
/// Identifier produced by an opaque expansion is always resolved at definition-site. /// Identifier produced by an opaque expansion is always resolved at definition-site.
/// Def-site spans in procedural macros, identifiers from `macro` by default use this. /// Def-site spans in procedural macros, identifiers from `macro` by default use this.
Opaque, Opaque,
@ -218,7 +218,7 @@ pub enum Transparency {
impl Transparency { impl Transparency {
pub fn fallback(macro_rules: bool) -> Self { pub fn fallback(macro_rules: bool) -> Self {
if macro_rules { Transparency::SemiTransparent } else { Transparency::Opaque } if macro_rules { Transparency::SemiOpaque } else { Transparency::Opaque }
} }
} }
@ -466,7 +466,7 @@ impl HygieneData {
fn normalize_to_macro_rules(&self, ctxt: SyntaxContext) -> SyntaxContext { fn normalize_to_macro_rules(&self, ctxt: SyntaxContext) -> SyntaxContext {
debug_assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder()); debug_assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
self.syntax_context_data[ctxt.0 as usize].opaque_and_semitransparent self.syntax_context_data[ctxt.0 as usize].opaque_and_semiopaque
} }
fn outer_expn(&self, ctxt: SyntaxContext) -> ExpnId { fn outer_expn(&self, ctxt: SyntaxContext) -> ExpnId {
@ -559,7 +559,7 @@ impl HygieneData {
} }
let call_site_ctxt = self.expn_data(expn_id).call_site.ctxt(); let call_site_ctxt = self.expn_data(expn_id).call_site.ctxt();
let mut call_site_ctxt = if transparency == Transparency::SemiTransparent { let mut call_site_ctxt = if transparency == Transparency::SemiOpaque {
self.normalize_to_macros_2_0(call_site_ctxt) self.normalize_to_macros_2_0(call_site_ctxt)
} else { } else {
self.normalize_to_macro_rules(call_site_ctxt) self.normalize_to_macro_rules(call_site_ctxt)
@ -605,33 +605,32 @@ impl HygieneData {
self.syntax_context_data.push(SyntaxContextData::decode_placeholder()); self.syntax_context_data.push(SyntaxContextData::decode_placeholder());
self.syntax_context_map.insert(key, ctxt); self.syntax_context_map.insert(key, ctxt);
// Opaque and semi-transparent versions of the parent. Note that they may be equal to the // Opaque and semi-opaque versions of the parent. Note that they may be equal to the
// parent itself. E.g. `parent_opaque` == `parent` if the expn chain contains only opaques, // parent itself. E.g. `parent_opaque` == `parent` if the expn chain contains only opaques,
// and `parent_opaque_and_semitransparent` == `parent` if the expn contains only opaques // and `parent_opaque_and_semiopaque` == `parent` if the expn contains only (semi-)opaques.
// and semi-transparents.
let parent_opaque = self.syntax_context_data[parent.0 as usize].opaque; let parent_opaque = self.syntax_context_data[parent.0 as usize].opaque;
let parent_opaque_and_semitransparent = let parent_opaque_and_semiopaque =
self.syntax_context_data[parent.0 as usize].opaque_and_semitransparent; self.syntax_context_data[parent.0 as usize].opaque_and_semiopaque;
// Evaluate opaque and semi-transparent versions of the new syntax context. // Evaluate opaque and semi-opaque versions of the new syntax context.
let (opaque, opaque_and_semitransparent) = match transparency { let (opaque, opaque_and_semiopaque) = match transparency {
Transparency::Transparent => (parent_opaque, parent_opaque_and_semitransparent), Transparency::Transparent => (parent_opaque, parent_opaque_and_semiopaque),
Transparency::SemiTransparent => ( Transparency::SemiOpaque => (
parent_opaque, parent_opaque,
// Will be the same as `ctxt` if the expn chain contains only opaques and semi-transparents. // Will be the same as `ctxt` if the expn chain contains only (semi-)opaques.
self.alloc_ctxt(parent_opaque_and_semitransparent, expn_id, transparency), self.alloc_ctxt(parent_opaque_and_semiopaque, expn_id, transparency),
), ),
Transparency::Opaque => ( Transparency::Opaque => (
// Will be the same as `ctxt` if the expn chain contains only opaques. // Will be the same as `ctxt` if the expn chain contains only opaques.
self.alloc_ctxt(parent_opaque, expn_id, transparency), self.alloc_ctxt(parent_opaque, expn_id, transparency),
// Will be the same as `ctxt` if the expn chain contains only opaques and semi-transparents. // Will be the same as `ctxt` if the expn chain contains only (semi-)opaques.
self.alloc_ctxt(parent_opaque_and_semitransparent, expn_id, transparency), self.alloc_ctxt(parent_opaque_and_semiopaque, expn_id, transparency),
), ),
}; };
// Fill the full data, now that we have it. // Fill the full data, now that we have it.
self.syntax_context_data[ctxt.as_u32() as usize] = self.syntax_context_data[ctxt.as_u32() as usize] =
SyntaxContextData::new(key, opaque, opaque_and_semitransparent); SyntaxContextData::new(key, opaque, opaque_and_semiopaque);
ctxt ctxt
} }
} }

View File

@ -1117,7 +1117,7 @@ impl Span {
/// Equivalent of `Span::mixed_site` from the proc macro API, /// Equivalent of `Span::mixed_site` from the proc macro API,
/// except that the location is taken from the `self` span. /// except that the location is taken from the `self` span.
pub fn with_mixed_site_ctxt(self, expn_id: ExpnId) -> Span { pub fn with_mixed_site_ctxt(self, expn_id: ExpnId) -> Span {
self.with_ctxt_from_mark(expn_id, Transparency::SemiTransparent) self.with_ctxt_from_mark(expn_id, Transparency::SemiOpaque)
} }
/// Produces a span with the same location as `self` and context produced by a macro with the /// Produces a span with the same location as `self` and context produced by a macro with the

View File

@ -1882,6 +1882,7 @@ symbols! {
select_unpredictable, select_unpredictable,
self_in_typedefs, self_in_typedefs,
self_struct_ctor, self_struct_ctor,
semiopaque,
semitransparent, semitransparent,
sha2, sha2,
sha3, sha3,

View File

@ -6,7 +6,7 @@ use rustc_hir::def_id::DefId;
use rustc_hir::intravisit::{Visitor, VisitorExt, walk_ty}; use rustc_hir::intravisit::{Visitor, VisitorExt, walk_ty};
use rustc_hir::{ use rustc_hir::{
self as hir, AmbigArg, GenericBound, GenericParam, GenericParamKind, Item, ItemKind, Lifetime, self as hir, AmbigArg, GenericBound, GenericParam, GenericParamKind, Item, ItemKind, Lifetime,
LifetimeName, LifetimeParamKind, MissingLifetimeKind, Node, TyKind, LifetimeKind, LifetimeParamKind, MissingLifetimeKind, Node, TyKind,
}; };
use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor}; use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor};
use rustc_span::def_id::LocalDefId; use rustc_span::def_id::LocalDefId;
@ -165,7 +165,7 @@ pub fn suggest_new_region_bound(
if let Some(span) = opaque.bounds.iter().find_map(|arg| match arg { if let Some(span) = opaque.bounds.iter().find_map(|arg| match arg {
GenericBound::Outlives(Lifetime { GenericBound::Outlives(Lifetime {
res: LifetimeName::Static, ident, .. kind: LifetimeKind::Static, ident, ..
}) => Some(ident.span), }) => Some(ident.span),
_ => None, _ => None,
}) { }) {
@ -253,7 +253,7 @@ pub fn suggest_new_region_bound(
} }
} }
TyKind::TraitObject(_, lt) => { TyKind::TraitObject(_, lt) => {
if let LifetimeName::ImplicitObjectLifetimeDefault = lt.res { if let LifetimeKind::ImplicitObjectLifetimeDefault = lt.kind {
err.span_suggestion_verbose( err.span_suggestion_verbose(
fn_return.span.shrink_to_hi(), fn_return.span.shrink_to_hi(),
format!("{declare} the trait object {captures}, {explicit}",), format!("{declare} the trait object {captures}, {explicit}",),
@ -414,7 +414,7 @@ pub struct HirTraitObjectVisitor<'a>(pub &'a mut Vec<Span>, pub DefId);
impl<'a, 'tcx> Visitor<'tcx> for HirTraitObjectVisitor<'a> { impl<'a, 'tcx> Visitor<'tcx> for HirTraitObjectVisitor<'a> {
fn visit_ty(&mut self, t: &'tcx hir::Ty<'tcx, AmbigArg>) { fn visit_ty(&mut self, t: &'tcx hir::Ty<'tcx, AmbigArg>) {
if let TyKind::TraitObject(poly_trait_refs, lifetime_ptr) = t.kind if let TyKind::TraitObject(poly_trait_refs, lifetime_ptr) = t.kind
&& let Lifetime { res: LifetimeName::ImplicitObjectLifetimeDefault, .. } = && let Lifetime { kind: LifetimeKind::ImplicitObjectLifetimeDefault, .. } =
lifetime_ptr.pointer() lifetime_ptr.pointer()
{ {
for ptr in poly_trait_refs { for ptr in poly_trait_refs {

View File

@ -850,14 +850,14 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
add_lt_suggs: &mut Vec<(Span, String)>, add_lt_suggs: &mut Vec<(Span, String)>,
) -> String { ) -> String {
struct LifetimeReplaceVisitor<'a> { struct LifetimeReplaceVisitor<'a> {
needle: hir::LifetimeName, needle: hir::LifetimeKind,
new_lt: &'a str, new_lt: &'a str,
add_lt_suggs: &'a mut Vec<(Span, String)>, add_lt_suggs: &'a mut Vec<(Span, String)>,
} }
impl<'hir> hir::intravisit::Visitor<'hir> for LifetimeReplaceVisitor<'_> { impl<'hir> hir::intravisit::Visitor<'hir> for LifetimeReplaceVisitor<'_> {
fn visit_lifetime(&mut self, lt: &'hir hir::Lifetime) { fn visit_lifetime(&mut self, lt: &'hir hir::Lifetime) {
if lt.res == self.needle { if lt.kind == self.needle {
self.add_lt_suggs.push(lt.suggestion(self.new_lt)); self.add_lt_suggs.push(lt.suggestion(self.new_lt));
} }
} }
@ -894,7 +894,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
}; };
let mut visitor = LifetimeReplaceVisitor { let mut visitor = LifetimeReplaceVisitor {
needle: hir::LifetimeName::Param(lifetime_def_id), needle: hir::LifetimeKind::Param(lifetime_def_id),
add_lt_suggs, add_lt_suggs,
new_lt: &new_lt, new_lt: &new_lt,
}; };

View File

@ -61,11 +61,11 @@ Here is a summary:
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Describe the *syntax* of a type: what the user wrote (with some desugaring). | Describe the *semantics* of a type: the meaning of what the user wrote. | | Describe the *syntax* of a type: what the user wrote (with some desugaring). | Describe the *semantics* of a type: the meaning of what the user wrote. |
| Each `rustc_hir::Ty` has its own spans corresponding to the appropriate place in the program. | Doesnt correspond to a single place in the users program. | | Each `rustc_hir::Ty` has its own spans corresponding to the appropriate place in the program. | Doesnt correspond to a single place in the users program. |
| `rustc_hir::Ty` has generics and lifetimes; however, some of those lifetimes are special markers like [`LifetimeName::Implicit`][implicit]. | `ty::Ty` has the full type, including generics and lifetimes, even if the user left them out | | `rustc_hir::Ty` has generics and lifetimes; however, some of those lifetimes are special markers like [`LifetimeKind::Implicit`][implicit]. | `ty::Ty` has the full type, including generics and lifetimes, even if the user left them out |
| `fn foo(x: u32) → u32 { }` - Two `rustc_hir::Ty` representing each usage of `u32`, each has its own `Span`s, and `rustc_hir::Ty` doesnt tell us that both are the same type | `fn foo(x: u32) → u32 { }` - One `ty::Ty` for all instances of `u32` throughout the program, and `ty::Ty` tells us that both usages of `u32` mean the same type. | | `fn foo(x: u32) → u32 { }` - Two `rustc_hir::Ty` representing each usage of `u32`, each has its own `Span`s, and `rustc_hir::Ty` doesnt tell us that both are the same type | `fn foo(x: u32) → u32 { }` - One `ty::Ty` for all instances of `u32` throughout the program, and `ty::Ty` tells us that both usages of `u32` mean the same type. |
| `fn foo(x: &u32) -> &u32)` - Two `rustc_hir::Ty` again. Lifetimes for the references show up in the `rustc_hir::Ty`s using a special marker, [`LifetimeName::Implicit`][implicit]. | `fn foo(x: &u32) -> &u32)`- A single `ty::Ty`. The `ty::Ty` has the hidden lifetime param. | | `fn foo(x: &u32) -> &u32)` - Two `rustc_hir::Ty` again. Lifetimes for the references show up in the `rustc_hir::Ty`s using a special marker, [`LifetimeKind::Implicit`][implicit]. | `fn foo(x: &u32) -> &u32)`- A single `ty::Ty`. The `ty::Ty` has the hidden lifetime param. |
[implicit]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/enum.LifetimeName.html#variant.Implicit [implicit]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/enum.LifetimeKind.html#variant.Implicit
**Order** **Order**

View File

@ -117,7 +117,14 @@ pub(crate) fn clean_doc_module<'tcx>(doc: &DocModule<'tcx>, cx: &mut DocContext<
hir::ItemKind::Use(path, kind) => { hir::ItemKind::Use(path, kind) => {
let hir::UsePath { segments, span, .. } = *path; let hir::UsePath { segments, span, .. } = *path;
let path = hir::Path { segments, res: *res, span }; let path = hir::Path { segments, res: *res, span };
clean_use_statement_inner(import, name, &path, kind, cx, &mut Default::default()) clean_use_statement_inner(
import,
Some(name),
&path,
kind,
cx,
&mut Default::default(),
)
} }
_ => unreachable!(), _ => unreachable!(),
} }
@ -125,8 +132,7 @@ pub(crate) fn clean_doc_module<'tcx>(doc: &DocModule<'tcx>, cx: &mut DocContext<
items.extend(doc.items.values().flat_map(|(item, renamed, _)| { items.extend(doc.items.values().flat_map(|(item, renamed, _)| {
// Now we actually lower the imports, skipping everything else. // Now we actually lower the imports, skipping everything else.
if let hir::ItemKind::Use(path, hir::UseKind::Glob) = item.kind { if let hir::ItemKind::Use(path, hir::UseKind::Glob) = item.kind {
let name = renamed.unwrap_or(kw::Empty); // using kw::Empty is a bit of a hack clean_use_statement(item, *renamed, path, hir::UseKind::Glob, cx, &mut inserted)
clean_use_statement(item, name, path, hir::UseKind::Glob, cx, &mut inserted)
} else { } else {
// skip everything else // skip everything else
Vec::new() Vec::new()
@ -1072,10 +1078,10 @@ fn clean_fn_decl_legacy_const_generics(func: &mut Function, attrs: &[hir::Attrib
.. ..
} = param } = param
{ {
func.decl func.decl.inputs.values.insert(
.inputs a.get() as _,
.values Argument { name: Some(name), type_: *ty, is_const: true },
.insert(a.get() as _, Argument { name, type_: *ty, is_const: true }); );
} else { } else {
panic!("unexpected non const in position {pos}"); panic!("unexpected non const in position {pos}");
} }
@ -1132,9 +1138,9 @@ fn clean_args_from_types_and_names<'tcx>(
// If at least one argument has a name, use `_` as the name of unnamed // If at least one argument has a name, use `_` as the name of unnamed
// arguments. Otherwise omit argument names. // arguments. Otherwise omit argument names.
let default_name = if idents.iter().any(|ident| nonempty_name(ident).is_some()) { let default_name = if idents.iter().any(|ident| nonempty_name(ident).is_some()) {
kw::Underscore Some(kw::Underscore)
} else { } else {
kw::Empty None
}; };
Arguments { Arguments {
@ -1143,7 +1149,7 @@ fn clean_args_from_types_and_names<'tcx>(
.enumerate() .enumerate()
.map(|(i, ty)| Argument { .map(|(i, ty)| Argument {
type_: clean_ty(ty, cx), type_: clean_ty(ty, cx),
name: idents.get(i).and_then(nonempty_name).unwrap_or(default_name), name: idents.get(i).and_then(nonempty_name).or(default_name),
is_const: false, is_const: false,
}) })
.collect(), .collect(),
@ -1162,7 +1168,7 @@ fn clean_args_from_types_and_body_id<'tcx>(
.iter() .iter()
.zip(body.params) .zip(body.params)
.map(|(ty, param)| Argument { .map(|(ty, param)| Argument {
name: name_from_pat(param.pat), name: Some(name_from_pat(param.pat)),
type_: clean_ty(ty, cx), type_: clean_ty(ty, cx),
is_const: false, is_const: false,
}) })
@ -1218,11 +1224,11 @@ fn clean_poly_fn_sig<'tcx>(
.iter() .iter()
.map(|t| Argument { .map(|t| Argument {
type_: clean_middle_ty(t.map_bound(|t| *t), cx, None, None), type_: clean_middle_ty(t.map_bound(|t| *t), cx, None, None),
name: if let Some(Some(ident)) = names.next() { name: Some(if let Some(Some(ident)) = names.next() {
ident.name ident.name
} else { } else {
kw::Underscore kw::Underscore
}, }),
is_const: false, is_const: false,
}) })
.collect(), .collect(),
@ -2792,10 +2798,7 @@ fn clean_maybe_renamed_item<'tcx>(
use hir::ItemKind; use hir::ItemKind;
let def_id = item.owner_id.to_def_id(); let def_id = item.owner_id.to_def_id();
let mut name = renamed.unwrap_or_else(|| { let mut name = if renamed.is_some() { renamed } else { cx.tcx.hir_opt_name(item.hir_id()) };
// FIXME: using kw::Empty is a bit of a hack
cx.tcx.hir_opt_name(item.hir_id()).unwrap_or(kw::Empty)
});
cx.with_param_env(def_id, |cx| { cx.with_param_env(def_id, |cx| {
let kind = match item.kind { let kind = match item.kind {
@ -2836,7 +2839,7 @@ fn clean_maybe_renamed_item<'tcx>(
item_type: Some(type_), item_type: Some(type_),
})), })),
item.owner_id.def_id.to_def_id(), item.owner_id.def_id.to_def_id(),
name, name.unwrap(),
import_id, import_id,
renamed, renamed,
)); ));
@ -2861,13 +2864,15 @@ fn clean_maybe_renamed_item<'tcx>(
}), }),
ItemKind::Impl(impl_) => return clean_impl(impl_, item.owner_id.def_id, cx), ItemKind::Impl(impl_) => return clean_impl(impl_, item.owner_id.def_id, cx),
ItemKind::Macro(_, macro_def, MacroKind::Bang) => MacroItem(Macro { ItemKind::Macro(_, macro_def, MacroKind::Bang) => MacroItem(Macro {
source: display_macro_source(cx, name, macro_def), source: display_macro_source(cx, name.unwrap(), macro_def),
macro_rules: macro_def.macro_rules, macro_rules: macro_def.macro_rules,
}), }),
ItemKind::Macro(_, _, macro_kind) => clean_proc_macro(item, &mut name, macro_kind, cx), ItemKind::Macro(_, _, macro_kind) => {
clean_proc_macro(item, name.as_mut().unwrap(), macro_kind, cx)
}
// proc macros can have a name set by attributes // proc macros can have a name set by attributes
ItemKind::Fn { ref sig, generics, body: body_id, .. } => { ItemKind::Fn { ref sig, generics, body: body_id, .. } => {
clean_fn_or_proc_macro(item, sig, generics, body_id, &mut name, cx) clean_fn_or_proc_macro(item, sig, generics, body_id, name.as_mut().unwrap(), cx)
} }
ItemKind::Trait(_, _, _, generics, bounds, item_ids) => { ItemKind::Trait(_, _, _, generics, bounds, item_ids) => {
let items = item_ids let items = item_ids
@ -2883,7 +2888,7 @@ fn clean_maybe_renamed_item<'tcx>(
})) }))
} }
ItemKind::ExternCrate(orig_name, _) => { ItemKind::ExternCrate(orig_name, _) => {
return clean_extern_crate(item, name, orig_name, cx); return clean_extern_crate(item, name.unwrap(), orig_name, cx);
} }
ItemKind::Use(path, kind) => { ItemKind::Use(path, kind) => {
return clean_use_statement(item, name, path, kind, cx, &mut FxHashSet::default()); return clean_use_statement(item, name, path, kind, cx, &mut FxHashSet::default());
@ -2895,7 +2900,7 @@ fn clean_maybe_renamed_item<'tcx>(
cx, cx,
kind, kind,
item.owner_id.def_id.to_def_id(), item.owner_id.def_id.to_def_id(),
name, name.unwrap(),
import_id, import_id,
renamed, renamed,
)] )]
@ -3006,7 +3011,7 @@ fn clean_extern_crate<'tcx>(
fn clean_use_statement<'tcx>( fn clean_use_statement<'tcx>(
import: &hir::Item<'tcx>, import: &hir::Item<'tcx>,
name: Symbol, name: Option<Symbol>,
path: &hir::UsePath<'tcx>, path: &hir::UsePath<'tcx>,
kind: hir::UseKind, kind: hir::UseKind,
cx: &mut DocContext<'tcx>, cx: &mut DocContext<'tcx>,
@ -3023,7 +3028,7 @@ fn clean_use_statement<'tcx>(
fn clean_use_statement_inner<'tcx>( fn clean_use_statement_inner<'tcx>(
import: &hir::Item<'tcx>, import: &hir::Item<'tcx>,
name: Symbol, name: Option<Symbol>,
path: &hir::Path<'tcx>, path: &hir::Path<'tcx>,
kind: hir::UseKind, kind: hir::UseKind,
cx: &mut DocContext<'tcx>, cx: &mut DocContext<'tcx>,
@ -3042,7 +3047,7 @@ fn clean_use_statement_inner<'tcx>(
let visibility = cx.tcx.visibility(import.owner_id); let visibility = cx.tcx.visibility(import.owner_id);
let attrs = cx.tcx.hir_attrs(import.hir_id()); let attrs = cx.tcx.hir_attrs(import.hir_id());
let inline_attr = hir_attr_lists(attrs, sym::doc).get_word_attr(sym::inline); let inline_attr = hir_attr_lists(attrs, sym::doc).get_word_attr(sym::inline);
let pub_underscore = visibility.is_public() && name == kw::Underscore; let pub_underscore = visibility.is_public() && name == Some(kw::Underscore);
let current_mod = cx.tcx.parent_module_from_def_id(import.owner_id.def_id); let current_mod = cx.tcx.parent_module_from_def_id(import.owner_id.def_id);
let import_def_id = import.owner_id.def_id; let import_def_id = import.owner_id.def_id;
@ -3108,6 +3113,7 @@ fn clean_use_statement_inner<'tcx>(
} }
Import::new_glob(resolve_use_source(cx, path), true) Import::new_glob(resolve_use_source(cx, path), true)
} else { } else {
let name = name.unwrap();
if inline_attr.is_none() if inline_attr.is_none()
&& let Res::Def(DefKind::Mod, did) = path.res && let Res::Def(DefKind::Mod, did) = path.res
&& !did.is_local() && !did.is_local()

View File

@ -1426,7 +1426,7 @@ pub(crate) struct Arguments {
#[derive(Clone, PartialEq, Eq, Debug, Hash)] #[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub(crate) struct Argument { pub(crate) struct Argument {
pub(crate) type_: Type, pub(crate) type_: Type,
pub(crate) name: Symbol, pub(crate) name: Option<Symbol>,
/// This field is used to represent "const" arguments from the `rustc_legacy_const_generics` /// This field is used to represent "const" arguments from the `rustc_legacy_const_generics`
/// feature. More information in <https://github.com/rust-lang/rust/issues/83167>. /// feature. More information in <https://github.com/rust-lang/rust/issues/83167>.
pub(crate) is_const: bool, pub(crate) is_const: bool,
@ -1434,7 +1434,7 @@ pub(crate) struct Argument {
impl Argument { impl Argument {
pub(crate) fn to_receiver(&self) -> Option<&Type> { pub(crate) fn to_receiver(&self) -> Option<&Type> {
if self.name == kw::SelfLower { Some(&self.type_) } else { None } if self.name == Some(kw::SelfLower) { Some(&self.type_) } else { None }
} }
} }

View File

@ -234,7 +234,7 @@ pub(super) fn clean_middle_path<'tcx>(
args: ty::Binder<'tcx, GenericArgsRef<'tcx>>, args: ty::Binder<'tcx, GenericArgsRef<'tcx>>,
) -> Path { ) -> Path {
let def_kind = cx.tcx.def_kind(did); let def_kind = cx.tcx.def_kind(did);
let name = cx.tcx.opt_item_name(did).unwrap_or(kw::Empty); let name = cx.tcx.opt_item_name(did).unwrap_or(sym::dummy);
Path { Path {
res: Res::Def(def_kind, did), res: Res::Def(def_kind, did),
segments: thin_vec![PathSegment { segments: thin_vec![PathSegment {

View File

@ -1241,8 +1241,8 @@ impl clean::Arguments {
.iter() .iter()
.map(|input| { .map(|input| {
fmt::from_fn(|f| { fmt::from_fn(|f| {
if !input.name.is_empty() { if let Some(name) = input.name {
write!(f, "{}: ", input.name)?; write!(f, "{}: ", name)?;
} }
input.type_.print(cx).fmt(f) input.type_.print(cx).fmt(f)
}) })
@ -1364,7 +1364,9 @@ impl clean::FnDecl {
if input.is_const { if input.is_const {
write!(f, "const ")?; write!(f, "const ")?;
} }
write!(f, "{}: ", input.name)?; if let Some(name) = input.name {
write!(f, "{}: ", name)?;
}
input.type_.print(cx).fmt(f)?; input.type_.print(cx).fmt(f)?;
} }
match (line_wrapping_indent, last_input_index) { match (line_wrapping_indent, last_input_index) {

View File

@ -223,7 +223,7 @@ pub(crate) struct IndexItemFunctionType {
inputs: Vec<RenderType>, inputs: Vec<RenderType>,
output: Vec<RenderType>, output: Vec<RenderType>,
where_clause: Vec<Vec<RenderType>>, where_clause: Vec<Vec<RenderType>>,
param_names: Vec<Symbol>, param_names: Vec<Option<Symbol>>,
} }
impl IndexItemFunctionType { impl IndexItemFunctionType {

View File

@ -11,7 +11,7 @@ use rustc_hir::def_id::DefId;
use rustc_index::IndexVec; use rustc_index::IndexVec;
use rustc_middle::ty::{self, TyCtxt}; use rustc_middle::ty::{self, TyCtxt};
use rustc_span::hygiene::MacroKind; use rustc_span::hygiene::MacroKind;
use rustc_span::symbol::{Symbol, kw, sym}; use rustc_span::symbol::{Symbol, sym};
use tracing::{debug, info}; use tracing::{debug, info};
use super::type_layout::document_type_layout; use super::type_layout::document_type_layout;
@ -347,9 +347,12 @@ fn item_module(cx: &Context<'_>, item: &clean::Item, items: &[clean::Item]) -> i
// but we actually want stable items to come first // but we actually want stable items to come first
return is_stable2.cmp(&is_stable1); return is_stable2.cmp(&is_stable1);
} }
let lhs = i1.name.unwrap_or(kw::Empty); match (i1.name, i2.name) {
let rhs = i2.name.unwrap_or(kw::Empty); (Some(name1), Some(name2)) => compare_names(name1.as_str(), name2.as_str()),
compare_names(lhs.as_str(), rhs.as_str()) (Some(_), None) => Ordering::Greater,
(None, Some(_)) => Ordering::Less,
(None, None) => Ordering::Equal,
}
} }
let tcx = cx.tcx(); let tcx = cx.tcx();

View File

@ -709,8 +709,11 @@ pub(crate) fn build_index(
let mut result = Vec::new(); let mut result = Vec::new();
for (index, item) in self.items.iter().enumerate() { for (index, item) in self.items.iter().enumerate() {
if let Some(ty) = &item.search_type if let Some(ty) = &item.search_type
&& let my = && let my = ty
ty.param_names.iter().map(|sym| sym.as_str()).collect::<Vec<_>>() .param_names
.iter()
.filter_map(|sym| sym.map(|sym| sym.to_string()))
.collect::<Vec<_>>()
&& my != prev && my != prev
{ {
result.push((index, my.join(","))); result.push((index, my.join(",")));
@ -1372,7 +1375,7 @@ fn simplify_fn_constraint<'a>(
/// Used to allow type-based search on constants and statics. /// Used to allow type-based search on constants and statics.
fn make_nullary_fn( fn make_nullary_fn(
clean_type: &clean::Type, clean_type: &clean::Type,
) -> (Vec<RenderType>, Vec<RenderType>, Vec<Symbol>, Vec<Vec<RenderType>>) { ) -> (Vec<RenderType>, Vec<RenderType>, Vec<Option<Symbol>>, Vec<Vec<RenderType>>) {
let mut rgen: FxIndexMap<SimplifiedParam, (isize, Vec<RenderType>)> = Default::default(); let mut rgen: FxIndexMap<SimplifiedParam, (isize, Vec<RenderType>)> = Default::default();
let output = get_index_type(clean_type, vec![], &mut rgen); let output = get_index_type(clean_type, vec![], &mut rgen);
(vec![], vec![output], vec![], vec![]) (vec![], vec![output], vec![], vec![])
@ -1387,7 +1390,7 @@ fn get_fn_inputs_and_outputs(
tcx: TyCtxt<'_>, tcx: TyCtxt<'_>,
impl_or_trait_generics: Option<&(clean::Type, clean::Generics)>, impl_or_trait_generics: Option<&(clean::Type, clean::Generics)>,
cache: &Cache, cache: &Cache,
) -> (Vec<RenderType>, Vec<RenderType>, Vec<Symbol>, Vec<Vec<RenderType>>) { ) -> (Vec<RenderType>, Vec<RenderType>, Vec<Option<Symbol>>, Vec<Vec<RenderType>>) {
let decl = &func.decl; let decl = &func.decl;
let mut rgen: FxIndexMap<SimplifiedParam, (isize, Vec<RenderType>)> = Default::default(); let mut rgen: FxIndexMap<SimplifiedParam, (isize, Vec<RenderType>)> = Default::default();
@ -1441,10 +1444,10 @@ fn get_fn_inputs_and_outputs(
simplified_params simplified_params
.iter() .iter()
.map(|(name, (_idx, _traits))| match name { .map(|(name, (_idx, _traits))| match name {
SimplifiedParam::Symbol(name) => *name, SimplifiedParam::Symbol(name) => Some(*name),
SimplifiedParam::Anonymous(_) => kw::Empty, SimplifiedParam::Anonymous(_) => None,
SimplifiedParam::AssociatedType(def_id, name) => { SimplifiedParam::AssociatedType(def_id, name) => {
Symbol::intern(&format!("{}::{}", tcx.item_name(*def_id), name)) Some(Symbol::intern(&format!("{}::{}", tcx.item_name(*def_id), name)))
} }
}) })
.collect(), .collect(),

View File

@ -11,7 +11,7 @@ use rustc_hir::def::CtorKind;
use rustc_hir::def_id::DefId; use rustc_hir::def_id::DefId;
use rustc_metadata::rendered_const; use rustc_metadata::rendered_const;
use rustc_middle::{bug, ty}; use rustc_middle::{bug, ty};
use rustc_span::{Pos, Symbol}; use rustc_span::{Pos, Symbol, kw};
use rustdoc_json_types::*; use rustdoc_json_types::*;
use crate::clean::{self, ItemId}; use crate::clean::{self, ItemId};
@ -611,7 +611,10 @@ impl FromClean<clean::FnDecl> for FunctionSignature {
inputs: inputs inputs: inputs
.values .values
.into_iter() .into_iter()
.map(|arg| (arg.name.to_string(), arg.type_.into_json(renderer))) // `_` is the most sensible name for missing param names.
.map(|arg| {
(arg.name.unwrap_or(kw::Underscore).to_string(), arg.type_.into_json(renderer))
})
.collect(), .collect(),
output: if output.is_unit() { None } else { Some(output.into_json(renderer)) }, output: if output.is_unit() { None } else { Some(output.into_json(renderer)) },
is_c_variadic: c_variadic, is_c_variadic: c_variadic,

View File

@ -14,7 +14,7 @@ use rustc_hir::intravisit::{
}; };
use rustc_hir::{ use rustc_hir::{
AmbigArg, BareFnTy, BodyId, FnDecl, FnSig, GenericArg, GenericArgs, GenericBound, GenericParam, GenericParamKind, AmbigArg, BareFnTy, BodyId, FnDecl, FnSig, GenericArg, GenericArgs, GenericBound, GenericParam, GenericParamKind,
Generics, HirId, Impl, ImplItem, ImplItemKind, Item, ItemKind, Lifetime, LifetimeName, LifetimeParamKind, Node, Generics, HirId, Impl, ImplItem, ImplItemKind, Item, ItemKind, Lifetime, LifetimeKind, LifetimeParamKind, Node,
PolyTraitRef, PredicateOrigin, TraitFn, TraitItem, TraitItemKind, Ty, TyKind, WhereBoundPredicate, WherePredicate, PolyTraitRef, PredicateOrigin, TraitFn, TraitItem, TraitItemKind, Ty, TyKind, WhereBoundPredicate, WherePredicate,
WherePredicateKind, lang_items, WherePredicateKind, lang_items,
}; };
@ -218,7 +218,7 @@ fn check_fn_inner<'tcx>(
for bound in pred.bounds { for bound in pred.bounds {
let mut visitor = RefVisitor::new(cx); let mut visitor = RefVisitor::new(cx);
walk_param_bound(&mut visitor, bound); walk_param_bound(&mut visitor, bound);
if visitor.lts.iter().any(|lt| matches!(lt.res, LifetimeName::Param(_))) { if visitor.lts.iter().any(|lt| matches!(lt.kind, LifetimeKind::Param(_))) {
return; return;
} }
if let GenericBound::Trait(ref trait_ref) = *bound { if let GenericBound::Trait(ref trait_ref) = *bound {
@ -235,7 +235,7 @@ fn check_fn_inner<'tcx>(
_ => None, _ => None,
}); });
for bound in lifetimes { for bound in lifetimes {
if bound.res != LifetimeName::Static && !bound.is_elided() { if bound.kind != LifetimeKind::Static && !bound.is_elided() {
return; return;
} }
} }
@ -421,8 +421,8 @@ fn named_lifetime_occurrences(lts: &[Lifetime]) -> Vec<(LocalDefId, usize)> {
} }
fn named_lifetime(lt: &Lifetime) -> Option<LocalDefId> { fn named_lifetime(lt: &Lifetime) -> Option<LocalDefId> {
match lt.res { match lt.kind {
LifetimeName::Param(id) if !lt.is_anonymous() => Some(id), LifetimeKind::Param(id) if !lt.is_anonymous() => Some(id),
_ => None, _ => None,
} }
} }
@ -614,7 +614,7 @@ where
// for lifetimes as parameters of generics // for lifetimes as parameters of generics
fn visit_lifetime(&mut self, lifetime: &'tcx Lifetime) { fn visit_lifetime(&mut self, lifetime: &'tcx Lifetime) {
if let LifetimeName::Param(def_id) = lifetime.res if let LifetimeKind::Param(def_id) = lifetime.kind
&& let Some(usages) = self.map.get_mut(&def_id) && let Some(usages) = self.map.get_mut(&def_id)
{ {
usages.push(Usage { usages.push(Usage {
@ -826,7 +826,7 @@ fn report_elidable_lifetimes(
.iter() .iter()
.map(|&lt| cx.tcx.def_span(lt)) .map(|&lt| cx.tcx.def_span(lt))
.chain(usages.iter().filter_map(|usage| { .chain(usages.iter().filter_map(|usage| {
if let LifetimeName::Param(def_id) = usage.res if let LifetimeKind::Param(def_id) = usage.kind
&& elidable_lts.contains(&def_id) && elidable_lts.contains(&def_id)
{ {
return Some(usage.ident.span); return Some(usage.ident.span);

View File

@ -3,7 +3,7 @@ use clippy_utils::source::SpanRangeExt;
use clippy_utils::sugg::Sugg; use clippy_utils::sugg::Sugg;
use clippy_utils::visitors::contains_unsafe_block; use clippy_utils::visitors::contains_unsafe_block;
use clippy_utils::{get_expr_use_or_unification_node, is_lint_allowed, path_def_id, path_to_local, std_or_core}; use clippy_utils::{get_expr_use_or_unification_node, is_lint_allowed, path_def_id, path_to_local, std_or_core};
use hir::LifetimeName; use hir::LifetimeKind;
use rustc_abi::ExternAbi; use rustc_abi::ExternAbi;
use rustc_errors::{Applicability, MultiSpan}; use rustc_errors::{Applicability, MultiSpan};
use rustc_hir::hir_id::{HirId, HirIdMap}; use rustc_hir::hir_id::{HirId, HirIdMap};
@ -432,7 +432,7 @@ fn check_fn_args<'cx, 'tcx: 'cx>(
} }
None None
}) { }) {
if let LifetimeName::Param(param_def_id) = lifetime.res if let LifetimeKind::Param(param_def_id) = lifetime.kind
&& !lifetime.is_anonymous() && !lifetime.is_anonymous()
&& fn_sig && fn_sig
.output() .output()

View File

@ -8,7 +8,7 @@ use rustc_hir::MatchSource::TryDesugar;
use rustc_hir::def::{DefKind, Res}; use rustc_hir::def::{DefKind, Res};
use rustc_hir::{ use rustc_hir::{
AssocItemConstraint, BinOpKind, BindingMode, Block, BodyId, Closure, ConstArg, ConstArgKind, Expr, ExprField, AssocItemConstraint, BinOpKind, BindingMode, Block, BodyId, Closure, ConstArg, ConstArgKind, Expr, ExprField,
ExprKind, FnRetTy, GenericArg, GenericArgs, HirId, HirIdMap, InlineAsmOperand, LetExpr, Lifetime, LifetimeName, ExprKind, FnRetTy, GenericArg, GenericArgs, HirId, HirIdMap, InlineAsmOperand, LetExpr, Lifetime, LifetimeKind,
Pat, PatExpr, PatExprKind, PatField, PatKind, Path, PathSegment, PrimTy, QPath, Stmt, StmtKind, StructTailExpr, Pat, PatExpr, PatExprKind, PatField, PatKind, Path, PathSegment, PrimTy, QPath, Stmt, StmtKind, StructTailExpr,
TraitBoundModifiers, Ty, TyKind, TyPat, TyPatKind, TraitBoundModifiers, Ty, TyKind, TyPat, TyPatKind,
}; };
@ -483,7 +483,7 @@ impl HirEqInterExpr<'_, '_, '_> {
} }
fn eq_lifetime(left: &Lifetime, right: &Lifetime) -> bool { fn eq_lifetime(left: &Lifetime, right: &Lifetime) -> bool {
left.res == right.res left.kind == right.kind
} }
fn eq_pat_field(&mut self, left: &PatField<'_>, right: &PatField<'_>) -> bool { fn eq_pat_field(&mut self, left: &PatField<'_>, right: &PatField<'_>) -> bool {
@ -1245,8 +1245,8 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
pub fn hash_lifetime(&mut self, lifetime: &Lifetime) { pub fn hash_lifetime(&mut self, lifetime: &Lifetime) {
lifetime.ident.name.hash(&mut self.s); lifetime.ident.name.hash(&mut self.s);
std::mem::discriminant(&lifetime.res).hash(&mut self.s); std::mem::discriminant(&lifetime.kind).hash(&mut self.s);
if let LifetimeName::Param(param_id) = lifetime.res { if let LifetimeKind::Param(param_id) = lifetime.kind {
param_id.hash(&mut self.s); param_id.hash(&mut self.s);
} }
} }

View File

@ -47,3 +47,22 @@ impl T for () {}
pub fn foo() { pub fn foo() {
().trait_method(); ().trait_method();
} }
// CHECK-LABEL: align_specified_twice_1
// CHECK-SAME: align 64
#[no_mangle]
#[repr(align(32), align(64))]
pub fn align_specified_twice_1() {}
// CHECK-LABEL: align_specified_twice_2
// CHECK-SAME: align 128
#[no_mangle]
#[repr(align(128), align(32))]
pub fn align_specified_twice_2() {}
// CHECK-LABEL: align_specified_twice_3
// CHECK-SAME: align 256
#[no_mangle]
#[repr(align(32))]
#[repr(align(256))]
pub fn align_specified_twice_3() {}

View File

@ -15,7 +15,7 @@ pub enum Enum0 {
B, B,
} }
// CHECK-LABEL: define noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @match0(i8{{.+}}%0) // CHECK-LABEL: define{{( dso_local)?}} noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @match0(i8{{.+}}%0)
// CHECK-NEXT: start: // CHECK-NEXT: start:
// CHECK-NEXT: %[[IS_B:.+]] = icmp eq i8 %0, 2 // CHECK-NEXT: %[[IS_B:.+]] = icmp eq i8 %0, 2
// CHECK-NEXT: %[[TRUNC:.+]] = and i8 %0, 1 // CHECK-NEXT: %[[TRUNC:.+]] = and i8 %0, 1
@ -37,7 +37,7 @@ pub enum Enum1 {
C, C,
} }
// CHECK-LABEL: define noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @match1(i8{{.+}}%0) // CHECK-LABEL: define{{( dso_local)?}} noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @match1(i8{{.+}}%0)
// CHECK-NEXT: start: // CHECK-NEXT: start:
// CHECK-NEXT: %[[REL_VAR:.+]] = add{{( nsw)?}} i8 %0, -2 // CHECK-NEXT: %[[REL_VAR:.+]] = add{{( nsw)?}} i8 %0, -2
// CHECK-NEXT: %[[REL_VAR_WIDE:.+]] = zext i8 %[[REL_VAR]] to i64 // CHECK-NEXT: %[[REL_VAR_WIDE:.+]] = zext i8 %[[REL_VAR]] to i64
@ -98,7 +98,7 @@ pub enum Enum2 {
E, E,
} }
// CHECK-LABEL: define noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @match2(i8{{.+}}%0) // CHECK-LABEL: define{{( dso_local)?}} noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @match2(i8{{.+}}%0)
// CHECK-NEXT: start: // CHECK-NEXT: start:
// CHECK-NEXT: %[[REL_VAR:.+]] = add i8 %0, 2 // CHECK-NEXT: %[[REL_VAR:.+]] = add i8 %0, 2
// CHECK-NEXT: %[[REL_VAR_WIDE:.+]] = zext i8 %[[REL_VAR]] to i64 // CHECK-NEXT: %[[REL_VAR_WIDE:.+]] = zext i8 %[[REL_VAR]] to i64
@ -121,7 +121,7 @@ pub fn match2(e: Enum2) -> u8 {
// And make sure it works even if the niched scalar is a pointer. // And make sure it works even if the niched scalar is a pointer.
// (For example, that we don't try to `sub` on pointers.) // (For example, that we don't try to `sub` on pointers.)
// CHECK-LABEL: define noundef{{( range\(i16 -?[0-9]+, -?[0-9]+\))?}} i16 @match3(ptr{{.+}}%0) // CHECK-LABEL: define{{( dso_local)?}} noundef{{( range\(i16 -?[0-9]+, -?[0-9]+\))?}} i16 @match3(ptr{{.+}}%0)
// CHECK-NEXT: start: // CHECK-NEXT: start:
// CHECK-NEXT: %[[IS_NULL:.+]] = icmp eq ptr %0, null // CHECK-NEXT: %[[IS_NULL:.+]] = icmp eq ptr %0, null
// CHECK-NEXT: br i1 %[[IS_NULL]] // CHECK-NEXT: br i1 %[[IS_NULL]]
@ -145,7 +145,7 @@ pub enum MiddleNiche {
E, E,
} }
// CHECK-LABEL: define noundef{{( range\(i8 -?[0-9]+, -?[0-9]+\))?}} i8 @match4(i8{{.+}}%0) // CHECK-LABEL: define{{( dso_local)?}} noundef{{( range\(i8 -?[0-9]+, -?[0-9]+\))?}} i8 @match4(i8{{.+}}%0)
// CHECK-NEXT: start: // CHECK-NEXT: start:
// CHECK-NEXT: %[[REL_VAR:.+]] = add{{( nsw)?}} i8 %0, -2 // CHECK-NEXT: %[[REL_VAR:.+]] = add{{( nsw)?}} i8 %0, -2
// CHECK-NEXT: %[[IS_NICHE:.+]] = icmp ult i8 %[[REL_VAR]], 5 // CHECK-NEXT: %[[IS_NICHE:.+]] = icmp ult i8 %[[REL_VAR]], 5
@ -449,7 +449,7 @@ pub enum HugeVariantIndex {
Possible259, Possible259,
} }
// CHECK-LABEL: define noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @match5(i8{{.+}}%0) // CHECK-LABEL: define{{( dso_local)?}} noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @match5(i8{{.+}}%0)
// CHECK-NEXT: start: // CHECK-NEXT: start:
// CHECK-NEXT: %[[REL_VAR:.+]] = add{{( nsw)?}} i8 %0, -2 // CHECK-NEXT: %[[REL_VAR:.+]] = add{{( nsw)?}} i8 %0, -2
// CHECK-NEXT: %[[REL_VAR_WIDE:.+]] = zext i8 %[[REL_VAR]] to i64 // CHECK-NEXT: %[[REL_VAR_WIDE:.+]] = zext i8 %[[REL_VAR]] to i64

View File

@ -66,7 +66,6 @@ error: unexpected `,` in pattern
LL | let women, men: (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned() LL | let women, men: (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned()
| ^ | ^
| |
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: try adding parentheses to match on a tuple help: try adding parentheses to match on a tuple
| |
LL | let (women, men): (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned() LL | let (women, men): (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned()

View File

@ -4,7 +4,6 @@ error: path separator must be a double colon
LL | a: Vec<foo::bar:A>, LL | a: Vec<foo::bar:A>,
| ^ | ^
| |
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: use a double colon instead help: use a double colon instead
| |
LL | a: Vec<foo::bar::A>, LL | a: Vec<foo::bar::A>,

View File

@ -6,9 +6,9 @@ macro transparent() {
let transparent = 0; let transparent = 0;
} }
#[rustc_macro_transparency = "semitransparent"] #[rustc_macro_transparency = "semitransparent"]
macro semitransparent() { macro semiopaque() {
struct SemiTransparent; struct SemiOpaque;
let semitransparent = 0; let semiopaque = 0;
} }
#[rustc_macro_transparency = "opaque"] #[rustc_macro_transparency = "opaque"]
macro opaque() { macro opaque() {
@ -18,14 +18,14 @@ macro opaque() {
fn main() { fn main() {
transparent!(); transparent!();
semitransparent!(); semiopaque!();
opaque!(); opaque!();
Transparent; // OK Transparent; // OK
SemiTransparent; // OK SemiOpaque; // OK
Opaque; //~ ERROR cannot find value `Opaque` in this scope Opaque; //~ ERROR cannot find value `Opaque` in this scope
transparent; // OK transparent; // OK
semitransparent; //~ ERROR expected value, found macro `semitransparent` semiopaque; //~ ERROR expected value, found macro `semiopaque`
opaque; //~ ERROR expected value, found macro `opaque` opaque; //~ ERROR expected value, found macro `opaque`
} }

View File

@ -4,17 +4,17 @@ error[E0425]: cannot find value `Opaque` in this scope
LL | Opaque; LL | Opaque;
| ^^^^^^ not found in this scope | ^^^^^^ not found in this scope
error[E0423]: expected value, found macro `semitransparent` error[E0423]: expected value, found macro `semiopaque`
--> $DIR/rustc-macro-transparency.rs:29:5 --> $DIR/rustc-macro-transparency.rs:29:5
| |
LL | struct SemiTransparent; LL | struct SemiOpaque;
| ----------------------- similarly named unit struct `SemiTransparent` defined here | ------------------ similarly named unit struct `SemiOpaque` defined here
... ...
LL | semitransparent; LL | semiopaque;
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^
| | | |
| not a value | not a value
| help: a unit struct with a similar name exists: `SemiTransparent` | help: a unit struct with a similar name exists (notice the capitalization): `SemiOpaque`
error[E0423]: expected value, found macro `opaque` error[E0423]: expected value, found macro `opaque`
--> $DIR/rustc-macro-transparency.rs:30:5 --> $DIR/rustc-macro-transparency.rs:30:5

View File

@ -24,5 +24,5 @@ crate0::{{expn1}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt:
SyntaxContexts: SyntaxContexts:
#0: parent: #0, outer_mark: (crate0::{{expn0}}, Opaque) #0: parent: #0, outer_mark: (crate0::{{expn0}}, Opaque)
#1: parent: #0, outer_mark: (crate0::{{expn1}}, SemiTransparent) #1: parent: #0, outer_mark: (crate0::{{expn1}}, SemiOpaque)
*/ */

View File

@ -6,7 +6,6 @@ LL | let _ = |A | B: E| ();
| | | |
| while parsing the body of this closure | while parsing the body of this closure
| |
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: you might have meant to open the body of the closure help: you might have meant to open the body of the closure
| |
LL | let _ = |A | { B: E| (); LL | let _ = |A | { B: E| ();

View File

@ -49,24 +49,18 @@ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
| |
LL | let _ = 0i32: i32: i32.count_ones(); LL | let _ = 0i32: i32: i32.count_ones();
| ^ expected one of `.`, `;`, `?`, `else`, or an operator | ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: expected one of `!`, `(`, `.`, `::`, `;`, `<`, `?`, or `else`, found `:` error: expected one of `!`, `(`, `.`, `::`, `;`, `<`, `?`, or `else`, found `:`
--> $DIR/issue-35813-postfix-after-cast.rs:43:21 --> $DIR/issue-35813-postfix-after-cast.rs:43:21
| |
LL | let _ = 0 as i32: i32.count_ones(); LL | let _ = 0 as i32: i32.count_ones();
| ^ expected one of 8 possible tokens | ^ expected one of 8 possible tokens
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
--> $DIR/issue-35813-postfix-after-cast.rs:47:17 --> $DIR/issue-35813-postfix-after-cast.rs:47:17
| |
LL | let _ = 0i32: i32 as i32.count_ones(); LL | let _ = 0i32: i32 as i32.count_ones();
| ^ expected one of `.`, `;`, `?`, `else`, or an operator | ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: cast cannot be followed by a method call error: cast cannot be followed by a method call
--> $DIR/issue-35813-postfix-after-cast.rs:51:13 --> $DIR/issue-35813-postfix-after-cast.rs:51:13
@ -84,16 +78,12 @@ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
| |
LL | let _ = 0i32: i32: i32 as u32 as i32.count_ones(); LL | let _ = 0i32: i32: i32 as u32 as i32.count_ones();
| ^ expected one of `.`, `;`, `?`, `else`, or an operator | ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
--> $DIR/issue-35813-postfix-after-cast.rs:60:17 --> $DIR/issue-35813-postfix-after-cast.rs:60:17
| |
LL | let _ = 0i32: i32.count_ones(): u32; LL | let _ = 0i32: i32.count_ones(): u32;
| ^ expected one of `.`, `;`, `?`, `else`, or an operator | ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: cast cannot be followed by a method call error: cast cannot be followed by a method call
--> $DIR/issue-35813-postfix-after-cast.rs:64:13 --> $DIR/issue-35813-postfix-after-cast.rs:64:13
@ -111,16 +101,12 @@ error: expected one of `.`, `;`, `?`, or `else`, found `:`
| |
LL | let _ = 0 as i32.count_ones(): u32; LL | let _ = 0 as i32.count_ones(): u32;
| ^ expected one of `.`, `;`, `?`, or `else` | ^ expected one of `.`, `;`, `?`, or `else`
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
--> $DIR/issue-35813-postfix-after-cast.rs:69:17 --> $DIR/issue-35813-postfix-after-cast.rs:69:17
| |
LL | let _ = 0i32: i32.count_ones() as u32; LL | let _ = 0i32: i32.count_ones() as u32;
| ^ expected one of `.`, `;`, `?`, `else`, or an operator | ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: cast cannot be followed by a method call error: cast cannot be followed by a method call
--> $DIR/issue-35813-postfix-after-cast.rs:73:13 --> $DIR/issue-35813-postfix-after-cast.rs:73:13
@ -138,8 +124,6 @@ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
| |
LL | let _ = 0i32: i32: i32.count_ones() as u32 as i32; LL | let _ = 0i32: i32: i32.count_ones() as u32 as i32;
| ^ expected one of `.`, `;`, `?`, `else`, or an operator | ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: cast cannot be followed by a method call error: cast cannot be followed by a method call
--> $DIR/issue-35813-postfix-after-cast.rs:82:13 --> $DIR/issue-35813-postfix-after-cast.rs:82:13
@ -262,8 +246,6 @@ error: expected identifier, found `:`
| |
LL | drop_ptr: F(); LL | drop_ptr: F();
| ^ expected identifier | ^ expected identifier
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `:` error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `:`
--> $DIR/issue-35813-postfix-after-cast.rs:160:13 --> $DIR/issue-35813-postfix-after-cast.rs:160:13

View File

@ -4,7 +4,6 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, fo
LL | let x = Tr<A, A:>; LL | let x = Tr<A, A:>;
| ^ expected one of 8 possible tokens | ^ expected one of 8 possible tokens
| |
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: maybe write a path separator here help: maybe write a path separator here
| |
LL | let x = Tr<A, A::>; LL | let x = Tr<A, A::>;

View File

@ -33,8 +33,6 @@ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
| |
LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false }; LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
| ^ expected one of `.`, `;`, `?`, `else`, or an operator | ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: Rust has no ternary operator error: Rust has no ternary operator
--> $DIR/ternary_operator.rs:26:19 --> $DIR/ternary_operator.rs:26:19

View File

@ -11,8 +11,6 @@ error: expected one of `)`, `,`, `@`, `if`, or `|`, found `:`
| |
LL | let a @ (b: u8); LL | let a @ (b: u8);
| ^ expected one of `)`, `,`, `@`, `if`, or `|` | ^ expected one of `)`, `,`, `@`, `if`, or `|`
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found `@` error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found `@`
--> $DIR/nested-type-ascription-syntactically-invalid.rs:30:15 --> $DIR/nested-type-ascription-syntactically-invalid.rs:30:15

View File

@ -60,11 +60,11 @@ SyntaxContexts:
#0: parent: #0, outer_mark: (crate0::{{expn0}}, Opaque) #0: parent: #0, outer_mark: (crate0::{{expn0}}, Opaque)
#1: parent: #0, outer_mark: (crate0::{{expn1}}, Opaque) #1: parent: #0, outer_mark: (crate0::{{expn1}}, Opaque)
#2: parent: #0, outer_mark: (crate0::{{expn1}}, Transparent) #2: parent: #0, outer_mark: (crate0::{{expn1}}, Transparent)
#3: parent: #0, outer_mark: (crate0::{{expn2}}, SemiTransparent) #3: parent: #0, outer_mark: (crate0::{{expn2}}, SemiOpaque)
#4: parent: #0, outer_mark: (crate0::{{expn3}}, Opaque) #4: parent: #0, outer_mark: (crate0::{{expn3}}, Opaque)
#5: parent: #3, outer_mark: (crate0::{{expn3}}, Transparent) #5: parent: #3, outer_mark: (crate0::{{expn3}}, Transparent)
#6: parent: #0, outer_mark: (crate0::{{expn3}}, SemiTransparent) #6: parent: #0, outer_mark: (crate0::{{expn3}}, SemiOpaque)
#7: parent: #0, outer_mark: (crate0::{{expn4}}, Opaque) #7: parent: #0, outer_mark: (crate0::{{expn4}}, Opaque)
#8: parent: #4, outer_mark: (crate0::{{expn4}}, Transparent) #8: parent: #4, outer_mark: (crate0::{{expn4}}, Transparent)
#9: parent: #4, outer_mark: (crate0::{{expn4}}, SemiTransparent) #9: parent: #4, outer_mark: (crate0::{{expn4}}, SemiOpaque)
*/ */

View File

@ -82,10 +82,10 @@ SyntaxContexts:
#0: parent: #0, outer_mark: (crate0::{{expn0}}, Opaque) #0: parent: #0, outer_mark: (crate0::{{expn0}}, Opaque)
#1: parent: #0, outer_mark: (crate0::{{expn1}}, Opaque) #1: parent: #0, outer_mark: (crate0::{{expn1}}, Opaque)
#2: parent: #0, outer_mark: (crate0::{{expn1}}, Transparent) #2: parent: #0, outer_mark: (crate0::{{expn1}}, Transparent)
#3: parent: #0, outer_mark: (crate0::{{expn2}}, SemiTransparent) #3: parent: #0, outer_mark: (crate0::{{expn2}}, SemiOpaque)
#4: parent: #3, outer_mark: (crate0::{{expn3}}, Opaque) #4: parent: #3, outer_mark: (crate0::{{expn3}}, Opaque)
#5: parent: #0, outer_mark: (crate0::{{expn3}}, Opaque) #5: parent: #0, outer_mark: (crate0::{{expn3}}, Opaque)
#6: parent: #0, outer_mark: (crate0::{{expn4}}, Opaque) #6: parent: #0, outer_mark: (crate0::{{expn4}}, Opaque)
#7: parent: #4, outer_mark: (crate0::{{expn4}}, Transparent) #7: parent: #4, outer_mark: (crate0::{{expn4}}, Transparent)
#8: parent: #5, outer_mark: (crate0::{{expn4}}, SemiTransparent) #8: parent: #5, outer_mark: (crate0::{{expn4}}, SemiOpaque)
*/ */

View File

@ -4,7 +4,6 @@ error: path separator must be a double colon
LL | fn fmt(&self, f: &mut fmt:Formatter) -> fmt::Result { LL | fn fmt(&self, f: &mut fmt:Formatter) -> fmt::Result {
| ^ | ^
| |
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: use a double colon instead help: use a double colon instead
| |
LL | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { LL | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

View File

@ -3,8 +3,6 @@ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
| |
LL | let _ = 0: i32; LL | let _ = 0: i32;
| ^ expected one of `.`, `;`, `?`, `else`, or an operator | ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -4,7 +4,6 @@ error: path separator must be a double colon
LL | a: foo:A, LL | a: foo:A,
| ^ | ^
| |
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: use a double colon instead help: use a double colon instead
| |
LL | a: foo::A, LL | a: foo::A,
@ -16,7 +15,6 @@ error: path separator must be a double colon
LL | b: foo::bar:B, LL | b: foo::bar:B,
| ^ | ^
| |
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: use a double colon instead help: use a double colon instead
| |
LL | b: foo::bar::B, LL | b: foo::bar::B,

View File

@ -4,7 +4,6 @@ error: path separator must be a double colon
LL | let _ = Box:new("foo".to_string()); LL | let _ = Box:new("foo".to_string());
| ^ | ^
| |
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: use a double colon instead help: use a double colon instead
| |
LL | let _ = Box::new("foo".to_string()); LL | let _ = Box::new("foo".to_string());

View File

@ -4,7 +4,6 @@ error: expected one of `(`, `.`, `::`, `;`, `?`, `else`, or an operator, found `
LL | let _ = vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?; LL | let _ = vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?;
| ^ expected one of 7 possible tokens | ^ expected one of 7 possible tokens
| |
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: maybe write a path separator here help: maybe write a path separator here
| |
LL | let _ = vec![Ok(2)].into_iter().collect::<Result<Vec<_>,_>>()?; LL | let _ = vec![Ok(2)].into_iter().collect::<Result<Vec<_>,_>>()?;

View File

@ -4,7 +4,6 @@ error: path separator must be a double colon
LL | std:io::stdin(); LL | std:io::stdin();
| ^ | ^
| |
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: use a double colon instead help: use a double colon instead
| |
LL | std::io::stdin(); LL | std::io::stdin();

View File

@ -4,7 +4,6 @@ error: path separator must be a double colon
LL | let _ = Option:Some(""); LL | let _ = Option:Some("");
| ^ | ^
| |
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: use a double colon instead help: use a double colon instead
| |
LL | let _ = Option::Some(""); LL | let _ = Option::Some("");

View File

@ -4,7 +4,6 @@ error: path separator must be a double colon
LL | let _ = Option:Some(vec![0, 1]); LL | let _ = Option:Some(vec![0, 1]);
| ^ | ^
| |
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: use a double colon instead help: use a double colon instead
| |
LL | let _ = Option::Some(vec![0, 1]); LL | let _ = Option::Some(vec![0, 1]);

View File

@ -4,7 +4,6 @@ error: path separator must be a double colon
LL | println!("{}", std::mem:size_of::<BTreeMap<u32, u32>>()); LL | println!("{}", std::mem:size_of::<BTreeMap<u32, u32>>());
| ^ | ^
| |
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: use a double colon instead help: use a double colon instead
| |
LL | println!("{}", std::mem::size_of::<BTreeMap<u32, u32>>()); LL | println!("{}", std::mem::size_of::<BTreeMap<u32, u32>>());

View File

@ -4,7 +4,6 @@ error: path separator must be a double colon
LL | let _: usize = std::mem:size_of::<u32>(); LL | let _: usize = std::mem:size_of::<u32>();
| ^ | ^
| |
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: use a double colon instead help: use a double colon instead
| |
LL | let _: usize = std::mem::size_of::<u32>(); LL | let _: usize = std::mem::size_of::<u32>();

View File

@ -4,7 +4,6 @@ error: expected identifier, found `:`
LL | _foo: i32 = 4; LL | _foo: i32 = 4;
| ^ expected identifier | ^ expected identifier
| |
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: you might have meant to introduce a new binding help: you might have meant to introduce a new binding
| |
LL | let _foo: i32 = 4; LL | let _foo: i32 = 4;

View File

@ -4,7 +4,6 @@ error: statements are terminated with a semicolon
LL | println!("test"): LL | println!("test"):
| ^ | ^
| |
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: use a semicolon instead help: use a semicolon instead
| |
LL - println!("test"): LL - println!("test"):

View File

@ -33,8 +33,6 @@ error: expected identifier, found `:`
| |
LL | S .. S: S; LL | S .. S: S;
| ^ expected identifier | ^ expected identifier
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:`
--> $DIR/type-ascription-precedence.rs:53:13 --> $DIR/type-ascription-precedence.rs:53:13

View File

@ -4,7 +4,6 @@ error: statements are terminated with a semicolon
LL | f() : LL | f() :
| ^ | ^
| |
= note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: use a semicolon instead help: use a semicolon instead
| |
LL - f() : LL - f() :