Skip to content

Rollup of 16 pull requests #96069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f427698
Parse inner attributes on inline const block
dtolnay Mar 16, 2022
3f7f5e8
Optimize RcInnerPtr::inc_strong instruction count
mjbshaw Mar 23, 2022
f5dd42b
Format unsafe {} blocks
mjbshaw Mar 23, 2022
8d14c03
Explicitly mention overflow is what we're checking
mjbshaw Mar 23, 2022
9cfdb89
Only add codegen backend to dep info if -Zbinary-dep-depinfo is used
bjorn3 Feb 13, 2022
c681a88
Don't include invalid paths in the depinfo for builtin backends
bjorn3 Feb 13, 2022
147e5da
Add test
bjorn3 Mar 24, 2022
8035796
Stablize `const_extern_fn` for "Rust" and "C"
Aaron1011 Mar 26, 2022
6b75406
Create 2024 edition
jhpratt Feb 28, 2022
98190b7
Revert "Work around invalid DWARF bugs for fat LTO"
cbiffle Apr 4, 2022
42af197
Improve debuginfo test coverage for simple statics.
cbiffle Apr 5, 2022
7bd22e2
only downgrade Error -> Ambiguous if type error is in predicate
compiler-errors Apr 7, 2022
edeb826
Inline shallow_resolve_ty into ShallowResolver
compiler-errors Apr 10, 2022
7f945b2
add simd_arith_offset intrinsics
RalfJung Apr 12, 2022
e886dc5
portable-simd: use simd_arith_offset to avoid ptr-int transmutation
RalfJung Apr 12, 2022
69de213
Fix `x test --doc --stage 0 library/std`
jyn514 Apr 13, 2022
eb905c0
add codegen smoke test
RalfJung Apr 13, 2022
7c2d57e
couple of clippy::complexity fixes
matthiaskrgr Apr 13, 2022
21d3f84
test: add is_superset test cases for BTreeSet
Gumichocopengin8 Apr 14, 2022
50c339e
test: add remove() test cases for BTreeSet
Gumichocopengin8 Apr 14, 2022
1e78a47
:arrow_up: rust-analyzer
lnicola Apr 14, 2022
9d319f3
update: actions/checkout@v2 to actions/checkout@v3
Gumichocopengin8 Apr 14, 2022
c20bb1d
Update issue-92893.stderr
ouz-a Apr 14, 2022
5459e66
docs: Update tests chapter for Termination stabilization
ehuss Apr 14, 2022
8f5fd4c
Rollup merge of #93969 - bjorn3:codegen_backend_dep_info, r=pnkfelix
fee1-dead Apr 15, 2022
9646009
Rollup merge of #94461 - jhpratt:2024-edition, r=pnkfelix
fee1-dead Apr 15, 2022
a0e3d80
Rollup merge of #94849 - ouz-a:master4, r=oli-obk
fee1-dead Apr 15, 2022
851cb4b
Rollup merge of #94985 - dtolnay:constattr, r=pnkfelix
fee1-dead Apr 15, 2022
3b9b3fb
Rollup merge of #95224 - mjbshaw:patch-1, r=yaahc
fee1-dead Apr 15, 2022
4d3e076
Rollup merge of #95346 - Aaron1011:stablize-const-extern-fn, r=pnkfelix
fee1-dead Apr 15, 2022
7a815c7
Rollup merge of #95685 - oxidecomputer:restore-static-dwarf, r=pnkfelix
fee1-dead Apr 15, 2022
ef8cf01
Rollup merge of #95749 - compiler-errors:ambig, r=oli-obk
fee1-dead Apr 15, 2022
b82ae65
Rollup merge of #95908 - compiler-errors:shallow_resolve_ty-inline, r…
fee1-dead Apr 15, 2022
95ec29e
Rollup merge of #95961 - RalfJung:gather-scatter, r=workingjubilee
fee1-dead Apr 15, 2022
df2f5f0
Rollup merge of #95993 - jyn514:fix-stage0-doctests, r=Mark-Simulacrum
fee1-dead Apr 15, 2022
c2137f3
Rollup merge of #96026 - matthiaskrgr:clippy_compl_1304, r=Dylan-DPC
fee1-dead Apr 15, 2022
ffe46cd
Rollup merge of #96034 - Gumichocopengin8:test/btree-set, r=Dylan-DPC
fee1-dead Apr 15, 2022
0bde871
Rollup merge of #96035 - Gumichocopengin8:feature/update-github-actio…
fee1-dead Apr 15, 2022
0caff27
Rollup merge of #96047 - lnicola:rust-analyzer-2022-04-14, r=lnicola
fee1-dead Apr 15, 2022
21b45bf
Rollup merge of #96062 - ehuss:test-termination, r=Dylan-DPC
fee1-dead Apr 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update issue-92893.stderr
  • Loading branch information
