Skip to content

Commit 7a599d7

Browse files
committed
Merge from rustc
2 parents 2416eae + fe61471 commit 7a599d7

File tree

1,055 files changed

+9669
-1316
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,055 files changed

+9669
-1316
lines changed

Cargo.lock

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,18 @@ version = "0.8.4"
722722
source = "registry+https://github.com/rust-lang/crates.io-index"
723723
checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
724724

725+
[[package]]
726+
name = "coverage-dump"
727+
version = "0.1.0"
728+
dependencies = [
729+
"anyhow",
730+
"leb128",
731+
"md-5",
732+
"miniz_oxide",
733+
"regex",
734+
"rustc-demangle",
735+
]
736+
725737
[[package]]
726738
name = "coverage_test_macros"
727739
version = "0.0.0"
@@ -2041,6 +2053,12 @@ version = "1.3.0"
20412053
source = "registry+https://github.com/rust-lang/crates.io-index"
20422054
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
20432055

2056+
[[package]]
2057+
name = "leb128"
2058+
version = "0.2.5"
2059+
source = "registry+https://github.com/rust-lang/crates.io-index"
2060+
checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67"
2061+
20442062
[[package]]
20452063
name = "levenshtein"
20462064
version = "1.0.5"
@@ -4228,7 +4246,6 @@ dependencies = [
42284246
"measureme",
42294247
"memoffset",
42304248
"rustc-rayon-core",
4231-
"rustc_ast",
42324249
"rustc_data_structures",
42334250
"rustc_errors",
42344251
"rustc_hir",
@@ -4437,15 +4454,12 @@ dependencies = [
44374454
name = "rustc_traits"
44384455
version = "0.0.0"
44394456
dependencies = [
4440-
"rustc_ast",
44414457
"rustc_data_structures",
44424458
"rustc_hir",
44434459
"rustc_infer",
44444460
"rustc_middle",
44454461
"rustc_span",
4446-
"rustc_target",
44474462
"rustc_trait_selection",
4448-
"smallvec",
44494463
"tracing",
44504464
]
44514465

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ members = [
4343
"src/tools/generate-windows-sys",
4444
"src/tools/rustdoc-gui-test",
4545
"src/tools/opt-dist",
46+
"src/tools/coverage-dump",
4647
]
4748

4849
exclude = [

RELEASES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Language
1010
- [expand: Change how `#![cfg(FALSE)]` behaves on crate root](https://github.com/rust-lang/rust/pull/110141/)
1111
- [Stabilize inline asm for LoongArch64](https://github.com/rust-lang/rust/pull/111235/)
1212
- [Uplift `clippy::undropped_manually_drops` lint](https://github.com/rust-lang/rust/pull/111530/)
13-
- [Uplift `clippy::invalid_utf8_in_unchecked` lint](https://github.com/rust-lang/rust/pull/111543/)
14-
- [Uplift `clippy::cast_ref_to_mut` lint](https://github.com/rust-lang/rust/pull/111567/)
15-
- [Uplift `clippy::cmp_nan` lint](https://github.com/rust-lang/rust/pull/111818/)
13+
- [Uplift `clippy::invalid_utf8_in_unchecked` lint](https://github.com/rust-lang/rust/pull/111543/) as `invalid_from_utf8_unchecked` and `invalid_from_utf8`
14+
- [Uplift `clippy::cast_ref_to_mut` lint](https://github.com/rust-lang/rust/pull/111567/) as `invalid_reference_casting`
15+
- [Uplift `clippy::cmp_nan` lint](https://github.com/rust-lang/rust/pull/111818/) as `invalid_nan_comparisons`
1616
- [resolve: Remove artificial import ambiguity errors](https://github.com/rust-lang/rust/pull/112086/)
1717
- [Don't require associated types with Self: Sized bounds in `dyn Trait` objects](https://github.com/rust-lang/rust/pull/112319/)
1818

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,10 @@ impl AttrTokenStream {
213213
.into_iter()
214214
}
215215
AttrTokenTree::Attributes(data) => {
216-
let mut outer_attrs = Vec::new();
217-
let mut inner_attrs = Vec::new();
218-
for attr in &data.attrs {
219-
match attr.style {
220-
crate::AttrStyle::Outer => outer_attrs.push(attr),
221-
crate::AttrStyle::Inner => inner_attrs.push(attr),
222-
}
223-
}
216+
let idx = data
217+
.attrs
218+
.partition_point(|attr| matches!(attr.style, crate::AttrStyle::Outer));
219+
let (outer_attrs, inner_attrs) = data.attrs.split_at(idx);
224220

225221
let mut target_tokens: Vec<_> = data
226222
.tokens
@@ -265,10 +261,10 @@ impl AttrTokenStream {
265261
"Failed to find trailing delimited group in: {target_tokens:?}"
266262
);
267263
}
268-
let mut flat: SmallVec<[_; 1]> = SmallVec::new();
264+
let mut flat: SmallVec<[_; 1]> =
265+
SmallVec::with_capacity(target_tokens.len() + outer_attrs.len());
269266
for attr in outer_attrs {
270-
// FIXME: Make this more efficient
271-
flat.extend(attr.tokens().0.clone().iter().cloned());
267+
flat.extend(attr.tokens().0.iter().cloned());
272268
}
273269
flat.extend(target_tokens);
274270
flat.into_iter()

compiler/rustc_borrowck/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ impl<'cx, 'tcx, R> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx, R> for MirBorro
603603

604604
fn visit_statement_before_primary_effect(
605605
&mut self,
606-
_results: &R,
606+
_results: &mut R,
607607
flow_state: &Flows<'cx, 'tcx>,
608608
stmt: &'cx Statement<'tcx>,
609609
location: Location,
@@ -673,7 +673,7 @@ impl<'cx, 'tcx, R> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx, R> for MirBorro
673673

674674
fn visit_terminator_before_primary_effect(
675675
&mut self,
676-
_results: &R,
676+
_results: &mut R,
677677
flow_state: &Flows<'cx, 'tcx>,
678678
term: &'cx Terminator<'tcx>,
679679
loc: Location,
@@ -784,7 +784,7 @@ impl<'cx, 'tcx, R> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx, R> for MirBorro
784784

785785
fn visit_terminator_after_primary_effect(
786786
&mut self,
787-
_results: &R,
787+
_results: &mut R,
788788
flow_state: &Flows<'cx, 'tcx>,
789789
term: &'cx Terminator<'tcx>,
790790
loc: Location,

compiler/rustc_codegen_cranelift/src/debuginfo/line_info.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,9 @@ impl DebugContext {
8282
match tcx.sess.source_map().lookup_line(span.lo()) {
8383
Ok(SourceFileAndLine { sf: file, line }) => {
8484
let line_pos = file.lines(|lines| lines[line]);
85+
let col = file.relative_position(span.lo()) - line_pos;
8586

86-
(
87-
file,
88-
u64::try_from(line).unwrap() + 1,
89-
u64::from((span.lo() - line_pos).to_u32()) + 1,
90-
)
87+
(file, u64::try_from(line).unwrap() + 1, u64::from(col.to_u32()) + 1)
9188
}
9289
Err(file) => (file, 0, 0),
9390
}

compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn make_mir_scope<'ll, 'tcx>(
6868
let file = cx.sess().source_map().lookup_source_file(mir.span.lo());
6969
debug_context.scopes[scope] = DebugScope {
7070
file_start_pos: file.start_pos,
71-
file_end_pos: file.end_pos,
71+
file_end_pos: file.end_position(),
7272
..debug_context.scopes[scope]
7373
};
7474
instantiated.insert(scope);
@@ -120,7 +120,7 @@ fn make_mir_scope<'ll, 'tcx>(
120120
dbg_scope,
121121
inlined_at: inlined_at.or(parent_scope.inlined_at),
122122
file_start_pos: loc.file.start_pos,
123-
file_end_pos: loc.file.end_pos,
123+
file_end_pos: loc.file.end_position(),
124124
};
125125
instantiated.insert(scope);
126126
}

compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl CodegenCx<'_, '_> {
267267

268268
// Use 1-based indexing.
269269
let line = (line + 1) as u32;
270-
let col = (pos - line_pos).to_u32() + 1;
270+
let col = (file.relative_position(pos) - line_pos).to_u32() + 1;
271271

272272
(file, line, col)
273273
}

compiler/rustc_const_eval/src/const_eval/eval_queries.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fn eval_body_using_ecx<'mir, 'tcx>(
7979
intern_const_alloc_recursive(ecx, intern_kind, &ret)?;
8080
// we leave alignment checks off, since this `ecx` will not be used for further evaluation anyway
8181

82-
debug!("eval_body_using_ecx done: {:?}", *ret);
82+
debug!("eval_body_using_ecx done: {:?}", ret);
8383
Ok(ret)
8484
}
8585

@@ -147,7 +147,7 @@ pub(super) fn op_to_const<'tcx>(
147147
// We know `offset` is relative to the allocation, so we can use `into_parts`.
148148
let to_const_value = |mplace: &MPlaceTy<'_>| {
149149
debug!("to_const_value(mplace: {:?})", mplace);
150-
match mplace.ptr.into_parts() {
150+
match mplace.ptr().into_parts() {
151151
(Some(alloc_id), offset) => {
152152
let alloc = ecx.tcx.global_alloc(alloc_id).unwrap_memory();
153153
ConstValue::ByRef { alloc, offset }
@@ -370,7 +370,7 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
370370
inner = true;
371371
}
372372
};
373-
let alloc_id = mplace.ptr.provenance.unwrap();
373+
let alloc_id = mplace.ptr().provenance.unwrap();
374374

375375
// Validation failed, report an error. This is always a hard error.
376376
if let Err(error) = validation {

compiler/rustc_const_eval/src/const_eval/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub(crate) fn const_caller_location(
3030
if intern_const_alloc_recursive(&mut ecx, InternKind::Constant, &loc_place).is_err() {
3131
bug!("intern_const_alloc_recursive should not error in this case")
3232
}
33-
ConstValue::Scalar(Scalar::from_maybe_pointer(loc_place.ptr, &tcx))
33+
ConstValue::Scalar(Scalar::from_maybe_pointer(loc_place.ptr(), &tcx))
3434
}
3535

3636
// We forbid type-level constants that contain more than `VALTREE_MAX_NODES` nodes.

0 commit comments

Comments
 (0)