Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 28, 2025. It is now read-only.
/rustPublic archive
forked fromrust-lang/rust

Commitecebe68

Browse files
committed
Auto merge ofrust-lang#127096 - matthiaskrgr:rollup-kh7e0rh, r=matthiaskrgr
Rollup of 11 pull requestsSuccessful merges: -rust-lang#123714 (Add test for fn pointer duplication.) -rust-lang#124091 (Update AST validation module docs) -rust-lang#127015 (Switch back `non_local_definitions` lint to allow-by-default) -rust-lang#127016 (docs: check if the disambiguator matches its suffix) -rust-lang#127029 (Fix Markdown tables in platform-support.md) -rust-lang#127032 (Enable const casting for `f16` and `f128`) -rust-lang#127055 (Mark Hasher::finish as #[must_use]) -rust-lang#127068 (Stall computing instance for drop shim until it has no unsubstituted const params) -rust-lang#127070 (add () to the marker_impls macro for ConstParamTy) -rust-lang#127071 (Remove (deprecated & unstable) {to,from}_bits pointer methods) -rust-lang#127078 (Enable full tools and profiler for LoongArch Linux targets)r? `@ghost``@rustbot` modify labels: rollup
2 parentse9e6e2e +f37272d commitecebe68

File tree

45 files changed

+830
-262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+830
-262
lines changed

‎compiler/rustc_ast_passes/src/ast_validation.rs‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
// Validate AST before lowering it to HIR.
2-
//
3-
// This pass is supposed to catch things that fit into AST data structures,
4-
// but not permitted by the language. It runs after expansion when AST is frozen,
5-
// so it can check for erroneous constructions produced by syntax extensions.
6-
// This pass is supposed to perform only simple checks not requiring name resolution
7-
// or type checking or some other kind of complex analysis.
1+
//! Validate AST before lowering it to HIR.
2+
//!
3+
//! This pass intends to check that the constructed AST is *syntactically valid* to allow the rest
4+
//! of the compiler to assume that the AST is valid. These checks cannot be performed during parsing
5+
//! because attribute macros are allowed to accept certain pieces of invalid syntax such as a
6+
//! function without body outside of a trait definition:
7+
//!
8+
//! ```ignore (illustrative)
9+
//! #[my_attribute]
10+
//! mod foo {
11+
//! fn missing_body();
12+
//! }
13+
//! ```
14+
//!
15+
//! These checks are run post-expansion, after AST is frozen, to be able to check for erroneous
16+
//! constructions produced by proc macros. This pass is only intended for simple checks that do not
17+
//! require name resolution or type checking, or other kinds of complex analysis.
818
919
use itertools::{Either,Itertools};
1020
use rustc_ast::ptr::P;

‎compiler/rustc_const_eval/src/interpret/cast.rs‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::assert_matches::assert_matches;
22

3-
use rustc_apfloat::ieee::{Double,Single};
3+
use rustc_apfloat::ieee::{Double,Half,Quad,Single};
44
use rustc_apfloat::{Float,FloatConvert};
55
use rustc_middle::mir::interpret::{InterpResult,PointerArithmetic,Scalar};
66
use rustc_middle::mir::CastKind;
@@ -187,10 +187,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
187187
bug!("FloatToFloat/FloatToInt cast: source type {} is not a float type", src.layout.ty)
188188
};
189189
let val =match fty{
190-
FloatTy::F16 =>unimplemented!("f16_f128"),
190+
FloatTy::F16 =>self.cast_from_float(src.to_scalar().to_f16()?, cast_to.ty),
191191
FloatTy::F32 =>self.cast_from_float(src.to_scalar().to_f32()?, cast_to.ty),
192192
FloatTy::F64 =>self.cast_from_float(src.to_scalar().to_f64()?, cast_to.ty),
193-
FloatTy::F128 =>unimplemented!("f16_f128"),
193+
FloatTy::F128 =>self.cast_from_float(src.to_scalar().to_f128()?, cast_to.ty),
194194
};
195195
Ok(ImmTy::from_scalar(val, cast_to))
196196
}
@@ -296,18 +296,18 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
296296
Float(fty)if signed =>{
297297
let v = vasi128;
298298
match fty{
299-
FloatTy::F16 =>unimplemented!("f16_f128"),
299+
FloatTy::F16 =>Scalar::from_f16(Half::from_i128(v).value),
300300
FloatTy::F32 =>Scalar::from_f32(Single::from_i128(v).value),
301301
FloatTy::F64 =>Scalar::from_f64(Double::from_i128(v).value),
302-
FloatTy::F128 =>unimplemented!("f16_f128"),
302+
FloatTy::F128 =>Scalar::from_f128(Quad::from_i128(v).value),
303303
}
304304
}
305305
// unsigned int -> float
306306
Float(fty) =>match fty{
307-
FloatTy::F16 =>unimplemented!("f16_f128"),
307+
FloatTy::F16 =>Scalar::from_f16(Half::from_u128(v).value),
308308
FloatTy::F32 =>Scalar::from_f32(Single::from_u128(v).value),
309309
FloatTy::F64 =>Scalar::from_f64(Double::from_u128(v).value),
310-
FloatTy::F128 =>unimplemented!("f16_f128"),
310+
FloatTy::F128 =>Scalar::from_f128(Quad::from_u128(v).value),
311311
},
312312

