Skip to content

Commit e092d0b

Browse files
committed
Auto merge of #99299 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
[stable] 1.62.1 release This bundles: * Windows: Fallback for overlapped I/O #98950 * don't succeed evaluate_obligation query if new opaque types were registered #98614 * Mitigate MMIO stale data vulnerability #98126 * Return a FxIndexSet in is_late_bound query. #99219 Also bumps the version number to 1.62.1 and includes a short release notes section for the release. r? `@Mark-Simulacrum`
2 parents a8314ef + 647922f commit e092d0b

File tree

36 files changed

+442
-212
lines changed

36 files changed

+442
-212
lines changed

RELEASES.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
Version 1.62.1 (2022-07-19)
2+
==========================
3+
4+
Rust 1.62.1 addresses a few recent regressions in the compiler and standard
5+
library, and also mitigates a CPU vulnerability on Intel SGX.
6+
7+
* [The compiler fixed unsound function coercions involving `impl Trait` return types.][98608]
8+
* [The compiler fixed an incremental compilation bug with `async fn` lifetimes.][98890]
9+
* [Windows added a fallback for overlapped I/O in synchronous reads and writes.][98950]
10+
* [The `x86_64-fortanix-unknown-sgx` target added a mitigation for the
11+
MMIO stale data vulnerability][98126], advisory [INTEL-SA-00615].
12+
13+
[98608]: https://github.com/rust-lang/rust/issues/98608
14+
[98890]: https://github.com/rust-lang/rust/issues/98890
15+
[98950]: https://github.com/rust-lang/rust/pull/98950
16+
[98126]: https://github.com/rust-lang/rust/pull/98126
17+
[INTEL-SA-00615]: https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00615.html
18+
119
Version 1.62.0 (2022-06-30)
220
==========================
321

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
929929
.region_constraints_added_in_snapshot(&snapshot.undo_snapshot)
930930
}
931931

932+
pub fn opaque_types_added_in_snapshot(&self, snapshot: &CombinedSnapshot<'a, 'tcx>) -> bool {
933+
self.inner.borrow().undo_log.opaque_types_in_snapshot(&snapshot.undo_snapshot)
934+
}
935+
932936
pub fn add_given(&self, sub: ty::Region<'tcx>, sup: ty::RegionVid) {
933937
self.inner.borrow_mut().unwrap_region_constraints().add_given(sub, sup);
934938
}

