Skip to content

Rollup of 10 pull requests #67721

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

Merged
merged 29 commits into from
Dec 30, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
65e3660
docs: Iterator adapters have unspecified results after a panic
Mark-Simulacrum Dec 23, 2019
f6faf0b
Clean up const-hack from #63810
jumbatm Dec 27, 2019
8c49486
Clean up const-hack from #63786
jumbatm Dec 27, 2019
282635f
Clean up const-hack from #61635
jumbatm Dec 27, 2019
91c2f78
Clean up const-hack from #58044
jumbatm Dec 27, 2019
e3155ab
Stabilize attribute macros on inline modules
petrochenkov Sep 7, 2019
a0d8b79
resolve: Minor cleanup of duplicate macro reexports
petrochenkov Dec 28, 2019
5e1b366
Do not ICE on lifetime error involving closures
estebank Dec 28, 2019
bc1b2d5
Some keyword documentation.
gilescope Dec 25, 2019
2e7dbb4
Move reachable.rs to librustc_passes.
cjgillot Dec 26, 2019
4922310
Move reachable_set query in librustc_passes.
cjgillot Dec 26, 2019
2a14d16
Move diagnostic_items.rs to librustc_passes.
cjgillot Dec 26, 2019
fd4d50d
Move diagnostic_items queries to librustc_passes.
cjgillot Dec 26, 2019
5b80a99
tidy: Enforce formatting rather than just check it if `--bless` is sp…
petrochenkov Dec 29, 2019
ec3a9f6
Move lib_features.rs in librustc_passes.
cjgillot Dec 27, 2019
5768162
Move get_lib_features query in librustc_passes.
cjgillot Dec 27, 2019
f5c63e7
Introduce librustc/middle/mod.rs
cjgillot Dec 29, 2019
c4b6de2
note other end-point when typeck range pats
Centril Dec 13, 2019
e4c0edd
Typo fix
petertodd Dec 30, 2019
f0309f5
Rollup merge of #64273 - petrochenkov:stabattrmod, r=Centril
JohnTitor Dec 30, 2019
2c46dd1
Rollup merge of #67287 - Centril:mismatch-range-improve-diag, r=estebank
JohnTitor Dec 30, 2019
97a7b03
Rollup merge of #67564 - Mark-Simulacrum:iter-adapter-panic, r=LukasK…
JohnTitor Dec 30, 2019
0eb19dc
Rollup merge of #67622 - gilescope:async-keyword-doc, r=Centril
JohnTitor Dec 30, 2019
047a4bb
Rollup merge of #67657 - jumbatm:cleanup-const-hack, r=oli-obk
JohnTitor Dec 30, 2019
f70847a
Rollup merge of #67677 - petrochenkov:dupexp, r=Centril
JohnTitor Dec 30, 2019
3928ace
Rollup merge of #67687 - estebank:issue-67634, r=matthewjasper
JohnTitor Dec 30, 2019
88e322c
Rollup merge of #67698 - cjgillot:passes-first, r=Zoxc
JohnTitor Dec 30, 2019
b6244af
Rollup merge of #67701 - petrochenkov:tidybless, r=Mark-Simulacrum
JohnTitor Dec 30, 2019
dcc30ac
Rollup merge of #67715 - petertodd:2019-typo-manuallydrop, r=Centril
JohnTitor Dec 30, 2019
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
22 changes: 20 additions & 2 deletions src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -882,9 +882,27 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
err.span_label(
drop_span,
format!(
"...but `{}` will be dropped here, when the function `{}` returns",
"...but `{}` will be dropped here, when the {} returns",
name,
self.infcx.tcx.hir().name(fn_hir_id),
self.infcx
.tcx
.hir()
.opt_name(fn_hir_id)
.map(|name| format!("function `{}`", name))
.unwrap_or_else(|| {
match &self
.infcx
.tcx
.typeck_tables_of(self.mir_def_id)
.node_type(fn_hir_id)
.kind
{
ty::Closure(..) => "enclosing closure",
ty::Generator(..) => "enclosing generator",
kind => bug!("expected closure or generator, found {:?}", kind),
}
.to_string()
})
),
);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
[0].iter().flat_map(|a| [0].iter().map(|_| &a)); //~ ERROR `a` does not live long enough
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error[E0597]: `a` does not live long enough
--> $DIR/unnamed-closure-doesnt-life-long-enough-issue-67634.rs:2:49
|
LL | [0].iter().flat_map(|a| [0].iter().map(|_| &a));
| - ^- ...but `a` will be dropped here, when the enclosing closure returns
| | |
| | `a` would have to be valid for `'_`...
| has type `&i32`
|
= note: functions cannot return a borrow to data owned within the function's scope, functions can only return borrows to data passed as arguments
= note: to learn more, visit <https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#dangling-references>

error: aborting due to previous error

For more information about this error, try `rustc --explain E0597`.