313313
// u8 -> char
@@ -321,7 +321,12 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
321321
/// Low-level cast helper function. Converts an apfloat `f` into int or float types.
322322
fncast_from_float<F>(&self,f:F,dest_ty:Ty<'tcx>) ->Scalar<M::Provenance>
323323
where
324-
F:Float +Into<Scalar<M::Provenance>> +FloatConvert<Single> +FloatConvert<Double>,
324+
F:Float
325+
+Into<Scalar<M::Provenance>>
326+
+FloatConvert<Half>
327+
+FloatConvert<Single>
328+
+FloatConvert<Double>
329+
+FloatConvert<Quad>,
325330
{
326331
use rustc_type_ir::TyKind::*;
327332

@@ -358,10 +363,12 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
358363
}
359364
// float -> float
360365
Float(fty) =>match fty{
361-
FloatTy::F16 =>unimplemented!("f16_f128"),
366+
FloatTy::F16 =>Scalar::from_f16(adjust_nan(self, f, f.convert(&mutfalse).value)),
362367
FloatTy::F32 =>Scalar::from_f32(adjust_nan(self, f, f.convert(&mutfalse).value)),
363368
FloatTy::F64 =>Scalar::from_f64(adjust_nan(self, f, f.convert(&mutfalse).value)),
364-
FloatTy::F128 =>unimplemented!("f16_f128"),
369+
FloatTy::F128 =>{
370+
Scalar::from_f128(adjust_nan(self, f, f.convert(&mutfalse).value))
371+
}
365372
},
366373
// That's it.
367374
_ =>span_bug!(self.cur_span(),"invalid float to {} cast", dest_ty),

‎compiler/rustc_lint/src/non_local_def.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ declare_lint! {
5050
/// All nested bodies (functions, enum discriminant, array length, consts) (expect for
5151
/// `const _: Ty = { ... }` in top-level module, which is still undecided) are checked.
5252
pubNON_LOCAL_DEFINITIONS,
53-
Warn,
53+
Allow,
5454
"checks for non-local definitions",
5555
report_in_external_macro
5656
}

‎compiler/rustc_mir_transform/src/inline.rs‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs}
1111
use rustc_middle::mir::visit::*;
1212
use rustc_middle::mir::*;
1313
use rustc_middle::ty::TypeVisitableExt;
14-
use rustc_middle::ty::{self,Instance,InstanceKind,ParamEnv,Ty,TyCtxt};
14+
use rustc_middle::ty::{self,Instance,InstanceKind,ParamEnv,Ty,TyCtxt,TypeFlags};
1515
use rustc_session::config::{DebugInfo,OptLevel};
1616
use rustc_span::source_map::Spanned;
1717
use rustc_span::sym;
@@ -306,6 +306,16 @@ impl<'tcx> Inliner<'tcx> {
306306
InstanceKind::Intrinsic(_) |InstanceKind::Virtual(..) =>{
307307
returnErr("instance without MIR (intrinsic / virtual)");
308308
}
309+
310+
// FIXME(#127030): `ConstParamHasTy` has bad interactions with
311+
// the drop shim builder, which does not evaluate predicates in
312+
// the correct param-env for types being dropped. Stall resolving
313+
// the MIR for this instance until all of its const params are
314+
// substituted.
315+
InstanceKind::DropGlue(_,Some(ty))if ty.has_type_flags(TypeFlags::HAS_CT_PARAM) =>{
316+
returnErr("still needs substitution");
317+
}
318+
309319
// This cannot result in an immediate cycle since the callee MIR is a shim, which does
310320
// not get any optimizations run on it. Any subsequent inlining may cause cycles, but we
311321
// do not need to catch this here, we can wait until the inliner decides to continue

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ pub trait Hasher {
334334
///
335335
/// [`write`]: Hasher::write
336336
#[stable(feature ="rust1", since ="1.0.0")]
337+
#[must_use]
337338
fnfinish(&self) ->u64;
338339

339340
/// Writes some data into this `Hasher`.

‎library/core/src/marker.rs‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -996,15 +996,12 @@ marker_impls! {
996996
bool,
997997
char,
998998
str/* Technically requires `[u8]: ConstParamTy` */,
999+
(),
9991000
{T:ConstParamTy,constN:usize}[T;N],
10001001
{T:ConstParamTy}[T],
10011002
{T: ?Sized +ConstParamTy}&T,
10021003
}
10031004

1004-
// FIXME(adt_const_params): Add to marker_impls call above once not in bootstrap
1005-
#[unstable(feature ="adt_const_params", issue ="95174")]
1006-
implConstParamTyfor(){}
1007-
10081005
/// A common trait implemented by all function pointers.
10091006
#[unstable(
10101007
feature ="fn_ptr_trait",

‎library/core/src/ptr/const_ptr.rs‎

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -112,71 +112,6 @@ impl<T: ?Sized> *const T {
112112
selfas_
113113
}
114114

115-
/// Casts a pointer to its raw bits.
116-
///
117-
/// This is equivalent to `as usize`, but is more specific to enhance readability.
118-
/// The inverse method is [`from_bits`](#method.from_bits).
119-
///
120-
/// In particular, `*p as usize` and `p as usize` will both compile for
121-
/// pointers to numeric types but do very different things, so using this
122-
/// helps emphasize that reading the bits was intentional.
123-
///
124-
/// # Examples
125-
///
126-
/// ```
127-
/// #![feature(ptr_to_from_bits)]
128-
/// # #[cfg(not(miri))] { // doctest does not work with strict provenance
129-
/// let array = [13, 42];
130-
/// let p0: *const i32 = &array[0];
131-
/// assert_eq!(<*const _>::from_bits(p0.to_bits()), p0);
132-
/// let p1: *const i32 = &array[1];
133-
/// assert_eq!(p1.to_bits() - p0.to_bits(), 4);
134-
/// # }
135-
/// ```
136-
#[unstable(feature ="ptr_to_from_bits", issue ="91126")]
137-
#[deprecated(
138-
since ="1.67.0",
139-
note ="replaced by the `expose_provenance` method, or update your code\
140-
to follow the strict provenance rules using its APIs"
141-
)]
142-
#[inline(always)]
143-
pubfnto_bits(self) ->usize
144-
where
145-
T:Sized,
146-
{
147-
selfasusize
148-
}
149-
150-
/// Creates a pointer from its raw bits.
151-
///
152-
/// This is equivalent to `as *const T`, but is more specific to enhance readability.
153-
/// The inverse method is [`to_bits`](#method.to_bits).
154-
///
155-
/// # Examples
156-
///
157-
/// ```
158-
/// #![feature(ptr_to_from_bits)]
159-
/// # #[cfg(not(miri))] { // doctest does not work with strict provenance
160-
/// use std::ptr::NonNull;
161-
/// let dangling: *const u8 = NonNull::dangling().as_ptr();
162-
/// assert_eq!(<*const u8>::from_bits(1), dangling);
163-
/// # }
164-
/// ```
165-
#[unstable(feature ="ptr_to_from_bits", issue ="91126")]
166-
#[deprecated(
167-
since ="1.67.0",
168-
note ="replaced by the `ptr::with_exposed_provenance` function, or update\
169-
your code to follow the strict provenance rules using its APIs"
170-
)]
171-
#[allow(fuzzy_provenance_casts)]// this is an unstable and semi-deprecated cast function
172-
#[inline(always)]
173-
pubfnfrom_bits(bits:usize) ->Self
174-
where
175-
T:Sized,
176-
{
177-
bitsasSelf
178-
}
179-
180115
/// Gets the "address" portion of the pointer.
181116
///
182117
/// This is similar to `self as usize`, which semantically discards *provenance* and

