Auto merge of #99707 - JohnTitor:rollup-74rb8vq, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #95040 (protect `std::io::Take::limit` from overflow in `read`) - #95916 (kmc-solid: Use `libc::abort` to abort a program) - #99494 (Use non-relocatable code in nofile-limit.rs test) - #99581 (Improve error messages involving `derive` and `packed`.) - #99643 (Add `sign-ext` target feature to the WASM target) - #99659 (Use `VecMap::get` in `ConstraintLocator::check`) - #99690 (add miri-track-caller to more intrinsic-exposing methods) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
2fdbf075cf
19 changed files with 140 additions and 111 deletions
|
@ -249,6 +249,7 @@ const WASM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
|||
("bulk-memory", Some(sym::wasm_target_feature)),
|
||||
("mutable-globals", Some(sym::wasm_target_feature)),
|
||||
("reference-types", Some(sym::wasm_target_feature)),
|
||||
("sign-ext", Some(sym::wasm_target_feature)),
|
||||
];
|
||||
|
||||
const BPF_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[("alu32", Some(sym::bpf_target_feature))];
|
||||
|
|
|
@ -36,13 +36,16 @@ fn unsafe_derive_on_repr_packed(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
|||
tcx.struct_span_lint_hir(UNALIGNED_REFERENCES, lint_hir_id, tcx.def_span(def_id), |lint| {
|
||||
// FIXME: when we make this a hard error, this should have its
|
||||
// own error code.
|
||||
let message = if tcx.generics_of(def_id).own_requires_monomorphization() {
|
||||
"`#[derive]` can't be used on a `#[repr(packed)]` struct with \
|
||||
type or const parameters (error E0133)"
|
||||
let extra = if tcx.generics_of(def_id).own_requires_monomorphization() {
|
||||
"with type or const parameters"
|
||||
} else {
|
||||
"`#[derive]` can't be used on a `#[repr(packed)]` struct that \
|
||||
does not derive Copy (error E0133)"
|
||||
"that does not derive `Copy`"
|
||||
};
|
||||
let message = format!(
|
||||
"`{}` can't be derived on this `#[repr(packed)]` struct {} (error E0133)",
|
||||
tcx.item_name(tcx.trait_id_of_impl(def_id.to_def_id()).expect("derived trait name")),
|
||||
extra
|
||||
);
|
||||
lint.build(message).emit();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -538,9 +538,9 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> {
|
|||
|
||||
impl ConstraintLocator<'_> {
|
||||
#[instrument(skip(self), level = "debug")]
|
||||
fn check(&mut self, def_id: LocalDefId) {
|
||||
fn check(&mut self, item_def_id: LocalDefId) {
|
||||
// Don't try to check items that cannot possibly constrain the type.
|
||||
if !self.tcx.has_typeck_results(def_id) {
|
||||
if !self.tcx.has_typeck_results(item_def_id) {
|
||||
debug!("no constraint: no typeck results");
|
||||
return;
|
||||
}
|
||||
|
@ -555,26 +555,20 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> {
|
|||
// // because we again need to reveal `Foo` so we can check whether the
|
||||
// // constant does not contain interior mutability.
|
||||
// ```
|
||||
let tables = self.tcx.typeck(def_id);
|
||||
let tables = self.tcx.typeck(item_def_id);
|
||||
if let Some(_) = tables.tainted_by_errors {
|
||||
self.found = Some(ty::OpaqueHiddenType { span: DUMMY_SP, ty: self.tcx.ty_error() });
|
||||
return;
|
||||
}
|
||||
if tables.concrete_opaque_types.get(&self.def_id).is_none() {
|
||||
if !tables.concrete_opaque_types.contains_key(&self.def_id) {
|
||||
debug!("no constraints in typeck results");
|
||||
return;
|
||||
}
|
||||
// Use borrowck to get the type with unerased regions.
|
||||
let concrete_opaque_types = &self.tcx.mir_borrowck(def_id).concrete_opaque_types;
|
||||
let concrete_opaque_types = &self.tcx.mir_borrowck(item_def_id).concrete_opaque_types;
|
||||
debug!(?concrete_opaque_types);
|
||||
for &(def_id, concrete_type) in concrete_opaque_types {
|
||||
if def_id != self.def_id {
|
||||
// Ignore constraints for other opaque types.
|
||||
continue;
|
||||
}
|
||||
|
||||
if let Some(&concrete_type) = concrete_opaque_types.get(&self.def_id) {
|
||||
debug!(?concrete_type, "found constraint");
|
||||
|
||||
if let Some(prev) = self.found {
|
||||
if concrete_type.ty != prev.ty && !(concrete_type, prev).references_error() {
|
||||
prev.report_mismatch(&concrete_type, self.tcx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue