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 8 pull requests #95666

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
76756cc
bootstrap.py: nixos check in /etc/os-release with quotes
ben0x539 Mar 23, 2022
064a559
Fix `x doc --stage 0 compiler`
jyn514 Mar 29, 2022
bf2c3b0
Fix ICE in rustdoc intra doc links when trying to get traits in scope…
GuillaumeGomez Apr 4, 2022
50cc0fa
Add test to ensure rustdoc does not panic on intra doc link pass
GuillaumeGomez Apr 4, 2022
6ece80f
diagnostics: use correct span for const generics
notriddle Apr 4, 2022
92246c0
Rely on #[link] attribute for unwind on Fuchsia.
anp Apr 4, 2022
ccb704c
Update panic docs to make it clearer when to use panic vs Result
yaahc Apr 4, 2022
0d2a000
Suggest derivable trait on E0277
ohno418 Mar 31, 2022
0ff2f58
Suggest only when Rhs for PartialEq and PartialOrd is the same type a…
ohno418 Apr 1, 2022
a8877cf
Handle reporting invariance of fn pointer
compiler-errors Apr 2, 2022
de23782
Suggest only when all fields impl the trait
ohno418 Apr 3, 2022
2a129d4
Format invariance notes with backticks
compiler-errors Apr 2, 2022
c5c66a6
Rollup merge of #95234 - ben0x539:nixquotes, r=Dylan-DPC
Dylan-DPC Apr 5, 2022
27fb711
Rollup merge of #95449 - jyn514:doc-stage-0, r=ehuss
Dylan-DPC Apr 5, 2022
c95357a
Rollup merge of #95525 - ohno418:suggest-derivable-trait-E0277, r=com…
Dylan-DPC Apr 5, 2022
78395bb
Rollup merge of #95607 - compiler-errors:issue-95272, r=Aaron1011
Dylan-DPC Apr 5, 2022
bec8741
Rollup merge of #95645 - GuillaumeGomez:intra-doc-link-ice-traits-in-…
Dylan-DPC Apr 5, 2022
6d09ee0
Rollup merge of #95654 - notriddle:notriddle/issue-95616, r=davidtwco
Dylan-DPC Apr 5, 2022
1aa4d58
Rollup merge of #95659 - anp:remove-link-print, r=tmandry
Dylan-DPC Apr 5, 2022
87836c5
Rollup merge of #95660 - yaahc:panic-docs-update, r=Dylan-DPC
Dylan-DPC Apr 5, 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
Handle reporting invariance of fn pointer
compiler-errors committed Apr 5, 2022
commit a8877cf73823351cee2a871bd5387628054fabea
11 changes: 11 additions & 0 deletions compiler/rustc_borrowck/src/diagnostics/region_errors.rs
Original file line number Diff line number Diff line change
@@ -358,6 +358,17 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
);
(desc, note)
}
ty::FnDef(def_id, _) => {
let name = self.infcx.tcx.item_name(*def_id);
let identity_substs =
InternalSubsts::identity_for_item(self.infcx.tcx, *def_id);
let desc = format!("a function pointer to `{name}`");
let note = format!(
"the function `{name}` is invariant over the parameter `{}`",
identity_substs[param_index as usize]
);
(desc, note)
}
_ => panic!("Unexpected type {:?}", ty),
};
diag.note(&format!("requirement occurs because of {desc}",));
17 changes: 17 additions & 0 deletions src/test/ui/nll/issue-95272.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#![feature(nll)]

use std::cell::Cell;

fn check<'a, 'b>(x: Cell<&'a ()>, y: Cell<&'b ()>)
where
'a: 'b,
{
}

fn test<'a, 'b>(x: Cell<&'a ()>, y: Cell<&'b ()>) {
let f = check;
//~^ ERROR lifetime may not live long enough
f(x, y);
}

fn main() {}
17 changes: 17 additions & 0 deletions src/test/ui/nll/issue-95272.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
error: lifetime may not live long enough
--> $DIR/issue-95272.rs:12:13
|
LL | fn test<'a, 'b>(x: Cell<&'a ()>, y: Cell<&'b ()>) {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | let f = check;
| ^^^^^ assignment requires that `'a` must outlive `'b`
|
= help: consider adding the following bound: `'a: 'b`
= note: requirement occurs because of a function pointer to `check`
= note: the function `check` is invariant over the parameter `'a`
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance

error: aborting due to previous error