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 10 pull requests #89572

Merged
merged 26 commits into from
Oct 6, 2021
Merged
Changes from 3 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
734209e
Normalize assoc types when checking ret ty of main
ThePuzzlemaker Sep 6, 2021
33a2825
Clean up the fix a bit
ThePuzzlemaker Sep 7, 2021
f1c8acc
Use `libc::sigaction()` instead of `sys::signal()` to prevent a deadlock
FabianWolff Sep 10, 2021
2bff77d
Fix suggestion for nested struct patterns
FabianWolff Sep 12, 2021
e3e5ae9
Clean up unneeded explicit pointer cast
dtolnay Sep 29, 2021
65ef265
Call `libc::sigaction()` only on Android
FabianWolff Oct 1, 2021
e3996ff
Fix Lower/UpperExp formatting for integers and precision zero
FabianWolff Oct 3, 2021
199b33f
Use a test value that doesn't depend on the handling of even/odd roun…
joshtriplett Oct 4, 2021
9cb30f4
Move generic error message to separate branches
JulianKnodt Sep 28, 2021
32a5abc
Make `proc_macro_derive_resolution_fallback` a future-breakage lint
Aaron1011 Oct 4, 2021
40fe064
Add a check for duplicated doc aliases in unused lint
GuillaumeGomez Oct 1, 2021
013aa37
Add test for duplicated doc aliases
GuillaumeGomez Oct 1, 2021
02c2a35
Discuss field-sensitivity and enums in context of `MaybeLiveLocals`
ecstatic-morse Oct 4, 2021
9f9f7f6
Ensure that `MaybeLiveLocals` works with simple sum-type assignments
ecstatic-morse Oct 4, 2021
c35a700
Make an initial guess for metadata size to reduce buffer resizes
joshtriplett Oct 5, 2021
4ec0377
for signed overflowing remainder, delay comparing lhs with MIN
tspiteri Oct 5, 2021
960e49e
Rollup merge of #88706 - ThePuzzlemaker:issue-88609, r=jackh726
Manishearth Oct 5, 2021
eb86098
Rollup merge of #88828 - FabianWolff:issue-88585, r=dtolnay
Manishearth Oct 5, 2021
60b9c5d
Rollup merge of #88871 - FabianWolff:issue-88403, r=jackh726
Manishearth Oct 5, 2021
0352a28
Rollup merge of #89317 - JulianKnodt:precise_errors, r=BoxyUwU
Manishearth Oct 5, 2021
e745e09
Rollup merge of #89351 - tspiteri:wrapping_rem, r=dtolnay
Manishearth Oct 5, 2021
80f1f0d
Rollup merge of #89442 - GuillaumeGomez:duplicated-doc-alias, r=estebank
Manishearth Oct 5, 2021
4e8c853
Rollup merge of #89502 - FabianWolff:issue-89493, r=joshtriplett
Manishearth Oct 5, 2021
048b0fd
Rollup merge of #89523 - Aaron1011:derive-future-compat, r=wesleywiser
Manishearth Oct 5, 2021
f71b3e2
Rollup merge of #89532 - ecstatic-morse:maybe-live-locals-enum, r=oli…
Manishearth Oct 5, 2021
5f8b161
Rollup merge of #89546 - joshtriplett:grow-metadata-faster, r=petroch…
Manishearth Oct 5, 2021
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: 21 additions & 1 deletion compiler/rustc_typeck/src/lib.rs
Original file line number Diff line number Diff line change
@@ -107,6 +107,7 @@ use rustc_middle::util;
use rustc_session::config::EntryFnType;
use rustc_span::{symbol::sym, Span, DUMMY_SP};
use rustc_target::spec::abi::Abi;
use rustc_trait_selection::infer::InferCtxtExt;
use rustc_trait_selection::traits::error_reporting::InferCtxtExt as _;
use rustc_trait_selection::traits::{
self, ObligationCause, ObligationCauseCode, TraitEngine, TraitEngineExt as _,
@@ -328,7 +329,26 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
ObligationCauseCode::MainFunctionType,
);
let mut fulfillment_cx = traits::FulfillmentContext::new();
fulfillment_cx.register_bound(&infcx, ty::ParamEnv::empty(), return_ty, term_id, cause);
// normalize any potential projections in the return type, then add
// any possible obligations to the fulfillment context.
// HACK(ThePuzzlemaker) this feels symptomatic of a problem within
// checking trait fulfillment, not this here. I'm not sure why it
// works in the example in `fn test()` given in #88609? This also
// probably isn't the best way to do this.
let InferOk { value: norm_return_ty, obligations } = infcx
.partially_normalize_associated_types_in(
cause.clone(),
ty::ParamEnv::empty(),
return_ty,
);
fulfillment_cx.register_predicate_obligations(&infcx, obligations);
fulfillment_cx.register_bound(
&infcx,
ty::ParamEnv::empty(),
norm_return_ty,
term_id,
cause,
);
if let Err(err) = fulfillment_cx.select_all_or_error(&infcx) {
infcx.report_fulfillment_errors(&err, None, false);
error = true;
19 changes: 19 additions & 0 deletions src/test/ui/typeck/issue-88609.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Regression test for #88609:
// The return type for `main` is not normalized while checking if it implements
// the trait `std::process::Termination`.

// build-pass

trait Same {
type Output;
}

impl<T> Same for T {
type Output = T;
}

type Unit = <() as Same>::Output;

fn main() -> Result<Unit, std::io::Error> {
unimplemented!()
}