Skip to content

Commit 1bd4fdc

Browse files
committed
Auto merge of #92811 - matthiaskrgr:rollup-wrctcef, r=matthiaskrgr
Rollup of 14 pull requests Successful merges: - #92328 (Tweak sentence in `transmute` docs) - #92432 (Error when selected impl is not const in constck) - #92506 (Document Box<T> FFI guarantee in 1.41.0 release notes) - #92699 (rustdoc: Display "private fields" instead of "fields omitted") - #92703 (RELEASES.md: Add 1.58 release note for `File::options` stabilization) - #92707 (Extended the note on the use of `no_run` attribute) - #92709 (Improve documentation for File::options to give a more likely example) - #92720 (Fix doc formatting for time.rs) - #92732 (Add note about upstream commit musl-patch-configure.diff is derived from) - #92742 (Add missing suffix for sidebar-items script path) - #92748 (Eliminate "boxed" wording in `std::error::Error` documentation) - #92754 (Update AsmArgs field visibility for rustfmt) - #92756 (:arrow_up: rust-analyzer) - #92764 (Fix rust logo style) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 72e74d7 + 05dd1e4 commit 1bd4fdc

File tree

22 files changed

+158
-36
lines changed

22 files changed

+158
-36
lines changed

RELEASES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Stabilized APIs
4444
- [`Result::unwrap_unchecked`]
4545
- [`Result::unwrap_err_unchecked`]
4646
- [`NonZero{unsigned}::is_power_of_two`]
47+
- [`File::options`]
4748

4849
These APIs are now usable in const contexts:
4950

@@ -141,6 +142,7 @@ and related tools.
141142
[`Result::unwrap_unchecked`]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.unwrap_unchecked
142143
[`Result::unwrap_err_unchecked`]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.unwrap_err_unchecked
143144
[`NonZero{unsigned}::is_power_of_two`]: https://doc.rust-lang.org/stable/std/num/struct.NonZeroU8.html#method.is_power_of_two
145+
[`File::options`]: https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.options
144146
[`unix::process::ExitStatusExt::core_dumped`]: https://doc.rust-lang.org/stable/std/os/unix/process/trait.ExitStatusExt.html#tymethod.core_dumped
145147
[`unix::process::ExitStatusExt::stopped_signal`]: https://doc.rust-lang.org/stable/std/os/unix/process/trait.ExitStatusExt.html#tymethod.stopped_signal
146148
[`unix::process::ExitStatusExt::continued`]: https://doc.rust-lang.org/stable/std/os/unix/process/trait.ExitStatusExt.html#tymethod.continued
@@ -2588,6 +2590,11 @@ Language
25882590
- [Visibility modifiers (e.g. `pub`) are now syntactically allowed on trait items and
25892591
enum variants.][66183] These are still rejected semantically, but
25902592
can be seen and parsed by procedural macros and conditional compilation.
2593+
- [You can now define a Rust `extern "C"` function with `Box<T>` and use `T*` as the corresponding
2594+
type on the C side.][62514] Please see [the documentation][box-memory-layout] for more information,
2595+
including the important caveat about preferring to avoid `Box<T>` in Rust signatures for functions defined in C.
2596+
2597+
[box-memory-layout]: https://doc.rust-lang.org/std/boxed/index.html#memory-layout
25912598

25922599
Compiler
25932600
--------
@@ -2662,6 +2669,7 @@ Compatibility Notes
26622669

26632670
[54733]: https://github.com/rust-lang/rust/pull/54733/
26642671
[61351]: https://github.com/rust-lang/rust/pull/61351/
2672+
[62514]: https://github.com/rust-lang/rust/pull/62514/
26652673
[67255]: https://github.com/rust-lang/rust/pull/67255/
26662674
[66661]: https://github.com/rust-lang/rust/pull/66661/
26672675
[66771]: https://github.com/rust-lang/rust/pull/66771/

compiler/rustc_builtin_macros/src/asm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ use rustc_target::asm::InlineAsmArch;
1616
use smallvec::smallvec;
1717

1818
pub struct AsmArgs {
19-
templates: Vec<P<ast::Expr>>,
20-
operands: Vec<(ast::InlineAsmOperand, Span)>,
19+
pub templates: Vec<P<ast::Expr>>,
20+
pub operands: Vec<(ast::InlineAsmOperand, Span)>,
2121
named_args: FxHashMap<Symbol, usize>,
2222
reg_args: FxHashSet<usize>,
23-
clobber_abis: Vec<(Symbol, Span)>,
23+
pub clobber_abis: Vec<(Symbol, Span)>,
2424
options: ast::InlineAsmOptions,
25-
options_spans: Vec<Span>,
25+
pub options_spans: Vec<Span>,
2626
}
2727

2828
fn parse_args<'a>(

