Skip to content

Commit

Permalink
Auto merge of rust-lang#76502 - Dylan-DPC:rollup-2c4zz0t, r=Dylan-DPC
Browse files Browse the repository at this point in the history
Rollup of 10 pull requests

Successful merges:

 - rust-lang#76162 (Make duration_since documentation more clear)
 - rust-lang#76355 (remove public visibility previously needed for rustfmt)
 - rust-lang#76374 (Improve ayu doc source line number contrast)
 - rust-lang#76379 (rustbuild: Remove `Mode::Codegen`)
 - rust-lang#76389 (Fix HashMap visualizers in Visual Studio (Code))
 - rust-lang#76396 (Fix typo in tracking issue template)
 - rust-lang#76401 (Add help note to unconstrained const parameter)
 - rust-lang#76402 (Update linker-plugin-lto.md to contain up to rust 1.46)
 - rust-lang#76403 (Fix documentation for TyCtxt::all_impls)
 - rust-lang#76498 (Update cargo)

Failed merges:

 - rust-lang#76458 (Add drain_filter method to HashMap and HashSet)

r? `@ghost`
  • Loading branch information
bors committed Sep 9, 2020
2 parents 5099914 + 389321a commit 90782cb
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/tracking_issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The feature gate for the issue is `#![feature(FFF)]`.
### About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also uses as hubs connecting to other relevant issues, e.g., bugs or open design questions.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however *not* meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_expand/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ fn error_cannot_declare_mod_here<'a, T>(

