Skip to content

Commit 90782cb

Browse files
committed
Auto merge of rust-lang#76502 - Dylan-DPC:rollup-2c4zz0t, r=Dylan-DPC
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`
2 parents 5099914 + 389321a commit 90782cb

File tree

13 files changed

+85
-38
lines changed

13 files changed

+85
-38
lines changed

.github/ISSUE_TEMPLATE/tracking_issue.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The feature gate for the issue is `#![feature(FFF)]`.
2323
### About tracking issues
2424

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

compiler/rustc_expand/src/module.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ fn error_cannot_declare_mod_here<'a, T>(
219219

220220
/// Derive a submodule path from the first found `#[path = "path_string"]`.
221221
/// The provided `dir_path` is joined with the `path_string`.
222-
// Public for rustfmt usage.
223-
pub fn submod_path_from_attr(
222+
pub(super) fn submod_path_from_attr(
224223
sess: &Session,
225224
attrs: &[Attribute],
226225
dir_path: &Path,

compiler/rustc_middle/src/ty/trait_def.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl<'tcx> TyCtxt<'tcx> {
167167
}
168168
}
169169

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

compiler/rustc_typeck/src/impl_wf_check.rs

+13-5
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ fn enforce_impl_params_are_constrained(
187187
}
188188

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

209209
fn report_unused_parameter(tcx: TyCtxt<'_>, span: Span, kind: &str, name: &str) {
210-
struct_span_err!(
210+
let mut err = struct_span_err!(
211211
tcx.sess,
212212
span,
213213
E0207,
214214
"the {} parameter `{}` is not constrained by the \
215215
impl trait, self type, or predicates",
216216
kind,
217217
name
218-
)
219-
.span_label(span, format!("unconstrained {} parameter", kind))
220-
.emit();
218+
);
219+
err.span_label(span, format!("unconstrained {} parameter", kind));
220+
if kind == "const" {
221+
err.note(
222+
"expressions using a const parameter must map each value to a distinct output value",
223+
);
224+
err.note(
225+
"proving the result of expressions other than the parameter are unique is not supported",
226+
);
227+
}
228+
err.emit();
221229
}
222230

223231
/// Enforce that we do not have two items in an impl with the same name.

library/std/src/time.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -460,12 +460,13 @@ impl SystemTime {
460460
///
461461
/// # Examples
462462
///
463-
/// ```
463+
/// ```no_run
464464
/// use std::time::SystemTime;
465465
///
466466
/// let sys_time = SystemTime::now();
467-
/// let difference = sys_time.duration_since(sys_time)
468-
/// .expect("Clock may have gone backwards");
467+
/// let new_sys_time = SystemTime::now();
468+
/// let difference = new_sys_time.duration_since(sys_time)
469+
/// .expect("Clock may have gone backwards");
469470
/// println!("{:?}", difference);
470471
/// ```
471472
#[stable(feature = "time2", since = "1.8.0")]

src/bootstrap/builder.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ impl<'a> Builder<'a> {
797797
if cmd == "doc" || cmd == "rustdoc" {
798798
let my_out = match mode {
799799
// This is the intended out directory for compiler documentation.
800-
Mode::Rustc | Mode::ToolRustc | Mode::Codegen => self.compiler_doc_out(target),
800+
Mode::Rustc | Mode::ToolRustc => self.compiler_doc_out(target),
801801
Mode::Std => out_dir.join(target.triple).join("doc"),
802802
_ => panic!("doc mode {:?} not expected", mode),
803803
};
@@ -875,7 +875,7 @@ impl<'a> Builder<'a> {
875875

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

10621062
let debuginfo_level = match mode {
1063-
Mode::Rustc | Mode::Codegen => self.config.rust_debuginfo_level_rustc,
1063+
Mode::Rustc => self.config.rust_debuginfo_level_rustc,
10641064
Mode::Std => self.config.rust_debuginfo_level_std,
10651065
Mode::ToolBootstrap | Mode::ToolStd | Mode::ToolRustc => {
10661066
self.config.rust_debuginfo_level_tools
@@ -1197,7 +1197,7 @@ impl<'a> Builder<'a> {
11971197
rustdocflags.arg("-Winvalid_codeblock_attributes");
11981198
}
11991199

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

src/bootstrap/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,6 @@ pub enum Mode {
298298
/// Build librustc, and compiler libraries, placing output in the "stageN-rustc" directory.
299299
Rustc,
300300

301-
/// Build codegen libraries, placing output in the "stageN-codegen" directory
302-
Codegen,
303-
304301
/// Build a tool, placing output in the "stage0-bootstrap-tools"
305302
/// directory. This is for miscellaneous sets of tools that are built
306303
/// using the bootstrap stage0 compiler in its entirety (target libraries
@@ -570,7 +567,6 @@ impl Build {
570567
let suffix = match mode {
571568
Mode::Std => "-std",
572569
Mode::Rustc => "-rustc",
573-
Mode::Codegen => "-codegen",
574570
Mode::ToolBootstrap => "-bootstrap-tools",
575571
Mode::ToolStd | Mode::ToolRustc => "-tools",
576572
};

src/doc/rustc/src/linker-plugin-lto.md

+15-12
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,20 @@ LLVM. However, the approximation is usually reliable.
100100

101101
The following table shows known good combinations of toolchain versions.
102102

103-
| | Clang 7 | Clang 8 | Clang 9 |
104-
|-----------|-----------|-----------|-----------|
105-
| Rust 1.34 ||||
106-
| Rust 1.35 ||||
107-
| Rust 1.36 ||||
108-
| Rust 1.37 ||||
109-
| Rust 1.38 ||||
110-
| Rust 1.39 ||||
111-
| Rust 1.40 ||||
112-
| Rust 1.41 ||||
113-
| Rust 1.42 ||||
114-
| Rust 1.43 ||||
103+
| Rust Version | Clang Version |
104+
|--------------|---------------|
105+
| Rust 1.34 | Clang 8 |
106+
| Rust 1.35 | Clang 8 |
107+
| Rust 1.36 | Clang 8 |
108+
| Rust 1.37 | Clang 8 |
109+
| Rust 1.38 | Clang 9 |
110+
| Rust 1.39 | Clang 9 |
111+
| Rust 1.40 | Clang 9 |
112+
| Rust 1.41 | Clang 9 |
113+
| Rust 1.42 | Clang 9 |
114+
| Rust 1.43 | Clang 9 |
115+
| Rust 1.44 | Clang 9 |
116+
| Rust 1.45 | Clang 10 |
117+
| Rust 1.46 | Clang 10 |
115118

116119
Note that the compatibility policy for this feature might change in the future.

src/etc/natvis/libstd.natvis

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<If Condition="(base.table.ctrl.pointer[i] &amp; 0x80) == 0">
4242
<!-- Bucket is populated -->
4343
<Exec>n--</Exec>
44-
<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>
44+
<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>
4545
</If>
4646
<Exec>i++</Exec>
4747
</Loop>
@@ -65,7 +65,7 @@
6565
<If Condition="(map.base.table.ctrl.pointer[i] &amp; 0x80) == 0">
6666
<!-- Bucket is populated -->
6767
<Exec>n--</Exec>
68-
<Item>static_cast&lt;$T1*&gt;(map.base.table.ctrl.pointer)[-(i + 1)]</Item>
68+
<Item>(($T1*)map.base.table.ctrl.pointer)[-(i + 1)]</Item>
6969
</If>
7070
<Exec>i++</Exec>
7171
</Loop>

src/librustdoc/html/static/themes/ayu.css

+3-2
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,10 @@ pre {
129129
color: #ffb44c;
130130
}
131131

132-
.line-numbers span { color: #5c6773ab; }
132+
.line-numbers span { color: #5c6773; }
133133
.line-numbers .line-highlighted {
134-
background-color: rgba(255, 236, 164, 0.06) !important;
134+
color: #708090;
135+
background-color: rgba(255, 236, 164, 0.06);
135136
padding-right: 4px;
136137
border-right: 1px solid #ffb44c;
137138
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Checks that const expressions have a useful note explaining why they can't be evaluated.
2+
// The note should relate to the fact that it cannot be shown forall N that it maps 1-1 to a new
3+
// type.
4+
5+
#![feature(const_generics)]
6+
#![allow(incomplete_features)]
7+
8+
struct Collatz<const N: Option<usize>>;
9+
10+
impl <const N: usize> Collatz<{Some(N)}> {}
11+
//~^ ERROR the const parameter
12+
13+
struct Foo;
14+
15+
impl<const N: usize> Foo {}
16+
//~^ ERROR the const parameter
17+
18+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
2+
--> $DIR/issue-68366.rs:10:13
3+
|
4+
LL | impl <const N: usize> Collatz<{Some(N)}> {}
5+
| ^ unconstrained const parameter
6+
|
7+
= note: expressions using a const parameter must map each value to a distinct output value
8+
= note: proving the result of expressions other than the parameter are unique is not supported
9+
10+
error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
11+
--> $DIR/issue-68366.rs:15:12
12+
|
13+
LL | impl<const N: usize> Foo {}
14+
| ^ unconstrained const parameter
15+
|
16+
= note: expressions using a const parameter must map each value to a distinct output value
17+
= note: proving the result of expressions other than the parameter are unique is not supported
18+
19+
error: aborting due to 2 previous errors
20+
21+
For more information about this error, try `rustc --explain E0207`.

0 commit comments

Comments
 (0)