Skip to content

Commit 0ff8610

Browse files
committed
Auto merge of rust-lang#118134 - Nilstrieb:rollup-kyo1l6e, r=Nilstrieb
Rollup of 6 pull requests Successful merges: - rust-lang#116085 (rustdoc-search: add support for traits and associated types) - rust-lang#117522 (Remove `--check-cfg` checking of command line `--cfg` args) - rust-lang#118029 (Expand Miri's BorTag GC to a Provenance GC) - rust-lang#118035 (Fix early param lifetimes in generic_const_exprs) - rust-lang#118083 (Remove i686-apple-darwin cross-testing) - rust-lang#118091 (Remove now deprecated target x86_64-sun-solaris.) r? `@ghost` `@rustbot` modify labels: rollup
2 parents e24e5af + fa8878b commit 0ff8610

File tree

96 files changed

+1988
-602
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+1988
-602
lines changed

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::session_diagnostics::{
3535
LifetimeReturnCategoryErr, RequireStaticErr, VarHereDenote,
3636
};
3737

38-
use super::{OutlivesSuggestionBuilder, RegionName};
38+
use super::{OutlivesSuggestionBuilder, RegionName, RegionNameSource};
3939
use crate::region_infer::{BlameConstraint, ExtraConstraintInfo};
4040
use crate::{
4141
nll::ConstraintDescription,
@@ -763,7 +763,14 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
763763
let err = LifetimeOutliveErr { span: *span };
764764
let mut diag = self.infcx.tcx.sess.create_err(err);
765765

766-
let fr_name = self.give_region_a_name(*fr).unwrap();
766+
// In certain scenarios, such as the one described in issue #118021,
767+
// we might encounter a lifetime that cannot be named.
768+
// These situations are bound to result in errors.
769+
// To prevent an immediate ICE, we opt to create a dummy name instead.
770+
let fr_name = self.give_region_a_name(*fr).unwrap_or(RegionName {
771+
name: kw::UnderscoreLifetime,
772+
source: RegionNameSource::Static,
773+
});
767774
fr_name.highlight_region_name(&mut diag);
768775
let outlived_fr_name = self.give_region_a_name(*outlived_fr).unwrap();
769776
outlived_fr_name.highlight_region_name(&mut diag);

compiler/rustc_const_eval/src/const_eval/machine.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ impl<K: Hash + Eq, V> interpret::AllocMap<K, V> for FxIndexMap<K, V> {
107107
FxIndexMap::contains_key(self, k)
108108
}
109109

110+
#[inline(always)]
111+
fn contains_key_ref<Q: ?Sized + Hash + Eq>(&self, k: &Q) -> bool
112+
where
113+
K: Borrow<Q>,
114+
{
115+
FxIndexMap::contains_key(self, k)
116+
}
117+
110118
#[inline(always)]
111119
fn insert(&mut self, k: K, v: V) -> Option<V> {
112120
FxIndexMap::insert(self, k, v)

compiler/rustc_const_eval/src/interpret/machine.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ pub trait AllocMap<K: Hash + Eq, V> {
4949
where
5050
K: Borrow<Q>;
5151

52+
/// Callers should prefer [`AllocMap::contains_key`] when it is possible to call because it may
53+
/// be more efficient. This function exists for callers that only have a shared reference
54+
/// (which might make it slightly less efficient than `contains_key`, e.g. if
55+
/// the data is stored inside a `RefCell`).
56+
fn contains_key_ref<Q: ?Sized + Hash + Eq>(&self, k: &Q) -> bool
57+
where
58+
K: Borrow<Q>;
59+
5260
/// Inserts a new entry into the map.
5361
fn insert(&mut self, k: K, v: V) -> Option<V>;
5462

compiler/rustc_const_eval/src/interpret/memory.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,15 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
692692
Ok((&mut alloc.extra, machine))
693693
}
694694

695+
/// Check whether an allocation is live. This is faster than calling
696+
/// [`InterpCx::get_alloc_info`] if all you need to check is whether the kind is
697+
/// [`AllocKind::Dead`] because it doesn't have to look up the type and layout of statics.
698+
pub fn is_alloc_live(&self, id: AllocId) -> bool {
699+
self.tcx.try_get_global_alloc(id).is_some()
700+
|| self.memory.alloc_map.contains_key_ref(&id)
701+
|| self.memory.extra_fn_ptr_map.contains_key(&id)
702+
}
703+
695704
/// Obtain the size and alignment of an allocation, even if that allocation has
696705
/// been deallocated.
697706
pub fn get_alloc_info(&self, id: AllocId) -> (Size, Align, AllocKind) {

compiler/rustc_lint/messages.ftl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,6 @@ lint_builtin_type_alias_generic_bounds = bounds on generic parameters are not en
128128
lint_builtin_type_alias_where_clause = where clauses are not enforced in type aliases
129129
.suggestion = the clause will not be checked when the type alias is used, and should be removed
130130
131-
lint_builtin_unexpected_cli_config_name = unexpected `{$name}` as condition name
132-
.help = was set with `--cfg` but isn't in the `--check-cfg` expected names
133-
134-
lint_builtin_unexpected_cli_config_value = unexpected condition value `{$value}` for condition name `{$name}`
135-
.help = was set with `--cfg` but isn't in the `--check-cfg` expected values
136-
137131
lint_builtin_unpermitted_type_init_label = this code causes undefined behavior when executed
138132
lint_builtin_unpermitted_type_init_label_suggestion = help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
139133

compiler/rustc_lint/src/builtin.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use crate::{
3333
BuiltinMutablesTransmutes, BuiltinNoMangleGeneric, BuiltinNonShorthandFieldPatterns,
3434
BuiltinSpecialModuleNameUsed, BuiltinTrivialBounds, BuiltinTypeAliasGenericBounds,
3535
BuiltinTypeAliasGenericBoundsSuggestion, BuiltinTypeAliasWhereClause,
36-
BuiltinUnexpectedCliConfigName, BuiltinUnexpectedCliConfigValue,
3736
BuiltinUngatedAsyncFnTrackCaller, BuiltinUnpermittedTypeInit,
3837
BuiltinUnpermittedTypeInitSub, BuiltinUnreachablePub, BuiltinUnsafe,
3938
BuiltinUnstableFeatures, BuiltinUnusedDocComment, BuiltinUnusedDocCommentSub,
@@ -60,7 +59,6 @@ use rustc_middle::ty::GenericArgKind;
6059
use rustc_middle::ty::ToPredicate;
6160
use rustc_middle::ty::TypeVisitableExt;
6261
use rustc_middle::ty::{self, Ty, TyCtxt, VariantDef};
63-
use rustc_session::config::ExpectedValues;
6462
use rustc_session::lint::{BuiltinLintDiagnostics, FutureIncompatibilityReason};
6563
use rustc_span::edition::Edition;
6664
use rustc_span::source_map::Spanned;
@@ -2889,26 +2887,3 @@ impl EarlyLintPass for SpecialModuleName {
28892887
}
28902888
}
28912889
}
2892-
2893-
pub use rustc_session::lint::builtin::UNEXPECTED_CFGS;
2894-
2895-
declare_lint_pass!(UnexpectedCfgs => [UNEXPECTED_CFGS]);
2896-
2897-
impl EarlyLintPass for UnexpectedCfgs {
2898-
fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &ast::Crate) {
2899-
let cfg = &cx.sess().parse_sess.config;
2900-
let check_cfg = &cx.sess().parse_sess.check_config;
2901-
for &(name, value) in cfg {
2902-
match check_cfg.expecteds.get(&name) {
2903-
Some(ExpectedValues::Some(values)) if !values.contains(&value) => {
2904-
let value = value.unwrap_or(kw::Empty);
2905-
cx.emit_lint(UNEXPECTED_CFGS, BuiltinUnexpectedCliConfigValue { name, value });
2906-
}
2907-
None if check_cfg.exhaustive_names => {
2908-
cx.emit_lint(UNEXPECTED_CFGS, BuiltinUnexpectedCliConfigName { name });
2909-
}
2910-
_ => { /* expected */ }
2911-
}
2912-
}
2913-
}
2914-
}

compiler/rustc_lint/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ early_lint_methods!(
179179
IncompleteInternalFeatures: IncompleteInternalFeatures,
180180
RedundantSemicolons: RedundantSemicolons,
181181
UnusedDocComment: UnusedDocComment,
182-
UnexpectedCfgs: UnexpectedCfgs,
183182
]
184183
]
185184
);

