Skip to content

Rollup of 8 pull requests #102234

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 26 commits into from
Sep 24, 2022
Merged
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a2cdbf8
Make code worling w/ pointers in `library/std/src/sys/sgx/abi/usercal…
WaffleLapkin Aug 20, 2022
495fa48
use `pointer::add` in memchr impl
WaffleLapkin Aug 20, 2022
31b7181
Replace `offset` with `add` in `fmt/num.rs` & remove some casts
WaffleLapkin Aug 20, 2022
3e6c9e5
Fix wrongly refactored Lift impl
oli-obk Sep 21, 2022
5be901a
effective visibility: Add test for a reexport of two names
petrochenkov Sep 21, 2022
4ddff03
resolve: Set effective visibilities for imports more precisely
petrochenkov Sep 22, 2022
98a3230
Apply changes proposed in the review
WaffleLapkin Sep 22, 2022
0b2f717
Added const_closure
onestacked Sep 23, 2022
8e0ea60
Constifed Try trait
onestacked Sep 23, 2022
53049f7
Fixed Doc-Tests
onestacked Sep 23, 2022
6267c60
Added some spacing in const closure
onestacked Sep 23, 2022
8b0feb8
rustdoc: remove no-op mobile CSS `#source-sidebar { z-index: 11 }`
notriddle Sep 23, 2022
f570d31
rustdoc: remove no-op CSS rule `#source-sidebar { z-index: 1 }`
notriddle Sep 23, 2022
d78bc41
Remove unused `ConstFn(Once)Closure` structs.
onestacked Sep 23, 2022
a74eba4
Make `ManuallyDrop` satisfy `~const Destruct`
fee1-dead Sep 23, 2022
84666af
Constify Residual behind const_try
onestacked Sep 23, 2022
ac06d9c
diagnostics: avoid syntactically invalid suggestion in if conditionals
notriddle Sep 23, 2022
5f77ce0
bootstrap/miri: switch to non-deprecated env var for setting the sysr…
RalfJung Sep 24, 2022
1b1596c
Rollup merge of #100823 - WaffleLapkin:less_offsets, r=scottmcm
matthiaskrgr Sep 24, 2022
bf167e0
Rollup merge of #102088 - oli-obk:cleanups, r=bjorn3
matthiaskrgr Sep 24, 2022
eb628e8
Rollup merge of #102109 - petrochenkov:addids, r=oli-obk
matthiaskrgr Sep 24, 2022
455a20b
Rollup merge of #102186 - ink-feather-org:const_try_trait, r=fee1-dead
matthiaskrgr Sep 24, 2022
1c4a85f
Rollup merge of #102203 - notriddle:notriddle/source-sidebar, r=Guill…
matthiaskrgr Sep 24, 2022
5fb41a6
Rollup merge of #102204 - fee1-dead-contrib:manually-drop-trivially-d…
matthiaskrgr Sep 24, 2022
81eb35f
Rollup merge of #102210 - notriddle:notriddle/did-you-mean, r=cjgillot
matthiaskrgr Sep 24, 2022
6900638
Rollup merge of #102226 - RalfJung:miri-sysroot-build, r=oli-obk
matthiaskrgr Sep 24, 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
10 changes: 10 additions & 0 deletions compiler/rustc_typeck/src/check/demand.rs
Original file line number Diff line number Diff line change
@@ -417,6 +417,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
hir::def::CtorKind::Const => unreachable!(),
};

// Suggest constructor as deep into the block tree as possible.
// This fixes https://github.com/rust-lang/rust/issues/101065,
// and also just helps make the most minimal suggestions.
let mut expr = expr;
while let hir::ExprKind::Block(block, _) = &expr.kind
&& let Some(expr_) = &block.expr
{
expr = expr_
}

vec![
(expr.span.shrink_to_lo(), format!("{prefix}{variant}{open}")),
(expr.span.shrink_to_hi(), close.to_owned()),
14 changes: 14 additions & 0 deletions src/test/ui/suggestions/issue-101065.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// check-fail
// run-rustfix

enum FakeResult<T> {
Ok(T)
}

fn main() {
let _x = if true {
FakeResult::Ok(FakeResult::Ok(()))
} else {
FakeResult::Ok(FakeResult::Ok(())) //~ERROR E0308
};
}
14 changes: 14 additions & 0 deletions src/test/ui/suggestions/issue-101065.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// check-fail
// run-rustfix

enum FakeResult<T> {
Ok(T)
}

fn main() {
let _x = if true {
FakeResult::Ok(FakeResult::Ok(()))
} else {
FakeResult::Ok(()) //~ERROR E0308
};
}
23 changes: 23 additions & 0 deletions src/test/ui/suggestions/issue-101065.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
error[E0308]: `if` and `else` have incompatible types
--> $DIR/issue-101065.rs:12:9
|
LL | let _x = if true {
| ______________-
LL | | FakeResult::Ok(FakeResult::Ok(()))
| | ---------------------------------- expected because of this
LL | | } else {
LL | | FakeResult::Ok(())
| | ^^^^^^^^^^^^^^^^^^ expected enum `FakeResult`, found `()`
LL | | };
| |_____- `if` and `else` have incompatible types
|
= note: expected enum `FakeResult<FakeResult<()>>`
found enum `FakeResult<()>`
help: try wrapping the expression in `FakeResult::Ok`
|
LL | FakeResult::Ok(FakeResult::Ok(()))
| +++++++++++++++ +

error: aborting due to previous error

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