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

Merged
merged 138 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
c6cc160
needless_borrows_for_generic_args: Fix for &mut
meithecatte Jun 5, 2024
37d8462
fix tests after rebase
Skgland Jul 4, 2024
26cdeed
bless tests
Skgland Jul 4, 2024
5f3a6e1
Remove unary neg from `clippy::precedence` lint
Urgau Feb 20, 2024
fceeb13
Add test for `try_err` lint within try blocks.
yaxum62 Jul 16, 2024
1821def
add expected output for try_err test
yaxum62 Jul 16, 2024
a5fd2c9
Remove duplicated peel_middle_ty_refs
tesuji Jul 17, 2024
58027e2
Fix [`redundant_slicing`] when the slice is behind a mutable reference
apoisternex Jul 18, 2024
266abf3
Avoid ref when using format!
nyurik Jul 19, 2024
bc8fc6b
Make restriction lint's use `span_lint_and_then` (i -> l)
xFrednet Jul 21, 2024
d17f113
Make restriction lint's use `span_lint_and_then` (m -> m)
xFrednet Jul 21, 2024
0cdf6e1
Fix while_let_on_iterator dropping loop label when applying fix.
jusexton Jul 23, 2024
e63061d
Apply review suggestion
meithecatte Jul 24, 2024
de1e163
get rid of unnecessary `res` field in `for_each_expr` visitors
y21 Jul 25, 2024
36214e9
Rollup merge of #121364 - Urgau:unary_precedence, r=compiler-errors
matthiaskrgr Jul 25, 2024
4e6851e
Merge commit '37f4fbb92913586b73a35772efd00eccd1cbbe13' into clippy-s…
flip1995 Jul 25, 2024
32dc02a
Add regression test for issue 13073
tesuji Jul 16, 2024
e53182a
Factor out check_closure function
tesuji Jul 16, 2024
0bc9f00
Check for 'static lifetime in return type
tesuji Jul 17, 2024
c7cfe7f
Auto merge of #13156 - y21:for_each_expr_visitor_refactor, r=xFrednet
bors Jul 25, 2024
dc49aa3
Support ?Trait bounds in supertraits and dyn Trait under a feature gate
Bryanskiy Feb 23, 2024
062b66d
Auto merge of #12892 - meithecatte:needless-borrows-mutrefs, r=xFrednet
bors Jul 25, 2024
e9852cc
Only apply dereference-removing special case for actual references
Kobzol Jul 12, 2024
533c377
Auto merge of #12473 - Kobzol:assigning-clones-deref, r=Alexendoo
bors Jul 25, 2024
95ee06c
Auto merge of #128193 - flip1995:clippy-subtree-update, r=matthiaskrgr
bors Jul 26, 2024
90c1963
Make restriction lint's use `span_lint_and_then` (n -> p)
xFrednet Jul 21, 2024
345c94c
Auto merge of #13144 - xFrednet:07797-restriction-and-then-what, r=y21
bors Jul 26, 2024
82b4434
Bump ui_test version -> 0.25
flip1995 Jul 26, 2024
8ca8ed9
chore: fix some comments
riyueguang Jul 26, 2024
10fb062
missing_trait_methods: lint methods in definition order
Alexendoo Jul 25, 2024
3504145
Auto merge of #13164 - flip1995:ui-test-bump, r=Alexendoo
bors Jul 26, 2024
b5fa6e2
Fix display of configs in clippy doc page
GuillaumeGomez Jul 26, 2024
84e36e6
Make `std_instead_of_core` somewhat MSRV aware
Alexendoo Jul 26, 2024
479491e
Auto merge of #13130 - nyurik:ref-lints, r=Centri3
bors Jul 26, 2024
6713631
Auto merge of #13165 - riyueguang:master, r=Jarcho
bors Jul 26, 2024
2acbd31
Auto merge of #121676 - Bryanskiy:polarity, r=petrochenkov
bors Jul 26, 2024
eb2fc42
Rollup merge of #124941 - Skgland:stabilize-const-int-from-str, r=dto…
tgross35 Jul 26, 2024
9964b4e
Add `BTreeSet` to set_contains_or_insert
nyurik Jul 5, 2024
1ec5025
Auto merge of #13168 - Alexendoo:std-instead-of-core-msrv, r=Manishearth
bors Jul 27, 2024
7de9c20
Make restriction lint's use `span_lint_and_then` (q -> s)
xFrednet Jul 22, 2024
4bf4c47
Make restriction lint's use `span_lint_and_then` (t -> w)
xFrednet Jul 22, 2024
92768ee
Auto merge of #13053 - nyurik:rename-set_contains_or_insert, r=llogiq
bors Jul 27, 2024
d20be39
Auto merge of #13149 - jusexton:issue-13123, r=dswij
bors Jul 27, 2024
236c8c7
Auto merge of #13159 - Alexendoo:missing-trait-methods-stable-order, …
bors Jul 27, 2024
0812732
stabilize `is_sorted`
slanterns Jul 27, 2024
a54e313
alphabetize the config fields
Jarcho Jul 27, 2024
84dc569
Add docs for `await_holding_invalid_types`
Jarcho Jul 27, 2024
7a25ead
Remove unneeded parens in config macro
Jarcho Jul 27, 2024
7422202
Add missing default values
Jarcho Jul 28, 2024
1d06ad5
Mark the lints for each config via an attribute instead of a doc comm…
Jarcho Jul 28, 2024
78a750e
Sort the config list using `dev fmt`
Jarcho Jul 28, 2024
668b659
Auto merge of #13166 - GuillaumeGomez:fix-clippy-doc, r=xFrednet
bors Jul 28, 2024
1a1c978
[`if_let_mutex`]: make the mutex check part of the expr visitor
y21 Jul 28, 2024
61dcf6c
inline a bunch of `if let`s into a single let chain
y21 Jul 28, 2024
5faea65
step cfg(bootstrap)
Mark-Simulacrum Jul 23, 2024
38a3462
Fix fix under loop may dropping loop label when applying fix.
shenyifu Jul 29, 2024
f7db895
Auto merge of #13176 - shenyifu:master, r=Manishearth
bors Jul 29, 2024
3b64ca9
Auto merge of #13173 - Jarcho:conf_order, r=xFrednet
bors Jul 29, 2024
712e8f4
Fix broken list for lints config
GuillaumeGomez Jul 29, 2024
957a301
Clean up clippy lints page JS source code
GuillaumeGomez Jul 29, 2024
5342092
Auto merge of #13179 - GuillaumeGomez:clean-up-lints-page-js, r=Alexe…
bors Jul 29, 2024
182c268
Add lint for `unused_result_ok`
ithinuel Jan 15, 2024
834b691
Auto merge of #13174 - y21:if_let_mutex_multi_mutex, r=llogiq
bors Jul 29, 2024
79783e9
Fix implicit_hasher test not compiling
Alexendoo Jul 29, 2024
33b16d3
implicit_hasher: use a single multipart suggestion
Alexendoo Jul 29, 2024
6317479
Add possibility to focus on search input using keyboard
GuillaumeGomez Jul 29, 2024
943a8e0
Remove some miscellaneous `#[allow]`s
Alexendoo Jul 29, 2024
accf686
Auto merge of #13178 - GuillaumeGomez:clippy-lints-page-improvement, …
bors Jul 29, 2024
8f3cfb4
Auto merge of #13182 - Alexendoo:remove-allows, r=Manishearth
bors Jul 30, 2024
c6f45df
Auto merge of #13181 - Alexendoo:implicit-hasher-suggestion, r=llogiq
bors Jul 30, 2024
ea06fa3
Auto merge of #13177 - GuillaumeGomez:fix-broken-list-lints-config, r…
bors Jul 31, 2024
edca730
Fix false positive for `missing_backticks` in footnote references
GuillaumeGomez Jul 31, 2024
5542309
Auto merge of #13195 - GuillaumeGomez:fix-false-positive-13183, r=Man…
bors Jul 31, 2024
2fc74a3
Auto merge of #13108 - tesuji:fix_redundant_closure, r=xFrednet
bors Aug 1, 2024
5ef38a3
Do not underline suggestions for code that is already there
estebank Jun 22, 2024
1aa686b
Auto merge of #13126 - apoisternex:issue12751, r=dswij
bors Aug 3, 2024
1ea827f
Auto merge of #13115 - tesuji:rm-dup-peels, r=dswij
bors Aug 3, 2024
a9d72c7
Migrating restriction lints to `span_lint_and_then` (a -> d)
xFrednet Jul 20, 2024
0532104
Migrating restriction lints to `span_lint_and_then` (e -> i)
xFrednet Jul 21, 2024
0347280
Auto merge of #13107 - yaxum62:i5757, r=xFrednet
bors Aug 3, 2024
b2d0631
Limit number of nonminimal_bool ops
Alexendoo Aug 3, 2024
d18ce7c
lintcheck: force warn all lints
Alexendoo Aug 3, 2024
35dcc9b
Add clarification for from_iter_instead_of_collect
alex-semenyuk Aug 3, 2024
eb7b676
Auto merge of #13208 - alex-semenyuk:fix_doc_from_iter_instead_of_col…
bors Aug 3, 2024
8dd459d
Auto merge of #13209 - Alexendoo:nonminimal-bool-limit-ops, r=y21
bors Aug 3, 2024
b9716dd
fix-typos
sheshnath-at-knoldus Jul 31, 2024
377d72a
Auto merge of #13194 - sheshnath-at-knoldus:fix-typos, r=Jarcho
bors Aug 3, 2024
1ea7bdd
Remove `multispan_sugg[_with_applicability]`
Alexendoo Aug 4, 2024
7ac242c
Auto merge of #13213 - Alexendoo:multispan-sugg, r=y21
bors Aug 4, 2024
234ea1f
Check exit status of subcommands spawned by rustc_tools_util
dtolnay Aug 4, 2024
e611c8e
Auto merge of #13217 - dtolnay-contrib:toolsutil, r=flip1995
bors Aug 5, 2024
1672d5d
Mark some lint deprecations as renames
Jarcho Jul 29, 2024
2c34d58
Store deprecated lints as an array of tuples.
Jarcho Jul 29, 2024
c2186e1
Make `cargo dev deprecate` require a reason
Jarcho Aug 1, 2024
e17d254
Auto merge of #13180 - Jarcho:deprecated_shrink, r=flip1995
bors Aug 5, 2024
c082bc2
Auto merge of #13136 - xFrednet:07797-restriction-and-then, r=blyxyas
bors Aug 5, 2024
9f6536c
Use a deterministic number of digits in rustc_tools_util commit hashes
dtolnay Aug 5, 2024
5f6d07b
Auto merge of #13222 - dtolnay-contrib:deterministic, r=flip1995
bors Aug 5, 2024
4c6a3f4
pass the right `ParamEnv` to `might_permit_raw_init_strict`
y21 Aug 5, 2024
cfb3881
Auto merge of #13145 - xFrednet:07797-restriction-and-then-why, r=Jarcho
bors Aug 6, 2024
a411267
Auto merge of #13210 - Alexendoo:lintcheck-force-warn, r=xFrednet
bors Aug 6, 2024
4e57b2c
Use `-D warnings` instead of `deny-warnings` feature.
Jarcho Aug 6, 2024
9d9a0dc
Auto merge of #13225 - Jarcho:warnings, r=flip1995
bors Aug 6, 2024
5ead90f
Auto merge of #12150 - ithinuel:add_misleading_use_of_ok, r=y21
bors Aug 6, 2024
16633a2
Replace `in_constant` with `is_in_const_context`. Use only the state …
Jarcho Aug 7, 2024
514824f
Refactor `single_match`
Jarcho Aug 22, 2023
8bcecff
Handle or patterns in `single_match` and `single_match_else`
Jarcho Aug 31, 2023
8225f2a
Add path prefixes back when compiling `clippy_dev` and `lintcheck`
Alexendoo Aug 7, 2024
f2deab3
Auto merge of #13232 - Alexendoo:path-prefix, r=flip1995
bors Aug 7, 2024
17de8fb
lintcheck: disable doc links
Alexendoo Aug 8, 2024
bfb10f4
Auto merge of #13234 - Alexendoo:lintcheck-doc-links, r=xFrednet
bors Aug 8, 2024
a120fb7
rwlock: disable 'frob' test in Miri on macOS
RalfJung Aug 4, 2024
5ccf543
Auto merge of #11441 - Jarcho:issue_11365, r=xFrednet
bors Aug 8, 2024
5d96870
std float tests: special-case Miri in feature detection
RalfJung Aug 8, 2024
ffc391c
Auto merge of #13231 - Jarcho:no_tree_walk_in_const, r=Alexendoo
bors Aug 8, 2024
3779062
Add `HasSession` trait
Jarcho Jul 31, 2024
d2cb227
Don't store `LateContext` in `ConstEvalLateContext`
Jarcho Jul 31, 2024
e4ad36d
Require `ConstEvalCtxt` to be constructed.
Jarcho Aug 1, 2024
ae696f8
Split `ColorConfig` off of `HumanReadableErrorType`
estebank Aug 8, 2024
b1e8792
Auto merge of #13200 - Jarcho:constant_no_typeck, r=Alexendoo
bors Aug 8, 2024
95c1c34
review comments
estebank Aug 8, 2024
c2a0d9c
rustdoc: fixed #101105
its-the-shrimp Aug 8, 2024
7a73a10
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Aug 8, 2024
e608b2f
Bump nightly version -> 2024-08-08
flip1995 Aug 8, 2024
1bf30eb
rustdoc-json: added a test for #107278
its-the-shrimp Aug 8, 2024
cb80611
Auto merge of #13236 - flip1995:rustup, r=flip1995
bors Aug 8, 2024
b7f07ce
Merge commit 'cb806113e0f83a8f9b47d35b453b676543bcc40e' into clippy-s…
flip1995 Aug 8, 2024
8be2688
Update Cargo.lock
flip1995 Aug 8, 2024
ec1c424
Don't implement AsyncFn for FnDef/FnPtr that wouldnt implement Fn
compiler-errors Aug 7, 2024
524e768
Add comment that bors did not see pushed before it merged
compiler-errors Aug 3, 2024
95b4072
Rollup merge of #128640 - RalfJung:rwlock-macos-miri, r=joboet
matthiaskrgr Aug 8, 2024
bcf6f9f
Rollup merge of #128791 - compiler-errors:async-fn-unsafe, r=lcnr
matthiaskrgr Aug 8, 2024
f106496
Rollup merge of #128806 - estebank:color-config, r=jieyouxu
matthiaskrgr Aug 8, 2024
5f04617
Rollup merge of #128818 - RalfJung:std-miri-floats, r=tgross35
matthiaskrgr Aug 8, 2024
5e388ea
Rollup merge of #128834 - its-the-shrimp:fix_101105, r=aDotInTheVoid
matthiaskrgr Aug 8, 2024
8789b95
Rollup merge of #128836 - its-the-shrimp:add_test_for_107278, r=aDotI…
matthiaskrgr Aug 8, 2024
58c6497
Rollup merge of #128837 - flip1995:clippy-subtree-update, r=Manishearth
matthiaskrgr Aug 8, 2024
9243aee
Rollup merge of #128851 - compiler-errors:validate-mir-opt-mir, r=mat…
matthiaskrgr Aug 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 6 additions & 5 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -564,14 +564,15 @@ dependencies = [
"termize",
"tokio",
"toml 0.7.8",
"ui_test 0.24.0",
"ui_test 0.25.0",
"walkdir",
]

