Auto merge of #124040 - GuillaumeGomez:rollup-hrrvsgh, r=GuillaumeGomez
Rollup of 7 pull requests Successful merges: - #123673 (Don't ICE for kind mismatches during error rendering) - #123675 (Taint const qualifs if a static is referenced that didn't pass wfcheck) - #123975 (Port the 2 `rust-lld` run-make tests to `rmake`) - #124000 (Use `/* value */` as a placeholder) - #124013 (Box::into_raw: make Miri understand that this is a box-to-raw cast) - #124027 (Prefer identity equality over equating types during coercion.) - #124036 (Remove `default_hidden_visibility: false` from wasm targets) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
7e3ba5b8b7
36 changed files with 363 additions and 106 deletions
|
@ -331,6 +331,11 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
|
|||
if self.tcx.is_thread_local_static(def_id) {
|
||||
self.tcx.dcx().span_bug(span, "tls access is checked in `Rvalue::ThreadLocalRef`");
|
||||
}
|
||||
if let Some(def_id) = def_id.as_local()
|
||||
&& let Err(guar) = self.tcx.at(span).check_well_formed(hir::OwnerId { def_id })
|
||||
{
|
||||
self.error_emitted = Some(guar);
|
||||
}
|
||||
self.check_op_spanned(ops::StaticAccess, span)
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ use rustc_hir::def_id::{DefId, LocalDefId};
|
|||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_hir::ItemKind;
|
||||
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_infer::infer::{self, RegionResolutionError};
|
||||
use rustc_infer::infer::{DefineOpaqueTypes, TyCtxtInferExt};
|
||||
use rustc_infer::traits::Obligation;
|
||||
use rustc_middle::ty::adjustment::CoerceUnsizedInfo;
|
||||
use rustc_middle::ty::{self, suggest_constraining_type_params, Ty, TyCtxt, TypeVisitableExt};
|
||||
|
@ -189,10 +189,7 @@ fn visit_implementation_of_dispatch_from_dyn(checker: &Checker<'_>) -> Result<()
|
|||
// even if they do not carry that attribute.
|
||||
use rustc_type_ir::TyKind::*;
|
||||
match (source.kind(), target.kind()) {
|
||||
(&Ref(r_a, _, mutbl_a), Ref(r_b, _, mutbl_b))
|
||||
if infcx.at(&cause, param_env).eq(DefineOpaqueTypes::No, r_a, *r_b).is_ok()
|
||||
&& mutbl_a == *mutbl_b =>
|
||||
{
|
||||
(&Ref(r_a, _, mutbl_a), Ref(r_b, _, mutbl_b)) if r_a == *r_b && mutbl_a == *mutbl_b => {
|
||||
Ok(())
|
||||
}
|
||||
(&RawPtr(_, a_mutbl), &RawPtr(_, b_mutbl)) if a_mutbl == b_mutbl => Ok(()),
|
||||
|
@ -230,18 +227,14 @@ fn visit_implementation_of_dispatch_from_dyn(checker: &Checker<'_>) -> Result<()
|
|||
}
|
||||
}
|
||||
|
||||
if let Ok(ok) =
|
||||
infcx.at(&cause, param_env).eq(DefineOpaqueTypes::No, ty_a, ty_b)
|
||||
{
|
||||
if ok.obligations.is_empty() {
|
||||
res = Err(tcx.dcx().emit_err(errors::DispatchFromDynZST {
|
||||
span,
|
||||
name: field.name,
|
||||
ty: ty_a,
|
||||
}));
|
||||
if ty_a == ty_b {
|
||||
res = Err(tcx.dcx().emit_err(errors::DispatchFromDynZST {
|
||||
span,
|
||||
name: field.name,
|
||||
ty: ty_a,
|
||||
}));
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -433,14 +426,12 @@ pub fn coerce_unsized_info<'tcx>(
|
|||
// something more accepting, but we use
|
||||
// equality because we want to be able to
|
||||
// perform this check without computing
|
||||
// variance where possible. (This is because
|
||||
// we may have to evaluate constraint
|
||||
// variance or constraining opaque types' hidden types.
|
||||
// (This is because we may have to evaluate constraint
|
||||
// expressions in the course of execution.)
|
||||
// See e.g., #41936.
|
||||
if let Ok(ok) = infcx.at(&cause, param_env).eq(DefineOpaqueTypes::No, a, b) {
|
||||
if ok.obligations.is_empty() {
|
||||
return None;
|
||||
}
|
||||
if a == b {
|
||||
return None;
|
||||
}
|
||||
|
||||
// Collect up all fields that were significantly changed
|
||||
|
|
|
@ -80,9 +80,6 @@ pub fn options() -> TargetOptions {
|
|||
// threaded model which will legalize atomics to normal operations.
|
||||
singlethread: true,
|
||||
|
||||
// no dynamic linking, no need for default visibility!
|
||||
default_hidden_visibility: true,
|
||||
|
||||
// Symbol visibility takes care of this for the WebAssembly.
|
||||
// Additionally the only known linker, LLD, doesn't support the script
|
||||
// arguments just yet
|
||||
|
|
|
@ -4545,7 +4545,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
self.type_implements_trait(default_trait, [ty], param_env).must_apply_modulo_regions()
|
||||
};
|
||||
|
||||
Some(match ty.kind() {
|
||||
Some(match *ty.kind() {
|
||||
ty::Never | ty::Error(_) => return None,
|
||||
ty::Bool => "false".to_string(),
|
||||
ty::Char => "\'x\'".to_string(),
|
||||
|
@ -4572,12 +4572,19 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
if let (ty::Str, hir::Mutability::Not) = (ty.kind(), mutability) {
|
||||
"\"\"".to_string()
|
||||
} else {
|
||||
let ty = self.ty_kind_suggestion(param_env, *ty)?;
|
||||
let ty = self.ty_kind_suggestion(param_env, ty)?;
|
||||
format!("&{}{ty}", mutability.prefix_str())
|
||||
}
|
||||
}
|
||||
ty::Array(ty, len) if let Some(len) = len.try_eval_target_usize(tcx, param_env) => {
|
||||
format!("[{}; {}]", self.ty_kind_suggestion(param_env, *ty)?, len)
|
||||
if len == 0 {
|
||||
"[]".to_string()
|
||||
} else if self.type_is_copy_modulo_regions(param_env, ty) || len == 1 {
|
||||
// Can only suggest `[ty; 0]` if sz == 1 or copy
|
||||
format!("[{}; {}]", self.ty_kind_suggestion(param_env, ty)?, len)
|
||||
} else {
|
||||
"/* value */".to_string()
|
||||
}
|
||||
}
|
||||
ty::Tuple(tys) => format!(
|
||||
"({}{})",
|
||||
|
@ -4587,7 +4594,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
.join(", "),
|
||||
if tys.len() == 1 { "," } else { "" }
|
||||
),
|
||||
_ => "value".to_string(),
|
||||
_ => "/* value */".to_string(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1977,6 +1977,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
for (obligation_arg, impl_arg) in
|
||||
std::iter::zip(obligation_trait_ref.args, impl_trait_ref.args)
|
||||
{
|
||||
if (obligation_arg, impl_arg).references_error() {
|
||||
return false;
|
||||
}
|
||||
if let Err(terr) =
|
||||
ocx.eq(&ObligationCause::dummy(), param_env, impl_arg, obligation_arg)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue