Skip to content

Commit d068a61

Browse files
committed
Auto merge of #74958 - Mark-Simulacrum:stable-next, r=pnkfelix
[stable] 1.45.2 release This is intended to fix the stable breakage noted in #74954, but does *not* close that issue -- there remains investigation and likely nightly/beta fixes need to be issued as well. r? @pnkfelix
2 parents c367798 + fcd1712 commit d068a61

File tree

7 files changed

+49
-53
lines changed

7 files changed

+49
-53
lines changed

RELEASES.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
Version 1.45.2 (2020-08-03)
2+
==========================
3+
4+
* [Fix bindings in tuple struct patterns][74954]
5+
* [Fix track_caller integration with trait objects][74784]
6+
7+
[74954]: https://github.com/rust-lang/rust/issues/74954
8+
[74784]: https://github.com/rust-lang/rust/issues/74784
9+
110
Version 1.45.1 (2020-07-30)
211
==========================
312

src/librustc_middle/ty/instance.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ impl<'tcx> Instance<'tcx> {
345345
debug!(" => associated item with unsizeable self: Self");
346346
Some(Instance { def: InstanceDef::VtableShim(def_id), substs })
347347
} else {
348-
Instance::resolve(tcx, param_env, def_id, substs).ok().flatten()
348+
Instance::resolve_for_fn_ptr(tcx, param_env, def_id, substs)
349349
}
350350
}
351351

src/librustc_resolve/late.rs

+7-19
Original file line numberDiff line numberDiff line change
@@ -1407,30 +1407,18 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
14071407
pat_src: PatternSource,
14081408
bindings: &mut SmallVec<[(PatBoundCtx, FxHashSet<Ident>); 1]>,
14091409
) {
1410-
let is_tuple_struct_pat = matches!(pat.kind, PatKind::TupleStruct(_, _));
1411-
14121410
// Visit all direct subpatterns of this pattern.
14131411
pat.walk(&mut |pat| {
14141412
debug!("resolve_pattern pat={:?} node={:?}", pat, pat.kind);
14151413
match pat.kind {
1416-
// In tuple struct patterns ignore the invalid `ident @ ...`.
1417-
// It will be handled as an error by the AST lowering.
14181414
PatKind::Ident(bmode, ident, ref sub) => {
1419-
if is_tuple_struct_pat && sub.as_ref().filter(|p| p.is_rest()).is_some() {
1420-
self.r
1421-
.session
1422-
.delay_span_bug(ident.span, "ident in tuple pattern is invalid");
1423-
} else {
1424-
// First try to resolve the identifier as some existing entity,
1425-
// then fall back to a fresh binding.
1426-
let has_sub = sub.is_some();
1427-
let res = self
1428-
.try_resolve_as_non_binding(pat_src, pat, bmode, ident, has_sub)
1429-
.unwrap_or_else(|| {
1430-
self.fresh_binding(ident, pat.id, pat_src, bindings)
1431-
});
1432-
self.r.record_partial_res(pat.id, PartialRes::new(res));
1433-
}
1415+
// First try to resolve the identifier as some existing entity,
1416+
// then fall back to a fresh binding.
1417+
let has_sub = sub.is_some();
1418+
let res = self
1419+
.try_resolve_as_non_binding(pat_src, pat, bmode, ident, has_sub)
1420+
.unwrap_or_else(|| self.fresh_binding(ident, pat.id, pat_src, bindings));
1421+
self.r.record_partial_res(pat.id, PartialRes::new(res));
14341422
}
14351423
PatKind::TupleStruct(ref path, ..) => {
14361424
self.smart_resolve_path(pat.id, None, path, PathSource::TupleStruct);

src/test/ui/issues/issue-74539.rs

-12
This file was deleted.

src/test/ui/issues/issue-74539.stderr

-21
This file was deleted.

src/test/ui/issues/issue-74954.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// check-pass
2+
3+
fn main() {
4+
if let Some([b'@', filename @ ..]) = Some(b"@abc123") {
5+
println!("filename {:?}", filename);
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// run-pass
2+
3+
#![feature(track_caller)]
4+
5+
trait Tracked {
6+
#[track_caller]
7+
fn handle(&self) {
8+
let location = std::panic::Location::caller();
9+
assert_eq!(location.file(), file!());
10+
// we only call this via trait object, so the def site should *always* be returned
11+
assert_eq!(location.line(), line!() - 4);
12+
assert_eq!(location.column(), 5);
13+
}
14+
}
15+
16+
impl Tracked for () {}
17+
impl Tracked for u8 {}
18+
19+
fn main() {
20+
let tracked: &dyn Tracked = &5u8;
21+
tracked.handle();
22+
23+
const TRACKED: &dyn Tracked = &();
24+
TRACKED.handle();
25+
}

0 commit comments

Comments
 (0)