/// Derive a submodule path from the first found `#[path = "path_string"]`.
/// The provided `dir_path` is joined with the `path_string`.
// Public for rustfmt usage.
pub fn submod_path_from_attr(
pub(super) fn submod_path_from_attr(
sess: &Session,
attrs: &[Attribute],
dir_path: &Path,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/trait_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl<'tcx> TyCtxt<'tcx> {
}
}

/// Returns a vector containing all impls
/// Returns an iterator containing all impls
pub fn all_impls(self, def_id: DefId) -> impl Iterator<Item = DefId> + 'tcx {
let TraitImpls { blanket_impls, non_blanket_impls } = self.trait_impls_of(def_id);

Expand Down
18 changes: 13 additions & 5 deletions compiler/rustc_typeck/src/impl_wf_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ fn enforce_impl_params_are_constrained(
}

// (*) This is a horrible concession to reality. I think it'd be
// better to just ban unconstrianed lifetimes outright, but in
// better to just ban unconstrained lifetimes outright, but in
// practice people do non-hygenic macros like:
//
// ```
Expand All @@ -207,17 +207,25 @@ fn enforce_impl_params_are_constrained(
}

fn report_unused_parameter(tcx: TyCtxt<'_>, span: Span, kind: &str, name: &str) {
struct_span_err!(
let mut err = struct_span_err!(
tcx.sess,
span,
E0207,
"the {} parameter `{}` is not constrained by the \
impl trait, self type, or predicates",
kind,
name
)
.span_label(span, format!("unconstrained {} parameter", kind))
.emit();
);
err.span_label(span, format!("unconstrained {} parameter", kind));
if kind == "const" {
err.note(
"expressions using a const parameter must map each value to a distinct output value",
);
err.note(
"proving the result of expressions other than the parameter are unique is not supported",
);
}
err.emit();
}

/// Enforce that we do not have two items in an impl with the same name.
Expand Down
7 changes: 4 additions & 3 deletions library/std/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,12 +460,13 @@ impl SystemTime {
///
/// # Examples
///
/// ```
/// ```no_run
/// use std::time::SystemTime;
///
/// let sys_time = SystemTime::now();
/// let difference = sys_time.duration_since(sys_time)
/// .expect("Clock may have gone backwards");
/// let new_sys_time = SystemTime::now();
/// let difference = new_sys_time.duration_since(sys_time)
/// .expect("Clock may have gone backwards");
/// println!("{:?}", difference);
/// ```
#[stable(feature = "time2", since = "1.8.0")]
Expand Down
10 changes: 5 additions & 5 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ impl<'a> Builder<'a> {
if cmd == "doc" || cmd == "rustdoc" {
let my_out = match mode {
// This is the intended out directory for compiler documentation.
Mode::Rustc | Mode::ToolRustc | Mode::Codegen => self.compiler_doc_out(target),
Mode::Rustc | Mode::ToolRustc => self.compiler_doc_out(target),
Mode::Std => out_dir.join(target.triple).join("doc"),
_ => panic!("doc mode {:?} not expected", mode),
};
Expand Down Expand Up @@ -875,7 +875,7 @@ impl<'a> Builder<'a> {

match mode {
Mode::Std | Mode::ToolBootstrap | Mode::ToolStd => {}
Mode::Rustc | Mode::Codegen | Mode::ToolRustc => {
Mode::Rustc | Mode::ToolRustc => {
// Build proc macros both for the host and the target
if target != compiler.host && cmd != "check" {
cargo.arg("-Zdual-proc-macros");
Expand Down Expand Up @@ -1060,7 +1060,7 @@ impl<'a> Builder<'a> {
}

let debuginfo_level = match mode {
Mode::Rustc | Mode::Codegen => self.config.rust_debuginfo_level_rustc,
Mode::Rustc => self.config.rust_debuginfo_level_rustc,
Mode::Std => self.config.rust_debuginfo_level_std,
Mode::ToolBootstrap | Mode::ToolStd | Mode::ToolRustc => {
self.config.rust_debuginfo_level_tools
Expand Down Expand Up @@ -1197,7 +1197,7 @@ impl<'a> Builder<'a> {
rustdocflags.arg("-Winvalid_codeblock_attributes");
}

if let Mode::Rustc | Mode::Codegen = mode {
if mode == Mode::Rustc {
rustflags.arg("-Zunstable-options");
rustflags.arg("-Wrustc::internal");
}
Expand Down Expand Up @@ -1360,7 +1360,7 @@ impl<'a> Builder<'a> {
// When we build Rust dylibs they're all intended for intermediate
// usage, so make sure we pass the -Cprefer-dynamic flag instead of
// linking all deps statically into the dylib.
if let Mode::Std | Mode::Rustc | Mode::Codegen = mode {
if matches!(mode, Mode::Std | Mode::Rustc) {
rustflags.arg("-Cprefer-dynamic");
}

Expand Down
4 changes: 0 additions & 4 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,6 @@ pub enum Mode {
/// Build librustc, and compiler libraries, placing output in the "stageN-rustc" directory.
Rustc,

/// Build codegen libraries, placing output in the "stageN-codegen" directory
Codegen,

/// Build a tool, placing output in the "stage0-bootstrap-tools"
/// directory. This is for miscellaneous sets of tools that are built
/// using the bootstrap stage0 compiler in its entirety (target libraries
Expand Down Expand Up @@ -570,7 +567,6 @@ impl Build {
let suffix = match mode {
Mode::Std => "-std",
Mode::Rustc => "-rustc",
Mode::Codegen => "-codegen",
Mode::ToolBootstrap => "-bootstrap-tools",
Mode::ToolStd | Mode::ToolRustc => "-tools",
};
Expand Down
27 changes: 15 additions & 12 deletions src/doc/rustc/src/linker-plugin-lto.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,20 @@ LLVM. However, the approximation is usually reliable.

The following table shows known good combinations of toolchain versions.

| | Clang 7 | Clang 8 | Clang 9 |
|-----------|-----------|-----------|-----------|
| Rust 1.34 ||||
| Rust 1.35 ||||
| Rust 1.36 ||||
| Rust 1.37 ||||
| Rust 1.38 ||||
| Rust 1.39 ||||
| Rust 1.40 ||||
| Rust 1.41 ||||
| Rust 1.42 ||||
| Rust 1.43 ||||
| Rust Version | Clang Version |
|--------------|---------------|
| Rust 1.34 | Clang 8 |
| Rust 1.35 | Clang 8 |
| Rust 1.36 | Clang 8 |
| Rust 1.37 | Clang 8 |
| Rust 1.38 | Clang 9 |
| Rust 1.39 | Clang 9 |
| Rust 1.40 | Clang 9 |
| Rust 1.41 | Clang 9 |
| Rust 1.42 | Clang 9 |
| Rust 1.43 | Clang 9 |
| Rust 1.44 | Clang 9 |
| Rust 1.45 | Clang 10 |
| Rust 1.46 | Clang 10 |

Note that the compatibility policy for this feature might change in the future.
4 changes: 2 additions & 2 deletions src/etc/natvis/libstd.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<If Condition="(base.table.ctrl.pointer[i] &amp; 0x80) == 0">
<!-- Bucket is populated -->
<Exec>n--</Exec>
<Item Name="{static_cast&lt;tuple&lt;$T1, $T2&gt;*&gt;(base.table.ctrl.pointer)[-(i + 1)].__0}">static_cast&lt;tuple&lt;$T1, $T2&gt;*&gt;(base.table.ctrl.pointer)[-(i + 1)].__1</Item>
<Item Name="{((tuple&lt;$T1, $T2&gt;*)base.table.ctrl.pointer)[-(i + 1)].__0}">((tuple&lt;$T1, $T2&gt;*)base.table.ctrl.pointer)[-(i + 1)].__1</Item>
</If>
<Exec>i++</Exec>
</Loop>
Expand All @@ -65,7 +65,7 @@
<If Condition="(map.base.table.ctrl.pointer[i] &amp; 0x80) == 0">
<!-- Bucket is populated -->
<Exec>n--</Exec>
<Item>static_cast&lt;$T1*&gt;(map.base.table.ctrl.pointer)[-(i + 1)]</Item>
<Item>(($T1*)map.base.table.ctrl.pointer)[-(i + 1)]</Item>
</If>
<Exec>i++</Exec>
</Loop>
Expand Down
5 changes: 3 additions & 2 deletions src/librustdoc/html/static/themes/ayu.css
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ pre {
color: #ffb44c;
}

.line-numbers span { color: #5c6773ab; }
.line-numbers span { color: #5c6773; }
.line-numbers .line-highlighted {
background-color: rgba(255, 236, 164, 0.06) !important;
color: #708090;
background-color: rgba(255, 236, 164, 0.06);
padding-right: 4px;
border-right: 1px solid #ffb44c;
}
Expand Down
18 changes: 18 additions & 0 deletions src/test/ui/const-generics/issues/issue-68366.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Checks that const expressions have a useful note explaining why they can't be evaluated.
// The note should relate to the fact that it cannot be shown forall N that it maps 1-1 to a new
// type.

#![feature(const_generics)]
#![allow(incomplete_features)]

struct Collatz<const N: Option<usize>>;

impl <const N: usize> Collatz<{Some(N)}> {}
//~^ ERROR the const parameter

struct Foo;

impl<const N: usize> Foo {}
//~^ ERROR the const parameter

fn main() {}
21 changes: 21 additions & 0 deletions src/test/ui/const-generics/issues/issue-68366.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
--> $DIR/issue-68366.rs:10:13
|
LL | impl <const N: usize> Collatz<{Some(N)}> {}
| ^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported

error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
--> $DIR/issue-68366.rs:15:12
|
LL | impl<const N: usize> Foo {}
| ^ unconstrained const parameter
|
= note: expressions using a const parameter must map each value to a distinct output value
= note: proving the result of expressions other than the parameter are unique is not supported

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0207`.

0 comments on commit 90782cb

Please sign in to comment.