Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit faee636

Browse files
committed
Auto merge of rust-lang#114697 - matthiaskrgr:rollup-ywooy8x, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - rust-lang#114278 (better error handling for `rust.codegen-backends` on deserialization) - rust-lang#114674 (Add clubby789 to `users_on_vacation`) - rust-lang#114678 (`Expr::can_have_side_effects()` is incorrect for struct/enum/array/tuple literals) - rust-lang#114681 (doc (unstable-book): fix a typo) - rust-lang#114684 (Remove redundant calls to `resolve_vars_with_obligations`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 9fa6bdd + 5f0d585 commit faee636

File tree

14 files changed

+88
-25
lines changed

14 files changed

+88
-25
lines changed

compiler/rustc_hir/src/hir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,7 +1843,7 @@ impl Expr<'_> {
18431843
.iter()
18441844
.map(|field| field.expr)
18451845
.chain(init.into_iter())
1846-
.all(|e| e.can_have_side_effects()),
1846+
.any(|e| e.can_have_side_effects()),
18471847

18481848
ExprKind::Array(args)
18491849
| ExprKind::Tup(args)
@@ -1857,7 +1857,7 @@ impl Expr<'_> {
18571857
..
18581858
},
18591859
args,
1860-
) => args.iter().all(|arg| arg.can_have_side_effects()),
1860+
) => args.iter().any(|arg| arg.can_have_side_effects()),
18611861
ExprKind::If(..)
18621862
| ExprKind::Match(..)
18631863
| ExprKind::MethodCall(..)

compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10391039
/// Returns false if the coercion creates any obligations that result in
10401040
/// errors.
10411041
pub fn can_coerce(&self, expr_ty: Ty<'tcx>, target: Ty<'tcx>) -> bool {
1042+
// FIXME(-Ztrait-solver=next): We need to structurally resolve both types here.
10421043
let source = self.resolve_vars_with_obligations(expr_ty);
10431044
debug!("coercion::can_with_predicates({:?} -> {:?})", source, target);
10441045

compiler/rustc_hir_typeck/src/demand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
260260
));
261261
let expr = expr.peel_drop_temps();
262262
let cause = self.misc(expr.span);
263-
let expr_ty = self.resolve_vars_with_obligations(checked_ty);
263+
let expr_ty = self.resolve_vars_if_possible(checked_ty);
264264
let mut err = self.err_ctxt().report_mismatched_types(&cause, expected, expr_ty, e);
265265

266266
let is_insufficiently_polymorphic =

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
8585
/// to get more type information.
8686
// FIXME(-Ztrait-solver=next): A lot of the calls to this method should
8787
// probably be `try_structurally_resolve_type` or `structurally_resolve_type` instead.
88-
pub(in super::super) fn resolve_vars_with_obligations(&self, ty: Ty<'tcx>) -> Ty<'tcx> {
89-
self.resolve_vars_with_obligations_and_mutate_fulfillment(ty, |_| {})
90-
}
91-
92-
#[instrument(skip(self, mutate_fulfillment_errors), level = "debug", ret)]
93-
pub(in super::super) fn resolve_vars_with_obligations_and_mutate_fulfillment(
94-
&self,
95-
mut ty: Ty<'tcx>,
96-
mutate_fulfillment_errors: impl Fn(&mut Vec<traits::FulfillmentError<'tcx>>),
97-
) -> Ty<'tcx> {
88+
#[instrument(skip(self), level = "debug", ret)]
89+
pub(in super::super) fn resolve_vars_with_obligations(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
9890
// No Infer()? Nothing needs doing.
9991
if !ty.has_non_region_infer() {
10092
debug!("no inference var, nothing needs doing");
@@ -112,7 +104,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
112104
// possible. This can help substantially when there are
113105
// indirect dependencies that don't seem worth tracking
114106
// precisely.
115-
self.select_obligations_where_possible(mutate_fulfillment_errors);
107+
self.select_obligations_where_possible(|_| {});
116108
self.resolve_vars_if_possible(ty)
117109
}
118110

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
950950
if !expected.is_unit() {
951951
return;
952952
}
953-
let found = self.resolve_vars_with_obligations(found);
953+
let found = self.resolve_vars_if_possible(found);
954954

955955
let in_loop = self.is_loop(id)
956956
|| self

compiler/rustc_hir_typeck/src/method/suggest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2994,7 +2994,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
29942994
// This occurs for UFCS desugaring of `T::method`, where there is no
29952995
// receiver expression for the method call, and thus no autoderef.
29962996
if let SelfSource::QPath(_) = source {
2997-
return is_local(self.resolve_vars_with_obligations(rcvr_ty));
2997+
return is_local(rcvr_ty);
29982998
}
29992999

30003000
self.autoderef(span, rcvr_ty).any(|(ty, _)| is_local(ty))

src/bootstrap/compile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ fn needs_codegen_config(run: &RunConfig<'_>) -> bool {
11291129
needs_codegen_cfg
11301130
}
11311131

1132-
const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_";
1132+
pub(crate) const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_";
11331133

11341134
fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
11351135
if path.path.to_str().unwrap().contains(&CODEGEN_BACKEND_PREFIX) {

src/bootstrap/config.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use std::str::FromStr;
2020
use crate::cache::{Interned, INTERNER};
2121
use crate::cc_detect::{ndk_compiler, Language};
2222
use crate::channel::{self, GitInfo};
23+
use crate::compile::CODEGEN_BACKEND_PREFIX;
2324
pub use crate::flags::Subcommand;
2425
use crate::flags::{Color, Flags, Warnings};
2526
use crate::util::{exe, output, t};
@@ -1443,8 +1444,21 @@ impl Config {
14431444
.map(|v| v.parse().expect("failed to parse rust.llvm-libunwind"));
14441445

14451446
if let Some(ref backends) = rust.codegen_backends {
1446-
config.rust_codegen_backends =
1447-
backends.iter().map(|s| INTERNER.intern_str(s)).collect();
1447+
let available_backends = vec!["llvm", "cranelift", "gcc"];
1448+
1449+
config.rust_codegen_backends = backends.iter().map(|s| {
1450+
if let Some(backend) = s.strip_prefix(CODEGEN_BACKEND_PREFIX) {
1451+
if available_backends.contains(&backend) {
1452+
panic!("Invalid value '{s}' for 'rust.codegen-backends'. Instead, please use '{backend}'.");
1453+
} else {
1454+
println!("help: '{s}' for 'rust.codegen-backends' might fail. \
1455+
Codegen backends are mostly defined without the '{CODEGEN_BACKEND_PREFIX}' prefix. \
1456+
In this case, it would be referred to as '{backend}'.");
1457+
}
1458+
}
1459+
1460+
INTERNER.intern_str(s)
1461+
}).collect();
14481462
}
14491463

14501464
config.rust_codegen_units = rust.codegen_units.map(threads_from_config);

src/doc/unstable-book/src/compiler-flags/profile_sample_use.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# `profile-sample-use
1+
# `profile-sample-use`
22

33
---
44

tests/ui/async-await/in-trait/return-type-suggestion.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ trait A {
66
async fn e() {
77
Ok(())
88
//~^ ERROR mismatched types
9-
//~| HELP consider using a semicolon here
109
}
1110
}
1211

0 commit comments

Comments
 (0)