Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bc4b39c

Browse files
committedAug 29, 2022
Auto merge of rust-lang#101152 - Dylan-DPC:rollup-v4iw8ux, r=Dylan-DPC
Rollup of 8 pull requests Successful merges: - rust-lang#98304 (Add MaybeUninit memset test) - rust-lang#98801 (Add a `File::create_new` constructor) - rust-lang#99821 (Remove separate indexing of early-bound regions) - rust-lang#100239 (remove an ineffective check in const_prop) - rust-lang#100337 (Stabilize `std::io::read_to_string`) - rust-lang#100819 (Make use of `[wrapping_]byte_{add,sub}`) - rust-lang#100934 (Remove a panicking branch from `fmt::builders::PadAdapter`) - rust-lang#101000 (Separate CountIsStar from CountIsParam in rustc_parse_format.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents fcc2bdd + 0b6faca commit bc4b39c

File tree

44 files changed

+330
-534
lines changed

Some content is hidden

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

44 files changed

+330
-534
lines changed
 

‎compiler/rustc_arena/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#![feature(maybe_uninit_slice)]
1717
#![feature(min_specialization)]
1818
#![feature(decl_macro)]
19+
#![feature(pointer_byte_offsets)]
1920
#![feature(rustc_attrs)]
2021
#![cfg_attr(test, feature(test))]
2122
#![feature(strict_provenance)]
@@ -211,7 +212,7 @@ impl<T> TypedArena<T> {
211212

212213
unsafe {
213214
if mem::size_of::<T>() == 0 {
214-
self.ptr.set((self.ptr.get() as *mut u8).wrapping_offset(1) as *mut T);
215+
self.ptr.set(self.ptr.get().wrapping_byte_add(1));
215216
let ptr = ptr::NonNull::<T>::dangling().as_ptr();
216217
// Don't drop the object. This `write` is equivalent to `forget`.
217218
ptr::write(ptr, object);

‎compiler/rustc_builtin_macros/src/format.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ impl<'a, 'b> Context<'a, 'b> {
541541
) {
542542
match c {
543543
parse::CountImplied | parse::CountIs(..) => {}
544-
parse::CountIsParam(i) => {
544+
parse::CountIsParam(i) | parse::CountIsStar(i) => {
545545
self.unused_names_lint.maybe_add_positional_named_arg(
546546
self.args.get(i),
547547
named_arg_type,
@@ -589,7 +589,7 @@ impl<'a, 'b> Context<'a, 'b> {
589589
+ self
590590
.arg_with_formatting
591591
.iter()
592-
.filter(|fmt| matches!(fmt.precision, parse::CountIsParam(_)))
592+
.filter(|fmt| matches!(fmt.precision, parse::CountIsStar(_)))
593593
.count();
594594
if self.names.is_empty() && !numbered_position_args && count != self.num_args() {
595595
e = self.ecx.struct_span_err(
@@ -639,7 +639,7 @@ impl<'a, 'b> Context<'a, 'b> {
639639
if let Some(span) = fmt.precision_span {
640640
let span = self.fmtsp.from_inner(InnerSpan::new(span.start, span.end));
641641
match fmt.precision {
642-
parse::CountIsParam(pos) if pos > self.num_args() => {
642+
parse::CountIsParam(pos) if pos >= self.num_args() => {
643643
e.span_label(
644644
span,
645645
&format!(
@@ -651,12 +651,12 @@ impl<'a, 'b> Context<'a, 'b> {
651651
);
652652
zero_based_note = true;
653653
}
654-
parse::CountIsParam(pos) => {
654+
parse::CountIsStar(pos) => {
655655
let count = self.pieces.len()
656656
+ self
657657
.arg_with_formatting
658658
.iter()
659-
.filter(|fmt| matches!(fmt.precision, parse::CountIsParam(_)))
659+
.filter(|fmt| matches!(fmt.precision, parse::CountIsStar(_)))
660660
.count();
661661
e.span_label(
662662
span,
@@ -837,7 +837,7 @@ impl<'a, 'b> Context<'a, 'b> {
837837
};
838838
match c {
839839
parse::CountIs(i) => count(sym::Is, Some(self.ecx.expr_usize(sp, i))),
840-
parse::CountIsParam(i) => {
840+
parse::CountIsParam(i) | parse::CountIsStar(i) => {
841841
// This needs mapping too, as `i` is referring to a macro
842842
// argument. If `i` is not found in `count_positions` then
843843
// the error had already been emitted elsewhere.

0 commit comments

Comments
 (0)
This repository has been archived.