[[package]]
name = "clippy_config"
version = "0.1.82"
dependencies = [
"itertools",
"rustc-semver",
"serde",
"toml 0.7.8",
Expand Down Expand Up @@ -4936,9 +4937,9 @@ dependencies = [

[[package]]
name = "spanned"
version = "0.2.1"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed14ba8b4b82241bd5daba2c49185d4a0581a0058355fe96537338f002b8605d"
checksum = "86af297923fbcfd107c20a189a6e9c872160df71a7190ae4a7a6c5dce4b2feb6"
dependencies = [
"bstr",
"color-eyre",
Expand Down Expand Up @@ -5562,9 +5563,9 @@ dependencies = [

[[package]]
name = "ui_test"
version = "0.24.0"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc1c6c78d55482388711c8d417b8e547263046a607512278fed274c54633bbe4"
checksum = "f7e4f339f62edc873975c47115f9e71c5454ddaa37c1142b42fc0b2672c8dacb"
dependencies = [
"annotate-snippets 0.11.4",
"anyhow",
Expand Down
15 changes: 5 additions & 10 deletions compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,14 @@ const DEFAULT_COLUMN_WIDTH: usize = 140;
/// Describes the way the content of the `rendered` field of the json output is generated
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum HumanReadableErrorType {
Default(ColorConfig),
AnnotateSnippet(ColorConfig),
Short(ColorConfig),
Default,
AnnotateSnippet,
Short,
}

impl HumanReadableErrorType {
/// Returns a (`short`, `color`) tuple
pub fn unzip(self) -> (bool, ColorConfig) {
match self {
HumanReadableErrorType::Default(cc) => (false, cc),
HumanReadableErrorType::Short(cc) => (true, cc),
HumanReadableErrorType::AnnotateSnippet(cc) => (false, cc),
}
pub fn short(&self) -> bool {
*self == HumanReadableErrorType::Short
}
}

Expand Down
9 changes: 6 additions & 3 deletions compiler/rustc_errors/src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pub struct JsonEmitter {
ignored_directories_in_source_blocks: Vec<String>,
#[setters(skip)]
json_rendered: HumanReadableErrorType,
color_config: ColorConfig,
diagnostic_width: Option<usize>,
macro_backtrace: bool,
track_diagnostics: bool,
Expand All @@ -68,6 +69,7 @@ impl JsonEmitter {
fallback_bundle: LazyFallbackBundle,
pretty: bool,
json_rendered: HumanReadableErrorType,
color_config: ColorConfig,
) -> JsonEmitter {
JsonEmitter {
dst: IntoDynSyncSend(dst),
Expand All @@ -79,6 +81,7 @@ impl JsonEmitter {
ui_testing: false,
ignored_directories_in_source_blocks: Vec::new(),
json_rendered,
color_config,
diagnostic_width: None,
macro_backtrace: false,
track_diagnostics: false,
Expand Down Expand Up @@ -173,7 +176,7 @@ impl Emitter for JsonEmitter {
}

fn should_show_explain(&self) -> bool {
!matches!(self.json_rendered, HumanReadableErrorType::Short(_))
!self.json_rendered.short()
}
}

Expand Down Expand Up @@ -353,8 +356,8 @@ impl Diagnostic {

let buf = BufWriter::default();
let mut dst: Destination = Box::new(buf.clone());
let (short, color_config) = je.json_rendered.unzip();
match color_config {
let short = je.json_rendered.short();
match je.color_config {
ColorConfig::Always | ColorConfig::Auto => dst = Box::new(termcolor::Ansi::new(dst)),
ColorConfig::Never => {}
}
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_errors/src/json/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ fn test_positions(code: &str, span: (u32, u32), expected_output: SpanTestData) {
sm,
fallback_bundle,
true, // pretty
HumanReadableErrorType::Short(ColorConfig::Never),
HumanReadableErrorType::Short,
ColorConfig::Never,
);

let span = Span::with_root_ctxt(BytePos(span.0), BytePos(span.1));
Expand Down
8 changes: 7 additions & 1 deletion compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,8 +818,14 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
});
sess.time("layout_testing", || layout_test::test_layout(tcx));
sess.time("abi_testing", || abi_test::test_abi(tcx));

// If `-Zvalidate-mir` is set, we also want to compute the final MIR for each item
// (either its `mir_for_ctfe` or `optimized_mir`) since that helps uncover any bugs
// in MIR optimizations that may only be reachable through codegen, or other codepaths
// that requires the optimized/ctfe MIR, such as polymorphization, coroutine bodies,
// or evaluating consts.
if tcx.sess.opts.unstable_opts.validate_mir {
sess.time("ensuring_optimized_MIR_is_computable", || {
sess.time("ensuring_final_MIR_is_computable", || {
tcx.hir().par_body_owners(|def_id| {
tcx.instance_mir(ty::InstanceKind::Item(def_id.into()));
});
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ fn test_search_paths_tracking_hash_different_order() {
let early_dcx = EarlyDiagCtxt::new(JSON);
const JSON: ErrorOutputType = ErrorOutputType::Json {
pretty: false,
json_rendered: HumanReadableErrorType::Default(ColorConfig::Never),
json_rendered: HumanReadableErrorType::Default,
color_config: ColorConfig::Never,
};

let push = |opts: &mut Options, search_path| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,28 +458,23 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<I:
))
}

ty::FnDef(..) | ty::FnPtr(..) => {
let bound_sig = self_ty.fn_sig(cx);
let sig = bound_sig.skip_binder();
let future_trait_def_id = cx.require_lang_item(TraitSolverLangItem::Future);
// `FnDef` and `FnPtr` only implement `AsyncFn*` when their
// return type implements `Future`.
let nested = vec![
bound_sig
.rebind(ty::TraitRef::new(cx, future_trait_def_id, [sig.output()]))
.upcast(cx),
];
let future_output_def_id = cx.require_lang_item(TraitSolverLangItem::FutureOutput);
let future_output_ty = Ty::new_projection(cx, future_output_def_id, [sig.output()]);
Ok((
bound_sig.rebind(AsyncCallableRelevantTypes {
tupled_inputs_ty: Ty::new_tup(cx, sig.inputs().as_slice()),
output_coroutine_ty: sig.output(),
coroutine_return_ty: future_output_ty,
}),
nested,
))
ty::FnDef(def_id, _) => {
let sig = self_ty.fn_sig(cx);
if sig.skip_binder().is_fn_trait_compatible() && !cx.has_target_features(def_id) {
fn_item_to_async_callable(cx, sig)
} else {
Err(NoSolution)
}
}
ty::FnPtr(..) => {
let sig = self_ty.fn_sig(cx);
if sig.skip_binder().is_fn_trait_compatible() {
fn_item_to_async_callable(cx, sig)
} else {
Err(NoSolution)
}
}

ty::Closure(_, args) => {
let args = args.as_closure();
let bound_sig = args.sig();
Expand Down Expand Up @@ -563,6 +558,29 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<I:
}
}

fn fn_item_to_async_callable<I: Interner>(
cx: I,
bound_sig: ty::Binder<I, ty::FnSig<I>>,
) -> Result<(ty::Binder<I, AsyncCallableRelevantTypes<I>>, Vec<I::Predicate>), NoSolution> {
let sig = bound_sig.skip_binder();
let future_trait_def_id = cx.require_lang_item(TraitSolverLangItem::Future);
// `FnDef` and `FnPtr` only implement `AsyncFn*` when their
// return type implements `Future`.
let nested = vec![
bound_sig.rebind(ty::TraitRef::new(cx, future_trait_def_id, [sig.output()])).upcast(cx),
];
let future_output_def_id = cx.require_lang_item(TraitSolverLangItem::FutureOutput);
let future_output_ty = Ty::new_projection(cx, future_output_def_id, [sig.output()]);
Ok((
bound_sig.rebind(AsyncCallableRelevantTypes {
tupled_inputs_ty: Ty::new_tup(cx, sig.inputs().as_slice()),
output_coroutine_ty: sig.output(),
coroutine_return_ty: future_output_ty,
}),
nested,
))
}

/// Given a coroutine-closure, project to its returned coroutine when we are *certain*
/// that the closure's kind is compatible with the goal.
fn coroutine_closure_to_certain_coroutine<I: Interner>(
Expand Down
38 changes: 23 additions & 15 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,20 +602,21 @@ impl OutputType {
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ErrorOutputType {
/// Output meant for the consumption of humans.
HumanReadable(HumanReadableErrorType),
HumanReadable(HumanReadableErrorType, ColorConfig),
/// Output that's consumed by other tools such as `rustfix` or the `RLS`.
Json {
/// Render the JSON in a human readable way (with indents and newlines).
pretty: bool,
/// The JSON output includes a `rendered` field that includes the rendered
/// human output.
json_rendered: HumanReadableErrorType,
color_config: ColorConfig,
},
}

impl Default for ErrorOutputType {
fn default() -> Self {
Self::HumanReadable(HumanReadableErrorType::Default(ColorConfig::Auto))
Self::HumanReadable(HumanReadableErrorType::Default, ColorConfig::Auto)
}
}

Expand Down Expand Up @@ -1631,6 +1632,7 @@ pub fn parse_color(early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches) -> Col
/// Possible json config files
pub struct JsonConfig {
pub json_rendered: HumanReadableErrorType,
pub json_color: ColorConfig,
json_artifact_notifications: bool,
pub json_unused_externs: JsonUnusedExterns,
json_future_incompat: bool,
Expand Down Expand Up @@ -1668,8 +1670,7 @@ impl JsonUnusedExterns {
/// The first value returned is how to render JSON diagnostics, and the second
/// is whether or not artifact notifications are enabled.
pub fn parse_json(early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches) -> JsonConfig {
let mut json_rendered: fn(ColorConfig) -> HumanReadableErrorType =
HumanReadableErrorType::Default;
let mut json_rendered = HumanReadableErrorType::Default;
let mut json_color = ColorConfig::Never;
let mut json_artifact_notifications = false;
let mut json_unused_externs = JsonUnusedExterns::No;
Expand All @@ -1696,7 +1697,8 @@ pub fn parse_json(early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches) -> Json
}

JsonConfig {
json_rendered: json_rendered(json_color),
json_rendered,
json_color,
json_artifact_notifications,
json_unused_externs,
json_future_incompat,
Expand All @@ -1708,6 +1710,7 @@ pub fn parse_error_format(
early_dcx: &mut EarlyDiagCtxt,
matches: &getopts::Matches,
color: ColorConfig,
json_color: ColorConfig,
json_rendered: HumanReadableErrorType,
) -> ErrorOutputType {
// We need the `opts_present` check because the driver will send us Matches
Expand All @@ -1717,18 +1720,22 @@ pub fn parse_error_format(
let error_format = if matches.opts_present(&["error-format".to_owned()]) {
match matches.opt_str("error-format").as_deref() {
None | Some("human") => {
ErrorOutputType::HumanReadable(HumanReadableErrorType::Default(color))
ErrorOutputType::HumanReadable(HumanReadableErrorType::Default, color)
}
Some("human-annotate-rs") => {
ErrorOutputType::HumanReadable(HumanReadableErrorType::AnnotateSnippet(color))
ErrorOutputType::HumanReadable(HumanReadableErrorType::AnnotateSnippet, color)
}
Some("json") => ErrorOutputType::Json { pretty: false, json_rendered },
Some("pretty-json") => ErrorOutputType::Json { pretty: true, json_rendered },
Some("short") => ErrorOutputType::HumanReadable(HumanReadableErrorType::Short(color)),

Some("json") => {
ErrorOutputType::Json { pretty: false, json_rendered, color_config: json_color }
}
Some("pretty-json") => {
ErrorOutputType::Json { pretty: true, json_rendered, color_config: json_color }
}
Some("short") => ErrorOutputType::HumanReadable(HumanReadableErrorType::Short, color),
Some(arg) => {
early_dcx.abort_if_error_and_set_error_format(ErrorOutputType::HumanReadable(
HumanReadableErrorType::Default(color),
HumanReadableErrorType::Default,
color,
));
early_dcx.early_fatal(format!(
"argument for `--error-format` must be `human`, `json` or \
Expand All @@ -1737,7 +1744,7 @@ pub fn parse_error_format(
}
}
} else {
ErrorOutputType::HumanReadable(HumanReadableErrorType::Default(color))
ErrorOutputType::HumanReadable(HumanReadableErrorType::Default, color)
};

match error_format {
Expand Down Expand Up @@ -1791,7 +1798,7 @@ fn check_error_format_stability(
if let ErrorOutputType::Json { pretty: true, .. } = error_format {
early_dcx.early_fatal("`--error-format=pretty-json` is unstable");
}
if let ErrorOutputType::HumanReadable(HumanReadableErrorType::AnnotateSnippet(_)) =
if let ErrorOutputType::HumanReadable(HumanReadableErrorType::AnnotateSnippet, _) =
error_format
{
early_dcx.early_fatal("`--error-format=human-annotate-rs` is unstable");
Expand Down Expand Up @@ -2392,12 +2399,13 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M

let JsonConfig {
json_rendered,
json_color,
json_artifact_notifications,
json_unused_externs,
json_future_incompat,
} = parse_json(early_dcx, matches);

let error_format = parse_error_format(early_dcx, matches, color, json_rendered);
let error_format = parse_error_format(early_dcx, matches, color, json_color, json_rendered);

early_dcx.abort_if_error_and_set_error_format(error_format);

Expand Down
Loading
Loading