Skip to content

Commit dd8c3a8

Browse files
committed
Auto merge of #102691 - notriddle:rollup-tdtyagp, r=notriddle
Rollup of 5 pull requests Successful merges: - #102574 (Make Hash{Set,Map}::with_hasher unstably const) - #102650 (Slightly improve no return for returning function error) - #102662 (rustdoc: remove no-op CSS `.code-header { display: block }`) - #102670 (follow-up fix about 101866 to print the self type.) - #102686 (Don't build the compiler before building rls) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents d8613f7 + 40ce4af commit dd8c3a8

24 files changed

+52
-42
lines changed

compiler/rustc_hir_analysis/src/check/fn_ctxt/suggestions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11231123
} else {
11241124
err.span_suggestion_short(
11251125
span_semi,
1126-
"remove this semicolon",
1126+
"remove this semicolon to return this value",
11271127
"",
11281128
Applicability::MachineApplicable,
11291129
);

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2265,7 +2265,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
22652265
};
22662266
let mut suggestions = vec![(
22672267
trait_path_segment.ident.span.shrink_to_lo(),
2268-
format!("<{} as ", self.tcx.def_path(impl_def_id).to_string_no_crate_verbose())
2268+
format!("<{} as ", self.tcx.type_of(impl_def_id))
22692269
)];
22702270
if let Some(generic_arg) = trait_path_segment.args {
22712271
let between_span = trait_path_segment.ident.span.between(generic_arg.span_ext);

library/std/src/collections/hash/map.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ impl<K, V, S> HashMap<K, V, S> {
280280
/// ```
281281
#[inline]
282282
#[stable(feature = "hashmap_build_hasher", since = "1.7.0")]
283-
pub fn with_hasher(hash_builder: S) -> HashMap<K, V, S> {
283+
#[rustc_const_unstable(feature = "const_collections_with_hasher", issue = "102575")]
284+
pub const fn with_hasher(hash_builder: S) -> HashMap<K, V, S> {
284285
HashMap { base: base::HashMap::with_hasher(hash_builder) }
285286
}
286287

library/std/src/collections/hash/map/tests.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,3 +1115,9 @@ fn from_array() {
11151115
// that's a problem!
11161116
let _must_not_require_type_annotation = HashMap::from([(1, 2)]);
11171117
}
1118+
1119+
#[test]
1120+
fn const_with_hasher() {
1121+
const X: HashMap<(), (), ()> = HashMap::with_hasher(());
1122+
assert_eq!(X.len(), 0);
1123+
}

library/std/src/collections/hash/set.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ impl<T, S> HashSet<T, S> {
376376
/// ```
377377
#[inline]
378378
#[stable(feature = "hashmap_build_hasher", since = "1.7.0")]
379-
pub fn with_hasher(hasher: S) -> HashSet<T, S> {
379+
#[rustc_const_unstable(feature = "const_collections_with_hasher", issue = "102575")]
380+
pub const fn with_hasher(hasher: S) -> HashSet<T, S> {
380381
HashSet { base: base::HashSet::with_hasher(hasher) }
381382
}
382383

library/std/src/collections/hash/set/tests.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,3 +496,9 @@ fn from_array() {
496496
// that's a problem!
497497
let _must_not_require_type_annotation = HashSet::from([1, 2]);
498498
}
499+
500+
#[test]
501+
fn const_with_hasher() {
502+
const X: HashSet<(), ()> = HashSet::with_hasher(());
503+
assert_eq!(X.len(), 0);
504+
}

library/std/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@
351351
// Only used in tests/benchmarks:
352352
//
353353
// Only for const-ness:
354+
#![feature(const_collections_with_hasher)]
354355
#![feature(const_io_structs)]
355356
#![feature(const_ip)]
356357
#![feature(const_ipv4)]

src/bootstrap/tool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,10 +870,10 @@ tool_extended!((self, builder),
870870
Clippy, "src/tools/clippy", "clippy-driver", stable=true, in_tree=true, {};
871871
Miri, "src/tools/miri", "miri", stable=false, in_tree=true, {};
872872
CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri", stable=false, in_tree=true, {};
873-
Rls, "src/tools/rls", "rls", stable=true, {};
874873
// FIXME: tool_std is not quite right, we shouldn't allow nightly features.
875874
// But `builder.cargo` doesn't know how to handle ToolBootstrap in stages other than 0,
876875
// and this is close enough for now.
876+
Rls, "src/tools/rls", "rls", stable=true, in_tree=true, tool_std=true, {};
877877
RustDemangler, "src/tools/rust-demangler", "rust-demangler", stable=false, in_tree=true, tool_std=true, {};
878878
Rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, in_tree=true, {};
879879
);

src/librustdoc/html/static/css/rustdoc.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,10 +654,6 @@ pre.example-line-numbers {
654654
font-weight: normal;
655655
}
656656

657-
.method > .code-header, .trait-impl > .code-header {
658-
display: block;
659-
}
660-
661657
.in-band {
662658
flex-grow: 1;
663659
margin: 0px;

src/test/ui/block-result/consider-removing-last-semi.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | pub fn f() -> String {
77
| implicitly returns `()` as its body has no tail or `return` expression
88
LL | 0u8;
99
LL | "bla".to_string();
10-
| - help: remove this semicolon
10+
| - help: remove this semicolon to return this value
1111

1212
error[E0308]: mismatched types
1313
--> $DIR/consider-removing-last-semi.rs:8:15
@@ -18,7 +18,7 @@ LL | pub fn g() -> String {
1818
| implicitly returns `()` as its body has no tail or `return` expression
1919
LL | "this won't work".to_string();
2020
LL | "removeme".to_string();
21-
| - help: remove this semicolon
21+
| - help: remove this semicolon to return this value
2222

2323
error[E0308]: mismatched types
2424
--> $DIR/consider-removing-last-semi.rs:13:25
@@ -29,7 +29,7 @@ LL | pub fn macro_tests() -> u32 {
2929
| implicitly returns `()` as its body has no tail or `return` expression
3030
...
3131
LL | mac!();
32-
| - help: remove this semicolon
32+
| - help: remove this semicolon to return this value
3333

3434
error: aborting due to 3 previous errors
3535

0 commit comments

Comments
 (0)