Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 13 pull requests #67043

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5a9b704
Improve comments about NodeStates.
nnethercote Nov 12, 2019
c45fc6b
Give two functions clearer names.
nnethercote Nov 14, 2019
c874789
remove dependency from libhermit
stlankes Nov 25, 2019
481b18a
Small error codes explanation cleanup (E0092, E0093 and E0094)
GuillaumeGomez Nov 30, 2019
e4b2cb8
Add support for RISC-V 64-bit GNU/Linux
msizanoen1 Nov 23, 2019
930a0a2
Update libc
msizanoen1 Nov 30, 2019
5748b4c
Add missing check
GuillaumeGomez Nov 27, 2019
35ba58f
Remove minification on search-index.js file
GuillaumeGomez Nov 27, 2019
852079f
minify theme.js as well
GuillaumeGomez Nov 27, 2019
85df207
Use Module::print() instead of a PrintModulePass
Dec 2, 2019
2d0f0ca
Add missing backline
GuillaumeGomez Dec 2, 2019
7693bb9
Add long error for E0631 and update ui tests.
reese Dec 3, 2019
26a1ba8
Use simpler code example for E0631 long error.
reese Dec 3, 2019
3091b82
Tweak wording of `collect()` on bad target type
estebank Nov 26, 2019
911b7d6
Update missed test.
reese Dec 3, 2019
c911bb1
clean up E0107 error explanation
GuillaumeGomez Nov 30, 2019
1fa948f
capitalize Rust
andrewbanchich Dec 4, 2019
f6b435d
Accurately portray raw identifiers in error messages
estebank Dec 4, 2019
168e35d
Include a span in more `expected...found` notes
Aaron1011 Dec 4, 2019
b5ad0cb
review comments: move test
estebank Dec 4, 2019
0103308
Account for raw idents in module file finding
estebank Dec 4, 2019
c2ce7dd
Clean up E0116 error code long explanation
GuillaumeGomez Dec 4, 2019
1e5450d
Clean up E0117 error code long explanation
GuillaumeGomez Dec 4, 2019
9eaea4d
Clean up E0118 error code long explanation
GuillaumeGomez Dec 4, 2019
ae753a5
some error codes long explanation
GuillaumeGomez Dec 4, 2019
8be7223
Fix docs for formatting delegations
elichai Dec 4, 2019
3844ecb
Rollup merge of #66405 - nnethercote:tweak-ObligForest-NodeStates, r=…
JohnTitor Dec 5, 2019
3799a3f
Rollup merge of #66730 - hermitcore:master, r=alexcrichton
JohnTitor Dec 5, 2019
b4e4707
Rollup merge of #66764 - estebank:reword-bad-collect, r=alexcrichton
JohnTitor Dec 5, 2019
ac97356
Rollup merge of #66828 - GuillaumeGomez:less-minification, r=kinnison
JohnTitor Dec 5, 2019
d4b923a
Rollup merge of #66899 - msizanoen1:riscv-std, r=alexcrichton
JohnTitor Dec 5, 2019
0559618
Rollup merge of #66900 - GuillaumeGomez:clean-up-err-codes, r=Dylan-DPC
JohnTitor Dec 5, 2019
efcca89
Rollup merge of #66952 - 0dvictor:print, r=rkruppe
JohnTitor Dec 5, 2019
da1b26f
Rollup merge of #66979 - reese:E0631-long-error, r=GuillaumeGomez
JohnTitor Dec 5, 2019
7291c76
Rollup merge of #67005 - andrewbanchich:master, r=joshtriplett
JohnTitor Dec 5, 2019
2750309
Rollup merge of #67010 - estebank:raw-idents, r=Centril
JohnTitor Dec 5, 2019
5dcefce
Rollup merge of #67011 - Aaron1011:fix/expected-found-span, r=Dylan-DPC
JohnTitor Dec 5, 2019
ae38687
Rollup merge of #67017 - GuillaumeGomez:long-err-explanations-2, r=Dy…
JohnTitor Dec 5, 2019
18fe87b
Rollup merge of #67021 - elichai:2019-12-fmt, r=QuietMisdreavus
JohnTitor Dec 5, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1823,9 +1823,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"

