authorbors <bors@rust-lang.org> 2025-03-25 13:29:50 UTC
committerbors <bors@rust-lang.org> 2025-03-25 13:29:50 UTC
log48994b1674b3212d27b5e83841c0966bc2b4be43
tree17ef64301045014d011ead06bd02977c443627ad
parent7d49ae9731555937177d01e9fa39dbf22eb60399
parent375710407199a9377c6e272acdfae938c5a5a771

Auto merge of #138923 - TaKO8Ki:rollup-f3hkmqj, r=TaKO8Ki

Rollup of 9 pull requests Successful merges: - #138385 (Keyword tweaks) - #138580 (resolve: Avoid some unstable iteration 2) - #138652 (Reintroduce remote-test support in run-make tests) - #138701 (Make default_codegen_backend serializable) - #138755 ([rustdoc] Remove duplicated loop when computing doc cfgs) - #138829 (Slightly reword triagebot ping message for `relnotes-interest-group`) - #138837 (resolve: Avoid remaining unstable iteration) - #138838 (Fix/tweak some tests in new solver) - #138895 (Add a helper for building an owner id in ast lowering) r? `@ghost` `@rustbot` modify labels: rollup

32 files changed, 273 insertions(+), 214 deletions(-)

compiler/rustc_ast/src/token.rs-5
......@@ -928,11 +928,6 @@ impl Token {
928928 self.is_non_raw_ident_where(Ident::is_path_segment_keyword)
929929 }
930930
931 /// Don't use this unless you're doing something very loose and heuristic-y.
932 pub fn is_any_keyword(&self) -> bool {
933 self.is_non_raw_ident_where(Ident::is_any_keyword)
934 }
935
936931 /// Returns true for reserved identifiers used internally for elided lifetimes,
937932 /// unnamed method parameters, crate root module, error recovery etc.
938933 pub fn is_special_ident(&self) -> bool {
compiler/rustc_ast_lowering/src/item.rs+7-10
......@@ -132,8 +132,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
132132 }
133133
134134 pub(super) fn lower_item_ref(&mut self, i: &Item) -> SmallVec<[hir::ItemId; 1]> {
135 let mut node_ids =
136 smallvec![hir::ItemId { owner_id: hir::OwnerId { def_id: self.local_def_id(i.id) } }];
135 let mut node_ids = smallvec![hir::ItemId { owner_id: self.owner_id(i.id) }];
137136 if let ItemKind::Use(use_tree) = &i.kind {
138137 self.lower_item_id_use_tree(use_tree, &mut node_ids);
139138 }
......@@ -144,9 +143,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
144143 match &tree.kind {
145144 UseTreeKind::Nested { items, .. } => {
146145 for &(ref nested, id) in items {
147 vec.push(hir::ItemId {
148 owner_id: hir::OwnerId { def_id: self.local_def_id(id) },
149 });
146 vec.push(hir::ItemId { owner_id: self.owner_id(id) });
150147 self.lower_item_id_use_tree(nested, vec);
151148 }
152149 }
......@@ -585,7 +582,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
585582
586583 // Add all the nested `PathListItem`s to the HIR.
587584 for &(ref use_tree, id) in trees {
588 let new_hir_id = self.local_def_id(id);
585 let owner_id = self.owner_id(id);
589586
590587 // Each `use` import is an item and thus are owners of the
591588 // names in the path. Up to this point the nested import is
......@@ -602,7 +599,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
602599 }
603600
604601 let item = hir::Item {
605 owner_id: hir::OwnerId { def_id: new_hir_id },
602 owner_id,
606603 kind,
607604 vis_span,
608605 span: this.lower_span(use_tree.span),
......@@ -710,7 +707,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
710707
711708 fn lower_foreign_item_ref(&mut self, i: &ForeignItem) -> hir::ForeignItemRef {
712709 hir::ForeignItemRef {
713 id: hir::ForeignItemId { owner_id: hir::OwnerId { def_id: self.local_def_id(i.id) } },
710 id: hir::ForeignItemId { owner_id: self.owner_id(i.id) },
714711 ident: self.lower_ident(i.ident),
715712 span: self.lower_span(i.span),
716713 }
......@@ -931,7 +928,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
931928 panic!("macros should have been expanded by now")
932929 }
933930 };
934 let id = hir::TraitItemId { owner_id: hir::OwnerId { def_id: self.local_def_id(i.id) } };
931 let id = hir::TraitItemId { owner_id: self.owner_id(i.id) };
935932 hir::TraitItemRef {
936933 id,
937934 ident: self.lower_ident(i.ident),
......@@ -1046,7 +1043,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10461043
10471044 fn lower_impl_item_ref(&mut self, i: &AssocItem) -> hir::ImplItemRef {
10481045 hir::ImplItemRef {
1049 id: hir::ImplItemId { owner_id: hir::OwnerId { def_id: self.local_def_id(i.id) } },
1046 id: hir::ImplItemId { owner_id: self.owner_id(i.id) },
10501047 ident: self.lower_ident(i.ident),
10511048 span: self.lower_span(i.span),
10521049 kind: match &i.kind {
compiler/rustc_ast_lowering/src/lib.rs+10-6
......@@ -536,6 +536,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
536536 self.opt_local_def_id(node).unwrap_or_else(|| panic!("no entry for node id: `{node:?}`"))
537537 }
538538
539 /// Given the id of an owner node in the AST, returns the corresponding `OwnerId`.
540 fn owner_id(&self, node: NodeId) -> hir::OwnerId {
541 hir::OwnerId { def_id: self.local_def_id(node) }
542 }
543
539544 /// Freshen the `LoweringContext` and ready it to lower a nested item.
540545 /// The lowered item is registered into `self.children`.
541546 ///
......@@ -547,7 +552,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
547552 owner: NodeId,
548553 f: impl FnOnce(&mut Self) -> hir::OwnerNode<'hir>,
549554 ) {
550 let def_id = self.local_def_id(owner);
555 let owner_id = self.owner_id(owner);
551556
552557 let current_attrs = std::mem::take(&mut self.attrs);
553558 let current_bodies = std::mem::take(&mut self.bodies);
......@@ -558,8 +563,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
558563 #[cfg(debug_assertions)]
559564 let current_node_id_to_local_id = std::mem::take(&mut self.node_id_to_local_id);
560565 let current_trait_map = std::mem::take(&mut self.trait_map);
561 let current_owner =
562 std::mem::replace(&mut self.current_hir_id_owner, hir::OwnerId { def_id });
566 let current_owner = std::mem::replace(&mut self.current_hir_id_owner, owner_id);
563567 let current_local_counter =
564568 std::mem::replace(&mut self.item_local_id_counter, hir::ItemLocalId::new(1));
565569 let current_impl_trait_defs = std::mem::take(&mut self.impl_trait_defs);
......@@ -577,7 +581,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
577581 }
578582
579583 let item = f(self);
580 debug_assert_eq!(def_id, item.def_id().def_id);
584 debug_assert_eq!(owner_id, item.def_id());
581585 // `f` should have consumed all the elements in these vectors when constructing `item`.
582586 debug_assert!(self.impl_trait_defs.is_empty());
583587 debug_assert!(self.impl_trait_bounds.is_empty());
......@@ -598,8 +602,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
598602 self.impl_trait_defs = current_impl_trait_defs;
599603 self.impl_trait_bounds = current_impl_trait_bounds;
600604
601 debug_assert!(!self.children.iter().any(|(id, _)| id == &def_id));
602 self.children.push((def_id, hir::MaybeOwner::Owner(info)));
605 debug_assert!(!self.children.iter().any(|(id, _)| id == &owner_id.def_id));
606 self.children.push((owner_id.def_id, hir::MaybeOwner::Owner(info)));
603607 }
604608
605609 fn make_owner_info(&mut self, node: hir::OwnerNode<'hir>) -> &'hir hir::OwnerInfo<'hir> {
compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs+9-7
......@@ -971,15 +971,17 @@ where
971971 rhs: T,
972972 ) -> Result<(), NoSolution> {
973973 let goals = self.delegate.relate(param_env, lhs, variance, rhs, self.origin_span)?;
974 if cfg!(debug_assertions) {
975 for g in goals.iter() {
976 match g.predicate.kind().skip_binder() {
977 ty::PredicateKind::Subtype { .. } | ty::PredicateKind::AliasRelate(..) => {}
978 p => unreachable!("unexpected nested goal in `relate`: {p:?}"),
974 for &goal in goals.iter() {
975 let source = match goal.predicate.kind().skip_binder() {
976 ty::PredicateKind::Subtype { .. } | ty::PredicateKind::AliasRelate(..) => {
977 GoalSource::TypeRelating
979978 }
980 }
979 // FIXME(-Znext-solver=coinductive): should these WF goals also be unproductive?
980 ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_)) => GoalSource::Misc,
981 p => unreachable!("unexpected nested goal in `relate`: {p:?}"),
982 };
983 self.add_goal(source, goal);
981984 }
982 self.add_goals(GoalSource::TypeRelating, goals);
983985 Ok(())
984986 }
985987
compiler/rustc_resolve/src/build_reduced_graph.rs-1
......@@ -1115,7 +1115,6 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
11151115 }
11161116 });
11171117 } else {
1118 #[allow(rustc::potential_query_instability)] // FIXME
11191118 for ident in single_imports.iter().cloned() {
11201119 let result = self.r.maybe_resolve_ident_in_module(
11211120 ModuleOrUniformRoot::Module(module),
compiler/rustc_resolve/src/diagnostics.rs-1
......@@ -1468,7 +1468,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
14681468 return;
14691469 }
14701470
1471 #[allow(rustc::potential_query_instability)] // FIXME
14721471 let unused_macro = self.unused_macros.iter().find_map(|(def_id, (_, unused_ident))| {
14731472 if unused_ident.name == ident.name { Some((def_id, unused_ident)) } else { None }
14741473 });
compiler/rustc_resolve/src/ident.rs-1
......@@ -946,7 +946,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
946946
947947 // Check if one of single imports can still define the name,
948948 // if it can then our result is not determined and can be invalidated.
949 #[allow(rustc::potential_query_instability)] // FIXME
950949 for single_import in &resolution.single_imports {
951950 if ignore_import == Some(*single_import) {
952951 // This branch handles a cycle in single imports.
compiler/rustc_resolve/src/imports.rs+4-4
......@@ -4,7 +4,7 @@ use std::cell::Cell;
44use std::mem;
55
66use rustc_ast::NodeId;
7use rustc_data_structures::fx::FxHashSet;
7use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
88use rustc_data_structures::intern::Interned;
99use rustc_errors::codes::*;
1010use rustc_errors::{Applicability, MultiSpan, pluralize, struct_span_code_err};
......@@ -233,7 +233,7 @@ impl<'ra> ImportData<'ra> {
233233pub(crate) struct NameResolution<'ra> {
234234 /// Single imports that may define the name in the namespace.
235235 /// Imports are arena-allocated, so it's ok to use pointers as keys.
236 pub single_imports: FxHashSet<Import<'ra>>,
236 pub single_imports: FxIndexSet<Import<'ra>>,
237237 /// The least shadowable known binding for this name, or None if there are no known bindings.
238238 pub binding: Option<NameBinding<'ra>>,
239239 pub shadowed_glob: Option<NameBinding<'ra>>,
......@@ -494,7 +494,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
494494 let key = BindingKey::new(target, ns);
495495 let _ = this.try_define(import.parent_scope.module, key, dummy_binding, false);
496496 this.update_resolution(import.parent_scope.module, key, false, |_, resolution| {
497 resolution.single_imports.remove(&import);
497 resolution.single_imports.swap_remove(&import);
498498 })
499499 });
500500 self.record_use(target, dummy_binding, Used::Other);
......@@ -862,7 +862,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
862862 }
863863 let key = BindingKey::new(target, ns);
864864 this.update_resolution(parent, key, false, |_, resolution| {
865 resolution.single_imports.remove(&import);
865 resolution.single_imports.swap_remove(&import);
866866 });
867867 }
868868 }
compiler/rustc_resolve/src/late.rs+8-10
......@@ -272,7 +272,7 @@ impl RibKind<'_> {
272272/// resolving, the name is looked up from inside out.
273273#[derive(Debug)]
274274pub(crate) struct Rib<'ra, R = Res> {
275 pub bindings: FxHashMap<Ident, R>,
275 pub bindings: FxIndexMap<Ident, R>,
276276 pub patterns_with_skipped_bindings: UnordMap<DefId, Vec<(Span, Result<(), ErrorGuaranteed>)>>,
277277 pub kind: RibKind<'ra>,
278278}
......@@ -672,7 +672,7 @@ struct DiagMetadata<'ast> {
672672
673673 /// A list of labels as of yet unused. Labels will be removed from this map when
674674 /// they are used (in a `break` or `continue` statement)
675 unused_labels: FxHashMap<NodeId, Span>,
675 unused_labels: FxIndexMap<NodeId, Span>,
676676
677677 /// Only used for better errors on `let x = { foo: bar };`.
678678 /// In the case of a parse error with `let x = { foo: bar, };`, this isn't needed, it's only
......@@ -1639,8 +1639,8 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
16391639
16401640 // Allow all following defaults to refer to this type parameter.
16411641 let i = &Ident::with_dummy_span(param.ident.name);
1642 forward_ty_ban_rib.bindings.remove(i);
1643 forward_ty_ban_rib_const_param_ty.bindings.remove(i);
1642 forward_ty_ban_rib.bindings.swap_remove(i);
1643 forward_ty_ban_rib_const_param_ty.bindings.swap_remove(i);
16441644 }
16451645 GenericParamKind::Const { ref ty, kw_span: _, ref default } => {
16461646 // Const parameters can't have param bounds.
......@@ -1675,8 +1675,8 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
16751675
16761676 // Allow all following defaults to refer to this const parameter.
16771677 let i = &Ident::with_dummy_span(param.ident.name);
1678 forward_const_ban_rib.bindings.remove(i);
1679 forward_const_ban_rib_const_param_ty.bindings.remove(i);
1678 forward_const_ban_rib.bindings.swap_remove(i);
1679 forward_const_ban_rib_const_param_ty.bindings.swap_remove(i);
16801680 }
16811681 }
16821682 }
......@@ -2885,7 +2885,6 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
28852885 break;
28862886 }
28872887
2888 #[allow(rustc::potential_query_instability)] // FIXME
28892888 seen_bindings
28902889 .extend(parent_rib.bindings.keys().map(|ident| (*ident, ident.span)));
28912890 }
......@@ -4000,7 +3999,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
40003999 }
40014000 }
40024001
4003 fn innermost_rib_bindings(&mut self, ns: Namespace) -> &mut FxHashMap<Ident, Res> {
4002 fn innermost_rib_bindings(&mut self, ns: Namespace) -> &mut FxIndexMap<Ident, Res> {
40044003 &mut self.ribs[ns].last_mut().unwrap().bindings
40054004 }
40064005
......@@ -4776,7 +4775,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
47764775 Ok((node_id, _)) => {
47774776 // Since this res is a label, it is never read.
47784777 self.r.label_res_map.insert(expr.id, node_id);
4779 self.diag_metadata.unused_labels.remove(&node_id);
4778 self.diag_metadata.unused_labels.swap_remove(&node_id);
47804779 }
47814780 Err(error) => {
47824781 self.report_error(label.ident.span, error);
......@@ -5198,7 +5197,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
51985197 let mut late_resolution_visitor = LateResolutionVisitor::new(self);
51995198 late_resolution_visitor.resolve_doc_links(&krate.attrs, MaybeExported::Ok(CRATE_NODE_ID));
52005199 visit::walk_crate(&mut late_resolution_visitor, krate);
5201 #[allow(rustc::potential_query_instability)] // FIXME
52025200 for (id, span) in late_resolution_visitor.diag_metadata.unused_labels.iter() {
52035201 self.lint_buffer.buffer_lint(
52045202 lint::builtin::UNUSED_LABELS,
compiler/rustc_resolve/src/late/diagnostics.rs+1-6
......@@ -830,7 +830,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
830830 if let Some(rib) = &self.last_block_rib
831831 && let RibKind::Normal = rib.kind
832832 {
833 #[allow(rustc::potential_query_instability)] // FIXME
834833 for (ident, &res) in &rib.bindings {
835834 if let Res::Local(_) = res
836835 && path.len() == 1
......@@ -1019,7 +1018,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
10191018 if let Some(err_code) = err.code {
10201019 if err_code == E0425 {
10211020 for label_rib in &self.label_ribs {
1022 #[allow(rustc::potential_query_instability)] // FIXME
10231021 for (label_ident, node_id) in &label_rib.bindings {
10241022 let ident = path.last().unwrap().ident;
10251023 if format!("'{ident}") == label_ident.to_string() {
......@@ -1036,7 +1034,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
10361034 Applicability::MaybeIncorrect,
10371035 );
10381036 // Do not lint against unused label when we suggest them.
1039 self.diag_metadata.unused_labels.remove(node_id);
1037 self.diag_metadata.unused_labels.swap_remove(node_id);
10401038 }
10411039 }
10421040 }
......@@ -2265,7 +2263,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
22652263 };
22662264
22672265 // Locals and type parameters
2268 #[allow(rustc::potential_query_instability)] // FIXME
22692266 for (ident, &res) in &rib.bindings {
22702267 if filter_fn(res) && ident.span.ctxt() == rib_ctxt {
22712268 names.push(TypoSuggestion::typo_from_ident(*ident, res));
......@@ -2793,7 +2790,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
27932790 let within_scope = self.is_label_valid_from_rib(rib_index);
27942791
27952792 let rib = &self.label_ribs[rib_index];
2796 #[allow(rustc::potential_query_instability)] // FIXME
27972793 let names = rib
27982794 .bindings
27992795 .iter()
......@@ -2805,7 +2801,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
28052801 // Upon finding a similar name, get the ident that it was from - the span
28062802 // contained within helps make a useful diagnostic. In addition, determine
28072803 // whether this candidate is within scope.
2808 #[allow(rustc::potential_query_instability)] // FIXME
28092804 let (ident, _) = rib.bindings.iter().find(|(ident, _)| ident.name == symbol).unwrap();
28102805 (*ident, within_scope)
28112806 })
compiler/rustc_resolve/src/lib.rs+1-1
......@@ -1137,7 +1137,7 @@ pub struct Resolver<'ra, 'tcx> {
11371137 non_macro_attr: MacroData,
11381138 local_macro_def_scopes: FxHashMap<LocalDefId, Module<'ra>>,
11391139 ast_transform_scopes: FxHashMap<LocalExpnId, Module<'ra>>,
1140 unused_macros: FxHashMap<LocalDefId, (NodeId, Ident)>,
1140 unused_macros: FxIndexMap<LocalDefId, (NodeId, Ident)>,
11411141 /// A map from the macro to all its potentially unused arms.
11421142 unused_macro_rules: FxIndexMap<LocalDefId, UnordMap<usize, (Ident, Span)>>,
11431143 proc_macro_stubs: FxHashSet<LocalDefId>,
compiler/rustc_resolve/src/macros.rs+1-2
......@@ -323,7 +323,6 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> {
323323 }
324324
325325 fn check_unused_macros(&mut self) {
326 #[allow(rustc::potential_query_instability)] // FIXME
327326 for (_, &(node_id, ident)) in self.unused_macros.iter() {
328327 self.lint_buffer.buffer_lint(
329328 UNUSED_MACROS,
......@@ -576,7 +575,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
576575 match res {
577576 Res::Def(DefKind::Macro(_), def_id) => {
578577 if let Some(def_id) = def_id.as_local() {
579 self.unused_macros.remove(&def_id);
578 self.unused_macros.swap_remove(&def_id);
580579 if self.proc_macro_stubs.contains(&def_id) {
581580 self.dcx().emit_err(errors::ProcMacroSameCrate {
582581 span: path.span,
compiler/rustc_span/src/symbol.rs+33-31
......@@ -26,13 +26,13 @@ symbols! {
2626 // documents (such as the Rust Reference) about whether it is a keyword
2727 // (e.g. `_`).
2828 //
29 // If you modify this list, adjust any relevant `Symbol::{is,can_be}_*` predicates and
30 // `used_keywords`.
31 // But this should rarely be necessary if the keywords are kept in alphabetic order.
29 // If you modify this list, adjust any relevant `Symbol::{is,can_be}_*`
30 // predicates and `used_keywords`. Also consider adding new keywords to the
31 // `ui/parser/raw/raw-idents.rs` test.
3232 Keywords {
3333 // Special reserved identifiers used internally for elided lifetimes,
3434 // unnamed method parameters, crate root module, error recovery etc.
35 // Matching predicates: `is_any_keyword`, `is_special`/`is_reserved`
35 // Matching predicates: `is_special`/`is_reserved`
3636 //
3737 // Notes about `kw::Empty`:
3838 // - Its use can blur the lines between "empty symbol" and "no symbol".
......@@ -42,13 +42,16 @@ symbols! {
4242 // present, it's better to use `sym::dummy` than `kw::Empty`, because
4343 // it's clearer that it's intended as a dummy value, and more likely
4444 // to be detected if it accidentally does get used.
45 // tidy-alphabetical-start
46 DollarCrate: "$crate",
4547 Empty: "",
4648 PathRoot: "{{root}}",
47 DollarCrate: "$crate",
4849 Underscore: "_",
50 // tidy-alphabetical-end
4951
5052 // Keywords that are used in stable Rust.
51 // Matching predicates: `is_any_keyword`, `is_used_keyword_always`/`is_reserved`
53 // Matching predicates: `is_used_keyword_always`/`is_reserved`
54 // tidy-alphabetical-start
5255 As: "as",
5356 Break: "break",
5457 Const: "const",
......@@ -84,9 +87,11 @@ symbols! {
8487 Use: "use",
8588 Where: "where",
8689 While: "while",
90 // tidy-alphabetical-end
8791
8892 // Keywords that are used in unstable Rust or reserved for future use.
89 // Matching predicates: `is_any_keyword`, `is_unused_keyword_always`/`is_reserved`
93 // Matching predicates: `is_unused_keyword_always`/`is_reserved`
94 // tidy-alphabetical-start
9095 Abstract: "abstract",
9196 Become: "become",
9297 Box: "box",
......@@ -99,41 +104,48 @@ symbols! {
99104 Unsized: "unsized",
100105 Virtual: "virtual",
101106 Yield: "yield",
107 // tidy-alphabetical-end
102108
103109 // Edition-specific keywords that are used in stable Rust.
104 // Matching predicates: `is_any_keyword`, `is_used_keyword_conditional`/`is_reserved` (if
110 // Matching predicates: `is_used_keyword_conditional`/`is_reserved` (if
105111 // the edition suffices)
112 // tidy-alphabetical-start
106113 Async: "async", // >= 2018 Edition only
107114 Await: "await", // >= 2018 Edition only
108115 Dyn: "dyn", // >= 2018 Edition only
116 // tidy-alphabetical-end
109117
110118 // Edition-specific keywords that are used in unstable Rust or reserved for future use.
111 // Matching predicates: `is_any_keyword`, `is_unused_keyword_conditional`/`is_reserved` (if
119 // Matching predicates: `is_unused_keyword_conditional`/`is_reserved` (if
112120 // the edition suffices)
121 // tidy-alphabetical-start
113122 Gen: "gen", // >= 2024 Edition only
114123 Try: "try", // >= 2018 Edition only
115
116 // NOTE: When adding new keywords, consider adding them to the ui/parser/raw/raw-idents.rs test.
124 // tidy-alphabetical-end
117125
118126 // "Lifetime keywords": regular keywords with a leading `'`.
119 // Matching predicates: `is_any_keyword`
120 UnderscoreLifetime: "'_",
127 // Matching predicates: none
128 // tidy-alphabetical-start
121129 StaticLifetime: "'static",
130 UnderscoreLifetime: "'_",
131 // tidy-alphabetical-end
122132
123133 // Weak keywords, have special meaning only in specific contexts.
124 // Matching predicates: `is_any_keyword`
134 // Matching predicates: none
135 // tidy-alphabetical-start
125136 Auto: "auto",
126137 Builtin: "builtin",
127138 Catch: "catch",
139 ContractEnsures: "contract_ensures",
140 ContractRequires: "contract_requires",
128141 Default: "default",
129142 MacroRules: "macro_rules",
130143 Raw: "raw",
131144 Reuse: "reuse",
132 ContractEnsures: "contract_ensures",
133 ContractRequires: "contract_requires",
134145 Safe: "safe",
135146 Union: "union",
136147 Yeet: "yeet",
148 // tidy-alphabetical-end
137149 }
138150
139151 // Pre-interned symbols that can be referred to with `rustc_span::sym::*`.
......@@ -2677,11 +2689,6 @@ pub mod sym {
26772689}
26782690
26792691impl Symbol {
2680 /// Don't use this unless you're doing something very loose and heuristic-y.
2681 pub fn is_any_keyword(self) -> bool {
2682 self >= kw::As && self <= kw::Yeet
2683 }
2684
26852692 fn is_special(self) -> bool {
26862693 self <= kw::Underscore
26872694 }
......@@ -2690,14 +2697,14 @@ impl Symbol {
26902697 self >= kw::As && self <= kw::While
26912698 }
26922699
2693 fn is_used_keyword_conditional(self, edition: impl FnOnce() -> Edition) -> bool {
2694 (self >= kw::Async && self <= kw::Dyn) && edition() >= Edition::Edition2018
2695 }
2696
26972700 fn is_unused_keyword_always(self) -> bool {
26982701 self >= kw::Abstract && self <= kw::Yield
26992702 }
27002703
2704 fn is_used_keyword_conditional(self, edition: impl FnOnce() -> Edition) -> bool {
2705 (self >= kw::Async && self <= kw::Dyn) && edition() >= Edition::Edition2018
2706 }
2707
27012708 fn is_unused_keyword_conditional(self, edition: impl Copy + FnOnce() -> Edition) -> bool {
27022709 self == kw::Gen && edition().at_least_rust_2024()
27032710 || self == kw::Try && edition().at_least_rust_2018()
......@@ -2738,11 +2745,6 @@ impl Symbol {
27382745}
27392746
27402747impl Ident {
2741 /// Don't use this unless you're doing something very loose and heuristic-y.
2742 pub fn is_any_keyword(self) -> bool {
2743 self.name.is_any_keyword()
2744 }
2745
27462748 /// Returns `true` for reserved identifiers used internally for elided lifetimes,
27472749 /// unnamed method parameters, crate root module, error recovery etc.
27482750 pub fn is_special(self) -> bool {
......@@ -2792,7 +2794,7 @@ impl Ident {
27922794/// *Note:* Please update this if a new keyword is added beyond the current
27932795/// range.
27942796pub fn used_keywords(edition: impl Copy + FnOnce() -> Edition) -> Vec<Symbol> {
2795 (kw::Empty.as_u32()..kw::Yeet.as_u32())
2797 (kw::DollarCrate.as_u32()..kw::Yeet.as_u32())
27962798 .filter_map(|kw| {
27972799 let kw = Symbol::new(kw);
27982800 if kw.is_used_keyword_always() || kw.is_used_keyword_conditional(edition) {
compiler/rustc_target/src/spec/json.rs+8
......@@ -103,6 +103,12 @@ impl Target {
103103 base.$key_name = Some(s);
104104 }
105105 } );
106 ($key_name:ident, Option<StaticCow<str>>) => ( {
107 let name = (stringify!($key_name)).replace("_", "-");
108 if let Some(s) = obj.remove(&name).and_then(|b| Some(b.as_str()?.to_string())) {
109 base.$key_name = Some(s.into());
110 }
111 } );
106112 ($key_name:ident, BinaryFormat) => ( {
107113 let name = (stringify!($key_name)).replace("_", "-");
108114 obj.remove(&name).and_then(|f| f.as_str().and_then(|s| {
......@@ -623,6 +629,7 @@ impl Target {
623629 key!(stack_probes, StackProbeType)?;
624630 key!(min_global_align, Option<u64>);
625631 key!(default_codegen_units, Option<u64>);
632 key!(default_codegen_backend, Option<StaticCow<str>>);
626633 key!(trap_unreachable, bool);
627634 key!(requires_lto, bool);
628635 key!(singlethread, bool);
......@@ -801,6 +808,7 @@ impl ToJson for Target {
801808 target_option_val!(stack_probes);
802809 target_option_val!(min_global_align);
803810 target_option_val!(default_codegen_units);
811 target_option_val!(default_codegen_backend);
804812 target_option_val!(trap_unreachable);
805813 target_option_val!(requires_lto);
806814 target_option_val!(singlethread);
compiler/rustc_ty_utils/src/layout.rs+2-6
......@@ -611,7 +611,7 @@ fn layout_of_uncached<'tcx>(
611611 }
612612
613613 // Types with no meaningful known layout.
614 ty::Param(_) => {
614 ty::Param(_) | ty::Placeholder(..) => {
615615 return Err(error(cx, LayoutError::TooGeneric(ty)));
616616 }
617617
......@@ -628,11 +628,7 @@ fn layout_of_uncached<'tcx>(
628628 return Err(error(cx, err));
629629 }
630630
631 ty::Placeholder(..)
632 | ty::Bound(..)
633 | ty::CoroutineWitness(..)
634 | ty::Infer(_)
635 | ty::Error(_) => {
631 ty::Bound(..) | ty::CoroutineWitness(..) | ty::Infer(_) | ty::Error(_) => {
636632 // `ty::Error` is handled at the top of this function.
637633 bug!("layout_of: unexpected type `{ty}`")
638634 }
src/librustdoc/clean/types.rs+21-38
......@@ -1013,7 +1013,6 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute>
10131013 tcx: TyCtxt<'_>,
10141014 hidden_cfg: &FxHashSet<Cfg>,
10151015) -> Option<Arc<Cfg>> {
1016 let sess = tcx.sess;
10171016 let doc_cfg_active = tcx.features().doc_cfg();
10181017 let doc_auto_cfg_active = tcx.features().doc_auto_cfg();
10191018
......@@ -1034,9 +1033,27 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute>
10341033 .filter(|attr| attr.has_name(sym::cfg))
10351034 .peekable();
10361035 if doc_cfg.peek().is_some() && doc_cfg_active {
1037 doc_cfg
1038 .filter_map(|attr| Cfg::parse(&attr).ok())
1039 .fold(Cfg::True, |cfg, new_cfg| cfg & new_cfg)
1036 let sess = tcx.sess;
1037 doc_cfg.fold(Cfg::True, |mut cfg, item| {
1038 if let Some(cfg_mi) =
1039 item.meta_item().and_then(|item| rustc_expand::config::parse_cfg(item, sess))
1040 {
1041 // The result is unused here but we can gate unstable predicates
1042 rustc_attr_parsing::cfg_matches(
1043 cfg_mi,
1044 tcx.sess,
1045 rustc_ast::CRATE_NODE_ID,
1046 Some(tcx.features()),
1047 );
1048 match Cfg::parse(cfg_mi) {
1049 Ok(new_cfg) => cfg &= new_cfg,
1050 Err(e) => {
1051 sess.dcx().span_err(e.span, e.msg);
1052 }
1053 }
1054 }
1055 cfg
1056 })
10401057 } else if doc_auto_cfg_active {
10411058 // If there is no `doc(cfg())`, then we retrieve the `cfg()` attributes (because
10421059 // `doc(cfg())` overrides `cfg()`).
......@@ -1053,40 +1070,6 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute>
10531070 Cfg::True
10541071 };
10551072
1056 for attr in attrs.clone() {
1057 // #[doc]
1058 if attr.doc_str().is_none() && attr.has_name(sym::doc) {
1059 // #[doc(...)]
1060 if let Some(list) = attr.meta_item_list() {
1061 for item in list {
1062 // #[doc(hidden)]
1063 if !item.has_name(sym::cfg) {
1064 continue;
1065 }
1066 // #[doc(cfg(...))]
1067 if let Some(cfg_mi) = item
1068 .meta_item()
1069 .and_then(|item| rustc_expand::config::parse_cfg(item, sess))
1070 {
1071 // The result is unused here but we can gate unstable predicates
1072 rustc_attr_parsing::cfg_matches(
1073 cfg_mi,
1074 tcx.sess,
1075 rustc_ast::CRATE_NODE_ID,
1076 Some(tcx.features()),
1077 );
1078 match Cfg::parse(cfg_mi) {
1079 Ok(new_cfg) => cfg &= new_cfg,
1080 Err(e) => {
1081 sess.dcx().span_err(e.span, e.msg);
1082 }
1083 }
1084 }
1085 }
1086 }
1087 }
1088 }
1089
10901073 // treat #[target_feature(enable = "feat")] attributes as if they were
10911074 // #[doc(cfg(target_feature = "feat"))] attributes as well
10921075 for attr in hir_attr_lists(attrs, sym::target_feature) {
src/tools/run-make-support/src/run.rs+14-1
......@@ -12,7 +12,20 @@ fn run_common(name: &str, args: Option<&[&str]>) -> Command {
1212 bin_path.push(cwd());
1313 bin_path.push(name);
1414 let ld_lib_path_envvar = env_var("LD_LIB_PATH_ENVVAR");
15 let mut cmd = Command::new(bin_path);
15
16 let mut cmd = if let Some(rtc) = env::var_os("REMOTE_TEST_CLIENT") {
17 let mut cmd = Command::new(rtc);
18 cmd.arg("run");
19 // FIXME: the "0" indicates how many support files should be uploaded along with the binary
20 // to execute. If a test requires additional files to be pushed to the remote machine, this
21 // will have to be changed (and the support files will have to be uploaded).
22 cmd.arg("0");
23 cmd.arg(bin_path);
24 cmd
25 } else {
26 Command::new(bin_path)
27 };
28
1629 if let Some(args) = args {
1730 for arg in args {
1831 cmd.arg(arg);
src/tools/rustfmt/src/parse/macros/mod.rs+1-1
......@@ -81,7 +81,7 @@ pub(crate) struct ParsedMacroArgs {
8181}
8282
8383fn check_keyword<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> {
84 if parser.token.is_any_keyword()
84 if parser.token.is_reserved_ident()
8585 && parser.look_ahead(1, |t| *t == TokenKind::Eof || *t == TokenKind::Comma)
8686 {
8787 let keyword = parser.token.ident().unwrap().0.name;
tests/run-make/doctests-keep-binaries/rmake.rs+2
......@@ -1,3 +1,5 @@
1//@ ignore-cross-compile attempts to run the doctests
2
13// Check that valid binaries are persisted by running them, regardless of whether the
24// --run or --no-run option is used.
35
tests/run-make/target-cpu-native/rmake.rs+2
......@@ -3,6 +3,8 @@
33// warnings when used, and that binaries produced by it can also be successfully executed.
44// See https://github.com/rust-lang/rust/pull/23238
55
6//@ ignore-cross-compile target-cpu=native doesn't work well when cross compiling
7
68use run_make_support::{run, rustc};
79
810fn main() {
tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.current.stderr created+20
......@@ -0,0 +1,20 @@
1error[E0283]: type annotations needed
2 --> $DIR/dedup-normalized-2-higher-ranked.rs:28:5
3 |
4LL | impls(rigid);
5 | ^^^^^ cannot infer type of the type parameter `U` declared on the function `impls`
6 |
7 = note: cannot satisfy `for<'b> <P as Trait>::Rigid: Bound<'b, _>`
8note: required by a bound in `impls`
9 --> $DIR/dedup-normalized-2-higher-ranked.rs:25:13
10 |
11LL | fn impls<T: for<'b> Bound<'b, U>, U>(_: T) {}
12 | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `impls`
13help: consider specifying the generic arguments
14 |
15LL | impls::<<P as Trait>::Rigid, U>(rigid);
16 | ++++++++++++++++++++++++++
17
18error: aborting due to 1 previous error
19
20For more information about this error, try `rustc --explain E0283`.
tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.rs+6-1
......@@ -1,3 +1,8 @@
1//@ revisions: current next
2//@ ignore-compare-mode-next-solver (explicit revisions)
3//@[next] compile-flags: -Znext-solver
4//@[next] check-pass
5
16// We try to prove `for<'b> T::Rigid: Bound<'b, ?0>` and have 2 candidates from where-clauses:
27//
38// - `for<'a> Bound<'a, String>`
......@@ -21,7 +26,7 @@ fn impls<T: for<'b> Bound<'b, U>, U>(_: T) {}
2126
2227fn test<P: Trait>(rigid: P::Rigid) {
2328 impls(rigid);
24 //~^ ERROR type annotations needed
29 //[current]~^ ERROR type annotations needed
2530}
2631
2732fn main() {}
tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.stderr deleted-20
......@@ -1,20 +0,0 @@
1error[E0283]: type annotations needed
2 --> $DIR/dedup-normalized-2-higher-ranked.rs:23:5
3 |
4LL | impls(rigid);
5 | ^^^^^ cannot infer type of the type parameter `U` declared on the function `impls`
6 |
7 = note: cannot satisfy `for<'b> <P as Trait>::Rigid: Bound<'b, _>`
8note: required by a bound in `impls`
9 --> $DIR/dedup-normalized-2-higher-ranked.rs:20:13
10 |
11LL | fn impls<T: for<'b> Bound<'b, U>, U>(_: T) {}
12 | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `impls`
13help: consider specifying the generic arguments
14 |
15LL | impls::<<P as Trait>::Rigid, U>(rigid);
16 | ++++++++++++++++++++++++++
17
18error: aborting due to 1 previous error
19
20For more information about this error, try `rustc --explain E0283`.
tests/ui/consts/too_generic_eval_ice.current.stderr created+45
......@@ -0,0 +1,45 @@
1error: constant expression depends on a generic parameter
2 --> $DIR/too_generic_eval_ice.rs:11:13
3 |
4LL | [5; Self::HOST_SIZE] == [6; 0]
5 | ^^^^^^^^^^^^^^^
6 |
7 = note: this may fail depending on what value the parameter takes
8
9error: constant expression depends on a generic parameter
10 --> $DIR/too_generic_eval_ice.rs:11:9
11 |
12LL | [5; Self::HOST_SIZE] == [6; 0]
13 | ^^^^^^^^^^^^^^^^^^^^
14 |
15 = note: this may fail depending on what value the parameter takes
16
17error: constant expression depends on a generic parameter
18 --> $DIR/too_generic_eval_ice.rs:11:30
19 |
20LL | [5; Self::HOST_SIZE] == [6; 0]
21 | ^^
22 |
23 = note: this may fail depending on what value the parameter takes
24
25error[E0277]: can't compare `[{integer}; Self::HOST_SIZE]` with `[{integer}; 0]`
26 --> $DIR/too_generic_eval_ice.rs:11:30
27 |
28LL | [5; Self::HOST_SIZE] == [6; 0]
29 | ^^ no implementation for `[{integer}; Self::HOST_SIZE] == [{integer}; 0]`
30 |
31 = help: the trait `PartialEq<[{integer}; 0]>` is not implemented for `[{integer}; Self::HOST_SIZE]`
32 = help: the following other types implement trait `PartialEq<Rhs>`:
33 `&[T]` implements `PartialEq<Vec<U, A>>`
34 `&[T]` implements `PartialEq<[U; N]>`
35 `&[u8; N]` implements `PartialEq<ByteStr>`
36 `&[u8; N]` implements `PartialEq<ByteString>`
37 `&[u8]` implements `PartialEq<ByteStr>`
38 `&[u8]` implements `PartialEq<ByteString>`
39 `&mut [T]` implements `PartialEq<Vec<U, A>>`
40 `&mut [T]` implements `PartialEq<[U; N]>`
41 and 11 others
42
43error: aborting due to 4 previous errors
44
45For more information about this error, try `rustc --explain E0277`.
tests/ui/consts/too_generic_eval_ice.next.stderr created+9
......@@ -0,0 +1,9 @@
1error[E0284]: type annotations needed: cannot satisfy `the constant `Self::HOST_SIZE` can be evaluated`
2 --> $DIR/too_generic_eval_ice.rs:11:13
3 |
4LL | [5; Self::HOST_SIZE] == [6; 0]
5 | ^^^^^^^^^^^^^^^ cannot satisfy `the constant `Self::HOST_SIZE` can be evaluated`
6
7error: aborting due to 1 previous error
8
9For more information about this error, try `rustc --explain E0284`.
tests/ui/consts/too_generic_eval_ice.rs+9-4
......@@ -1,3 +1,7 @@
1//@ revisions: current next
2//@ ignore-compare-mode-next-solver (explicit revisions)
3//@[next] compile-flags: -Znext-solver
4
15pub struct Foo<A, B>(A, B);
26
37impl<A, B> Foo<A, B> {
......@@ -5,10 +9,11 @@ impl<A, B> Foo<A, B> {
59
610 pub fn crash() -> bool {
711 [5; Self::HOST_SIZE] == [6; 0]
8 //~^ ERROR constant expression depends on a generic parameter
9 //~| ERROR constant expression depends on a generic parameter
10 //~| ERROR constant expression depends on a generic parameter
11 //~| ERROR can't compare `[{integer}; Self::HOST_SIZE]` with `[{integer}; 0]`
12 //[current]~^ ERROR constant expression depends on a generic parameter
13 //[current]~| ERROR constant expression depends on a generic parameter
14 //[current]~| ERROR constant expression depends on a generic parameter
15 //[current]~| ERROR can't compare `[{integer}; Self::HOST_SIZE]` with `[{integer}; 0]`
16 //[next]~^^^^^ ERROR type annotations needed
1217 }
1318}
1419
tests/ui/consts/too_generic_eval_ice.stderr deleted-45
......@@ -1,45 +0,0 @@
1error: constant expression depends on a generic parameter
2 --> $DIR/too_generic_eval_ice.rs:7:13
3 |
4LL | [5; Self::HOST_SIZE] == [6; 0]
5 | ^^^^^^^^^^^^^^^
6 |
7 = note: this may fail depending on what value the parameter takes
8
9error: constant expression depends on a generic parameter
10 --> $DIR/too_generic_eval_ice.rs:7:9
11 |
12LL | [5; Self::HOST_SIZE] == [6; 0]
13 | ^^^^^^^^^^^^^^^^^^^^
14 |
15 = note: this may fail depending on what value the parameter takes
16
17error: constant expression depends on a generic parameter
18 --> $DIR/too_generic_eval_ice.rs:7:30
19 |
20LL | [5; Self::HOST_SIZE] == [6; 0]
21 | ^^
22 |
23 = note: this may fail depending on what value the parameter takes
24
25error[E0277]: can't compare `[{integer}; Self::HOST_SIZE]` with `[{integer}; 0]`
26 --> $DIR/too_generic_eval_ice.rs:7:30
27 |
28LL | [5; Self::HOST_SIZE] == [6; 0]
29 | ^^ no implementation for `[{integer}; Self::HOST_SIZE] == [{integer}; 0]`
30 |
31 = help: the trait `PartialEq<[{integer}; 0]>` is not implemented for `[{integer}; Self::HOST_SIZE]`
32 = help: the following other types implement trait `PartialEq<Rhs>`:
33 `&[T]` implements `PartialEq<Vec<U, A>>`
34 `&[T]` implements `PartialEq<[U; N]>`
35 `&[u8; N]` implements `PartialEq<ByteStr>`
36 `&[u8; N]` implements `PartialEq<ByteString>`
37 `&[u8]` implements `PartialEq<ByteStr>`
38 `&[u8]` implements `PartialEq<ByteString>`
39 `&mut [T]` implements `PartialEq<Vec<U, A>>`
40 `&mut [T]` implements `PartialEq<[U; N]>`
41 and 11 others
42
43error: aborting due to 4 previous errors
44
45For more information about this error, try `rustc --explain E0277`.
tests/ui/privacy/where-pub-type-impls-priv-trait.rs-1
......@@ -3,7 +3,6 @@
33// priv-in-pub lint tests where the private trait bounds a public type
44
55#![crate_type = "lib"]
6#![feature(generic_const_exprs)]
76#![allow(incomplete_features)]
87
98struct PrivTy;
tests/ui/privacy/where-pub-type-impls-priv-trait.stderr+10-10
......@@ -1,30 +1,30 @@
11warning: trait `PrivTr` is more private than the item `S`
2 --> $DIR/where-pub-type-impls-priv-trait.rs:20:1
2 --> $DIR/where-pub-type-impls-priv-trait.rs:19:1
33 |
44LL | pub struct S
55 | ^^^^^^^^^^^^ struct `S` is reachable at visibility `pub`
66 |
77note: but trait `PrivTr` is only usable at visibility `pub(crate)`
8 --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
8 --> $DIR/where-pub-type-impls-priv-trait.rs:9:1
99 |
1010LL | trait PrivTr {}
1111 | ^^^^^^^^^^^^
1212 = note: `#[warn(private_bounds)]` on by default
1313
1414warning: trait `PrivTr` is more private than the item `E`
15 --> $DIR/where-pub-type-impls-priv-trait.rs:27:1
15 --> $DIR/where-pub-type-impls-priv-trait.rs:26:1
1616 |
1717LL | pub enum E
1818 | ^^^^^^^^^^ enum `E` is reachable at visibility `pub`
1919 |
2020note: but trait `PrivTr` is only usable at visibility `pub(crate)`
21 --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
21 --> $DIR/where-pub-type-impls-priv-trait.rs:9:1
2222 |
2323LL | trait PrivTr {}
2424 | ^^^^^^^^^^^^
2525
2626warning: trait `PrivTr` is more private than the item `f`
27 --> $DIR/where-pub-type-impls-priv-trait.rs:34:1
27 --> $DIR/where-pub-type-impls-priv-trait.rs:33:1
2828 |
2929LL | / pub fn f()
3030LL | |
......@@ -33,13 +33,13 @@ LL | | PubTy: PrivTr
3333 | |_________________^ function `f` is reachable at visibility `pub`
3434 |
3535note: but trait `PrivTr` is only usable at visibility `pub(crate)`
36 --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
36 --> $DIR/where-pub-type-impls-priv-trait.rs:9:1
3737 |
3838LL | trait PrivTr {}
3939 | ^^^^^^^^^^^^
4040
4141warning: trait `PrivTr` is more private than the item `S`
42 --> $DIR/where-pub-type-impls-priv-trait.rs:41:1
42 --> $DIR/where-pub-type-impls-priv-trait.rs:40:1
4343 |
4444LL | / impl S
4545LL | |
......@@ -48,13 +48,13 @@ LL | | PubTy: PrivTr
4848 | |_________________^ implementation `S` is reachable at visibility `pub`
4949 |
5050note: but trait `PrivTr` is only usable at visibility `pub(crate)`
51 --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
51 --> $DIR/where-pub-type-impls-priv-trait.rs:9:1
5252 |
5353LL | trait PrivTr {}
5454 | ^^^^^^^^^^^^
5555
5656warning: trait `PrivTr` is more private than the item `S::f`
57 --> $DIR/where-pub-type-impls-priv-trait.rs:46:5
57 --> $DIR/where-pub-type-impls-priv-trait.rs:45:5
5858 |
5959LL | / pub fn f()
6060LL | |
......@@ -63,7 +63,7 @@ LL | | PubTy: PrivTr
6363 | |_____________________^ associated function `S::f` is reachable at visibility `pub`
6464 |
6565note: but trait `PrivTr` is only usable at visibility `pub(crate)`
66 --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
66 --> $DIR/where-pub-type-impls-priv-trait.rs:9:1
6767 |
6868LL | trait PrivTr {}
6969 | ^^^^^^^^^^^^
tests/ui/traits/next-solver/well-formed-in-relate.rs created+21
......@@ -0,0 +1,21 @@
1fn main() {
2 let x;
3 //~^ ERROR type annotations needed for `Map<_, _>`
4 higher_ranked();
5 x = unconstrained_map();
6}
7
8fn higher_ranked() where for<'a> &'a (): Sized {}
9
10struct Map<T, U> where T: Fn() -> U {
11 t: T,
12}
13
14trait Mirror {
15 type Assoc;
16}
17impl<T> Mirror for T {
18 type Assoc = T;
19}
20
21fn unconstrained_map<T: Fn() -> U, U>() -> <Map<T, U> as Mirror>::Assoc { todo!() }
tests/ui/traits/next-solver/well-formed-in-relate.stderr created+27
......@@ -0,0 +1,27 @@
1error[E0283]: type annotations needed for `Map<_, _>`
2 --> $DIR/well-formed-in-relate.rs:2:9
3 |
4LL | let x;
5 | ^
6...
7LL | x = unconstrained_map();
8 | ------------------- type must be known at this point
9 |
10 = note: multiple `impl`s satisfying `_: Fn()` found in the following crates: `alloc`, `core`:
11 - impl<A, F> Fn<A> for &F
12 where A: Tuple, F: Fn<A>, F: ?Sized;
13 - impl<Args, F, A> Fn<Args> for Box<F, A>
14 where Args: Tuple, F: Fn<Args>, A: Allocator, F: ?Sized;
15note: required by a bound in `unconstrained_map`
16 --> $DIR/well-formed-in-relate.rs:21:25
17 |
18LL | fn unconstrained_map<T: Fn() -> U, U>() -> <Map<T, U> as Mirror>::Assoc { todo!() }
19 | ^^^^^^^^^ required by this bound in `unconstrained_map`
20help: consider giving `x` an explicit type, where the type for type parameter `T` is specified
21 |
22LL | let x: Map<T, U>;
23 | +++++++++++
24
25error: aborting due to 1 previous error
26
27For more information about this error, try `rustc --explain E0283`.
triagebot.toml+2-2
......@@ -174,8 +174,8 @@ label = "O-emscripten"
174174
175175[ping.relnotes-interest-group]
176176message = """\
177Hi relnotes-interest-group, this PR adds release notes. Could you review this PR
178if you have time? Thanks <3
177Hi relnotes-interest-group, this issue/PR could use some help in reviewing /
178adjusting release notes. Could you take a look if available? Thanks <3
179179"""
180180
181181[prioritize]