compiler/rustc_infer/src/infer/opaque_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
9999
}
100100
let (a, b) = if a_is_expected { (a, b) } else { (b, a) };
101101
let process = |a: Ty<'tcx>, b: Ty<'tcx>| match *a.kind() {
102-
ty::Opaque(def_id, substs) => {
102+
ty::Opaque(def_id, substs) if def_id.is_local() => {
103103
let origin = if self.defining_use_anchor.is_some() {
104104
// Check that this is `impl Trait` type is
105105
// declared by `parent_def_id` -- i.e., one whose

compiler/rustc_infer/src/infer/undo_log.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ impl<'tcx> InferCtxtUndoLogs<'tcx> {
185185
})
186186
}
187187

188+
pub(crate) fn opaque_types_in_snapshot(&self, s: &Snapshot<'tcx>) -> bool {
189+
self.logs[s.undo_len..].iter().any(|log| matches!(log, UndoLog::OpaqueTypes(..)))
190+
}
191+
188192
pub(crate) fn region_constraints(
189193
&self,
190194
) -> impl Iterator<Item = &'_ region_constraints::UndoLog<'tcx>> + Clone {

compiler/rustc_infer/src/traits/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl<'tcx> ProjectionCache<'_, 'tcx> {
203203
Some(&ProjectionCacheEntry::NormalizedTy { ref ty, complete: _ }) => {
204204
info!("ProjectionCacheEntry::complete({:?}) - completing {:?}", key, ty);
205205
let mut ty = ty.clone();
206-
if result == EvaluationResult::EvaluatedToOk {
206+
if result.must_apply_considering_regions() {
207207
ty.obligations = vec![];
208208
}
209209
map.insert(key, ProjectionCacheEntry::NormalizedTy { ty, complete: Some(result) });

compiler/rustc_middle/src/arena.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ macro_rules! arena_types {
8585
[] attribute: rustc_ast::Attribute,
8686
[] name_set: rustc_data_structures::fx::FxHashSet<rustc_span::symbol::Symbol>,
8787
[] hir_id_set: rustc_hir::HirIdSet,
88+
[] late_bound_lifetimes: rustc_data_structures::fx::FxIndexSet<rustc_hir::def_id::LocalDefId>,
8889

8990
// Interned types
9091
[] tys: rustc_data_structures::intern::WithStableHash<rustc_middle::ty::TyS<'tcx>>,

compiler/rustc_middle/src/middle/resolve_lifetime.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use crate::ty;
44

5-
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
5+
use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
66
use rustc_hir::def_id::{DefId, LocalDefId};
77
use rustc_hir::ItemLocalId;
88
use rustc_macros::HashStable;
@@ -64,7 +64,7 @@ pub struct ResolveLifetimes {
6464
/// Set of lifetime def ids that are late-bound; a region can
6565
/// be late-bound if (a) it does NOT appear in a where-clause and
6666
/// (b) it DOES appear in the arguments.
67-
pub late_bound: FxHashMap<LocalDefId, FxHashSet<LocalDefId>>,
67+
pub late_bound: FxHashMap<LocalDefId, FxIndexSet<LocalDefId>>,
6868

6969
pub late_bound_vars: FxHashMap<LocalDefId, FxHashMap<ItemLocalId, Vec<ty::BoundVariableKind>>>,
7070
}

compiler/rustc_middle/src/query/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ rustc_queries! {
15371537
Option<&'tcx FxHashMap<ItemLocalId, Region>> {
15381538
desc { "looking up a named region" }
15391539
}
1540-
query is_late_bound_map(_: LocalDefId) -> Option<(LocalDefId, &'tcx FxHashSet<LocalDefId>)> {
1540+
query is_late_bound_map(_: LocalDefId) -> Option<(LocalDefId, &'tcx FxIndexSet<LocalDefId>)> {
15411541
desc { "testing if a region is late bound" }
15421542
}
15431543
/// For a given item (like a struct), gets the default lifetimes to be used

compiler/rustc_middle/src/traits/select.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ pub enum EvaluationResult {
176176
EvaluatedToOk,
177177
/// Evaluation successful, but there were unevaluated region obligations.
178178
EvaluatedToOkModuloRegions,
179+
/// Evaluation successful, but need to rerun because opaque types got
180+
/// hidden types assigned without it being known whether the opaque types
181+
/// are within their defining scope
182+
EvaluatedToOkModuloOpaqueTypes,
179183
/// Evaluation is known to be ambiguous -- it *might* hold for some
180184
/// assignment of inference variables, but it might not.
181185
///
@@ -252,9 +256,11 @@ impl EvaluationResult {
252256

253257
pub fn may_apply(self) -> bool {
254258
match self {
255-
EvaluatedToOk | EvaluatedToOkModuloRegions | EvaluatedToAmbig | EvaluatedToUnknown => {
256-
true
257-
}
259+
EvaluatedToOkModuloOpaqueTypes
260+
| EvaluatedToOk
261+
| EvaluatedToOkModuloRegions
262+
| EvaluatedToAmbig
263+
| EvaluatedToUnknown => true,
258264

259265
EvaluatedToErr | EvaluatedToRecur => false,
260266
}
@@ -264,7 +270,11 @@ impl EvaluationResult {
264270
match self {
265271
EvaluatedToUnknown | EvaluatedToRecur => true,
266272

267-
EvaluatedToOk | EvaluatedToOkModuloRegions | EvaluatedToAmbig | EvaluatedToErr => false,
273+
EvaluatedToOkModuloOpaqueTypes
274+
| EvaluatedToOk
275+
| EvaluatedToOkModuloRegions
276+
| EvaluatedToAmbig
277+
| EvaluatedToErr => false,
268278
}
269279
}
270280
}

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,7 @@ impl<'tcx> InstantiatedPredicates<'tcx> {
10651065
Lift
10661066
)]
10671067
pub struct OpaqueTypeKey<'tcx> {
1068+
// FIXME(oli-obk): make this a LocalDefId
10681069
pub def_id: DefId,
10691070
pub substs: SubstsRef<'tcx>,
10701071
}

0 commit comments

Comments
 (0)