compiler/rustc_const_eval/src/transform/check_consts/check.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
810810
param_env,
811811
Binder::dummy(TraitPredicate {
812812
trait_ref,
813-
constness: ty::BoundConstness::ConstIfConst,
813+
constness: ty::BoundConstness::NotConst,
814814
polarity: ty::ImplPolarity::Positive,
815815
}),
816816
);
@@ -829,6 +829,10 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
829829
return;
830830
}
831831
Ok(Some(ImplSource::UserDefined(data))) => {
832+
if let hir::Constness::NotConst = tcx.impl_constness(data.impl_def_id) {
833+
self.check_op(ops::FnCallNonConst(None));
834+
return;
835+
}
832836
let callee_name = tcx.item_name(callee);
833837
if let Some(&did) = tcx
834838
.associated_item_def_ids(data.impl_def_id)

library/core/src/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ extern "rust-intrinsic" {
961961
/// Below are common applications of `transmute` which can be replaced with safer
962962
/// constructs.
963963
///
964-
/// Turning raw bytes(`&[u8]`) to `u32`, `f64`, etc.:
964+
/// Turning raw bytes (`&[u8]`) into `u32`, `f64`, etc.:
965965
///
966966
/// ```
967967
/// let raw_bytes = [0x78, 0x56, 0x34, 0x12];

library/std/src/error.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -606,21 +606,21 @@ impl Error for time::FromSecsError {}
606606

607607
// Copied from `any.rs`.
608608
impl dyn Error + 'static {
609-
/// Returns `true` if the boxed type is the same as `T`
609+
/// Returns `true` if the inner type is the same as `T`.
610610
#[stable(feature = "error_downcast", since = "1.3.0")]
611611
#[inline]
612612
pub fn is<T: Error + 'static>(&self) -> bool {
613613
// Get `TypeId` of the type this function is instantiated with.
614614
let t = TypeId::of::<T>();
615615

616-
// Get `TypeId` of the type in the trait object.
617-
let boxed = self.type_id(private::Internal);
616+
// Get `TypeId` of the type in the trait object (`self`).
617+
let concrete = self.type_id(private::Internal);
618618

619619
// Compare both `TypeId`s on equality.
620-
t == boxed
620+
t == concrete
621621
}
622622

623-
/// Returns some reference to the boxed value if it is of type `T`, or
623+
/// Returns some reference to the inner value if it is of type `T`, or
624624
/// `None` if it isn't.
625625
#[stable(feature = "error_downcast", since = "1.3.0")]
626626
#[inline]
@@ -632,7 +632,7 @@ impl dyn Error + 'static {
632632
}
633633
}
634634

635-
/// Returns some mutable reference to the boxed value if it is of type `T`, or
635+
/// Returns some mutable reference to the inner value if it is of type `T`, or
636636
/// `None` if it isn't.
637637
#[stable(feature = "error_downcast", since = "1.3.0")]
638638
#[inline]

library/std/src/fs.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,10 @@ impl File {
356356
/// open or create a file with specific options if `open()` or `create()`
357357
/// are not appropriate.
358358
///
359-
/// It is equivalent to `OpenOptions::new()` but allows you to write more
360-
/// readable code. Instead of `OpenOptions::new().read(true).open("foo.txt")`
361-
/// you can write `File::options().read(true).open("foo.txt")`. This
359+
/// It is equivalent to `OpenOptions::new()`, but allows you to write more
360+
/// readable code. Instead of
361+
/// `OpenOptions::new().append(true).open("example.log")`,
362+
/// you can write `File::options().append(true).open("example.log")`. This
362363
/// also avoids the need to import `OpenOptions`.
363364
///
364365
/// See the [`OpenOptions::new`] function for more details.
@@ -369,7 +370,7 @@ impl File {
369370
/// use std::fs::File;
370371
///
371372
/// fn main() -> std::io::Result<()> {
372-
/// let mut f = File::options().read(true).open("foo.txt")?;
373+
/// let mut f = File::options().append(true).open("example.log")?;
373374
/// Ok(())
374375
/// }
375376
/// ```

library/std/src/time.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub use core::time::FromSecsError;
5454
/// instant when created, and are often useful for tasks such as measuring
5555
/// benchmarks or timing how long an operation takes.
5656
///
57-
/// Note, however, that instants are not guaranteed to be **steady**. In other
57+
/// Note, however, that instants are **not** guaranteed to be **steady**. In other
5858
/// words, each tick of the underlying clock might not be the same length (e.g.
5959
/// some seconds may be longer than others). An instant may jump forwards or
6060
/// experience time dilation (slow down or speed up), but it will never go

src/ci/docker/scripts/musl-toolchain.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ cd musl-cross-make
4848
git checkout a54eb56f33f255dfca60be045f12a5cfaf5a72a9
4949

5050
# Fix the cfi detection script in musl's configure so cfi is generated
51-
# when debug info is asked for.
51+
# when debug info is asked for. This patch is derived from
52+
# https://git.musl-libc.org/cgit/musl/commit/?id=c4d4028dde90562f631edf559fbc42d8ec1b29de.
53+
# When we upgrade to a version that includes this commit, we can remove the patch.
5254
mkdir patches/musl-1.1.24
5355
cp ../musl-patch-configure.diff patches/musl-1.1.24/0001-fix-cfi-detection.diff
5456

src/doc/rustdoc/src/documentation-tests.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,8 @@ panic during execution. If the code doesn't panic, the test will fail.
335335
The `no_run` attribute will compile your code but not run it. This is
336336
important for examples such as "Here's how to retrieve a web page,"
337337
which you would want to ensure compiles, but might be run in a test
338-
environment that has no network access.
338+
environment that has no network access. This attribute can also be
339+
used to demonstrate code snippets that can cause Undefined Behavior.
339340

340341
```rust
341342
/// ```no_run

src/librustdoc/html/render/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
665665
_ => unreachable!(),
666666
};
667667
let items = self.build_sidebar_items(module);
668-
let js_dst = self.dst.join("sidebar-items.js");
668+
let js_dst = self.dst.join(&format!("sidebar-items{}.js", self.shared.resource_suffix));
669669
let v = format!("initSidebarItems({});", serde_json::to_string(&items).unwrap());
670670
scx.fs.write(js_dst, v)?;
671671
}

0 commit comments

Comments
 (0)