Skip to content
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

Rollup of 5 pull requests #72073

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
88 changes: 32 additions & 56 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,9 @@ version = "0.1.0"

[[package]]
name = "cc"
version = "1.0.50"
version = "1.0.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"
checksum = "c3d87b23d6a92cd03af510a5ade527033f6aa6fa92161e2d5863a907d4c5e31d"
dependencies = [
"jobserver",
]
Expand Down Expand Up @@ -938,13 +938,13 @@ checksum = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69"

[[package]]
name = "derive-new"
version = "0.5.6"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ca414e896ae072546f4d789f452daaecf60ddee4c9df5dc6d5936d769e3d87c"
checksum = "71f31892cd5c62e414316f2963c5689242c43d8e7bbcaaeca97e5e28c95d91d9"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.12",
"syn 0.15.35",
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
]

[[package]]
Expand Down Expand Up @@ -1145,14 +1145,14 @@ dependencies = [

[[package]]
name = "failure_derive"
version = "0.1.5"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"
checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.12",
"syn 0.15.35",
"synstructure 0.10.2",
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"synstructure",
]

[[package]]
Expand Down Expand Up @@ -1405,30 +1405,18 @@ dependencies = [

[[package]]
name = "handlebars"
version = "2.0.1"
version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df044dd42cdb7e32f28557b661406fc0f2494be75199779998810dbc35030e0d"
checksum = "ba758d094d31274eb49d15da6f326b96bf3185239a6359bf684f3d5321148900"
dependencies = [
"hashbrown 0.5.0",
"lazy_static 1.4.0",
"log",
"pest",
"pest_derive",
"quick-error",
"regex",
"serde",
"serde_json",
]

[[package]]
name = "hashbrown"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1de41fb8dba9714efd92241565cdff73f78508c95697dd56787d3cba27e2353"
dependencies = [
"serde",
]

[[package]]
name = "hashbrown"
version = "0.6.2"
Expand Down Expand Up @@ -2055,9 +2043,9 @@ dependencies = [

[[package]]
name = "mdbook"
version = "0.3.5"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "031bdd9d4893c983e2f69ebc4b59070feee8276a584c4aabdcb351235ea28016"
checksum = "e7ec525f7ebccc2dd935c263717250cd37f9a4b264a77c5dbc950ea2734d8159"
dependencies = [
"ammonia",
"chrono",
Expand Down Expand Up @@ -2557,15 +2545,15 @@ dependencies = [

[[package]]
name = "pest_generator"
version = "2.1.0"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63120576c4efd69615b5537d3d052257328a4ca82876771d6944424ccfd9f646"
checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55"
dependencies = [
"pest",
"pest_meta",
"proc-macro2 0.4.30",
"quote 0.6.12",
"syn 0.15.35",
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
]

[[package]]
Expand Down Expand Up @@ -2785,9 +2773,9 @@ checksum = "6ddd112cca70a4d30883b2d21568a1d376ff8be4758649f64f973c6845128ad3"

[[package]]
name = "quick-error"
version = "1.2.2"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"

[[package]]
name = "quine-mc_cluskey"
Expand Down Expand Up @@ -3449,7 +3437,7 @@ dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"synstructure 0.12.1",
"synstructure",
]

[[package]]
Expand Down Expand Up @@ -4059,7 +4047,7 @@ dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"synstructure 0.12.1",
"synstructure",
]

[[package]]
Expand Down Expand Up @@ -4630,13 +4618,13 @@ dependencies = [

[[package]]
name = "serde_derive"
version = "1.0.81"
version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "477b13b646f5b5b56fc95bedfc3b550d12141ce84f466f6c44b9a17589923885"
checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.12",
"syn 0.15.35",
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
]

[[package]]
Expand Down Expand Up @@ -4800,7 +4788,7 @@ dependencies = [
"core",
"dlmalloc",
"fortanix-sgx-abi",
"hashbrown 0.6.2",
"hashbrown",
"hermit-abi",
"libc",
"panic_abort",
Expand Down Expand Up @@ -4932,18 +4920,6 @@ dependencies = [
"unicode-xid 0.2.0",
]

[[package]]
name = "synstructure"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.12",
"syn 0.15.35",
"unicode-xid 0.1.0",
]

[[package]]
name = "synstructure"
version = "0.12.1"
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_error_codes/error_codes/E0569.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
If an impl has a generic parameter with the `#[may_dangle]` attribute, then
that impl must be declared as an `unsafe impl.
that impl must be declared as an `unsafe impl`.

Erroneous code example:

Expand Down
13 changes: 7 additions & 6 deletions src/librustc_mir/dataflow/move_paths/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,17 +361,18 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
fn gather_terminator(&mut self, term: &Terminator<'tcx>) {
match term.kind {
TerminatorKind::Goto { target: _ }
| TerminatorKind::FalseEdges { .. }
| TerminatorKind::FalseUnwind { .. }
// In some sense returning moves the return place into the current
// call's destination, however, since there are no statements after
// this that could possibly access the return place, this doesn't
// need recording.
| TerminatorKind::Return
| TerminatorKind::Resume
| TerminatorKind::Abort
| TerminatorKind::GeneratorDrop
| TerminatorKind::FalseEdges { .. }
| TerminatorKind::FalseUnwind { .. }
| TerminatorKind::Unreachable => {}

TerminatorKind::Return => {
self.gather_move(Place::return_place());
}

TerminatorKind::Assert { ref cond, .. } => {
self.gather_operand(cond);
}
Expand Down
46 changes: 11 additions & 35 deletions src/librustc_mir/util/elaborate_drops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ where
.patch_terminator(bb, TerminatorKind::Goto { target: self.succ });
}
DropStyle::Static => {
let loc = self.terminator_loc(bb);
self.elaborator.clear_drop_flag(loc, self.path, DropFlagMode::Deep);
self.elaborator.patch().patch_terminator(
bb,
TerminatorKind::Drop {
Expand All @@ -175,9 +173,7 @@ where
);
}
DropStyle::Conditional => {
let unwind = self.unwind; // FIXME(#43234)
let succ = self.succ;
let drop_bb = self.complete_drop(Some(DropFlagMode::Deep), succ, unwind);
let drop_bb = self.complete_drop(self.succ, self.unwind);
self.elaborator
.patch()
.patch_terminator(bb, TerminatorKind::Goto { target: drop_bb });
Expand Down Expand Up @@ -249,7 +245,7 @@ where
// our own drop flag.
path: self.path,
}
.complete_drop(None, succ, unwind)
.complete_drop(succ, unwind)
}
}

Expand Down Expand Up @@ -278,13 +274,7 @@ where
// Clear the "master" drop flag at the end. This is needed
// because the "master" drop protects the ADT's discriminant,
// which is invalidated after the ADT is dropped.
let (succ, unwind) = (self.succ, self.unwind); // FIXME(#43234)
(
self.drop_flag_reset_block(DropFlagMode::Shallow, succ, unwind),
unwind.map(|unwind| {
self.drop_flag_reset_block(DropFlagMode::Shallow, unwind, Unwind::InCleanup)
}),
)
(self.drop_flag_reset_block(DropFlagMode::Shallow, self.succ, self.unwind), self.unwind)
}

/// Creates a full drop ladder, consisting of 2 connected half-drop-ladders
Expand Down Expand Up @@ -820,11 +810,7 @@ where
self.open_drop_for_adt(def, substs)
}
}
ty::Dynamic(..) => {
let unwind = self.unwind; // FIXME(#43234)
let succ = self.succ;
self.complete_drop(Some(DropFlagMode::Deep), succ, unwind)
}
ty::Dynamic(..) => self.complete_drop(self.succ, self.unwind),
ty::Array(ety, size) => {
let size = size.try_eval_usize(self.tcx(), self.elaborator.param_env());
self.open_drop_for_array(ety, size)
Expand All @@ -835,20 +821,10 @@ where
}
}

fn complete_drop(
&mut self,
drop_mode: Option<DropFlagMode>,
succ: BasicBlock,
unwind: Unwind,
) -> BasicBlock {
debug!("complete_drop({:?},{:?})", self, drop_mode);
fn complete_drop(&mut self, succ: BasicBlock, unwind: Unwind) -> BasicBlock {
debug!("complete_drop(succ={:?}, unwind={:?})", succ, unwind);

let drop_block = self.drop_block(succ, unwind);
let drop_block = if let Some(mode) = drop_mode {
self.drop_flag_reset_block(mode, drop_block, unwind)
} else {
drop_block
};

self.drop_flag_test_block(drop_block, succ, unwind)
}
Expand All @@ -861,6 +837,11 @@ where
) -> BasicBlock {
debug!("drop_flag_reset_block({:?},{:?})", self, mode);

if unwind.is_cleanup() {
// The drop flag isn't read again on the unwind path, so don't
// bother setting it.
return succ;
}
let block = self.new_block(unwind, TerminatorKind::Goto { target: succ });
let block_start = Location { block, statement_index: 0 };
self.elaborator.clear_drop_flag(block_start, self.path, mode);
Expand Down Expand Up @@ -969,11 +950,6 @@ where
self.elaborator.patch().new_temp(ty, self.source_info.span)
}

fn terminator_loc(&mut self, bb: BasicBlock) -> Location {
let body = self.elaborator.body();
self.elaborator.patch().terminator_loc(body, bb)
}

fn constant_usize(&self, val: u16) -> Operand<'tcx> {
Operand::Constant(box Constant {
span: self.source_info.span,
Expand Down
11 changes: 8 additions & 3 deletions src/librustc_mir/util/graphviz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,17 @@ where
write!(w, r#"<table border="0" cellborder="1" cellspacing="0">"#)?;

// Basic block number at the top.
let (blk, color) = if data.is_cleanup {
(format!("{} (cleanup)", block.index()), "lightblue")
} else {
(format!("{}", block.index()), "gray")
};
write!(
w,
r#"<tr><td {attrs} colspan="{colspan}">{blk}</td></tr>"#,
attrs = r#"bgcolor="gray" align="center""#,
r#"<tr><td bgcolor="{color}" align="center" colspan="{colspan}">{blk}</td></tr>"#,
colspan = num_cols,
blk = block.index()
blk = blk,
color = color
)?;

init(w)?;
Expand Down
18 changes: 10 additions & 8 deletions src/librustc_mir_build/build/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
self.in_opt_scope(opt_destruction_scope.map(|de| (de, source_info)), move |this| {
this.in_scope((region_scope, source_info), LintLevel::Inherited, move |this| {
if targeted_by_break {
// This is a `break`-able block
let exit_block = this.cfg.start_new_block();
let block_exit =
this.in_breakable_scope(None, exit_block, destination, |this| {
this.ast_block_stmts(destination, block, span, stmts, expr, safety_mode)
});
this.cfg.goto(unpack!(block_exit), source_info, exit_block);
exit_block.unit()
this.in_breakable_scope(None, destination, span, |this| {
Some(this.ast_block_stmts(
destination,
block,
span,
stmts,
expr,
safety_mode,
))
})
} else {
this.ast_block_stmts(destination, block, span, stmts, expr, safety_mode)
}
Expand Down
Loading