‎library/core/src/ptr/mut_ptr.rs‎

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -117,72 +117,6 @@ impl<T: ?Sized> *mut T {
117117
selfas_
118118
}
119119

120-
/// Casts a pointer to its raw bits.
121-
///
122-
/// This is equivalent to `as usize`, but is more specific to enhance readability.
123-
/// The inverse method is [`from_bits`](pointer#method.from_bits-1).
124-
///
125-
/// In particular, `*p as usize` and `p as usize` will both compile for
126-
/// pointers to numeric types but do very different things, so using this
127-
/// helps emphasize that reading the bits was intentional.
128-
///
129-
/// # Examples
130-
///
131-
/// ```
132-
/// #![feature(ptr_to_from_bits)]
133-
/// # #[cfg(not(miri))] { // doctest does not work with strict provenance
134-
/// let mut array = [13, 42];
135-
/// let mut it = array.iter_mut();
136-
/// let p0: *mut i32 = it.next().unwrap();
137-
/// assert_eq!(<*mut _>::from_bits(p0.to_bits()), p0);
138-
/// let p1: *mut i32 = it.next().unwrap();
139-
/// assert_eq!(p1.to_bits() - p0.to_bits(), 4);
140-
/// }
141-
/// ```
142-
#[unstable(feature ="ptr_to_from_bits", issue ="91126")]
143-
#[deprecated(
144-
since ="1.67.0",
145-
note ="replaced by the `expose_provenance` method, or update your code\
146-
to follow the strict provenance rules using its APIs"
147-
)]
148-
#[inline(always)]
149-
pubfnto_bits(self) ->usize
150-
where
151-
T:Sized,
152-
{
153-
selfasusize
154-
}
155-
156-
/// Creates a pointer from its raw bits.
157-
///
158-
/// This is equivalent to `as *mut T`, but is more specific to enhance readability.
159-
/// The inverse method is [`to_bits`](pointer#method.to_bits-1).
160-
///
161-
/// # Examples
162-
///
163-
/// ```
164-
/// #![feature(ptr_to_from_bits)]
165-
/// # #[cfg(not(miri))] { // doctest does not work with strict provenance
166-
/// use std::ptr::NonNull;
167-
/// let dangling: *mut u8 = NonNull::dangling().as_ptr();
168-
/// assert_eq!(<*mut u8>::from_bits(1), dangling);
169-
/// }
170-
/// ```
171-
#[unstable(feature ="ptr_to_from_bits", issue ="91126")]
172-
#[deprecated(
173-
since ="1.67.0",
174-
note ="replaced by the `ptr::with_exposed_provenance_mut` function, or\
175-
update your code to follow the strict provenance rules using its APIs"
176-
)]
177-
#[allow(fuzzy_provenance_casts)]// this is an unstable and semi-deprecated cast function
178-
#[inline(always)]
179-
pubfnfrom_bits(bits:usize) ->Self
180-
where
181-
T:Sized,
182-
{
183-
bitsasSelf
184-
}
185-
186120
/// Gets the "address" portion of the pointer.
187121
///
188122
/// This is similar to `self as usize`, which semantically discards *provenance* and

‎src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,10 @@ ENV CC_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-gcc \
2525

2626
ENV HOSTS=loongarch64-unknown-linux-gnu
2727

28-
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
28+
ENV RUST_CONFIGURE_ARGS \
29+
--enable-extended \
30+
--enable-full-tools \
31+
--enable-profiler \
32+
--disable-docs
33+
2934
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS

‎src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ ENV HOSTS=loongarch64-unknown-linux-musl
2727

2828
ENV RUST_CONFIGURE_ARGS \
2929
--enable-extended \
30-
--enable-lld \
30+
--enable-full-tools \
31+
--enable-profiler \
3132
--disable-docs \
3233
--set target.loongarch64-unknown-linux-musl.crt-static=false \
3334
--musl-root-loongarch64=/x-tools/loongarch64-unknown-linux-musl/loongarch64-unknown-linux-musl/sysroot/usr

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp