Skip to content

Commit db8043b

Browse files
committed
Auto merge of #131869 - matthiaskrgr:rollup-xrkz174, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #131654 (Various fixes for Xous) - #131743 (rustc_metadata: minor tidying) - #131823 (Bump libc to 0.2.161) - #131850 (Missing parenthesis) - #131857 (Allow dropping dyn principal) r? `@ghost` `@rustbot` modify labels: rollup
2 parents d9c4b8d + 13b3984 commit db8043b

28 files changed

Lines changed: 738 additions & 121 deletions

File tree

‎compiler/rustc_codegen_cranelift/src/unsize.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ pub(crate) fn unsized_info<'tcx>(
3434
{
3535
let old_info =
3636
old_info.expect("unsized_info: missing old info for trait upcasting coercion");
37-
if data_a.principal_def_id() == data_b.principal_def_id(){
37+
let b_principal_def_id = data_b.principal_def_id();
38+
if data_a.principal_def_id() == b_principal_def_id || b_principal_def_id.is_none(){
39+
// A NOP cast that doesn't actually change anything, should be allowed even with invalid vtables.
3840
debug_assert!(
3941
validate_trivial_unsize(fx.tcx, data_a, data_b),
4042
"NOP unsize vtable changed principal trait ref: {data_a} -> {data_b}"

‎compiler/rustc_codegen_ssa/src/base.rs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub fn validate_trivial_unsize<'tcx>(
147147
infcx.leak_check(universe,None).is_ok()
148148
})
149149
}
150-
(None,None) => true,
150+
(_,None) => true,
151151
_ => false,
152152
}
153153
}
@@ -175,7 +175,8 @@ fn unsized_info<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
175175
{
176176
let old_info =
177177
old_info.expect("unsized_info: missing old info for trait upcasting coercion");
178-
if data_a.principal_def_id() == data_b.principal_def_id(){
178+
let b_principal_def_id = data_b.principal_def_id();
179+
if data_a.principal_def_id() == b_principal_def_id || b_principal_def_id.is_none(){
179180
// Codegen takes advantage of the additional assumption, where if the
180181
// principal trait def id of what's being casted doesn't change,
181182
// then we don't need to adjust the vtable at all. This

‎compiler/rustc_metadata/src/locator.rs‎

Lines changed: 49 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,11 @@ impl<'a> CrateLocator<'a> {
499499
dylibs:FxIndexMap<PathBuf,PathKind>,
500500
) -> Result<Option<(Svh,Library)>,CrateError>{
501501
letmut slot = None;
502-
// Order here matters, rmeta should come first. See comment in
503-
// `extract_one` below.
502+
// Order here matters, rmeta should come first.
503+
//
504+
// Make sure there's at most one rlib and at most one dylib.
505+
//
506+
// See comment in `extract_one` below.
504507
let source = CrateSource{
505508
rmeta:self.extract_one(rmetas,CrateFlavor::Rmeta,&mut slot)?,
506509
rlib:self.extract_one(rlibs,CrateFlavor::Rlib,&mut slot)?,
@@ -706,54 +709,58 @@ impl<'a> CrateLocator<'a> {
706709
letmut rmetas = FxIndexMap::default();
707710
letmut dylibs = FxIndexMap::default();
708711
for loc in&self.exact_paths{
709-
if !loc.canonicalized().exists(){
710-
returnErr(CrateError::ExternLocationNotExist(
711-
self.crate_name,
712-
loc.original().clone(),
713-
));
712+
let loc_canon = loc.canonicalized();
713+
let loc_orig = loc.original();
714+
if !loc_canon.exists(){
715+
returnErr(CrateError::ExternLocationNotExist(self.crate_name, loc_orig.clone()));
714716
}
715-
if !loc.original().is_file(){
716-
returnErr(CrateError::ExternLocationNotFile(
717-
self.crate_name,
718-
loc.original().clone(),
719-
));
717+
if !loc_orig.is_file(){
718+
returnErr(CrateError::ExternLocationNotFile(self.crate_name, loc_orig.clone()));
720719
}
721-
letSome(file) = loc.original().file_name().and_then(|s| s.to_str())else{
722-
returnErr(CrateError::ExternLocationNotFile(
723-
self.crate_name,
724-
loc.original().clone(),
725-
));
720+
// Note to take care and match against the non-canonicalized name:
721+
// some systems save build artifacts into content-addressed stores
722+
// that do not preserve extensions, and then link to them using
723+
// e.g. symbolic links. If we canonicalize too early, we resolve
724+
// the symlink, the file type is lost and we might treat rlibs and
725+
// rmetas as dylibs.
726+
letSome(file) = loc_orig.file_name().and_then(|s| s.to_str())else{
727+
returnErr(CrateError::ExternLocationNotFile(self.crate_name, loc_orig.clone()));
726728
};
727-
728-
if file.starts_with("lib") && (file.ends_with(".rlib") || file.ends_with(".rmeta"))
729-
|| file.starts_with(self.target.dll_prefix.as_ref())
730-
&& file.ends_with(self.target.dll_suffix.as_ref())
731-
{
732-
// Make sure there's at most one rlib and at most one dylib.
733-
// Note to take care and match against the non-canonicalized name:
734-
// some systems save build artifacts into content-addressed stores
735-
// that do not preserve extensions, and then link to them using
736-
// e.g. symbolic links. If we canonicalize too early, we resolve
737-
// the symlink, the file type is lost and we might treat rlibs and
738-
// rmetas as dylibs.
739-
let loc_canon = loc.canonicalized().clone();
740-
let loc = loc.original();
741-
if loc.file_name().unwrap().to_str().unwrap().ends_with(".rlib"){
742-
rlibs.insert(loc_canon,PathKind::ExternFlag);
743-
}elseif loc.file_name().unwrap().to_str().unwrap().ends_with(".rmeta"){
744-
rmetas.insert(loc_canon,PathKind::ExternFlag);
745-
}else{
746-
dylibs.insert(loc_canon,PathKind::ExternFlag);
729+
// FnMut cannot return reference to captured value, so references
730+
// must be taken outside the closure.
731+
let rlibs = &mut rlibs;
732+
let rmetas = &mut rmetas;
733+
let dylibs = &mut dylibs;
734+
let type_via_filename = (|| {
735+
if file.starts_with("lib"){
736+
if file.ends_with(".rlib"){
737+
returnSome(rlibs);
738+
}
739+
if file.ends_with(".rmeta"){
740+
returnSome(rmetas);
741+
}
742+
}
743+
let dll_prefix = self.target.dll_prefix.as_ref();
744+
let dll_suffix = self.target.dll_suffix.as_ref();
745+
if file.starts_with(dll_prefix) && file.ends_with(dll_suffix){
746+
returnSome(dylibs);
747+
}
748+
None
749+
})();
750+
match type_via_filename {
751+
Some(type_via_filename) => {
752+
type_via_filename.insert(loc_canon.clone(),PathKind::ExternFlag);
753+
}
754+
None => {
755+
self.crate_rejections
756+
.via_filename
757+
.push(CrateMismatch{path: loc_orig.clone(),got:String::new()});
747758
}
748-
}else{
749-
self.crate_rejections
750-
.via_filename
751-
.push(CrateMismatch{path: loc.original().clone(),got:String::new()});
752759
}
753760
}
754761

755762
// Extract the dylib/rlib/rmeta triple.
756-
Ok(self.extract_lib(rlibs, rmetas, dylibs)?.map(|(_, lib)| lib))
763+
self.extract_lib(rlibs, rmetas, dylibs).map(|opt| opt.map(|(_, lib)| lib))
757764
}
758765

759766
pub(crate)fninto_error(self,root:Option<CratePaths>) -> CrateError{

‎compiler/rustc_next_trait_solver/src/solve/trait_goals.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,8 @@ where
785785
letmut responses = vec![];
786786
// If the principal def ids match (or are both none), then we're not doing
787787
// trait upcasting. We're just removing auto traits (or shortening the lifetime).
788-
if a_data.principal_def_id() == b_data.principal_def_id(){
788+
let b_principal_def_id = b_data.principal_def_id();
789+
if a_data.principal_def_id() == b_principal_def_id || b_principal_def_id.is_none(){
789790
responses.extend(self.consider_builtin_upcast_to_principal(
790791
goal,
791792
CandidateSource::BuiltinImpl(BuiltinImplSource::Misc),

‎compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
10181018
// #2 (region bounds).
10191019
let principal_def_id_a = a_data.principal_def_id();
10201020
let principal_def_id_b = b_data.principal_def_id();
1021-
if principal_def_id_a == principal_def_id_b {
1021+
if principal_def_id_a == principal_def_id_b || principal_def_id_b.is_none(){
10221022
// We may upcast to auto traits that are either explicitly listed in
10231023
// the object type's bounds, or implied by the principal trait ref's
10241024
// supertraits.

‎compiler/rustc_trait_selection/src/traits/select/confirmation.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11531153
// We already checked the compatibility of auto traits within `assemble_candidates_for_unsizing`.
11541154
let iter = data_a
11551155
.principal()
1156+
.filter(|_| {
1157+
// optionally drop the principal, if we're unsizing to no principal
1158+
data_b.principal().is_some()
1159+
})
11561160
.map(|b| b.map_bound(ty::ExistentialPredicate::Trait))
11571161
.into_iter()
11581162
.chain(

‎library/Cargo.lock‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is automatically @generated by Cargo.
22
# It is not intended for manual editing.
3-
version = 3
3+
version = 4
44

55
[[package]]
66
name = "addr2line"
@@ -124,9 +124,9 @@ dependencies = [
124124

125125
[[package]]
126126
name = "gimli"
127-
version = "0.30.0"
127+
version = "0.31.1"
128128
source = "registry+https://github.com/rust-lang/crates.io-index"
129-
checksum = "e2e1d97fbe9722ba9bbd0c97051c2956e726562b61f86a25a4360398a40edfc9"
129+
checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
130130
dependencies = [
131131
"compiler_builtins",
132132
"rustc-std-workspace-alloc",
@@ -158,9 +158,9 @@ dependencies = [
158158

159159
[[package]]
160160
name = "libc"
161-
version = "0.2.159"
161+
version = "0.2.161"
162162
source = "registry+https://github.com/rust-lang/crates.io-index"
163-
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
163+
checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1"
164164
dependencies = [
165165
"rustc-std-workspace-core",
166166
]
@@ -406,12 +406,12 @@ dependencies = [
406406

407407
[[package]]
408408
name = "unwinding"
409-
version = "0.2.2"
409+
version = "0.2.3"
410410
source = "registry+https://github.com/rust-lang/crates.io-index"
411-
checksum = "dc55842d0db6329a669d55a623c674b02d677b16bfb2d24857d4089d41eba882"
411+
checksum = "637d511437df708cee34bdec7ba2f1548d256b7acf3ff20e0a1c559f9bf3a987"
412412
dependencies = [
413413
"compiler_builtins",
414-
"gimli 0.30.0",
414+
"gimli 0.31.1",
415415
"rustc-std-workspace-core",
416416
]
417417

‎library/core/src/macros/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ pub(crate) mod builtin {
15501550
/// MODE is any of Forward, Reverse, ForwardFirst, ReverseFirst.
15511551
/// INPUT_ACTIVITIES consists of one valid activity for each input parameter.
15521552
/// OUTPUT_ACTIVITY must not be set if we implicitely return nothing (or explicitely return
1553-
/// `-> ()`. Otherwise it must be set to one of the allowed activities.
1553+
/// `-> ()`). Otherwise it must be set to one of the allowed activities.
15541554
#[unstable(feature = "autodiff", issue = "124509")]
15551555
#[allow_internal_unstable(rustc_attrs)]
15561556
#[rustc_builtin_macro]

‎library/std/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ miniz_oxide = { version = "0.7.0", optional = true, default-features = false }
3939
addr2line = { version = "0.22.0", optional = true, default-features = false }
4040

4141
[target.'cfg(not(all(windows,target_env="msvc")))'.dependencies]
42-
libc = { version = "0.2.159", default-features = false, features = [
42+
libc = { version = "0.2.161", default-features = false, features = [
4343
'rustc-dep-of-std',
4444
], public = true }
4545

‎library/std/src/os/xous/ffi.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ pub(crate) fn thread_id() -> Result<ThreadId, Error> {
615615
/// An error is generated if the `knob` is not a valid limit, or if the call
616616
/// would not succeed.
617617
pub(crate)fnadjust_limit(knob:Limits,current:usize,new:usize) -> Result<usize,Error>{
618-
letmut a0 = Syscall::JoinThreadasusize;
618+
letmut a0 = Syscall::AdjustProcessLimitasusize;
619619
letmut a1 = knob asusize;
620620
let a2 = current;
621621
let a3 = new;

0 commit comments

Comments
 (0)