ouz-a committed Apr 14, 2022
commit c20bb1d59f17c6329ea922c4bb2ccec5d46e7e00
9 changes: 3 additions & 6 deletions compiler/rustc_middle/src/middle/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,9 @@ impl ScopeTree {
self.parent_map.get(&id).cloned().map(|(p, _)| p)
}

/// Returns the lifetime of the local variable `var_id`
pub fn var_scope(&self, var_id: hir::ItemLocalId) -> Scope {
self.var_map
.get(&var_id)
.cloned()
.unwrap_or_else(|| bug!("no enclosing scope for id {:?}", var_id))
/// Returns the lifetime of the local variable `var_id`, if any.
pub fn var_scope(&self, var_id: hir::ItemLocalId) -> Option<Scope> {
self.var_map.get(&var_id).cloned()
}

/// Returns the scope when the temp created by `expr_id` will be cleaned up.
Expand Down
10 changes: 6 additions & 4 deletions compiler/rustc_mir_build/src/build/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,17 +701,19 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let local_id = self.var_local_id(var, for_guard);
let source_info = self.source_info(span);
self.cfg.push(block, Statement { source_info, kind: StatementKind::StorageLive(local_id) });
let region_scope = self.region_scope_tree.var_scope(var.local_id);
if schedule_drop {
// Altough there is almost always scope for given variable in corner cases
// like #92893 we might get variable with no scope.
if let Some(region_scope) = self.region_scope_tree.var_scope(var.local_id) && schedule_drop{
self.schedule_drop(span, region_scope, local_id, DropKind::Storage);
}
Place::from(local_id)
}

crate fn schedule_drop_for_binding(&mut self, var: HirId, span: Span, for_guard: ForGuard) {
let local_id = self.var_local_id(var, for_guard);
let region_scope = self.region_scope_tree.var_scope(var.local_id);
self.schedule_drop(span, region_scope, local_id, DropKind::Value);
if let Some(region_scope) = self.region_scope_tree.var_scope(var.local_id) {
self.schedule_drop(span, region_scope, local_id, DropKind::Value);
}
}

/// Visit all of the primary bindings in a patterns, that is, visit the
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/check/generator_interior.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> {
self.expr_count += 1;

if let PatKind::Binding(..) = pat.kind {
let scope = self.region_scope_tree.var_scope(pat.hir_id.local_id);
let scope = self.region_scope_tree.var_scope(pat.hir_id.local_id).unwrap();
let ty = self.fcx.typeck_results.borrow().pat_ty(pat);
self.record(ty, pat.hir_id, Some(scope), None, pat.span, false);
}
Expand Down
7 changes: 7 additions & 0 deletions src/test/ui/mir/issue-92893.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
struct Bug<A = [(); (let a = (), 1).1]> {
//~^ `let` expressions are not supported here
//~^^ `let` expressions in this position are unstable [E0658]
a: A
}

fn main() {}
20 changes: 20 additions & 0 deletions src/test/ui/mir/issue-92893.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error: `let` expressions are not supported here
--> $DIR/issue-92893.rs:1:22
|
LL | struct Bug<A = [(); (let a = (), 1).1]> {
| ^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions

error[E0658]: `let` expressions in this position are unstable
--> $DIR/issue-92893.rs:1:22
|
LL | struct Bug<A = [(); (let a = (), 1).1]> {
| ^^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub(super) fn check<'tcx>(
if let Some(indexed_extent) = indexed_extent {
let parent_def_id = cx.tcx.hir().get_parent_item(expr.hir_id);
let region_scope_tree = cx.tcx.region_scope_tree(parent_def_id);
let pat_extent = region_scope_tree.var_scope(pat.hir_id.local_id);
let pat_extent = region_scope_tree.var_scope(pat.hir_id.local_id).unwrap();
if region_scope_tree.is_subscope_of(indexed_extent, pat_extent) {
return;
}
Expand Down Expand Up @@ -262,7 +262,7 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
match res {
Res::Local(hir_id) => {
let parent_def_id = self.cx.tcx.hir().get_parent_item(expr.hir_id);
let extent = self.cx.tcx.region_scope_tree(parent_def_id).var_scope(hir_id.local_id);
let extent = self.cx.tcx.region_scope_tree(parent_def_id).var_scope(hir_id.local_id).unwrap();
if index_used_directly {
self.indexed_directly.insert(
seqvar.segments[0].ident.name,
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_lints/src/shadow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ impl<'tcx> LateLintPass<'tcx> for Shadow {

fn is_shadow(cx: &LateContext<'_>, owner: LocalDefId, first: ItemLocalId, second: ItemLocalId) -> bool {
let scope_tree = cx.tcx.region_scope_tree(owner.to_def_id());
let first_scope = scope_tree.var_scope(first);
let second_scope = scope_tree.var_scope(second);
let first_scope = scope_tree.var_scope(first).unwrap();
let second_scope = scope_tree.var_scope(second).unwrap();
scope_tree.is_subscope_of(second_scope, first_scope)
}

Expand Down