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 #70451

Merged
merged 28 commits into from
Mar 27, 2020
Merged
Changes from 2 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ff65bff
Fix cycle error when emitting suggestion for mismatched `fn` type
Aaron1011 Mar 11, 2020
ef2957d
allowing getting &mut OsStr from OsString
TyPR124 Mar 16, 2020
21975a1
add comments about safety
TyPR124 Mar 16, 2020
cce8ee8
remove #[inline] for consistency in windows/os_str
TyPR124 Mar 16, 2020
16712ed
corrections on safety comments
TyPR124 Mar 16, 2020
e4a65e8
make safety comments more explicit
TyPR124 Mar 16, 2020
45416cd
add comment about maintaining OsStr encoding
TyPR124 Mar 20, 2020
f07802c
decouple rustc_hir::print from crate
Centril Mar 23, 2020
b60d732
rustc_hir: nix rustc_errors dep
Centril Mar 23, 2020
b3866a5
move rustc_hir::print -> rustc_hir_pretty
Centril Mar 23, 2020
92885e3
rustc_typeck: remove rustc_hir_pretty usage
Centril Mar 23, 2020
f1701dd
rustc: remove rustc_hir_pretty dependency.
Centril Mar 24, 2020
b514c42
trait_bound_spans -> sized_trait_bound_spans
Centril Mar 26, 2020
b2f7a95
rustc_hir_pretty: bump recursion_limit
Centril Mar 26, 2020
40a0fdc
Add regression test for #66706
Alexendoo Mar 26, 2020
15346ed
Remove `BitDenotation` framework
ecstatic-morse Feb 29, 2020
9978afb
Move `MoveDataParamEnv` to beginning of module
ecstatic-morse Feb 29, 2020
bae1114
Rename `dataflow::generic` to `dataflow::framework`
ecstatic-morse Feb 29, 2020
93ce5ff
Update use statements in `dataflow/mod.rs`
ecstatic-morse Feb 29, 2020
a8cc89f
Update imports from `dataflow::generic` to `dataflow`
ecstatic-morse Feb 29, 2020
7108cea
Move `BottomValue` into `framework/mod.rs`
ecstatic-morse Mar 2, 2020
fe0e7c3
Update `framework` module docs
ecstatic-morse Mar 2, 2020
89d6009
Make `framework` a private module
ecstatic-morse Mar 2, 2020
0f6144a
Rollup merge of #69644 - ecstatic-morse:unified-dataflow-cleanup, r=e…
Dylan-DPC Mar 27, 2020
f635c37
Rollup merge of #69936 - Aaron1011:fix/suggestion-cycle, r=varkor
Dylan-DPC Mar 27, 2020
c0369c4
Rollup merge of #70048 - TyPR124:mutable_osstr, r=dtolnay
Dylan-DPC Mar 27, 2020
7041efc
Rollup merge of #70344 - Centril:hir-pretty, r=eddyb
Dylan-DPC Mar 27, 2020
fa15774
Rollup merge of #70435 - Alexendoo:test-66706, r=Centril
Dylan-DPC Mar 27, 2020
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
26 changes: 4 additions & 22 deletions src/librustc_typeck/check/op.rs
Original file line number Diff line number Diff line change
@@ -492,36 +492,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
err.span_label(span, ty.to_string());
if let FnDef(def_id, _) = ty.kind {
let source_map = self.tcx.sess.source_map();
let hir_id = match self.tcx.hir().as_local_hir_id(def_id) {
Some(hir_id) => hir_id,
None => return false,
};
if !self.tcx.has_typeck_tables(def_id) {
return false;
}
let fn_sig = {
match self.tcx.typeck_tables_of(def_id).liberated_fn_sigs().get(hir_id) {
Some(f) => *f,
None => {
bug!("No fn-sig entry for def_id={:?}", def_id);
}
}
};
// We're emitting a suggestion, so we can just ignore regions
let fn_sig = *self.tcx.fn_sig(def_id).skip_binder();

let other_ty = if let FnDef(def_id, _) = other_ty.kind {
let hir_id = match self.tcx.hir().as_local_hir_id(def_id) {
Some(hir_id) => hir_id,
None => return false,
};
if !self.tcx.has_typeck_tables(def_id) {
return false;
}
match self.tcx.typeck_tables_of(def_id).liberated_fn_sigs().get(hir_id) {
Some(f) => f.clone().output(),
None => {
bug!("No fn-sig entry for def_id={:?}", def_id);
}
}
// We're emitting a suggestion, so we can just ignore regions
self.tcx.fn_sig(def_id).skip_binder().output()
} else {
other_ty
};
16 changes: 16 additions & 0 deletions src/test/ui/issues/issue-66667-function-cmp-cycle.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
fn first() {
second == 1 //~ ERROR binary operation
//~^ ERROR mismatched types
}

fn second() {
first == 1 //~ ERROR binary operation
//~^ ERROR mismatched types
}

fn bar() {
bar == 1 //~ ERROR binary operation
//~^ ERROR mismatched types
}

fn main() {}
55 changes: 55 additions & 0 deletions src/test/ui/issues/issue-66667-function-cmp-cycle.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
error[E0369]: binary operation `==` cannot be applied to type `fn() {second}`
--> $DIR/issue-66667-function-cmp-cycle.rs:2:12
|
LL | second == 1
| ------ ^^ - {integer}
| |
| fn() {second}

error[E0308]: mismatched types
--> $DIR/issue-66667-function-cmp-cycle.rs:2:15
|
LL | second == 1
| ^ expected fn item, found integer
|
= note: expected fn item `fn() {second}`
found type `{integer}`

error[E0369]: binary operation `==` cannot be applied to type `fn() {first}`
--> $DIR/issue-66667-function-cmp-cycle.rs:7:11
|
LL | first == 1
| ----- ^^ - {integer}
| |
| fn() {first}

error[E0308]: mismatched types
--> $DIR/issue-66667-function-cmp-cycle.rs:7:14
|
LL | first == 1
| ^ expected fn item, found integer
|
= note: expected fn item `fn() {first}`
found type `{integer}`

error[E0369]: binary operation `==` cannot be applied to type `fn() {bar}`
--> $DIR/issue-66667-function-cmp-cycle.rs:12:9
|
LL | bar == 1
| --- ^^ - {integer}
| |
| fn() {bar}

error[E0308]: mismatched types
--> $DIR/issue-66667-function-cmp-cycle.rs:12:12
|
LL | bar == 1
| ^ expected fn item, found integer
|
= note: expected fn item `fn() {bar}`
found type `{integer}`

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0308, E0369.
For more information about an error, try `rustc --explain E0308`.