compiler/rustc_lint/src/lints.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -553,21 +553,6 @@ pub enum BuiltinSpecialModuleNameUsed {
553553
Main,
554554
}
555555

556-
#[derive(LintDiagnostic)]
557-
#[diag(lint_builtin_unexpected_cli_config_name)]
558-
#[help]
559-
pub struct BuiltinUnexpectedCliConfigName {
560-
pub name: Symbol,
561-
}
562-
563-
#[derive(LintDiagnostic)]
564-
#[diag(lint_builtin_unexpected_cli_config_value)]
565-
#[help]
566-
pub struct BuiltinUnexpectedCliConfigValue {
567-
pub name: Symbol,
568-
pub value: Symbol,
569-
}
570-
571556
// deref_into_dyn_supertrait.rs
572557
#[derive(LintDiagnostic)]
573558
#[diag(lint_supertrait_as_deref_target)]

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3439,6 +3439,7 @@ declare_lint_pass! {
34393439
UNCONDITIONAL_PANIC,
34403440
UNCONDITIONAL_RECURSION,
34413441
UNDEFINED_NAKED_FUNCTION_ABI,
3442+
UNEXPECTED_CFGS,
34423443
UNFULFILLED_LINT_EXPECTATIONS,
34433444
UNINHABITED_STATIC,
34443445
UNKNOWN_CRATE_TYPES,

compiler/rustc_middle/src/mir/interpret/mod.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -525,13 +525,6 @@ impl<'tcx> TyCtxt<'tcx> {
525525
self.alloc_map.lock().reserve()
526526
}
527527

528-
/// Miri's provenance GC needs to see all live allocations. The interpreter manages most
529-
/// allocations but some are managed by [`TyCtxt`] and without this method the interpreter
530-
/// doesn't know their [`AllocId`]s are in use.
531-
pub fn iter_allocs<F: FnMut(AllocId)>(self, func: F) {
532-
self.alloc_map.lock().alloc_map.keys().copied().for_each(func)
533-
}
534-
535528
/// Reserves a new ID *if* this allocation has not been dedup-reserved before.
536529
/// Should only be used for "symbolic" allocations (function pointers, vtables, statics), we
537530
/// don't want to dedup IDs for "real" memory!

0 commit comments

Comments
 (0)