[[package]]
name = "libc"
version = "0.2.64"
version = "0.2.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74dfca3d9957906e8d1e6a0b641dc9a59848e793f1da2165889fd4f62d10d79c"
checksum = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
dependencies = [
"rustc-std-workspace-core",
]
Expand Down
11 changes: 6 additions & 5 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ pub trait Display {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// let val = self.0;
///
/// write!(f, "{:o}", val) // delegate to i32's implementation
/// fmt::Octal::fmt(&val, f) // delegate to i32's implementation
/// }
/// }
///
Expand Down Expand Up @@ -712,7 +712,7 @@ pub trait Octal {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// let val = self.0;
///
/// write!(f, "{:b}", val) // delegate to i32's implementation
/// fmt::Binary::fmt(&val, f) // delegate to i32's implementation
/// }
/// }
///
Expand Down Expand Up @@ -771,7 +771,7 @@ pub trait Binary {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// let val = self.0;
///
/// write!(f, "{:x}", val) // delegate to i32's implementation
/// fmt::LowerHex::fmt(&val, f) // delegate to i32's implementation
/// }
/// }
///
Expand Down Expand Up @@ -824,7 +824,7 @@ pub trait LowerHex {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// let val = self.0;
///
/// write!(f, "{:X}", val) // delegate to i32's implementation
/// fmt::UpperHex::fmt(&val, f) // delegate to i32's implementation
/// }
/// }
///
Expand Down Expand Up @@ -869,7 +869,8 @@ pub trait UpperHex {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// // use `as` to convert to a `*const T`, which implements Pointer, which we can use
///
/// write!(f, "{:p}", self as *const Length)
/// let ptr = self as *const Self;
/// fmt::Pointer::fmt(&ptr, f)
/// }
/// }
///
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/iter/traits/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(
message="a collection of type `{Self}` cannot be built from an iterator \
message="a value of type `{Self}` cannot be built from an iterator \
over elements of type `{A}`",
label="a collection of type `{Self}` cannot be built from `std::iter::Iterator<Item={A}>`",
label="value of type `{Self}` cannot be built from `std::iter::Iterator<Item={A}>`",
)]
pub trait FromIterator<A>: Sized {
/// Creates a value from an iterator.
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
//!
//! Atomic variables are safe to share between threads (they implement [`Sync`])
//! but they do not themselves provide the mechanism for sharing and follow the
//! [threading model](../../../std/thread/index.html#the-threading-model) of rust.
//! [threading model](../../../std/thread/index.html#the-threading-model) of Rust.
//! The most common way to share an atomic variable is to put it into an [`Arc`][arc] (an
//! atomically-reference-counted shared pointer).
//!
Expand Down
3 changes: 3 additions & 0 deletions src/libpanic_unwind/gcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ const UNWIND_DATA_REG: (i32, i32) = (24, 25); // I0, I1
#[cfg(target_arch = "hexagon")]
const UNWIND_DATA_REG: (i32, i32) = (0, 1); // R0, R1

#[cfg(target_arch = "riscv64")]
const UNWIND_DATA_REG: (i32, i32) = (10, 11); // x10, x11

// The following code is based on GCC's C and C++ personality routines. For reference, see:
// https://github.com/gcc-mirror/gcc/blob/master/libstdc++-v3/libsupc++/eh_personality.cc
// https://github.com/gcc-mirror/gcc/blob/trunk/libgcc/unwind-c.c
Expand Down
15 changes: 10 additions & 5 deletions src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1809,12 +1809,17 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
sub_region,
"...",
);
err.note(&format!(
"...so that the {}:\nexpected {}\n found {}",
sup_trace.cause.as_requirement_str(),
sup_expected.content(),
sup_found.content()
err.span_note(sup_trace.cause.span, &format!(
"...so that the {}",
sup_trace.cause.as_requirement_str()
));

err.note_expected_found(
&"",
sup_expected,
&"",
sup_found
);
err.emit();
return;
}
Expand Down
20 changes: 14 additions & 6 deletions src/librustc/infer/error_reporting/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
match *origin {
infer::Subtype(ref trace) => {
if let Some((expected, found)) = self.values_str(&trace.values) {
let expected = expected.content();
let found = found.content();
err.note(&format!("...so that the {}:\nexpected {}\n found {}",
trace.cause.as_requirement_str(),
expected,
found));
err.span_note(
trace.cause.span,
&format!(
"...so that the {}",
trace.cause.as_requirement_str()
)
);

err.note_expected_found(
&"",
expected,
&"",
found
);
} else {
// FIXME: this really should be handled at some earlier stage. Our
// handling of region checking when type errors are present is
Expand Down
3 changes: 3 additions & 0 deletions src/librustc/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,9 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
if !self.empty_path {
write!(self, "::")?;
}
if ast::Ident::from_str(&name).is_raw_guess() {
write!(self, "r#")?;
}
write!(self, "{}", name)?;

// FIXME(eddyb) this will print e.g. `{{closure}}#3`, but it
Expand Down
13 changes: 5 additions & 8 deletions src/librustc_codegen_llvm/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,14 +588,11 @@ pub(crate) unsafe fn codegen(cgcx: &CodegenContext<LlvmCodegenBackend>,
cursor.position() as size_t
}

with_codegen(tm, llmod, config.no_builtins, |cpm| {
let result =
llvm::LLVMRustPrintModule(cpm, llmod, out_c.as_ptr(), demangle_callback);
llvm::LLVMDisposePassManager(cpm);
result.into_result().map_err(|()| {
let msg = format!("failed to write LLVM IR to {}", out.display());
llvm_err(diag_handler, &msg)
})
let result =
llvm::LLVMRustPrintModule(llmod, out_c.as_ptr(), demangle_callback);
result.into_result().map_err(|()| {
let msg = format!("failed to write LLVM IR to {}", out.display());
llvm_err(diag_handler, &msg)
})?;
}

Expand Down
3 changes: 1 addition & 2 deletions src/librustc_codegen_llvm/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1727,8 +1727,7 @@ extern "C" {
Output: *const c_char,
FileType: FileType)
-> LLVMRustResult;
pub fn LLVMRustPrintModule(PM: &PassManager<'a>,
M: &'a Module,
pub fn LLVMRustPrintModule(M: &'a Module,
Output: *const c_char,
Demangle: extern fn(*const c_char,
size_t,
Expand Down
89 changes: 60 additions & 29 deletions src/librustc_data_structures/obligation_forest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,11 @@ type ObligationTreeIdGenerator =
pub struct ObligationForest<O: ForestObligation> {
/// The list of obligations. In between calls to
/// `process_obligations`, this list only contains nodes in the
/// `Pending` or `Success` state (with a non-zero number of
/// `Pending` or `Waiting` state (with a non-zero number of
/// incomplete children). During processing, some of those nodes
/// may be changed to the error state, or we may find that they
/// are completed (That is, `num_incomplete_children` drops to 0).
/// At the end of processing, those nodes will be removed by a
/// call to `compress`.
/// are completed. At the end of processing, those nodes will be
/// removed by a call to `compress`.
///
/// `usize` indices are used here and throughout this module, rather than
/// `rustc_index::newtype_index!` indices, because this code is hot enough that the
Expand Down Expand Up @@ -211,28 +210,56 @@ impl<O> Node<O> {
/// represents the current state of processing for the obligation (of
/// type `O`) associated with this node.
///
/// Outside of ObligationForest methods, nodes should be either Pending
/// or Waiting.
/// The non-`Error` state transitions are as follows.
/// ```
/// (Pre-creation)
/// |
/// | register_obligation_at() (called by process_obligations() and
/// v from outside the crate)
/// Pending
/// |
/// | process_obligations()
/// v
/// Success
/// | ^
/// | | update_waiting_and_success_states()
/// | v
/// | Waiting
/// |
/// | process_cycles()
/// v
/// Done
/// |
/// | compress()
/// v
/// (Removed)
/// ```
/// The `Error` state can be introduced in several places, via `error_at()`.
///
/// Outside of `ObligationForest` methods, nodes should be either `Pending` or
/// `Waiting`.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
enum NodeState {
/// Obligations for which selection had not yet returned a
/// non-ambiguous result.
/// This obligation has not yet been selected successfully. Cannot have
/// subobligations.
Pending,

/// This obligation was selected successfully, but may or
/// may not have subobligations.
/// This obligation was selected successfully, but the state of any
/// subobligations are current unknown. It will be converted to `Waiting`
/// or `Done` once the states of the subobligations become known.
Success,

/// This obligation was selected successfully, but it has
/// a pending subobligation.
/// This obligation was selected successfully, but it has one or more
/// pending subobligations.
Waiting,

/// This obligation, along with its subobligations, are complete,
/// and will be removed in the next collection.
/// This obligation was selected successfully, as were all of its
/// subobligations (of which there may be none). It will be removed by the
/// next compression step.
Done,

/// This obligation was resolved to an error. Error nodes are
/// removed from the vector by the compression step.
/// This obligation was resolved to an error. It will be removed by the
/// next compression step.
Error,
}

Expand Down Expand Up @@ -464,7 +491,7 @@ impl<O: ForestObligation> ObligationForest<O> {
};
}

self.mark_as_waiting();
self.update_waiting_and_success_states();
self.process_cycles(processor);
let completed = self.compress(do_completed);

Expand All @@ -477,10 +504,9 @@ impl<O: ForestObligation> ObligationForest<O> {
}
}

/// Mark all `NodeState::Success` nodes as `NodeState::Done` and
/// report all cycles between them. This should be called
/// after `mark_as_waiting` marks all nodes with pending
/// subobligations as NodeState::Waiting.
/// Mark all `Success` nodes as `Done` and report all cycles between them.
/// This should be called after `update_waiting_and_success_states` updates
/// the status of all `Waiting` and `Success` nodes.
fn process_cycles<P>(&self, processor: &mut P)
where P: ObligationProcessor<Obligation=O>
{
Expand Down Expand Up @@ -562,42 +588,47 @@ impl<O: ForestObligation> ObligationForest<O> {

// This always-inlined function is for the hot call site.
#[inline(always)]
fn inlined_mark_neighbors_as_waiting_from(&self, node: &Node<O>) {
fn inlined_mark_dependents_as_waiting(&self, node: &Node<O>) {
for &index in node.dependents.iter() {
let node = &self.nodes[index];
match node.state.get() {
NodeState::Waiting | NodeState::Error => {}
NodeState::Success => {
node.state.set(NodeState::Waiting);
// This call site is cold.
self.uninlined_mark_neighbors_as_waiting_from(node);
self.uninlined_mark_dependents_as_waiting(node);
}
NodeState::Pending | NodeState::Done => {
// This call site is cold.
self.uninlined_mark_neighbors_as_waiting_from(node);
self.uninlined_mark_dependents_as_waiting(node);
}
}
}
}

// This never-inlined function is for the cold call site.
#[inline(never)]
fn uninlined_mark_neighbors_as_waiting_from(&self, node: &Node<O>) {
self.inlined_mark_neighbors_as_waiting_from(node)
fn uninlined_mark_dependents_as_waiting(&self, node: &Node<O>) {
self.inlined_mark_dependents_as_waiting(node)
}

/// Marks all nodes that depend on a pending node as `NodeState::Waiting`.
fn mark_as_waiting(&self) {
/// Updates the states of all `Waiting` and `Success` nodes. Upon
/// completion, all such nodes that depend on a pending node will be marked
/// as `Waiting`, and all others will be marked as `Success`.
fn update_waiting_and_success_states(&self) {
// Optimistically mark all `Waiting` nodes as `Success`.
for node in &self.nodes {
if node.state.get() == NodeState::Waiting {
node.state.set(NodeState::Success);
}
}

// Convert all `Success` nodes that still depend on a pending node to
// `Waiting`. This may undo some of the changes done in the loop above.
for node in &self.nodes {
if node.state.get() == NodeState::Pending {
// This call site is hot.
self.inlined_mark_neighbors_as_waiting_from(node);
self.inlined_mark_dependents_as_waiting(node);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_error_codes/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ E0622: include_str!("./error_codes/E0622.md"),
E0623: include_str!("./error_codes/E0623.md"),
E0624: include_str!("./error_codes/E0624.md"),
E0626: include_str!("./error_codes/E0626.md"),
E0631: include_str!("./error_codes/E0631.md"),
E0633: include_str!("./error_codes/E0633.md"),
E0635: include_str!("./error_codes/E0635.md"),
E0636: include_str!("./error_codes/E0636.md"),
Expand Down Expand Up @@ -580,7 +581,6 @@ E0745: include_str!("./error_codes/E0745.md"),
// rustc_const_unstable attribute must be paired with stable/unstable
// attribute
E0630,
E0631, // type mismatch in closure arguments
E0632, // cannot provide explicit generic arguments when `impl Trait` is
// used in argument position
E0634, // type has conflicting packed representaton hints
Expand Down
7 changes: 4 additions & 3 deletions src/librustc_error_codes/error_codes/E0092.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
You tried to declare an undefined atomic operation function.
An undefined atomic operation function was declared.

Erroneous code example:

```compile_fail,E0092
Expand All @@ -11,8 +12,8 @@ extern "rust-intrinsic" {
```

Please check you didn't make a mistake in the function's name. All intrinsic
functions are defined in librustc_codegen_llvm/intrinsic.rs and in
libcore/intrinsics.rs in the Rust source code. Example:
functions are defined in `librustc_codegen_llvm/intrinsic.rs` and in
`libcore/intrinsics.rs` in the Rust source code. Example:

```
#![feature(intrinsics)]
Expand Down
8 changes: 5 additions & 3 deletions src/librustc_error_codes/error_codes/E0093.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
You declared an unknown intrinsic function. Erroneous code example:
An unknown intrinsic function was declared.

Erroneous code example:

```compile_fail,E0093
#![feature(intrinsics)]
Expand All @@ -15,8 +17,8 @@ fn main() {
```

Please check you didn't make a mistake in the function's name. All intrinsic
functions are defined in librustc_codegen_llvm/intrinsic.rs and in
libcore/intrinsics.rs in the Rust source code. Example:
functions are defined in `librustc_codegen_llvm/intrinsic.rs` and in
`libcore/intrinsics.rs` in the Rust source code. Example:

```
#![feature(intrinsics)]
Expand Down
Loading