Skip to content

Commit 3cf5fc5

Browse files
committed
Auto merge of #102995 - JohnTitor:rollup-yomkwge, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #102641 (Support casting boxes to dyn*) - #102836 (rustc_target: Fix json target specs using LLD linker flavors in link args) - #102949 (should-skip-this: add missing backslash) - #102967 (Add test for issue 102964) - #102971 (tidy: error if a lang feature is already present) - #102974 (Fix small word dupe typos) - #102980 (rustdoc: merge separate `.item-info` CSS) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 2a92176 + e802936 commit 3cf5fc5

File tree

25 files changed

+226
-159
lines changed

25 files changed

+226
-159
lines changed

Diff for: compiler/rustc_codegen_ssa/src/mir/rvalue.rs

+9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use rustc_middle::ty::cast::{CastTy, IntTy};
1414
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
1515
use rustc_middle::ty::{self, adjustment::PointerCast, Instance, Ty, TyCtxt};
1616
use rustc_span::source_map::{Span, DUMMY_SP};
17+
use rustc_target::abi::Size;
1718

1819
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1920
#[instrument(level = "trace", skip(self, bx))]
@@ -285,6 +286,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
285286
bug!("Only valid to do a DynStar cast into a DynStar type")
286287
};
287288
let vtable = get_vtable(bx.cx(), source.ty(self.mir, bx.tcx()), trait_ref);
289+
let vtable = bx.pointercast(vtable, bx.cx().type_ptr_to(bx.cx().type_isize()));
290+
// FIXME(dyn-star): this is probably not the best way to check if this is
291+
// a pointer, and really we should ensure that the value is a suitable
292+
// pointer earlier in the compilation process.
293+
let data = match operand.layout.pointee_info_at(bx.cx(), Size::ZERO) {
294+
Some(_) => bx.ptrtoint(data, bx.cx().type_isize()),
295+
None => data,
296+
};
288297
OperandValue::Pair(data, vtable)
289298
}
290299
mir::CastKind::Pointer(

Diff for: compiler/rustc_error_codes/src/error_codes/E0591.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ unsafe {
5353
```
5454

5555
Here, transmute is being used to convert the types of the fn arguments.
56-
This pattern is incorrect because, because the type of `foo` is a function
57-
**item** (`typeof(foo)`), which is zero-sized, and the target type (`fn()`)
56+
This pattern is incorrect because the type of `foo` is a function **item**
57+
(`typeof(foo)`), which is zero-sized, and the target type (`fn()`)
5858
is a function pointer, which is not zero-sized.
5959
This pattern should be rewritten. There are a few possible ways to do this:
6060

Diff for: compiler/rustc_infer/src/infer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ impl<'tcx> InferCtxt<'tcx> {
12831283
assert!(old_value.is_none());
12841284
}
12851285

1286-
/// Process the region constraints and return any any errors that
1286+
/// Process the region constraints and return any errors that
12871287
/// result. After this, no more unification operations should be
12881288
/// done -- or the compiler will panic -- but it is legal to use
12891289
/// `resolve_vars_if_possible` as well as `fully_resolve`.

Diff for: compiler/rustc_target/src/spec/mod.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -1739,11 +1739,15 @@ impl TargetOptions {
17391739
self.lld_flavor_json,
17401740
self.linker_is_gnu_json,
17411741
);
1742-
match linker_flavor {
1743-
LinkerFlavor::Gnu(_, Lld::Yes)
1744-
| LinkerFlavor::Darwin(_, Lld::Yes)
1745-
| LinkerFlavor::Msvc(Lld::Yes) => {}
1746-
_ => add_link_args_iter(args, linker_flavor, args_json.iter().cloned()),
1742+
// Normalize to no lld to avoid asserts.
1743+
let linker_flavor = match linker_flavor {
1744+
LinkerFlavor::Gnu(cc, _) => LinkerFlavor::Gnu(cc, Lld::No),
1745+
LinkerFlavor::Darwin(cc, _) => LinkerFlavor::Darwin(cc, Lld::No),
1746+
LinkerFlavor::Msvc(_) => LinkerFlavor::Msvc(Lld::No),
1747+
_ => linker_flavor,
1748+
};
1749+
if !args.contains_key(&linker_flavor) {
1750+
add_link_args_iter(args, linker_flavor, args_json.iter().cloned());
17471751
}
17481752
}
17491753
}

Diff for: library/std/src/io/error/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn test_errorkind_packing() {
8686
assert_eq!(Error::from(ErrorKind::NotFound).kind(), ErrorKind::NotFound);
8787
assert_eq!(Error::from(ErrorKind::PermissionDenied).kind(), ErrorKind::PermissionDenied);
8888
assert_eq!(Error::from(ErrorKind::Uncategorized).kind(), ErrorKind::Uncategorized);
89-
// Check that the innards look like like what we want.
89+
// Check that the innards look like what we want.
9090
assert_matches!(
9191
Error::from(ErrorKind::OutOfMemory).repr.data(),
9292
ErrorData::Simple(ErrorKind::OutOfMemory),

Diff for: library/std/src/sys/unix/kernel_copy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
//! Since those syscalls have requirements that cannot be fully checked in advance and
2121
//! gathering additional information about file descriptors would require additional syscalls
2222
//! anyway it simply attempts to use them one after another (guided by inaccurate hints) to
23-
//! figure out which one works and and falls back to the generic read-write copy loop if none of them
23+
//! figure out which one works and falls back to the generic read-write copy loop if none of them
2424
//! does.
2525
//! Once a working syscall is found for a pair of file descriptors it will be called in a loop
2626
//! until the copy operation is completed.

Diff for: src/ci/scripts/should-skip-this.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if [[ -n "${CI_ONLY_WHEN_SUBMODULES_CHANGED-}" ]]; then
1919
# those files are present in the diff a submodule was updated.
2020
echo "Submodules were updated"
2121
elif ! (git diff --quiet "$BASE_COMMIT" -- \
22-
src/tools/clippy src/tools/rustfmt src/tools/miri
22+
src/tools/clippy src/tools/rustfmt src/tools/miri \
2323
library/std/src/sys); then
2424
# There is not an easy blanket search for subtrees. For now, manually list
2525
# the subtrees.

Diff for: src/librustdoc/html/static/css/rustdoc.css

+3-6
Original file line numberDiff line numberDiff line change
@@ -692,16 +692,13 @@ pre, .rustdoc.source .example-wrap {
692692

693693
.item-info {
694694
display: block;
695+
margin-left: 24px;
695696
}
696697

697-
.content .item-info code {
698+
.item-info code {
698699
font-size: 0.875rem;
699700
}
700701

701-
.content .item-info {
702-
margin-left: 24px;
703-
}
704-
705702
#main-content > .item-info {
706703
margin-top: 0;
707704
margin-left: 0;
@@ -1945,7 +1942,7 @@ in storage.js plus the media query with (min-width: 701px)
19451942
}
19461943

19471944
/* Align summary-nested and unnested item-info gizmos. */
1948-
.content .impl-items > .item-info {
1945+
.impl-items > .item-info {
19491946
margin-left: 34px;
19501947
}
19511948
}

Diff for: src/test/ui/async-await/issue-64130-1-sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![feature(negative_impls)]
22
// edition:2018
33

4-
// This tests the the specialized async-await-specific error when futures don't implement an
4+
// This tests the specialized async-await-specific error when futures don't implement an
55
// auto trait (which is specifically Sync) due to some type that was captured.
66

77
struct Foo;

Diff for: src/test/ui/async-await/issue-64130-2-send.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![feature(negative_impls)]
22
// edition:2018
33

4-
// This tests the the specialized async-await-specific error when futures don't implement an
4+
// This tests the specialized async-await-specific error when futures don't implement an
55
// auto trait (which is specifically Send) due to some type that was captured.
66

77
struct Foo;

Diff for: src/test/ui/async-await/issue-64130-3-other.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![feature(negative_impls)]
33
// edition:2018
44

5-
// This tests the the unspecialized async-await-specific error when futures don't implement an
5+
// This tests the unspecialized async-await-specific error when futures don't implement an
66
// auto trait (which is not Send or Sync) due to some type that was captured.
77

88
auto trait Qux {}

Diff for: src/test/ui/const-generics/occurs-check/unused-substs-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![feature(generic_const_exprs)]
22
#![allow(incomplete_features)]
33

4-
// The goal is is to get an unevaluated const `ct` with a `Ty::Infer(TyVar(_#1t)` subst.
4+
// The goal is to get an unevaluated const `ct` with a `Ty::Infer(TyVar(_#1t)` subst.
55
//
66
// If we are then able to infer `ty::Infer(TyVar(_#1t) := Ty<ct>` we introduced an
77
// artificial inference cycle.

Diff for: src/test/ui/const-generics/occurs-check/unused-substs-3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![feature(generic_const_exprs)]
22
#![allow(incomplete_features)]
33

4-
// The goal is is to get an unevaluated const `ct` with a `Ty::Infer(TyVar(_#1t)` subst.
4+
// The goal is to get an unevaluated const `ct` with a `Ty::Infer(TyVar(_#1t)` subst.
55
//
66
// If we are then able to infer `ty::Infer(TyVar(_#1t) := Ty<ct>` we introduced an
77
// artificial inference cycle.

Diff for: src/test/ui/deprecation/deprecation-lint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ mod cross_crate {
5151

5252
let _ = nested::DeprecatedTupleStruct (1); //~ ERROR use of deprecated tuple struct `deprecation_lint::nested::DeprecatedTupleStruct`: text
5353

54-
// At the moment, the lint checker only checks stability in
54+
// At the moment, the lint checker only checks stability
5555
// in the arguments of macros.
5656
// Eventually, we will want to lint the contents of the
5757
// macro in the module *defining* it. Also, stability levels

Diff for: src/test/ui/dyn-star/box.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// run-pass
2+
// compile-flags: -C opt-level=0
3+
4+
#![feature(dyn_star)]
5+
#![allow(incomplete_features)]
6+
7+
use std::fmt::Display;
8+
9+
fn make_dyn_star() -> dyn* Display {
10+
Box::new(42) as dyn* Display
11+
}
12+
13+
fn main() {
14+
let x = make_dyn_star();
15+
16+
println!("{x}");
17+
}

Diff for: src/test/ui/explain.stdout

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ unsafe {
4747
```
4848

4949
Here, transmute is being used to convert the types of the fn arguments.
50-
This pattern is incorrect because, because the type of `foo` is a function
51-
**item** (`typeof(foo)`), which is zero-sized, and the target type (`fn()`)
50+
This pattern is incorrect because the type of `foo` is a function **item**
51+
(`typeof(foo)`), which is zero-sized, and the target type (`fn()`)
5252
is a function pointer, which is not zero-sized.
5353
This pattern should be rewritten. There are a few possible ways to do this:
5454

Diff for: src/test/ui/issues/issue-102964.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
use std::rc::Rc;
2+
type Foo<'a, T> = &'a dyn Fn(&T);
3+
type RcFoo<'a, T> = Rc<Foo<'a, T>>;
4+
5+
fn bar_function<T>(function: Foo<T>) -> RcFoo<T> {
6+
//~^ ERROR mismatched types
7+
let rc = Rc::new(function);
8+
}
9+
10+
fn main() {}

Diff for: src/test/ui/issues/issue-102964.stderr

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/issue-102964.rs:5:41
3+
|
4+
LL | fn bar_function<T>(function: Foo<T>) -> RcFoo<T> {
5+
| ------------ ^^^^^^^^ expected struct `Rc`, found `()`
6+
| |
7+
| implicitly returns `()` as its body has no tail or `return` expression
8+
|
9+
= note: expected struct `Rc<&dyn for<'a> Fn(&'a T)>`
10+
found unit type `()`
11+
help: consider returning the local binding `rc`
12+
|
13+
LL ~ let rc = Rc::new(function);
14+
LL + rc
15+
|
16+
17+
error: aborting due to previous error
18+
19+
For more information about this error, try `rustc --explain E0308`.

Diff for: src/test/ui/issues/issue-29746.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ macro_rules! zip {
77
zip!([$($rest),*], $a.zip($b), (x,y), [x,y])
88
};
99

10-
// Intermediate steps to build the zipped expression, the match pattern, and
10+
// Intermediate steps to build the zipped expression, the match pattern
1111
// and the output tuple of the closure, using macro hygiene to repeatedly
1212
// introduce new variables named 'x'.
1313
([$a:expr, $($rest:expr),*], $zip:expr, $pat:pat, [$($flat:expr),*]) => {

Diff for: src/test/ui/issues/issue-75907.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Test for for diagnostic improvement issue #75907
1+
// Test for diagnostic improvement issue #75907
22

33
mod foo {
44
pub(crate) struct Foo(u8);

Diff for: src/test/ui/issues/issue-75907_b.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Test for for diagnostic improvement issue #75907, extern crate
1+
// Test for diagnostic improvement issue #75907, extern crate
22
// aux-build:issue-75907.rs
33

44
extern crate issue_75907 as a;

Diff for: src/test/ui/lint/lint-stability-deprecated.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ mod cross_crate {
130130
let _ = UnstableTupleStruct (1);
131131
let _ = StableTupleStruct (1);
132132

133-
// At the moment, the lint checker only checks stability in
133+
// At the moment, the lint checker only checks stability
134134
// in the arguments of macros.
135135
// Eventually, we will want to lint the contents of the
136136
// macro in the module *defining* it. Also, stability levels

Diff for: src/test/ui/proc-macro/meta-macro-hygiene.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ macro_rules! produce_it {
1919
// `print_def_site!` will respan the `$crate` identifier
2020
// with `Span::def_site()`. This should cause it to resolve
2121
// relative to `meta_macro`, *not* `make_macro` (despite
22-
// the fact that that `print_def_site` is produced by
23-
// a `macro_rules!` macro in `make_macro`).
22+
// the fact that `print_def_site` is produced by a
23+
// `macro_rules!` macro in `make_macro`).
2424
meta_macro::print_def_site!($crate::dummy!());
2525
}
2626
}

Diff for: src/test/ui/proc-macro/meta-macro-hygiene.stdout

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ macro_rules! produce_it
3535
// `print_def_site!` will respan the `$crate` identifier
3636
// with `Span::def_site()`. This should cause it to resolve
3737
// relative to `meta_macro`, *not* `make_macro` (despite
38-
// the fact that that `print_def_site` is produced by
39-
// a `macro_rules!` macro in `make_macro`).
38+
// the fact that `print_def_site` is produced by a
39+
// `macro_rules!` macro in `make_macro`).
4040
}
4141
}
4242

0 commit comments

Comments
 (0)