Skip to content

Rollup of 6 pull requests #117249

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 24 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6c97f13
Invalid `?` suggestion on mismatched `Ok(T)`
eopb Oct 20, 2023
24cdb27
let_chainify `suggest_coercing_result_via_try_operator`
eopb Oct 22, 2023
8716890
Enable cg_clif tests for riscv64gc
bjorn3 Oct 21, 2023
c1bfd46
When expecting closure argument but finding block provide suggestion
estebank Oct 23, 2023
f0a2635
Redo `stringify.rs` test.
nnethercote Oct 19, 2023
2e2e780
Augment `stringify.rs` test.
nnethercote Oct 19, 2023
c1800fb
Augment `stringify.rs` test some more.
nnethercote Oct 24, 2023
173dcb2
Touch up syn parsing in symbols macro
dtolnay Oct 25, 2023
ba17934
Represent symbol value as enum to prepare for supporting env vars
dtolnay Oct 25, 2023
95742ff
Add a Parse impl for symbol Value
dtolnay Oct 25, 2023
8dea49a
Delete counter from symbols proc macro in favor of hashmap as source …
dtolnay Oct 25, 2023
726a43c
Move symbols macro map into a struct
dtolnay Oct 25, 2023
65f0253
Support environment variable for interned Symbol value
dtolnay Oct 25, 2023
1078250
Continue generating other symbols if an expr is not supported
dtolnay Oct 25, 2023
5563a9b
Improve span of env-related errors
dtolnay Oct 25, 2023
ac4fa3f
Pre-intern a symbol for env!("CFG_RELEASE")
dtolnay Oct 25, 2023
c1552df
Fix symbols::tests::test_symbols
dtolnay Oct 25, 2023
94ecabf
Add comment to mem::replace to explain why it's not implemented via m…
chfogelman Oct 26, 2023
934cbe4
Rollup merge of #116968 - eopb:116967, r=petrochenkov
matthiaskrgr Oct 26, 2023
596369f
Rollup merge of #117032 - bjorn3:riscv64_enable_cg_clif_tests, r=petr…
matthiaskrgr Oct 26, 2023
d09c988
Rollup merge of #117106 - estebank:issue-27300, r=petrochenkov
matthiaskrgr Oct 26, 2023
a8f7acd
Rollup merge of #117114 - nnethercote:improve-stringify-test, r=petro…
matthiaskrgr Oct 26, 2023
2656c98
Rollup merge of #117188 - dtolnay:symbolenv, r=cjgillot
matthiaskrgr Oct 26, 2023
c0b1c1a
Rollup merge of #117243 - chfogelman:replace-not-swap-comment, r=thomcc
matthiaskrgr Oct 26, 2023
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
Next Next commit
Invalid ? suggestion on mismatched Ok(T)
  • Loading branch information
eopb committed Oct 20, 2023
commit 6c97f136126557a982990a1d0ef879996b268cba
5 changes: 5 additions & 0 deletions compiler/rustc_hir_typeck/src/demand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} else {
return false;
}
let e_ok = args_e.type_at(0);
let f_ok = args_f.type_at(0);
if !self.infcx.can_eq(self.param_env, f_ok, e_ok) {
return false;
}
let e = args_e.type_at(1);
let f = args_f.type_at(1);
if self
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fn foo() -> Result<String, ()> {
let out: Result<(), ()> = Ok(());
out //~ ERROR mismatched types
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error[E0308]: mismatched types
--> $DIR/issue-116967-cannot-coerce-returned-result.rs:3:5
|
LL | fn foo() -> Result<String, ()> {
| ------------------ expected `Result<String, ()>` because of return type
LL | let out: Result<(), ()> = Ok(());
LL | out
| ^^^ expected `Result<String, ()>`, found `Result<(), ()>`
|
= note: expected enum `Result<String, _>`
found enum `Result<(), _>`

error: aborting due to previous error

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