Skip to content

Rollup of 12 pull requests #132317

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

Merged
merged 29 commits into from
Oct 29, 2024
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8ee548f
const fn str::is_char_boundary
zachs18 Oct 23, 2024
aa493d0
const fn str::split_at*
zachs18 Oct 23, 2024
6ab87f8
Collect item bounds for RPITITs from trait where clauses just like as…
compiler-errors Oct 26, 2024
e4f793a
riscv-soft-abi-with-float-features.rs: adapt for LLVM 20
krasimirgg Oct 28, 2024
0bff994
split clippy task for library and compiler, so different lints can be…
klensy Oct 7, 2024
746b675
fix clippy::clone_on_ref_ptr for compiler
klensy Oct 7, 2024
a946721
clarified doc for `std::fs::OpenOptions.truncate()`
yakiimoninja Oct 28, 2024
5910a4f
clarified std::fs truncate doc
yakiimoninja Oct 28, 2024
d4774ff
Remove my ping for rustdoc/clean/types.rs
camelid Oct 28, 2024
b2f335e
Split `boxed.rs` into a few modules
WaffleLapkin Oct 27, 2024
f0744ca
Bless a miri test
WaffleLapkin Oct 28, 2024
5ae5323
Remove myself from mentions inside `tests/ui/check-cfg` directory
Urgau Oct 28, 2024
8b7b8e5
Hack out effects support for old solver
compiler-errors Oct 22, 2024
1763637
correct LLVMRustCreateThinLTOData arg types
klensy Oct 27, 2024
2b326e3
correct LLVMRustDIBuilderCreateOpLLVMFragment return type
klensy Oct 27, 2024
6c93c65
Delete `tests/crashes/23707.rs` because it's flaky
jieyouxu Oct 29, 2024
6f82a95
Rename `command-list.rs` to `directive-list.rs`
Zalathar Oct 29, 2024
5d0f52e
Rollup merge of #131375 - klensy:clone_on_ref_ptr, r=cjgillot
workingjubilee Oct 29, 2024
b496974
Rollup merge of #131520 - zachs18:const-str-split, r=Noratrieb
workingjubilee Oct 29, 2024
e97286e
Rollup merge of #132119 - compiler-errors:effects-old-solver, r=lcnr
workingjubilee Oct 29, 2024
b8f08fe
Rollup merge of #132194 - compiler-errors:rpitit-super-wc, r=spastorino
workingjubilee Oct 29, 2024
a70b90b
Rollup merge of #132216 - klensy:c_uint, r=cuviper
workingjubilee Oct 29, 2024
5ee13ae
Rollup merge of #132233 - WaffleLapkin:box-module-split, r=workingjub…
workingjubilee Oct 29, 2024
423d4f0
Rollup merge of #132266 - krasimirgg:llvm-20-testfix, r=hanna-kruppe,…
workingjubilee Oct 29, 2024
29a7ca9
Rollup merge of #132270 - yakiimoninja:fs-truncate-docs, r=Noratrieb
workingjubilee Oct 29, 2024
3eb7ddd
Rollup merge of #132284 - camelid:rm-ping, r=workingjubilee
workingjubilee Oct 29, 2024
9d58475
Rollup merge of #132293 - Urgau:tests-check-cfg-out-triagebot, r=lqd
workingjubilee Oct 29, 2024
0963636
Rollup merge of #132312 - jieyouxu:delete-crashes-23707, r=matthiaskrgr
workingjubilee Oct 29, 2024
6c5641c
Rollup merge of #132313 - Zalathar:directive-list, r=jieyouxu
workingjubilee Oct 29, 2024
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
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
@@ -3301,6 +3301,7 @@ version = "0.0.0"
dependencies = [
"itertools",
"rustc_ast",
"rustc_data_structures",
"rustc_lexer",
"rustc_span",
"thin-vec",
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
@@ -368,7 +368,7 @@ impl Clone for TokenKind {
// a copy. This is faster than the `derive(Clone)` version which has a
// separate path for every variant.
match self {
Interpolated(nt) => Interpolated(nt.clone()),
Interpolated(nt) => Interpolated(Lrc::clone(nt)),
_ => unsafe { std::ptr::read(self) },
}
}
21 changes: 11 additions & 10 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ use std::assert_matches::assert_matches;
use rustc_ast::ptr::P as AstP;
use rustc_ast::*;
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_data_structures::sync::Lrc;
use rustc_hir as hir;
use rustc_hir::HirId;
use rustc_hir::def::{DefKind, Res};
@@ -143,7 +144,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
ExprKind::IncludedBytes(bytes) => {
let lit = self.arena.alloc(respan(
self.lower_span(e.span),
LitKind::ByteStr(bytes.clone(), StrStyle::Cooked),
LitKind::ByteStr(Lrc::clone(bytes), StrStyle::Cooked),
));
hir::ExprKind::Lit(lit)
}
@@ -536,15 +537,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
this.mark_span_with_reason(
DesugaringKind::TryBlock,
expr.span,
Some(this.allow_try_trait.clone()),
Some(Lrc::clone(&this.allow_try_trait)),
),
expr,
)
} else {
let try_span = this.mark_span_with_reason(
DesugaringKind::TryBlock,
this.tcx.sess.source_map().end_point(body.span),
Some(this.allow_try_trait.clone()),
Some(Lrc::clone(&this.allow_try_trait)),
);

(try_span, this.expr_unit(try_span))
@@ -653,7 +654,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let unstable_span = self.mark_span_with_reason(
DesugaringKind::Async,
self.lower_span(span),
Some(self.allow_gen_future.clone()),
Some(Lrc::clone(&self.allow_gen_future)),
);
let resume_ty =
self.make_lang_item_qpath(hir::LangItem::ResumeTy, unstable_span, None);
@@ -739,7 +740,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let unstable_span = self.mark_span_with_reason(
DesugaringKind::Async,
span,
Some(self.allow_gen_future.clone()),
Some(Lrc::clone(&self.allow_gen_future)),
);
self.lower_attrs(inner_hir_id, &[Attribute {
kind: AttrKind::Normal(ptr::P(NormalAttr::from_ident(Ident::new(
@@ -815,13 +816,13 @@ impl<'hir> LoweringContext<'_, 'hir> {

let features = match await_kind {
FutureKind::Future => None,
FutureKind::AsyncIterator => Some(self.allow_for_await.clone()),
FutureKind::AsyncIterator => Some(Lrc::clone(&self.allow_for_await)),
};
let span = self.mark_span_with_reason(DesugaringKind::Await, await_kw_span, features);
let gen_future_span = self.mark_span_with_reason(
DesugaringKind::Await,
full_span,
Some(self.allow_gen_future.clone()),
Some(Lrc::clone(&self.allow_gen_future)),
);
let expr_hir_id = expr.hir_id;

@@ -1841,13 +1842,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
let unstable_span = self.mark_span_with_reason(
DesugaringKind::QuestionMark,
span,
Some(self.allow_try_trait.clone()),
Some(Lrc::clone(&self.allow_try_trait)),
);
let try_span = self.tcx.sess.source_map().end_point(span);
let try_span = self.mark_span_with_reason(
DesugaringKind::QuestionMark,
try_span,
Some(self.allow_try_trait.clone()),
Some(Lrc::clone(&self.allow_try_trait)),
);

// `Try::branch(<expr>)`
@@ -1941,7 +1942,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let unstable_span = self.mark_span_with_reason(
DesugaringKind::YeetExpr,
span,
Some(self.allow_try_trait.clone()),
Some(Lrc::clone(&self.allow_try_trait)),
);

let from_yeet_expr = self.wrap_in_try_constructor(
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1878,7 +1878,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
CoroutineKind::Async { return_impl_trait_id, .. } => (return_impl_trait_id, None),
CoroutineKind::Gen { return_impl_trait_id, .. } => (return_impl_trait_id, None),
CoroutineKind::AsyncGen { return_impl_trait_id, .. } => {
(return_impl_trait_id, Some(self.allow_async_iterator.clone()))
(return_impl_trait_id, Some(Lrc::clone(&self.allow_async_iterator)))
}
};

2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/path.rs
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
let bound_modifier_allowed_features = if let Res::Def(DefKind::Trait, async_def_id) = res
&& self.tcx.async_fn_trait_kind_from_def_id(async_def_id).is_some()
{
Some(self.allow_async_fn_traits.clone())
Some(Lrc::clone(&self.allow_async_fn_traits))
} else {
None
};
1 change: 1 addition & 0 deletions compiler/rustc_ast_pretty/Cargo.toml
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ edition = "2021"
# tidy-alphabetical-start
itertools = "0.12"
rustc_ast = { path = "../rustc_ast" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_lexer = { path = "../rustc_lexer" }
rustc_span = { path = "../rustc_span" }
thin-vec = "0.2.12"
3 changes: 2 additions & 1 deletion compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ use rustc_ast::{
GenericBound, InlineAsmOperand, InlineAsmOptions, InlineAsmRegOrRegClass,
InlineAsmTemplatePiece, PatKind, RangeEnd, RangeSyntax, Safety, SelfKind, Term, attr,
};
use rustc_data_structures::sync::Lrc;
use rustc_span::edition::Edition;
use rustc_span::source_map::{SourceMap, Spanned};
use rustc_span::symbol::{Ident, IdentPrinter, Symbol, kw, sym};
@@ -105,7 +106,7 @@ fn split_block_comment_into_lines(text: &str, col: CharPos) -> Vec<String> {
fn gather_comments(sm: &SourceMap, path: FileName, src: String) -> Vec<Comment> {
let sm = SourceMap::new(sm.path_mapping().clone());
let source_file = sm.new_source_file(path, src);
let text = (*source_file.src.as_ref().unwrap()).clone();
let text = Lrc::clone(&(*source_file.src.as_ref().unwrap()));

let text: &str = text.as_str();
let start_bpos = source_file.start_pos;
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/nll.rs
Original file line number Diff line number Diff line change
@@ -107,13 +107,13 @@ pub(crate) fn compute_regions<'a, 'tcx>(
param_env,
body,
promoted,
universal_regions.clone(),
Rc::clone(&universal_regions),
location_table,
borrow_set,
&mut all_facts,
flow_inits,
move_data,
elements.clone(),
Rc::clone(&elements),
upvars,
);

4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/region_infer/mod.rs
Original file line number Diff line number Diff line change
@@ -733,7 +733,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
}

// Now take member constraints into account.
let member_constraints = self.member_constraints.clone();
let member_constraints = Rc::clone(&self.member_constraints);
for m_c_i in member_constraints.indices(scc_a) {
self.apply_member_constraint(scc_a, m_c_i, member_constraints.choice_regions(m_c_i));
}
@@ -1679,7 +1679,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
infcx: &InferCtxt<'tcx>,
errors_buffer: &mut RegionErrors<'tcx>,
) {
let member_constraints = self.member_constraints.clone();
let member_constraints = Rc::clone(&self.member_constraints);
for m_c_i in member_constraints.all_indices() {
debug!(?m_c_i);
let m_c = &member_constraints[m_c_i];
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
@@ -134,7 +134,7 @@ pub(crate) fn type_check<'a, 'tcx>(
let mut constraints = MirTypeckRegionConstraints {
placeholder_indices: PlaceholderIndices::default(),
placeholder_index_to_region: IndexVec::default(),
liveness_constraints: LivenessValues::with_specific_points(elements.clone()),
liveness_constraints: LivenessValues::with_specific_points(Rc::clone(&elements)),
outlives_constraints: OutlivesConstraintSet::default(),
member_constraints: MemberConstraintSet::default(),
type_tests: Vec::default(),
@@ -150,7 +150,7 @@ pub(crate) fn type_check<'a, 'tcx>(
infcx,
param_env,
implicit_region_bound,
universal_regions.clone(),
Rc::clone(&universal_regions),
&mut constraints,
);

6 changes: 3 additions & 3 deletions compiler/rustc_codegen_llvm/src/back/lto.rs
Original file line number Diff line number Diff line change
@@ -503,9 +503,9 @@ fn thin_lto(
// upstream...
let data = llvm::LLVMRustCreateThinLTOData(
thin_modules.as_ptr(),
thin_modules.len() as u32,
thin_modules.len(),
symbols_below_threshold.as_ptr(),
symbols_below_threshold.len() as u32,
symbols_below_threshold.len(),
)
.ok_or_else(|| write::llvm_err(dcx, LlvmError::PrepareThinLtoContext))?;

@@ -570,7 +570,7 @@ fn thin_lto(

info!(" - {}: re-compiled", module_name);
opt_jobs.push(LtoModuleCodegen::Thin(ThinModule {
shared: shared.clone(),
shared: Arc::clone(&shared),
idx: module_index,
}));
}
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
@@ -2385,9 +2385,9 @@ unsafe extern "C" {
pub fn LLVMRustThinLTOBufferThinLinkDataLen(M: &ThinLTOBuffer) -> size_t;
pub fn LLVMRustCreateThinLTOData(
Modules: *const ThinLTOModule,
NumModules: c_uint,
NumModules: size_t,
PreservedSymbols: *const *const c_char,
PreservedSymbolsLen: c_uint,
PreservedSymbolsLen: size_t,
) -> Option<&'static mut ThinLTOData>;
pub fn LLVMRustPrepareThinLTORename(
Data: &ThinLTOData,
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
@@ -514,7 +514,7 @@ pub(crate) fn start_async_codegen<B: ExtraBackendMethods>(
future: Some(coordinator_thread),
phantom: PhantomData,
},
output_filenames: tcx.output_filenames(()).clone(),
output_filenames: Arc::clone(tcx.output_filenames(())),
}
}

@@ -1203,7 +1203,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
coordinator_send,
expanded_args: tcx.sess.expanded_args.clone(),
diag_emitter: shared_emitter.clone(),
output_filenames: tcx.output_filenames(()).clone(),
output_filenames: Arc::clone(tcx.output_filenames(())),
regular_module_config: regular_config,
metadata_module_config: metadata_config,
allocator_module_config: allocator_config,
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ use rustc_ast::expand::allocator::{ALLOCATOR_METHODS, AllocatorKind, global_fn_n
use rustc_attr as attr;
use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry};
use rustc_data_structures::sync::par_map;
use rustc_data_structures::sync::{Lrc, par_map};
use rustc_data_structures::unord::UnordMap;
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
use rustc_hir::lang_items::LangItem;
@@ -923,7 +923,7 @@ impl CrateInfo {
crate_name: UnordMap::with_capacity(n_crates),
used_crates,
used_crate_source: UnordMap::with_capacity(n_crates),
dependency_formats: tcx.dependency_formats(()).clone(),
dependency_formats: Lrc::clone(tcx.dependency_formats(())),
windows_subsystem,
natvis_debugger_visualizers: Default::default(),
};
@@ -936,7 +936,7 @@ impl CrateInfo {
info.crate_name.insert(cnum, tcx.crate_name(cnum));

let used_crate_source = tcx.used_crate_source(cnum);
info.used_crate_source.insert(cnum, used_crate_source.clone());
info.used_crate_source.insert(cnum, Lrc::clone(used_crate_source));
if tcx.is_profiler_runtime(cnum) {
info.profiler_runtime = Some(cnum);
}
2 changes: 1 addition & 1 deletion compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1395,7 +1395,7 @@ pub fn install_ice_hook(
}

let using_internal_features = Arc::new(std::sync::atomic::AtomicBool::default());
let using_internal_features_hook = using_internal_features.clone();
let using_internal_features_hook = Arc::clone(&using_internal_features);
panic::update_hook(Box::new(
move |default_hook: &(dyn Fn(&PanicHookInfo<'_>) + Send + Sync + 'static),
info: &PanicHookInfo<'_>| {
Original file line number Diff line number Diff line change
@@ -173,7 +173,7 @@ impl AnnotateSnippetEmitter {
source_map.ensure_source_file_source_present(&file);
(
format!("{}", source_map.filename_for_diagnostics(&file.name)),
source_string(file.clone(), &line),
source_string(Lrc::clone(&file), &line),
line.line_index,
line.annotations,
)
15 changes: 10 additions & 5 deletions compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
@@ -1555,7 +1555,7 @@ impl HumanEmitter {
// Get the left-side margin to remove it
let mut whitespace_margin = usize::MAX;
for line_idx in 0..annotated_file.lines.len() {
let file = annotated_file.file.clone();
let file = Lrc::clone(&annotated_file.file);
let line = &annotated_file.lines[line_idx];
if let Some(source_string) =
line.line_index.checked_sub(1).and_then(|l| file.get_line(l))
@@ -1646,7 +1646,7 @@ impl HumanEmitter {

let depths = self.render_source_line(
&mut buffer,
annotated_file.file.clone(),
Lrc::clone(&annotated_file.file),
&annotated_file.lines[line_idx],
width_offset,
code_offset,
@@ -2529,7 +2529,12 @@ impl FileWithAnnotatedLines {
// | | |
// | |______foo
// | baz
add_annotation_to_file(&mut output, file.clone(), ann.line_start, ann.as_start());
add_annotation_to_file(
&mut output,
Lrc::clone(&file),
ann.line_start,
ann.as_start(),
);
// 4 is the minimum vertical length of a multiline span when presented: two lines
// of code and two lines of underline. This is not true for the special case where
// the beginning doesn't have an underline, but the current logic seems to be
@@ -2545,11 +2550,11 @@ impl FileWithAnnotatedLines {
.unwrap_or(ann.line_start);
for line in ann.line_start + 1..until {
// Every `|` that joins the beginning of the span (`___^`) to the end (`|__^`).
add_annotation_to_file(&mut output, file.clone(), line, ann.as_line());
add_annotation_to_file(&mut output, Lrc::clone(&file), line, ann.as_line());
}
let line_end = ann.line_end - 1;
if middle < line_end {
add_annotation_to_file(&mut output, file.clone(), line_end, ann.as_line());
add_annotation_to_file(&mut output, Lrc::clone(&file), line_end, ann.as_line());
}
} else {
end_ann.annotation_type = AnnotationType::Singleline;
4 changes: 2 additions & 2 deletions compiler/rustc_errors/src/json.rs
Original file line number Diff line number Diff line change
@@ -367,9 +367,9 @@ impl Diagnostic {
ColorConfig::Always | ColorConfig::Auto => dst = Box::new(termcolor::Ansi::new(dst)),
ColorConfig::Never => {}
}
HumanEmitter::new(dst, je.fallback_bundle.clone())
HumanEmitter::new(dst, Lrc::clone(&je.fallback_bundle))
.short_message(short)
.sm(Some(je.sm.clone()))
.sm(Some(Lrc::clone(&je.sm)))
.fluent_bundle(je.fluent_bundle.clone())
.diagnostic_width(je.diagnostic_width)
.macro_backtrace(je.macro_backtrace)
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/mbe/macro_parser.rs
Original file line number Diff line number Diff line change
@@ -622,7 +622,7 @@ impl TtParser {
// possible next positions into `next_mps`. After some post-processing, the contents of
// `next_mps` replenish `cur_mps` and we start over again.
self.cur_mps.clear();
self.cur_mps.push(MatcherPos { idx: 0, matches: self.empty_matches.clone() });
self.cur_mps.push(MatcherPos { idx: 0, matches: Rc::clone(&self.empty_matches) });

loop {
self.next_mps.clear();
3 changes: 2 additions & 1 deletion compiler/rustc_expand/src/mbe/transcribe.rs
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ use rustc_ast::mut_visit::{self, MutVisitor};
use rustc_ast::token::{self, Delimiter, IdentIsRaw, Lit, LitKind, Nonterminal, Token, TokenKind};
use rustc_ast::tokenstream::{DelimSpacing, DelimSpan, Spacing, TokenStream, TokenTree};
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sync::Lrc;
use rustc_errors::{Diag, DiagCtxtHandle, PResult, pluralize};
use rustc_parse::lexer::nfc_normalize;
use rustc_parse::parser::ParseNtResult;
@@ -293,7 +294,7 @@ pub(super) fn transcribe<'a>(
// `Delimiter::Invisible` to maintain parsing priorities.
// `Interpolated` is currently used for such groups in rustc parser.
marker.visit_span(&mut sp);
TokenTree::token_alone(token::Interpolated(nt.clone()), sp)
TokenTree::token_alone(token::Interpolated(Lrc::clone(nt)), sp)
}
MatchedSeq(..) => {
// We were unable to descend far enough. This is an error.
4 changes: 0 additions & 4 deletions compiler/rustc_hir_analysis/messages.ftl
Original file line number Diff line number Diff line change
@@ -149,10 +149,6 @@ hir_analysis_drop_impl_reservation = reservation `Drop` impls are not supported
hir_analysis_duplicate_precise_capture = cannot capture parameter `{$name}` twice
.label = parameter captured again here
hir_analysis_effects_without_next_solver = using `#![feature(effects)]` without enabling next trait solver globally
.note = the next trait solver must be enabled globally for the effects feature to work correctly
.help = use `-Znext-solver` to enable
hir_analysis_empty_specialization = specialization impl does not specialize any associated items
.note = impl is a specialization of this impl
Loading