| author | bors <bors@rust-lang.org> 2025-03-25 13:29:50 UTC |
| committer | bors <bors@rust-lang.org> 2025-03-25 13:29:50 UTC |
| log | 48994b1674b3212d27b5e83841c0966bc2b4be43 |
| tree | 17ef64301045014d011ead06bd02977c443627ad |
| parent | 7d49ae9731555937177d01e9fa39dbf22eb60399 |
| parent | 375710407199a9377c6e272acdfae938c5a5a771 |
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: rollup32 files changed, 273 insertions(+), 214 deletions(-)
compiler/rustc_ast/src/token.rs-5| ... | ... | @@ -928,11 +928,6 @@ impl Token { |
| 928 | 928 | self.is_non_raw_ident_where(Ident::is_path_segment_keyword) |
| 929 | 929 | } |
| 930 | 930 | |
| 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 | ||
| 936 | 931 | /// Returns true for reserved identifiers used internally for elided lifetimes, |
| 937 | 932 | /// unnamed method parameters, crate root module, error recovery etc. |
| 938 | 933 | pub fn is_special_ident(&self) -> bool { |
compiler/rustc_ast_lowering/src/item.rs+7-10| ... | ... | @@ -132,8 +132,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | 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) }]; | |
| 137 | 136 | if let ItemKind::Use(use_tree) = &i.kind { |
| 138 | 137 | self.lower_item_id_use_tree(use_tree, &mut node_ids); |
| 139 | 138 | } |
| ... | ... | @@ -144,9 +143,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 144 | 143 | match &tree.kind { |
| 145 | 144 | UseTreeKind::Nested { items, .. } => { |
| 146 | 145 | 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) }); | |
| 150 | 147 | self.lower_item_id_use_tree(nested, vec); |
| 151 | 148 | } |
| 152 | 149 | } |
| ... | ... | @@ -585,7 +582,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 585 | 582 | |
| 586 | 583 | // Add all the nested `PathListItem`s to the HIR. |
| 587 | 584 | 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); | |
| 589 | 586 | |
| 590 | 587 | // Each `use` import is an item and thus are owners of the |
| 591 | 588 | // names in the path. Up to this point the nested import is |
| ... | ... | @@ -602,7 +599,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 602 | 599 | } |
| 603 | 600 | |
| 604 | 601 | let item = hir::Item { |
| 605 | owner_id: hir::OwnerId { def_id: new_hir_id }, | |
| 602 | owner_id, | |
| 606 | 603 | kind, |
| 607 | 604 | vis_span, |
| 608 | 605 | span: this.lower_span(use_tree.span), |
| ... | ... | @@ -710,7 +707,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 710 | 707 | |
| 711 | 708 | fn lower_foreign_item_ref(&mut self, i: &ForeignItem) -> hir::ForeignItemRef { |
| 712 | 709 | 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) }, | |
| 714 | 711 | ident: self.lower_ident(i.ident), |
| 715 | 712 | span: self.lower_span(i.span), |
| 716 | 713 | } |
| ... | ... | @@ -931,7 +928,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 931 | 928 | panic!("macros should have been expanded by now") |
| 932 | 929 | } |
| 933 | 930 | }; |
| 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) }; | |
| 935 | 932 | hir::TraitItemRef { |
| 936 | 933 | id, |
| 937 | 934 | ident: self.lower_ident(i.ident), |
| ... | ... | @@ -1046,7 +1043,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 1046 | 1043 | |
| 1047 | 1044 | fn lower_impl_item_ref(&mut self, i: &AssocItem) -> hir::ImplItemRef { |
| 1048 | 1045 | 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) }, | |
| 1050 | 1047 | ident: self.lower_ident(i.ident), |
| 1051 | 1048 | span: self.lower_span(i.span), |
| 1052 | 1049 | kind: match &i.kind { |
compiler/rustc_ast_lowering/src/lib.rs+10-6| ... | ... | @@ -536,6 +536,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { |
| 536 | 536 | self.opt_local_def_id(node).unwrap_or_else(|| panic!("no entry for node id: `{node:?}`")) |
| 537 | 537 | } |
| 538 | 538 | |
| 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 | ||
| 539 | 544 | /// Freshen the `LoweringContext` and ready it to lower a nested item. |
| 540 | 545 | /// The lowered item is registered into `self.children`. |
| 541 | 546 | /// |
| ... | ... | @@ -547,7 +552,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { |
| 547 | 552 | owner: NodeId, |
| 548 | 553 | f: impl FnOnce(&mut Self) -> hir::OwnerNode<'hir>, |
| 549 | 554 | ) { |
| 550 | let def_id = self.local_def_id(owner); | |
| 555 | let owner_id = self.owner_id(owner); | |
| 551 | 556 | |
| 552 | 557 | let current_attrs = std::mem::take(&mut self.attrs); |
| 553 | 558 | let current_bodies = std::mem::take(&mut self.bodies); |
| ... | ... | @@ -558,8 +563,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { |
| 558 | 563 | #[cfg(debug_assertions)] |
| 559 | 564 | let current_node_id_to_local_id = std::mem::take(&mut self.node_id_to_local_id); |
| 560 | 565 | 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); | |
| 563 | 567 | let current_local_counter = |
| 564 | 568 | std::mem::replace(&mut self.item_local_id_counter, hir::ItemLocalId::new(1)); |
| 565 | 569 | let current_impl_trait_defs = std::mem::take(&mut self.impl_trait_defs); |
| ... | ... | @@ -577,7 +581,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { |
| 577 | 581 | } |
| 578 | 582 | |
| 579 | 583 | let item = f(self); |
| 580 | debug_assert_eq!(def_id, item.def_id().def_id); | |
| 584 | debug_assert_eq!(owner_id, item.def_id()); | |
| 581 | 585 | // `f` should have consumed all the elements in these vectors when constructing `item`. |
| 582 | 586 | debug_assert!(self.impl_trait_defs.is_empty()); |
| 583 | 587 | debug_assert!(self.impl_trait_bounds.is_empty()); |
| ... | ... | @@ -598,8 +602,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { |
| 598 | 602 | self.impl_trait_defs = current_impl_trait_defs; |
| 599 | 603 | self.impl_trait_bounds = current_impl_trait_bounds; |
| 600 | 604 | |
| 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))); | |
| 603 | 607 | } |
| 604 | 608 | |
| 605 | 609 | 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 |
| 971 | 971 | rhs: T, |
| 972 | 972 | ) -> Result<(), NoSolution> { |
| 973 | 973 | 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 | |
| 979 | 978 | } |
| 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); | |
| 981 | 984 | } |
| 982 | self.add_goals(GoalSource::TypeRelating, goals); | |
| 983 | 985 | Ok(()) |
| 984 | 986 | } |
| 985 | 987 |
compiler/rustc_resolve/src/build_reduced_graph.rs-1| ... | ... | @@ -1115,7 +1115,6 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> { |
| 1115 | 1115 | } |
| 1116 | 1116 | }); |
| 1117 | 1117 | } else { |
| 1118 | #[allow(rustc::potential_query_instability)] // FIXME | |
| 1119 | 1118 | for ident in single_imports.iter().cloned() { |
| 1120 | 1119 | let result = self.r.maybe_resolve_ident_in_module( |
| 1121 | 1120 | ModuleOrUniformRoot::Module(module), |
compiler/rustc_resolve/src/diagnostics.rs-1| ... | ... | @@ -1468,7 +1468,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1468 | 1468 | return; |
| 1469 | 1469 | } |
| 1470 | 1470 | |
| 1471 | #[allow(rustc::potential_query_instability)] // FIXME | |
| 1472 | 1471 | let unused_macro = self.unused_macros.iter().find_map(|(def_id, (_, unused_ident))| { |
| 1473 | 1472 | if unused_ident.name == ident.name { Some((def_id, unused_ident)) } else { None } |
| 1474 | 1473 | }); |
compiler/rustc_resolve/src/ident.rs-1| ... | ... | @@ -946,7 +946,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 946 | 946 | |
| 947 | 947 | // Check if one of single imports can still define the name, |
| 948 | 948 | // if it can then our result is not determined and can be invalidated. |
| 949 | #[allow(rustc::potential_query_instability)] // FIXME | |
| 950 | 949 | for single_import in &resolution.single_imports { |
| 951 | 950 | if ignore_import == Some(*single_import) { |
| 952 | 951 | // This branch handles a cycle in single imports. |
compiler/rustc_resolve/src/imports.rs+4-4| ... | ... | @@ -4,7 +4,7 @@ use std::cell::Cell; |
| 4 | 4 | use std::mem; |
| 5 | 5 | |
| 6 | 6 | use rustc_ast::NodeId; |
| 7 | use rustc_data_structures::fx::FxHashSet; | |
| 7 | use rustc_data_structures::fx::{FxHashSet, FxIndexSet}; | |
| 8 | 8 | use rustc_data_structures::intern::Interned; |
| 9 | 9 | use rustc_errors::codes::*; |
| 10 | 10 | use rustc_errors::{Applicability, MultiSpan, pluralize, struct_span_code_err}; |
| ... | ... | @@ -233,7 +233,7 @@ impl<'ra> ImportData<'ra> { |
| 233 | 233 | pub(crate) struct NameResolution<'ra> { |
| 234 | 234 | /// Single imports that may define the name in the namespace. |
| 235 | 235 | /// 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>>, | |
| 237 | 237 | /// The least shadowable known binding for this name, or None if there are no known bindings. |
| 238 | 238 | pub binding: Option<NameBinding<'ra>>, |
| 239 | 239 | pub shadowed_glob: Option<NameBinding<'ra>>, |
| ... | ... | @@ -494,7 +494,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 494 | 494 | let key = BindingKey::new(target, ns); |
| 495 | 495 | let _ = this.try_define(import.parent_scope.module, key, dummy_binding, false); |
| 496 | 496 | this.update_resolution(import.parent_scope.module, key, false, |_, resolution| { |
| 497 | resolution.single_imports.remove(&import); | |
| 497 | resolution.single_imports.swap_remove(&import); | |
| 498 | 498 | }) |
| 499 | 499 | }); |
| 500 | 500 | self.record_use(target, dummy_binding, Used::Other); |
| ... | ... | @@ -862,7 +862,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 862 | 862 | } |
| 863 | 863 | let key = BindingKey::new(target, ns); |
| 864 | 864 | this.update_resolution(parent, key, false, |_, resolution| { |
| 865 | resolution.single_imports.remove(&import); | |
| 865 | resolution.single_imports.swap_remove(&import); | |
| 866 | 866 | }); |
| 867 | 867 | } |
| 868 | 868 | } |
compiler/rustc_resolve/src/late.rs+8-10| ... | ... | @@ -272,7 +272,7 @@ impl RibKind<'_> { |
| 272 | 272 | /// resolving, the name is looked up from inside out. |
| 273 | 273 | #[derive(Debug)] |
| 274 | 274 | pub(crate) struct Rib<'ra, R = Res> { |
| 275 | pub bindings: FxHashMap<Ident, R>, | |
| 275 | pub bindings: FxIndexMap<Ident, R>, | |
| 276 | 276 | pub patterns_with_skipped_bindings: UnordMap<DefId, Vec<(Span, Result<(), ErrorGuaranteed>)>>, |
| 277 | 277 | pub kind: RibKind<'ra>, |
| 278 | 278 | } |
| ... | ... | @@ -672,7 +672,7 @@ struct DiagMetadata<'ast> { |
| 672 | 672 | |
| 673 | 673 | /// A list of labels as of yet unused. Labels will be removed from this map when |
| 674 | 674 | /// they are used (in a `break` or `continue` statement) |
| 675 | unused_labels: FxHashMap<NodeId, Span>, | |
| 675 | unused_labels: FxIndexMap<NodeId, Span>, | |
| 676 | 676 | |
| 677 | 677 | /// Only used for better errors on `let x = { foo: bar };`. |
| 678 | 678 | /// 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> { |
| 1639 | 1639 | |
| 1640 | 1640 | // Allow all following defaults to refer to this type parameter. |
| 1641 | 1641 | 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); | |
| 1644 | 1644 | } |
| 1645 | 1645 | GenericParamKind::Const { ref ty, kw_span: _, ref default } => { |
| 1646 | 1646 | // Const parameters can't have param bounds. |
| ... | ... | @@ -1675,8 +1675,8 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 1675 | 1675 | |
| 1676 | 1676 | // Allow all following defaults to refer to this const parameter. |
| 1677 | 1677 | 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); | |
| 1680 | 1680 | } |
| 1681 | 1681 | } |
| 1682 | 1682 | } |
| ... | ... | @@ -2885,7 +2885,6 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 2885 | 2885 | break; |
| 2886 | 2886 | } |
| 2887 | 2887 | |
| 2888 | #[allow(rustc::potential_query_instability)] // FIXME | |
| 2889 | 2888 | seen_bindings |
| 2890 | 2889 | .extend(parent_rib.bindings.keys().map(|ident| (*ident, ident.span))); |
| 2891 | 2890 | } |
| ... | ... | @@ -4000,7 +3999,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 4000 | 3999 | } |
| 4001 | 4000 | } |
| 4002 | 4001 | |
| 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> { | |
| 4004 | 4003 | &mut self.ribs[ns].last_mut().unwrap().bindings |
| 4005 | 4004 | } |
| 4006 | 4005 | |
| ... | ... | @@ -4776,7 +4775,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 4776 | 4775 | Ok((node_id, _)) => { |
| 4777 | 4776 | // Since this res is a label, it is never read. |
| 4778 | 4777 | 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); | |
| 4780 | 4779 | } |
| 4781 | 4780 | Err(error) => { |
| 4782 | 4781 | self.report_error(label.ident.span, error); |
| ... | ... | @@ -5198,7 +5197,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 5198 | 5197 | let mut late_resolution_visitor = LateResolutionVisitor::new(self); |
| 5199 | 5198 | late_resolution_visitor.resolve_doc_links(&krate.attrs, MaybeExported::Ok(CRATE_NODE_ID)); |
| 5200 | 5199 | visit::walk_crate(&mut late_resolution_visitor, krate); |
| 5201 | #[allow(rustc::potential_query_instability)] // FIXME | |
| 5202 | 5200 | for (id, span) in late_resolution_visitor.diag_metadata.unused_labels.iter() { |
| 5203 | 5201 | self.lint_buffer.buffer_lint( |
| 5204 | 5202 | 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> { |
| 830 | 830 | if let Some(rib) = &self.last_block_rib |
| 831 | 831 | && let RibKind::Normal = rib.kind |
| 832 | 832 | { |
| 833 | #[allow(rustc::potential_query_instability)] // FIXME | |
| 834 | 833 | for (ident, &res) in &rib.bindings { |
| 835 | 834 | if let Res::Local(_) = res |
| 836 | 835 | && path.len() == 1 |
| ... | ... | @@ -1019,7 +1018,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { |
| 1019 | 1018 | if let Some(err_code) = err.code { |
| 1020 | 1019 | if err_code == E0425 { |
| 1021 | 1020 | for label_rib in &self.label_ribs { |
| 1022 | #[allow(rustc::potential_query_instability)] // FIXME | |
| 1023 | 1021 | for (label_ident, node_id) in &label_rib.bindings { |
| 1024 | 1022 | let ident = path.last().unwrap().ident; |
| 1025 | 1023 | if format!("'{ident}") == label_ident.to_string() { |
| ... | ... | @@ -1036,7 +1034,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { |
| 1036 | 1034 | Applicability::MaybeIncorrect, |
| 1037 | 1035 | ); |
| 1038 | 1036 | // 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); | |
| 1040 | 1038 | } |
| 1041 | 1039 | } |
| 1042 | 1040 | } |
| ... | ... | @@ -2265,7 +2263,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { |
| 2265 | 2263 | }; |
| 2266 | 2264 | |
| 2267 | 2265 | // Locals and type parameters |
| 2268 | #[allow(rustc::potential_query_instability)] // FIXME | |
| 2269 | 2266 | for (ident, &res) in &rib.bindings { |
| 2270 | 2267 | if filter_fn(res) && ident.span.ctxt() == rib_ctxt { |
| 2271 | 2268 | names.push(TypoSuggestion::typo_from_ident(*ident, res)); |
| ... | ... | @@ -2793,7 +2790,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { |
| 2793 | 2790 | let within_scope = self.is_label_valid_from_rib(rib_index); |
| 2794 | 2791 | |
| 2795 | 2792 | let rib = &self.label_ribs[rib_index]; |
| 2796 | #[allow(rustc::potential_query_instability)] // FIXME | |
| 2797 | 2793 | let names = rib |
| 2798 | 2794 | .bindings |
| 2799 | 2795 | .iter() |
| ... | ... | @@ -2805,7 +2801,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { |
| 2805 | 2801 | // Upon finding a similar name, get the ident that it was from - the span |
| 2806 | 2802 | // contained within helps make a useful diagnostic. In addition, determine |
| 2807 | 2803 | // whether this candidate is within scope. |
| 2808 | #[allow(rustc::potential_query_instability)] // FIXME | |
| 2809 | 2804 | let (ident, _) = rib.bindings.iter().find(|(ident, _)| ident.name == symbol).unwrap(); |
| 2810 | 2805 | (*ident, within_scope) |
| 2811 | 2806 | }) |
compiler/rustc_resolve/src/lib.rs+1-1| ... | ... | @@ -1137,7 +1137,7 @@ pub struct Resolver<'ra, 'tcx> { |
| 1137 | 1137 | non_macro_attr: MacroData, |
| 1138 | 1138 | local_macro_def_scopes: FxHashMap<LocalDefId, Module<'ra>>, |
| 1139 | 1139 | ast_transform_scopes: FxHashMap<LocalExpnId, Module<'ra>>, |
| 1140 | unused_macros: FxHashMap<LocalDefId, (NodeId, Ident)>, | |
| 1140 | unused_macros: FxIndexMap<LocalDefId, (NodeId, Ident)>, | |
| 1141 | 1141 | /// A map from the macro to all its potentially unused arms. |
| 1142 | 1142 | unused_macro_rules: FxIndexMap<LocalDefId, UnordMap<usize, (Ident, Span)>>, |
| 1143 | 1143 | 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> { |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | fn check_unused_macros(&mut self) { |
| 326 | #[allow(rustc::potential_query_instability)] // FIXME | |
| 327 | 326 | for (_, &(node_id, ident)) in self.unused_macros.iter() { |
| 328 | 327 | self.lint_buffer.buffer_lint( |
| 329 | 328 | UNUSED_MACROS, |
| ... | ... | @@ -576,7 +575,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 576 | 575 | match res { |
| 577 | 576 | Res::Def(DefKind::Macro(_), def_id) => { |
| 578 | 577 | if let Some(def_id) = def_id.as_local() { |
| 579 | self.unused_macros.remove(&def_id); | |
| 578 | self.unused_macros.swap_remove(&def_id); | |
| 580 | 579 | if self.proc_macro_stubs.contains(&def_id) { |
| 581 | 580 | self.dcx().emit_err(errors::ProcMacroSameCrate { |
| 582 | 581 | span: path.span, |
compiler/rustc_span/src/symbol.rs+33-31| ... | ... | @@ -26,13 +26,13 @@ symbols! { |
| 26 | 26 | // documents (such as the Rust Reference) about whether it is a keyword |
| 27 | 27 | // (e.g. `_`). |
| 28 | 28 | // |
| 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. | |
| 32 | 32 | Keywords { |
| 33 | 33 | // Special reserved identifiers used internally for elided lifetimes, |
| 34 | 34 | // 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` | |
| 36 | 36 | // |
| 37 | 37 | // Notes about `kw::Empty`: |
| 38 | 38 | // - Its use can blur the lines between "empty symbol" and "no symbol". |
| ... | ... | @@ -42,13 +42,16 @@ symbols! { |
| 42 | 42 | // present, it's better to use `sym::dummy` than `kw::Empty`, because |
| 43 | 43 | // it's clearer that it's intended as a dummy value, and more likely |
| 44 | 44 | // to be detected if it accidentally does get used. |
| 45 | // tidy-alphabetical-start | |
| 46 | DollarCrate: "$crate", | |
| 45 | 47 | Empty: "", |
| 46 | 48 | PathRoot: "{{root}}", |
| 47 | DollarCrate: "$crate", | |
| 48 | 49 | Underscore: "_", |
| 50 | // tidy-alphabetical-end | |
| 49 | 51 | |
| 50 | 52 | // 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 | |
| 52 | 55 | As: "as", |
| 53 | 56 | Break: "break", |
| 54 | 57 | Const: "const", |
| ... | ... | @@ -84,9 +87,11 @@ symbols! { |
| 84 | 87 | Use: "use", |
| 85 | 88 | Where: "where", |
| 86 | 89 | While: "while", |
| 90 | // tidy-alphabetical-end | |
| 87 | 91 | |
| 88 | 92 | // 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 | |
| 90 | 95 | Abstract: "abstract", |
| 91 | 96 | Become: "become", |
| 92 | 97 | Box: "box", |
| ... | ... | @@ -99,41 +104,48 @@ symbols! { |
| 99 | 104 | Unsized: "unsized", |
| 100 | 105 | Virtual: "virtual", |
| 101 | 106 | Yield: "yield", |
| 107 | // tidy-alphabetical-end | |
| 102 | 108 | |
| 103 | 109 | // 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 | |
| 105 | 111 | // the edition suffices) |
| 112 | // tidy-alphabetical-start | |
| 106 | 113 | Async: "async", // >= 2018 Edition only |
| 107 | 114 | Await: "await", // >= 2018 Edition only |
| 108 | 115 | Dyn: "dyn", // >= 2018 Edition only |
| 116 | // tidy-alphabetical-end | |
| 109 | 117 | |
| 110 | 118 | // 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 | |
| 112 | 120 | // the edition suffices) |
| 121 | // tidy-alphabetical-start | |
| 113 | 122 | Gen: "gen", // >= 2024 Edition only |
| 114 | 123 | 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 | |
| 117 | 125 | |
| 118 | 126 | // "Lifetime keywords": regular keywords with a leading `'`. |
| 119 | // Matching predicates: `is_any_keyword` | |
| 120 | UnderscoreLifetime: "'_", | |
| 127 | // Matching predicates: none | |
| 128 | // tidy-alphabetical-start | |
| 121 | 129 | StaticLifetime: "'static", |
| 130 | UnderscoreLifetime: "'_", | |
| 131 | // tidy-alphabetical-end | |
| 122 | 132 | |
| 123 | 133 | // Weak keywords, have special meaning only in specific contexts. |
| 124 | // Matching predicates: `is_any_keyword` | |
| 134 | // Matching predicates: none | |
| 135 | // tidy-alphabetical-start | |
| 125 | 136 | Auto: "auto", |
| 126 | 137 | Builtin: "builtin", |
| 127 | 138 | Catch: "catch", |
| 139 | ContractEnsures: "contract_ensures", | |
| 140 | ContractRequires: "contract_requires", | |
| 128 | 141 | Default: "default", |
| 129 | 142 | MacroRules: "macro_rules", |
| 130 | 143 | Raw: "raw", |
| 131 | 144 | Reuse: "reuse", |
| 132 | ContractEnsures: "contract_ensures", | |
| 133 | ContractRequires: "contract_requires", | |
| 134 | 145 | Safe: "safe", |
| 135 | 146 | Union: "union", |
| 136 | 147 | Yeet: "yeet", |
| 148 | // tidy-alphabetical-end | |
| 137 | 149 | } |
| 138 | 150 | |
| 139 | 151 | // Pre-interned symbols that can be referred to with `rustc_span::sym::*`. |
| ... | ... | @@ -2677,11 +2689,6 @@ pub mod sym { |
| 2677 | 2689 | } |
| 2678 | 2690 | |
| 2679 | 2691 | impl 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 | ||
| 2685 | 2692 | fn is_special(self) -> bool { |
| 2686 | 2693 | self <= kw::Underscore |
| 2687 | 2694 | } |
| ... | ... | @@ -2690,14 +2697,14 @@ impl Symbol { |
| 2690 | 2697 | self >= kw::As && self <= kw::While |
| 2691 | 2698 | } |
| 2692 | 2699 | |
| 2693 | fn is_used_keyword_conditional(self, edition: impl FnOnce() -> Edition) -> bool { | |
| 2694 | (self >= kw::Async && self <= kw::Dyn) && edition() >= Edition::Edition2018 | |
| 2695 | } | |
| 2696 | ||
| 2697 | 2700 | fn is_unused_keyword_always(self) -> bool { |
| 2698 | 2701 | self >= kw::Abstract && self <= kw::Yield |
| 2699 | 2702 | } |
| 2700 | 2703 | |
| 2704 | fn is_used_keyword_conditional(self, edition: impl FnOnce() -> Edition) -> bool { | |
| 2705 | (self >= kw::Async && self <= kw::Dyn) && edition() >= Edition::Edition2018 | |
| 2706 | } | |
| 2707 | ||
| 2701 | 2708 | fn is_unused_keyword_conditional(self, edition: impl Copy + FnOnce() -> Edition) -> bool { |
| 2702 | 2709 | self == kw::Gen && edition().at_least_rust_2024() |
| 2703 | 2710 | || self == kw::Try && edition().at_least_rust_2018() |
| ... | ... | @@ -2738,11 +2745,6 @@ impl Symbol { |
| 2738 | 2745 | } |
| 2739 | 2746 | |
| 2740 | 2747 | impl 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 | ||
| 2746 | 2748 | /// Returns `true` for reserved identifiers used internally for elided lifetimes, |
| 2747 | 2749 | /// unnamed method parameters, crate root module, error recovery etc. |
| 2748 | 2750 | pub fn is_special(self) -> bool { |
| ... | ... | @@ -2792,7 +2794,7 @@ impl Ident { |
| 2792 | 2794 | /// *Note:* Please update this if a new keyword is added beyond the current |
| 2793 | 2795 | /// range. |
| 2794 | 2796 | pub 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()) | |
| 2796 | 2798 | .filter_map(|kw| { |
| 2797 | 2799 | let kw = Symbol::new(kw); |
| 2798 | 2800 | 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 { |
| 103 | 103 | base.$key_name = Some(s); |
| 104 | 104 | } |
| 105 | 105 | } ); |
| 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 | } ); | |
| 106 | 112 | ($key_name:ident, BinaryFormat) => ( { |
| 107 | 113 | let name = (stringify!($key_name)).replace("_", "-"); |
| 108 | 114 | obj.remove(&name).and_then(|f| f.as_str().and_then(|s| { |
| ... | ... | @@ -623,6 +629,7 @@ impl Target { |
| 623 | 629 | key!(stack_probes, StackProbeType)?; |
| 624 | 630 | key!(min_global_align, Option<u64>); |
| 625 | 631 | key!(default_codegen_units, Option<u64>); |
| 632 | key!(default_codegen_backend, Option<StaticCow<str>>); | |
| 626 | 633 | key!(trap_unreachable, bool); |
| 627 | 634 | key!(requires_lto, bool); |
| 628 | 635 | key!(singlethread, bool); |
| ... | ... | @@ -801,6 +808,7 @@ impl ToJson for Target { |
| 801 | 808 | target_option_val!(stack_probes); |
| 802 | 809 | target_option_val!(min_global_align); |
| 803 | 810 | target_option_val!(default_codegen_units); |
| 811 | target_option_val!(default_codegen_backend); | |
| 804 | 812 | target_option_val!(trap_unreachable); |
| 805 | 813 | target_option_val!(requires_lto); |
| 806 | 814 | target_option_val!(singlethread); |
compiler/rustc_ty_utils/src/layout.rs+2-6| ... | ... | @@ -611,7 +611,7 @@ fn layout_of_uncached<'tcx>( |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | // Types with no meaningful known layout. |
| 614 | ty::Param(_) => { | |
| 614 | ty::Param(_) | ty::Placeholder(..) => { | |
| 615 | 615 | return Err(error(cx, LayoutError::TooGeneric(ty))); |
| 616 | 616 | } |
| 617 | 617 | |
| ... | ... | @@ -628,11 +628,7 @@ fn layout_of_uncached<'tcx>( |
| 628 | 628 | return Err(error(cx, err)); |
| 629 | 629 | } |
| 630 | 630 | |
| 631 | ty::Placeholder(..) | |
| 632 | | ty::Bound(..) | |
| 633 | | ty::CoroutineWitness(..) | |
| 634 | | ty::Infer(_) | |
| 635 | | ty::Error(_) => { | |
| 631 | ty::Bound(..) | ty::CoroutineWitness(..) | ty::Infer(_) | ty::Error(_) => { | |
| 636 | 632 | // `ty::Error` is handled at the top of this function. |
| 637 | 633 | bug!("layout_of: unexpected type `{ty}`") |
| 638 | 634 | } |
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> |
| 1013 | 1013 | tcx: TyCtxt<'_>, |
| 1014 | 1014 | hidden_cfg: &FxHashSet<Cfg>, |
| 1015 | 1015 | ) -> Option<Arc<Cfg>> { |
| 1016 | let sess = tcx.sess; | |
| 1017 | 1016 | let doc_cfg_active = tcx.features().doc_cfg(); |
| 1018 | 1017 | let doc_auto_cfg_active = tcx.features().doc_auto_cfg(); |
| 1019 | 1018 | |
| ... | ... | @@ -1034,9 +1033,27 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute> |
| 1034 | 1033 | .filter(|attr| attr.has_name(sym::cfg)) |
| 1035 | 1034 | .peekable(); |
| 1036 | 1035 | 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 | }) | |
| 1040 | 1057 | } else if doc_auto_cfg_active { |
| 1041 | 1058 | // If there is no `doc(cfg())`, then we retrieve the `cfg()` attributes (because |
| 1042 | 1059 | // `doc(cfg())` overrides `cfg()`). |
| ... | ... | @@ -1053,40 +1070,6 @@ pub(crate) fn extract_cfg_from_attrs<'a, I: Iterator<Item = &'a hir::Attribute> |
| 1053 | 1070 | Cfg::True |
| 1054 | 1071 | }; |
| 1055 | 1072 | |
| 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 | ||
| 1090 | 1073 | // treat #[target_feature(enable = "feat")] attributes as if they were |
| 1091 | 1074 | // #[doc(cfg(target_feature = "feat"))] attributes as well |
| 1092 | 1075 | 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 { |
| 12 | 12 | bin_path.push(cwd()); |
| 13 | 13 | bin_path.push(name); |
| 14 | 14 | 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 | ||
| 16 | 29 | if let Some(args) = args { |
| 17 | 30 | for arg in args { |
| 18 | 31 | cmd.arg(arg); |
src/tools/rustfmt/src/parse/macros/mod.rs+1-1| ... | ... | @@ -81,7 +81,7 @@ pub(crate) struct ParsedMacroArgs { |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | fn 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() | |
| 85 | 85 | && parser.look_ahead(1, |t| *t == TokenKind::Eof || *t == TokenKind::Comma) |
| 86 | 86 | { |
| 87 | 87 | 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 | ||
| 1 | 3 | // Check that valid binaries are persisted by running them, regardless of whether the |
| 2 | 4 | // --run or --no-run option is used. |
| 3 | 5 |
tests/run-make/target-cpu-native/rmake.rs+2| ... | ... | @@ -3,6 +3,8 @@ |
| 3 | 3 | // warnings when used, and that binaries produced by it can also be successfully executed. |
| 4 | 4 | // See https://github.com/rust-lang/rust/pull/23238 |
| 5 | 5 | |
| 6 | //@ ignore-cross-compile target-cpu=native doesn't work well when cross compiling | |
| 7 | ||
| 6 | 8 | use run_make_support::{run, rustc}; |
| 7 | 9 | |
| 8 | 10 | fn main() { |
tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.current.stderr created+20| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | error[E0283]: type annotations needed | |
| 2 | --> $DIR/dedup-normalized-2-higher-ranked.rs:28:5 | |
| 3 | | | |
| 4 | LL | 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, _>` | |
| 8 | note: required by a bound in `impls` | |
| 9 | --> $DIR/dedup-normalized-2-higher-ranked.rs:25:13 | |
| 10 | | | |
| 11 | LL | fn impls<T: for<'b> Bound<'b, U>, U>(_: T) {} | |
| 12 | | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `impls` | |
| 13 | help: consider specifying the generic arguments | |
| 14 | | | |
| 15 | LL | impls::<<P as Trait>::Rigid, U>(rigid); | |
| 16 | | ++++++++++++++++++++++++++ | |
| 17 | ||
| 18 | error: aborting due to 1 previous error | |
| 19 | ||
| 20 | For 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 | ||
| 1 | 6 | // We try to prove `for<'b> T::Rigid: Bound<'b, ?0>` and have 2 candidates from where-clauses: |
| 2 | 7 | // |
| 3 | 8 | // - `for<'a> Bound<'a, String>` |
| ... | ... | @@ -21,7 +26,7 @@ fn impls<T: for<'b> Bound<'b, U>, U>(_: T) {} |
| 21 | 26 | |
| 22 | 27 | fn test<P: Trait>(rigid: P::Rigid) { |
| 23 | 28 | impls(rigid); |
| 24 | //~^ ERROR type annotations needed | |
| 29 | //[current]~^ ERROR type annotations needed | |
| 25 | 30 | } |
| 26 | 31 | |
| 27 | 32 | fn main() {} |
tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.stderr deleted-20| ... | ... | @@ -1,20 +0,0 @@ |
| 1 | error[E0283]: type annotations needed | |
| 2 | --> $DIR/dedup-normalized-2-higher-ranked.rs:23:5 | |
| 3 | | | |
| 4 | LL | 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, _>` | |
| 8 | note: required by a bound in `impls` | |
| 9 | --> $DIR/dedup-normalized-2-higher-ranked.rs:20:13 | |
| 10 | | | |
| 11 | LL | fn impls<T: for<'b> Bound<'b, U>, U>(_: T) {} | |
| 12 | | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `impls` | |
| 13 | help: consider specifying the generic arguments | |
| 14 | | | |
| 15 | LL | impls::<<P as Trait>::Rigid, U>(rigid); | |
| 16 | | ++++++++++++++++++++++++++ | |
| 17 | ||
| 18 | error: aborting due to 1 previous error | |
| 19 | ||
| 20 | For more information about this error, try `rustc --explain E0283`. |
tests/ui/consts/too_generic_eval_ice.current.stderr created+45| ... | ... | @@ -0,0 +1,45 @@ |
| 1 | error: constant expression depends on a generic parameter | |
| 2 | --> $DIR/too_generic_eval_ice.rs:11:13 | |
| 3 | | | |
| 4 | LL | [5; Self::HOST_SIZE] == [6; 0] | |
| 5 | | ^^^^^^^^^^^^^^^ | |
| 6 | | | |
| 7 | = note: this may fail depending on what value the parameter takes | |
| 8 | ||
| 9 | error: constant expression depends on a generic parameter | |
| 10 | --> $DIR/too_generic_eval_ice.rs:11:9 | |
| 11 | | | |
| 12 | LL | [5; Self::HOST_SIZE] == [6; 0] | |
| 13 | | ^^^^^^^^^^^^^^^^^^^^ | |
| 14 | | | |
| 15 | = note: this may fail depending on what value the parameter takes | |
| 16 | ||
| 17 | error: constant expression depends on a generic parameter | |
| 18 | --> $DIR/too_generic_eval_ice.rs:11:30 | |
| 19 | | | |
| 20 | LL | [5; Self::HOST_SIZE] == [6; 0] | |
| 21 | | ^^ | |
| 22 | | | |
| 23 | = note: this may fail depending on what value the parameter takes | |
| 24 | ||
| 25 | error[E0277]: can't compare `[{integer}; Self::HOST_SIZE]` with `[{integer}; 0]` | |
| 26 | --> $DIR/too_generic_eval_ice.rs:11:30 | |
| 27 | | | |
| 28 | LL | [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 | ||
| 43 | error: aborting due to 4 previous errors | |
| 44 | ||
| 45 | For more information about this error, try `rustc --explain E0277`. |
tests/ui/consts/too_generic_eval_ice.next.stderr created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | error[E0284]: type annotations needed: cannot satisfy `the constant `Self::HOST_SIZE` can be evaluated` | |
| 2 | --> $DIR/too_generic_eval_ice.rs:11:13 | |
| 3 | | | |
| 4 | LL | [5; Self::HOST_SIZE] == [6; 0] | |
| 5 | | ^^^^^^^^^^^^^^^ cannot satisfy `the constant `Self::HOST_SIZE` can be evaluated` | |
| 6 | ||
| 7 | error: aborting due to 1 previous error | |
| 8 | ||
| 9 | For 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 | ||
| 1 | 5 | pub struct Foo<A, B>(A, B); |
| 2 | 6 | |
| 3 | 7 | impl<A, B> Foo<A, B> { |
| ... | ... | @@ -5,10 +9,11 @@ impl<A, B> Foo<A, B> { |
| 5 | 9 | |
| 6 | 10 | pub fn crash() -> bool { |
| 7 | 11 | [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 | |
| 12 | 17 | } |
| 13 | 18 | } |
| 14 | 19 |
tests/ui/consts/too_generic_eval_ice.stderr deleted-45| ... | ... | @@ -1,45 +0,0 @@ |
| 1 | error: constant expression depends on a generic parameter | |
| 2 | --> $DIR/too_generic_eval_ice.rs:7:13 | |
| 3 | | | |
| 4 | LL | [5; Self::HOST_SIZE] == [6; 0] | |
| 5 | | ^^^^^^^^^^^^^^^ | |
| 6 | | | |
| 7 | = note: this may fail depending on what value the parameter takes | |
| 8 | ||
| 9 | error: constant expression depends on a generic parameter | |
| 10 | --> $DIR/too_generic_eval_ice.rs:7:9 | |
| 11 | | | |
| 12 | LL | [5; Self::HOST_SIZE] == [6; 0] | |
| 13 | | ^^^^^^^^^^^^^^^^^^^^ | |
| 14 | | | |
| 15 | = note: this may fail depending on what value the parameter takes | |
| 16 | ||
| 17 | error: constant expression depends on a generic parameter | |
| 18 | --> $DIR/too_generic_eval_ice.rs:7:30 | |
| 19 | | | |
| 20 | LL | [5; Self::HOST_SIZE] == [6; 0] | |
| 21 | | ^^ | |
| 22 | | | |
| 23 | = note: this may fail depending on what value the parameter takes | |
| 24 | ||
| 25 | error[E0277]: can't compare `[{integer}; Self::HOST_SIZE]` with `[{integer}; 0]` | |
| 26 | --> $DIR/too_generic_eval_ice.rs:7:30 | |
| 27 | | | |
| 28 | LL | [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 | ||
| 43 | error: aborting due to 4 previous errors | |
| 44 | ||
| 45 | For more information about this error, try `rustc --explain E0277`. |
tests/ui/privacy/where-pub-type-impls-priv-trait.rs-1| ... | ... | @@ -3,7 +3,6 @@ |
| 3 | 3 | // priv-in-pub lint tests where the private trait bounds a public type |
| 4 | 4 | |
| 5 | 5 | #![crate_type = "lib"] |
| 6 | #![feature(generic_const_exprs)] | |
| 7 | 6 | #![allow(incomplete_features)] |
| 8 | 7 | |
| 9 | 8 | struct PrivTy; |
tests/ui/privacy/where-pub-type-impls-priv-trait.stderr+10-10| ... | ... | @@ -1,30 +1,30 @@ |
| 1 | 1 | warning: 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 | |
| 3 | 3 | | |
| 4 | 4 | LL | pub struct S |
| 5 | 5 | | ^^^^^^^^^^^^ struct `S` is reachable at visibility `pub` |
| 6 | 6 | | |
| 7 | 7 | note: 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 | |
| 9 | 9 | | |
| 10 | 10 | LL | trait PrivTr {} |
| 11 | 11 | | ^^^^^^^^^^^^ |
| 12 | 12 | = note: `#[warn(private_bounds)]` on by default |
| 13 | 13 | |
| 14 | 14 | warning: 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 | |
| 16 | 16 | | |
| 17 | 17 | LL | pub enum E |
| 18 | 18 | | ^^^^^^^^^^ enum `E` is reachable at visibility `pub` |
| 19 | 19 | | |
| 20 | 20 | note: 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 | |
| 22 | 22 | | |
| 23 | 23 | LL | trait PrivTr {} |
| 24 | 24 | | ^^^^^^^^^^^^ |
| 25 | 25 | |
| 26 | 26 | warning: 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 | |
| 28 | 28 | | |
| 29 | 29 | LL | / pub fn f() |
| 30 | 30 | LL | | |
| ... | ... | @@ -33,13 +33,13 @@ LL | | PubTy: PrivTr |
| 33 | 33 | | |_________________^ function `f` is reachable at visibility `pub` |
| 34 | 34 | | |
| 35 | 35 | note: 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 | |
| 37 | 37 | | |
| 38 | 38 | LL | trait PrivTr {} |
| 39 | 39 | | ^^^^^^^^^^^^ |
| 40 | 40 | |
| 41 | 41 | warning: 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 | |
| 43 | 43 | | |
| 44 | 44 | LL | / impl S |
| 45 | 45 | LL | | |
| ... | ... | @@ -48,13 +48,13 @@ LL | | PubTy: PrivTr |
| 48 | 48 | | |_________________^ implementation `S` is reachable at visibility `pub` |
| 49 | 49 | | |
| 50 | 50 | note: 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 | |
| 52 | 52 | | |
| 53 | 53 | LL | trait PrivTr {} |
| 54 | 54 | | ^^^^^^^^^^^^ |
| 55 | 55 | |
| 56 | 56 | warning: 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 | |
| 58 | 58 | | |
| 59 | 59 | LL | / pub fn f() |
| 60 | 60 | LL | | |
| ... | ... | @@ -63,7 +63,7 @@ LL | | PubTy: PrivTr |
| 63 | 63 | | |_____________________^ associated function `S::f` is reachable at visibility `pub` |
| 64 | 64 | | |
| 65 | 65 | note: 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 | |
| 67 | 67 | | |
| 68 | 68 | LL | trait PrivTr {} |
| 69 | 69 | | ^^^^^^^^^^^^ |
tests/ui/traits/next-solver/well-formed-in-relate.rs created+21| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | fn main() { | |
| 2 | let x; | |
| 3 | //~^ ERROR type annotations needed for `Map<_, _>` | |
| 4 | higher_ranked(); | |
| 5 | x = unconstrained_map(); | |
| 6 | } | |
| 7 | ||
| 8 | fn higher_ranked() where for<'a> &'a (): Sized {} | |
| 9 | ||
| 10 | struct Map<T, U> where T: Fn() -> U { | |
| 11 | t: T, | |
| 12 | } | |
| 13 | ||
| 14 | trait Mirror { | |
| 15 | type Assoc; | |
| 16 | } | |
| 17 | impl<T> Mirror for T { | |
| 18 | type Assoc = T; | |
| 19 | } | |
| 20 | ||
| 21 | fn 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 @@ |
| 1 | error[E0283]: type annotations needed for `Map<_, _>` | |
| 2 | --> $DIR/well-formed-in-relate.rs:2:9 | |
| 3 | | | |
| 4 | LL | let x; | |
| 5 | | ^ | |
| 6 | ... | |
| 7 | LL | 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; | |
| 15 | note: required by a bound in `unconstrained_map` | |
| 16 | --> $DIR/well-formed-in-relate.rs:21:25 | |
| 17 | | | |
| 18 | LL | fn unconstrained_map<T: Fn() -> U, U>() -> <Map<T, U> as Mirror>::Assoc { todo!() } | |
| 19 | | ^^^^^^^^^ required by this bound in `unconstrained_map` | |
| 20 | help: consider giving `x` an explicit type, where the type for type parameter `T` is specified | |
| 21 | | | |
| 22 | LL | let x: Map<T, U>; | |
| 23 | | +++++++++++ | |
| 24 | ||
| 25 | error: aborting due to 1 previous error | |
| 26 | ||
| 27 | For more information about this error, try `rustc --explain E0283`. |
triagebot.toml+2-2| ... | ... | @@ -174,8 +174,8 @@ label = "O-emscripten" |
| 174 | 174 | |
| 175 | 175 | [ping.relnotes-interest-group] |
| 176 | 176 | message = """\ |
| 177 | Hi relnotes-interest-group, this PR adds release notes. Could you review this PR | |
| 178 | if you have time? Thanks <3 | |
| 177 | Hi relnotes-interest-group, this issue/PR could use some help in reviewing / | |
| 178 | adjusting release notes. Could you take a look if available? Thanks <3 | |
| 179 | 179 | """ |
| 180 | 180 | |
| 181 | 181 | [prioritize] |