Skip to content

Commit d4a881e

Browse files

File tree

11 files changed

+100
-11
lines changed

11 files changed

+100
-11
lines changed
 

‎compiler/rustc_middle/src/ty/sty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2827,11 +2827,11 @@ impl<'tcx> Ty<'tcx> {
28272827

28282828
ty::Adt(def, _args) => def.sized_constraint(tcx).skip_binder().is_empty(),
28292829

2830-
ty::Alias(..) | ty::Param(_) | ty::Placeholder(..) => false,
2830+
ty::Alias(..) | ty::Param(_) | ty::Placeholder(..) | ty::Bound(..) => false,
28312831

28322832
ty::Infer(ty::TyVar(_)) => false,
28332833

2834-
ty::Bound(..) | ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {
2834+
ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {
28352835
bug!("`is_trivially_sized` applied to unexpected type: {:?}", self)
28362836
}
28372837
}

‎library/core/src/ffi/c_str.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ use crate::str;
2020
/// in each pair are borrowed references; the latter are owned
2121
/// strings.
2222
///
23-
/// Note that this structure is **not** `repr(C)` and is not recommended to be
24-
/// placed in the signatures of FFI functions. Instead, safe wrappers of FFI
25-
/// functions may leverage the unsafe [`CStr::from_ptr`] constructor to provide
26-
/// a safe interface to other consumers.
23+
/// Note that this structure does **not** have a guaranteed layout (the `repr(transparent)`
24+
/// notwithstanding) and is not recommended to be placed in the signatures of FFI functions.
25+
/// Instead, safe wrappers of FFI functions may leverage the unsafe [`CStr::from_ptr`] constructor
26+
/// to provide a safe interface to other consumers.
2727
///
2828
/// [`CString`]: ../../std/ffi/struct.CString.html
2929
/// [`String`]: ../../std/string/struct.String.html

‎library/std/src/sync/mpsc/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,11 @@ pub struct IntoIter<T> {
303303
rx: Receiver<T>,
304304
}
305305

306-
/// The sending-half of Rust's asynchronous [`channel`] type. This half can only be
307-
/// owned by one thread, but it can be cloned to send to other threads.
306+
/// The sending-half of Rust's asynchronous [`channel`] type.
308307
///
309308
/// Messages can be sent through this channel with [`send`].
310309
///
311-
/// Note: all senders (the original and the clones) need to be dropped for the receiver
310+
/// Note: all senders (the original and its clones) need to be dropped for the receiver
312311
/// to stop blocking to receive messages with [`Receiver::recv`].
313312
///
314313
/// [`send`]: Sender::send

‎src/librustdoc/doctest.rs

+16
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,9 @@ fn run_test(
469469
// Run the code!
470470
let mut cmd;
471471

472+
let output_file = make_maybe_absolute_path(output_file);
472473
if let Some(tool) = runtool {
474+
let tool = make_maybe_absolute_path(tool.into());
473475
cmd = Command::new(tool);
474476
cmd.args(runtool_args);
475477
cmd.arg(output_file);
@@ -503,6 +505,20 @@ fn run_test(
503505
Ok(())
504506
}
505507

508+
/// Converts a path intended to use as a command to absolute if it is
509+
/// relative, and not a single component.
510+
///
511+
/// This is needed to deal with relative paths interacting with
512+
/// `Command::current_dir` in a platform-specific way.
513+
fn make_maybe_absolute_path(path: PathBuf) -> PathBuf {
514+
if path.components().count() == 1 {
515+
// Look up process via PATH.
516+
path
517+
} else {
518+
std::env::current_dir().map(|c| c.join(&path)).unwrap_or_else(|_| path)
519+
}
520+
}
521+
506522
/// Transforms a test into code that can be compiled into a Rust binary, and returns the number of
507523
/// lines before the test code begins as well as if the output stream supports colors or not.
508524
pub(crate) fn make_test(

‎tests/run-make/doctests-keep-binaries/Makefile

+12-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ include ../tools.mk
33

44
# Check that valid binaries are persisted by running them, regardless of whether the --run or --no-run option is used.
55

6-
all: run no_run
6+
MY_SRC_DIR := ${CURDIR}
7+
8+
all: run no_run test_run_directory
79

810
run:
911
mkdir -p $(TMPDIR)/doctests
@@ -20,3 +22,12 @@ no_run:
2022
$(TMPDIR)/doctests/t_rs_2_0/rust_out
2123
$(TMPDIR)/doctests/t_rs_8_0/rust_out
2224
rm -rf $(TMPDIR)/doctests
25+
26+
# Behavior with --test-run-directory with relative paths.
27+
test_run_directory:
28+
mkdir -p $(TMPDIR)/doctests
29+
mkdir -p $(TMPDIR)/rundir
30+
$(RUSTC) --crate-type rlib t.rs
31+
( cd $(TMPDIR); \
32+
$(RUSTDOC) -Zunstable-options --test --persist-doctests doctests --test-run-directory rundir --extern t=libt.rlib $(MY_SRC_DIR)/t.rs )
33+
rm -rf $(TMPDIR)/doctests $(TMPDIR)/rundir
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ignore-cross-compile
2+
include ../tools.mk
3+
4+
# Tests behavior of rustdoc --runtool
5+
6+
MY_SRC_DIR := ${CURDIR}
7+
8+
all: with_test_run_directory
9+
10+
# Behavior with --runtool with relative paths and --test-run-directory.
11+
with_test_run_directory:
12+
mkdir -p $(TMPDIR)/rundir
13+
mkdir -p $(TMPDIR)/runtool
14+
$(RUSTC) --crate-type rlib t.rs
15+
$(RUSTC) runtool.rs -o $(TMPDIR)/runtool/runtool
16+
( cd $(TMPDIR); \
17+
$(RUSTDOC) -Zunstable-options --test --test-run-directory rundir \
18+
--runtool runtool/runtool --extern t=libt.rlib $(MY_SRC_DIR)/t.rs \
19+
)
20+
rm -rf $(TMPDIR)/rundir $(TMPDIR)/runtool
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
eprintln!("{:?}", std::env::args().collect::<Vec<_>>());
3+
}

‎tests/run-make/doctests-runtool/t.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// Fungle the foople.
2+
/// ```
3+
/// t::foople();
4+
/// ```
5+
pub fn foople() {}
6+
7+
/// Flomble the florp
8+
/// ```
9+
/// t::florp();
10+
/// ```
11+
pub fn florp() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// check-pass
2+
3+
#![feature(non_lifetime_binders)]
4+
//~^ WARN is incomplete and may not be safe
5+
6+
pub fn foo()
7+
where
8+
for<V> V: Sized,
9+
{
10+
bar();
11+
}
12+
13+
pub fn bar()
14+
where
15+
for<V> V: Sized,
16+
{
17+
}
18+
19+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/sized-late-bound-issue-114872.rs:3:12
3+
|
4+
LL | #![feature(non_lifetime_binders)]
5+
| ^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
8+
= note: `#[warn(incomplete_features)]` on by default
9+
10+
warning: 1 warning emitted
11+

‎triagebot.toml

-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,6 @@ cc = ["@camelid"]
386386
message = "Some changes occurred in HTML/CSS/JS."
387387
cc = [
388388
"@GuillaumeGomez",
389-
"@Folyd",
390389
"@jsha",
391390
]
392391

0 commit comments

Comments
 (0)
Please sign in to comment.