mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Auto merge of #144502 - matthiaskrgr:rollup-o81uk9m, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - rust-lang/rust#144331 (Disable non_exhaustive_omitted_patterns within matches! macro) - rust-lang/rust#144376 (Suggest unwrapping when private method name is available in inner type) - rust-lang/rust#144421 (Call `is_parsed_attribute` rather than keeping track of a list of parsed attributes manually) - rust-lang/rust#144424 (Allow setting `release-blog-post` label with rustbot) - rust-lang/rust#144427 (rename ext_tool_checks to extra_checks and use mod.rs) - rust-lang/rust#144435 (rustc-dev-guide subtree update) - rust-lang/rust#144448 (Limit defaultness query to impl of trait) - rust-lang/rust#144462 (Allow pretty printing paths with `-Zself-profile-events=args`) - rust-lang/rust#144463 (change_tracker: fix a typo) - rust-lang/rust#144468 (resolve: Do not create `NameResolutions` on access unless necessary) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
@@ -4255,6 +4255,7 @@ dependencies = [
|
||||
"rustc-literal-escaper",
|
||||
"rustc_ast",
|
||||
"rustc_ast_pretty",
|
||||
"rustc_attr_parsing",
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
"rustc_feature",
|
||||
|
||||
@@ -551,6 +551,11 @@ pub fn llvm_recording_enabled(&self) -> bool {
|
||||
pub fn get_self_profiler(&self) -> Option<Arc<SelfProfiler>> {
|
||||
self.profiler.clone()
|
||||
}
|
||||
|
||||
/// Is expensive recording of query keys and/or function arguments enabled?
|
||||
pub fn is_args_recording_enabled(&self) -> bool {
|
||||
self.enabled() && self.event_filter_mask.intersects(EventFilter::ARGS)
|
||||
}
|
||||
}
|
||||
|
||||
/// A helper for recording costly arguments to self-profiling events. Used with
|
||||
|
||||
@@ -264,6 +264,7 @@ pub(crate) fn report_method_error(
|
||||
err.span_label(within_macro_span, "due to this macro variable");
|
||||
}
|
||||
self.suggest_valid_traits(&mut err, item_name, out_of_scope_traits, true);
|
||||
self.suggest_unwrapping_inner_self(&mut err, source, rcvr_ty, item_name);
|
||||
err.emit()
|
||||
}
|
||||
|
||||
|
||||
@@ -933,6 +933,7 @@ fn add(
|
||||
fn check_gated_lint(&self, lint_id: LintId, span: Span, lint_from_cli: bool) -> bool {
|
||||
let feature = if let Some(feature) = lint_id.lint.feature_gate
|
||||
&& !self.features.enabled(feature)
|
||||
&& !span.allows_unstable(feature)
|
||||
{
|
||||
// Lint is behind a feature that is not enabled; eventually return false.
|
||||
feature
|
||||
|
||||
@@ -2124,11 +2124,11 @@ fn encode_impls(&mut self) -> LazyArray<TraitImpls> {
|
||||
};
|
||||
let def_id = id.owner_id.to_def_id();
|
||||
|
||||
self.tables.defaultness.set_some(def_id.index, tcx.defaultness(def_id));
|
||||
|
||||
if of_trait && let Some(header) = tcx.impl_trait_header(def_id) {
|
||||
record!(self.tables.impl_trait_header[def_id] <- header);
|
||||
|
||||
self.tables.defaultness.set_some(def_id.index, tcx.defaultness(def_id));
|
||||
|
||||
let trait_ref = header.trait_ref.instantiate_identity();
|
||||
let simplified_self_ty = fast_reject::simplify_type(
|
||||
self.tcx,
|
||||
|
||||
@@ -9,6 +9,7 @@ bitflags = "2.4.1"
|
||||
rustc-literal-escaper = "0.0.5"
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
||||
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_errors = { path = "../rustc_errors" }
|
||||
rustc_feature = { path = "../rustc_feature" }
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
//! Meta-syntax validation logic of attributes for post-expansion.
|
||||
|
||||
use std::slice;
|
||||
|
||||
use rustc_ast::token::Delimiter;
|
||||
use rustc_ast::tokenstream::DelimSpan;
|
||||
use rustc_ast::{
|
||||
self as ast, AttrArgs, Attribute, DelimArgs, MetaItem, MetaItemInner, MetaItemKind, NodeId,
|
||||
Path, Safety,
|
||||
};
|
||||
use rustc_attr_parsing::{AttributeParser, Late};
|
||||
use rustc_errors::{Applicability, DiagCtxtHandle, FatalError, PResult};
|
||||
use rustc_feature::{AttributeSafety, AttributeTemplate, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute};
|
||||
use rustc_session::errors::report_lit_error;
|
||||
@@ -266,67 +269,7 @@ pub fn check_builtin_meta_item(
|
||||
) {
|
||||
if !is_attr_template_compatible(&template, &meta.kind) {
|
||||
// attrs with new parsers are locally validated so excluded here
|
||||
if matches!(
|
||||
name,
|
||||
sym::inline
|
||||
| sym::export_stable
|
||||
| sym::ffi_const
|
||||
| sym::ffi_pure
|
||||
| sym::rustc_std_internal_symbol
|
||||
| sym::may_dangle
|
||||
| sym::rustc_as_ptr
|
||||
| sym::rustc_pub_transparent
|
||||
| sym::rustc_const_stable_indirect
|
||||
| sym::rustc_force_inline
|
||||
| sym::rustc_confusables
|
||||
| sym::rustc_skip_during_method_dispatch
|
||||
| sym::rustc_pass_by_value
|
||||
| sym::rustc_deny_explicit_impl
|
||||
| sym::rustc_do_not_implement_via_object
|
||||
| sym::rustc_coinductive
|
||||
| sym::const_trait
|
||||
| sym::stable
|
||||
| sym::unstable
|
||||
| sym::rustc_allowed_through_unstable_modules
|
||||
| sym::rustc_specialization_trait
|
||||
| sym::rustc_unsafe_specialization_marker
|
||||
| sym::rustc_allow_incoherent_impl
|
||||
| sym::rustc_coherence_is_core
|
||||
| sym::marker
|
||||
| sym::fundamental
|
||||
| sym::rustc_paren_sugar
|
||||
| sym::type_const
|
||||
| sym::repr
|
||||
// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres
|
||||
// ambiguity
|
||||
| sym::rustc_align
|
||||
| sym::deprecated
|
||||
| sym::optimize
|
||||
| sym::pointee
|
||||
| sym::cold
|
||||
| sym::target_feature
|
||||
| sym::rustc_allow_const_fn_unstable
|
||||
| sym::macro_use
|
||||
| sym::macro_escape
|
||||
| sym::naked
|
||||
| sym::no_mangle
|
||||
| sym::non_exhaustive
|
||||
| sym::omit_gdb_pretty_printer_section
|
||||
| sym::path
|
||||
| sym::ignore
|
||||
| sym::must_use
|
||||
| sym::track_caller
|
||||
| sym::link_name
|
||||
| sym::link_ordinal
|
||||
| sym::export_name
|
||||
| sym::rustc_macro_transparency
|
||||
| sym::link_section
|
||||
| sym::rustc_layout_scalar_valid_range_start
|
||||
| sym::rustc_layout_scalar_valid_range_end
|
||||
| sym::no_implicit_prelude
|
||||
| sym::automatically_derived
|
||||
| sym::coverage
|
||||
) {
|
||||
if AttributeParser::<Late>::is_parsed_attribute(slice::from_ref(&name)) {
|
||||
return;
|
||||
}
|
||||
emit_malformed_attribute(psess, style, meta.span, name, template);
|
||||
|
||||
@@ -452,8 +452,10 @@ fn add_import(
|
||||
self.r.per_ns(|this, ns| {
|
||||
if !type_ns_only || ns == TypeNS {
|
||||
let key = BindingKey::new(target, ns);
|
||||
let mut resolution = this.resolution(current_module, key).borrow_mut();
|
||||
resolution.single_imports.insert(import);
|
||||
this.resolution_or_default(current_module, key)
|
||||
.borrow_mut()
|
||||
.single_imports
|
||||
.insert(import);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -509,9 +509,7 @@ pub(crate) fn check_unused(&mut self, krate: &ast::Crate) {
|
||||
let mut check_redundant_imports = FxIndexSet::default();
|
||||
for module in self.arenas.local_modules().iter() {
|
||||
for (_key, resolution) in self.resolutions(*module).borrow().iter() {
|
||||
let resolution = resolution.borrow();
|
||||
|
||||
if let Some(binding) = resolution.best_binding()
|
||||
if let Some(binding) = resolution.borrow().best_binding()
|
||||
&& let NameBindingKind::Import { import, .. } = binding.kind
|
||||
&& let ImportKind::Single { id, .. } = import.kind
|
||||
{
|
||||
|
||||
@@ -2659,10 +2659,8 @@ pub(crate) fn check_for_module_export_macro(
|
||||
return None;
|
||||
}
|
||||
|
||||
let resolutions = self.resolutions(crate_module).borrow();
|
||||
let binding_key = BindingKey::new(ident, MacroNS);
|
||||
let resolution = resolutions.get(&binding_key)?;
|
||||
let binding = resolution.borrow().binding()?;
|
||||
let binding = self.resolution(crate_module, binding_key)?.binding()?;
|
||||
let Res::Def(DefKind::Macro(MacroKind::Bang), _) = binding.res() else {
|
||||
return None;
|
||||
};
|
||||
|
||||
@@ -114,9 +114,7 @@ pub(crate) fn compute_effective_visibilities<'c>(
|
||||
/// including their whole reexport chains.
|
||||
fn set_bindings_effective_visibilities(&mut self, module_id: LocalDefId) {
|
||||
let module = self.r.expect_module(module_id.to_def_id());
|
||||
let resolutions = self.r.resolutions(module);
|
||||
|
||||
for (_, name_resolution) in resolutions.borrow().iter() {
|
||||
for (_, name_resolution) in self.r.resolutions(module).borrow().iter() {
|
||||
let Some(mut binding) = name_resolution.borrow().binding() else {
|
||||
continue;
|
||||
};
|
||||
|
||||
@@ -848,8 +848,13 @@ fn resolve_ident_in_module_unadjusted(
|
||||
};
|
||||
|
||||
let key = BindingKey::new(ident, ns);
|
||||
let resolution =
|
||||
self.resolution(module, key).try_borrow_mut().map_err(|_| (Determined, Weak::No))?; // This happens when there is a cycle of imports.
|
||||
// `try_borrow_mut` is required to ensure exclusive access, even if the resulting binding
|
||||
// doesn't need to be mutable. It will fail when there is a cycle of imports, and without
|
||||
// the exclusive access infinite recursion will crash the compiler with stack overflow.
|
||||
let resolution = &*self
|
||||
.resolution_or_default(module, key)
|
||||
.try_borrow_mut()
|
||||
.map_err(|_| (Determined, Weak::No))?;
|
||||
|
||||
// If the primary binding is unusable, search further and return the shadowed glob
|
||||
// binding if it exists. What we really want here is having two separate scopes in
|
||||
|
||||
@@ -469,7 +469,7 @@ fn update_resolution<T, F>(
|
||||
// Ensure that `resolution` isn't borrowed when defining in the module's glob importers,
|
||||
// during which the resolution might end up getting re-defined via a glob cycle.
|
||||
let (binding, t, warn_ambiguity) = {
|
||||
let resolution = &mut *self.resolution(module, key).borrow_mut();
|
||||
let resolution = &mut *self.resolution_or_default(module, key).borrow_mut();
|
||||
let old_binding = resolution.binding();
|
||||
|
||||
let t = f(self, resolution);
|
||||
@@ -651,7 +651,6 @@ pub(crate) fn lint_reexports(&mut self, exported_ambiguities: FxHashSet<NameBind
|
||||
for module in self.arenas.local_modules().iter() {
|
||||
for (key, resolution) in self.resolutions(*module).borrow().iter() {
|
||||
let resolution = resolution.borrow();
|
||||
|
||||
let Some(binding) = resolution.best_binding() else { continue };
|
||||
|
||||
if let NameBindingKind::Import { import, .. } = binding.kind
|
||||
@@ -1202,41 +1201,39 @@ fn finalize_import(&mut self, import: Import<'ra>) -> Option<UnresolvedImportErr
|
||||
});
|
||||
|
||||
return if all_ns_failed {
|
||||
let resolutions = match module {
|
||||
ModuleOrUniformRoot::Module(module) => Some(self.resolutions(module).borrow()),
|
||||
_ => None,
|
||||
};
|
||||
let resolutions = resolutions.as_ref().into_iter().flat_map(|r| r.iter());
|
||||
let names = resolutions
|
||||
.filter_map(|(BindingKey { ident: i, .. }, resolution)| {
|
||||
if i.name == ident.name {
|
||||
return None;
|
||||
} // Never suggest the same name
|
||||
match *resolution.borrow() {
|
||||
ref resolution
|
||||
if let Some(name_binding) = resolution.best_binding() =>
|
||||
{
|
||||
match name_binding.kind {
|
||||
NameBindingKind::Import { binding, .. } => {
|
||||
match binding.kind {
|
||||
// Never suggest the name that has binding error
|
||||
// i.e., the name that cannot be previously resolved
|
||||
NameBindingKind::Res(Res::Err) => None,
|
||||
_ => Some(i.name),
|
||||
let names = match module {
|
||||
ModuleOrUniformRoot::Module(module) => {
|
||||
self.resolutions(module)
|
||||
.borrow()
|
||||
.iter()
|
||||
.filter_map(|(BindingKey { ident: i, .. }, resolution)| {
|
||||
if i.name == ident.name {
|
||||
return None;
|
||||
} // Never suggest the same name
|
||||
|
||||
let resolution = resolution.borrow();
|
||||
if let Some(name_binding) = resolution.best_binding() {
|
||||
match name_binding.kind {
|
||||
NameBindingKind::Import { binding, .. } => {
|
||||
match binding.kind {
|
||||
// Never suggest the name that has binding error
|
||||
// i.e., the name that cannot be previously resolved
|
||||
NameBindingKind::Res(Res::Err) => None,
|
||||
_ => Some(i.name),
|
||||
}
|
||||
}
|
||||
_ => Some(i.name),
|
||||
}
|
||||
_ => Some(i.name),
|
||||
} else if resolution.single_imports.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(i.name)
|
||||
}
|
||||
}
|
||||
NameResolution { ref single_imports, .. }
|
||||
if single_imports.is_empty() =>
|
||||
{
|
||||
None
|
||||
}
|
||||
_ => Some(i.name),
|
||||
}
|
||||
})
|
||||
.collect::<Vec<Symbol>>();
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
_ => Vec::new(),
|
||||
};
|
||||
|
||||
let lev_suggestion =
|
||||
find_best_match_for_name(&names, ident.name, None).map(|suggestion| {
|
||||
@@ -1517,8 +1514,7 @@ fn resolve_glob_import(&mut self, import: Import<'ra>) {
|
||||
let imported_binding = self.import(binding, import);
|
||||
let warn_ambiguity = self
|
||||
.resolution(import.parent_scope.module, key)
|
||||
.borrow()
|
||||
.binding()
|
||||
.and_then(|r| r.binding())
|
||||
.is_some_and(|binding| binding.warn_ambiguity_recursive());
|
||||
let _ = self.try_define(
|
||||
import.parent_scope.module,
|
||||
|
||||
@@ -3449,8 +3449,7 @@ fn check_trait_item<F>(
|
||||
};
|
||||
ident.span.normalize_to_macros_2_0_and_adjust(module.expansion);
|
||||
let key = BindingKey::new(ident, ns);
|
||||
let mut binding =
|
||||
self.r.resolution(module, key).try_borrow().ok().and_then(|r| r.best_binding());
|
||||
let mut binding = self.r.resolution(module, key).and_then(|r| r.best_binding());
|
||||
debug!(?binding);
|
||||
if binding.is_none() {
|
||||
// We could not find the trait item in the correct namespace.
|
||||
@@ -3461,8 +3460,7 @@ fn check_trait_item<F>(
|
||||
_ => ns,
|
||||
};
|
||||
let key = BindingKey::new(ident, ns);
|
||||
binding =
|
||||
self.r.resolution(module, key).try_borrow().ok().and_then(|r| r.best_binding());
|
||||
binding = self.r.resolution(module, key).and_then(|r| r.best_binding());
|
||||
debug!(?binding);
|
||||
}
|
||||
|
||||
|
||||
@@ -1461,15 +1461,17 @@ fn get_single_associated_item(
|
||||
if let PathResult::Module(ModuleOrUniformRoot::Module(module)) =
|
||||
self.resolve_path(mod_path, None, None)
|
||||
{
|
||||
let resolutions = self.r.resolutions(module).borrow();
|
||||
let targets: Vec<_> = resolutions
|
||||
let targets: Vec<_> = self
|
||||
.r
|
||||
.resolutions(module)
|
||||
.borrow()
|
||||
.iter()
|
||||
.filter_map(|(key, resolution)| {
|
||||
resolution
|
||||
.borrow()
|
||||
.best_binding()
|
||||
.map(|binding| binding.res())
|
||||
.and_then(|res| if filter_fn(res) { Some((key, res)) } else { None })
|
||||
.and_then(|res| if filter_fn(res) { Some((*key, res)) } else { None })
|
||||
})
|
||||
.collect();
|
||||
if let [target] = targets.as_slice() {
|
||||
@@ -2300,8 +2302,9 @@ pub(crate) fn find_similarly_named_assoc_item(
|
||||
return None;
|
||||
}
|
||||
|
||||
let resolutions = self.r.resolutions(*module);
|
||||
let targets = resolutions
|
||||
let targets = self
|
||||
.r
|
||||
.resolutions(*module)
|
||||
.borrow()
|
||||
.iter()
|
||||
.filter_map(|(key, res)| {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#![recursion_limit = "256"]
|
||||
// tidy-alphabetical-end
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::cell::{Cell, Ref, RefCell};
|
||||
use std::collections::BTreeSet;
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
@@ -1905,9 +1905,16 @@ fn resolution(
|
||||
&mut self,
|
||||
module: Module<'ra>,
|
||||
key: BindingKey,
|
||||
) -> Option<Ref<'ra, NameResolution<'ra>>> {
|
||||
self.resolutions(module).borrow().get(&key).map(|resolution| resolution.borrow())
|
||||
}
|
||||
|
||||
fn resolution_or_default(
|
||||
&mut self,
|
||||
module: Module<'ra>,
|
||||
key: BindingKey,
|
||||
) -> &'ra RefCell<NameResolution<'ra>> {
|
||||
*self
|
||||
.resolutions(module)
|
||||
self.resolutions(module)
|
||||
.borrow_mut()
|
||||
.entry(key)
|
||||
.or_insert_with(|| self.arenas.alloc_name_resolution())
|
||||
|
||||
@@ -313,6 +313,7 @@ pub fn record_trimmed_def_paths(&self) {
|
||||
|| self.opts.unstable_opts.query_dep_graph
|
||||
|| self.opts.unstable_opts.dump_mir.is_some()
|
||||
|| self.opts.unstable_opts.unpretty.is_some()
|
||||
|| self.prof.is_args_recording_enabled()
|
||||
|| self.opts.output_types.contains_key(&OutputType::Mir)
|
||||
|| std::env::var_os("RUSTC_LOG").is_some()
|
||||
{
|
||||
|
||||
@@ -80,8 +80,11 @@ fn sizedness_constraint_for_ty<'tcx>(
|
||||
|
||||
fn defaultness(tcx: TyCtxt<'_>, def_id: LocalDefId) -> hir::Defaultness {
|
||||
match tcx.hir_node_by_def_id(def_id) {
|
||||
hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl(impl_), .. }) => impl_.defaultness,
|
||||
hir::Node::ImplItem(hir::ImplItem { defaultness, .. })
|
||||
hir::Node::Item(hir::Item {
|
||||
kind: hir::ItemKind::Impl(hir::Impl { defaultness, of_trait: Some(_), .. }),
|
||||
..
|
||||
})
|
||||
| hir::Node::ImplItem(hir::ImplItem { defaultness, .. })
|
||||
| hir::Node::TraitItem(hir::TraitItem { defaultness, .. }) => *defaultness,
|
||||
node => {
|
||||
bug!("`defaultness` called on {:?}", node);
|
||||
|
||||
@@ -426,8 +426,10 @@ macro_rules! debug_assert_ne {
|
||||
#[macro_export]
|
||||
#[stable(feature = "matches_macro", since = "1.42.0")]
|
||||
#[rustc_diagnostic_item = "matches_macro"]
|
||||
#[allow_internal_unstable(non_exhaustive_omitted_patterns_lint, stmt_expr_attributes)]
|
||||
macro_rules! matches {
|
||||
($expression:expr, $pattern:pat $(if $guard:expr)? $(,)?) => {
|
||||
#[allow(non_exhaustive_omitted_patterns)]
|
||||
match $expression {
|
||||
$pattern $(if $guard)? => true,
|
||||
_ => false
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
#![feature(min_specialization)]
|
||||
#![feature(never_type)]
|
||||
#![feature(next_index)]
|
||||
#![feature(non_exhaustive_omitted_patterns_lint)]
|
||||
#![feature(numfmt)]
|
||||
#![feature(pattern)]
|
||||
#![feature(pointer_is_aligned_to)]
|
||||
|
||||
@@ -213,3 +213,9 @@ fn _expression() {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[deny(non_exhaustive_omitted_patterns)]
|
||||
fn _matches_does_not_trigger_non_exhaustive_omitted_patterns_lint(o: core::sync::atomic::Ordering) {
|
||||
// Ordering is a #[non_exhaustive] enum from a separate crate
|
||||
let _m = matches!(o, core::sync::atomic::Ordering::Relaxed);
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ pub fn human_readable_changes(changes: &[ChangeInfo]) -> String {
|
||||
ChangeInfo {
|
||||
change_id: 143255,
|
||||
severity: ChangeSeverity::Warning,
|
||||
summary: "`llvm.lld` is no longer enabled by default for the dist profile.",
|
||||
summary: "`rust.lld` is no longer enabled by default for the dist profile.",
|
||||
},
|
||||
ChangeInfo {
|
||||
change_id: 143251,
|
||||
|
||||
@@ -1 +1 @@
|
||||
460259d14de0274b97b8801e08cb2fe5f16fdac5
|
||||
efd420c770bb179537c01063e98cb6990c439654
|
||||
|
||||
@@ -40,27 +40,24 @@ implement a new tool feature or test, that should happen in one collective rustc
|
||||
* `portable-simd` ([sync script](https://github.com/rust-lang/portable-simd/blob/master/subtree-sync.sh))
|
||||
* `rustfmt`
|
||||
* `rustc_codegen_cranelift` ([sync script](https://github.com/rust-lang/rustc_codegen_cranelift/blob/113af154d459e41b3dc2c5d7d878e3d3a8f33c69/scripts/rustup.sh#L7))
|
||||
* Using the [josh] tool
|
||||
* `miri` ([sync guide](https://github.com/rust-lang/miri/blob/master/CONTRIBUTING.md#advanced-topic-syncing-with-the-rustc-repo))
|
||||
* `rust-analyzer` ([sync script](https://github.com/rust-lang/rust-analyzer/blob/2e13684be123eca7181aa48e043e185d8044a84a/xtask/src/release.rs#L147))
|
||||
* `rustc-dev-guide` ([josh sync](#synchronizing-a-josh-subtree))
|
||||
* `compiler-builtins` ([josh sync](#synchronizing-a-josh-subtree))
|
||||
* `stdarch` ([josh sync](#synchronizing-a-josh-subtree))
|
||||
* Using the [josh](#synchronizing-a-josh-subtree) tool
|
||||
* `miri`
|
||||
* `rust-analyzer`
|
||||
* `rustc-dev-guide`
|
||||
* `compiler-builtins`
|
||||
* `stdarch`
|
||||
|
||||
### Josh subtrees
|
||||
|
||||
The [josh] tool is an alternative to git subtrees, which manages git history in a different way and scales better to larger repositories. Specific tooling is required to work with josh; you can check out the `miri` or `rust-analyzer` scripts linked above for inspiration. We provide a helper [`rustc-josh-sync`][josh-sync] tool to help with the synchronization, described [below](#synchronizing-a-josh-subtree).
|
||||
The [josh] tool is an alternative to git subtrees, which manages git history in a different way and scales better to larger repositories. Specific tooling is required to work with josh. We provide a helper [`rustc-josh-sync`][josh-sync] tool to help with the synchronization, described [below](#synchronizing-a-josh-subtree).
|
||||
|
||||
### Synchronizing a Josh subtree
|
||||
|
||||
We use a dedicated tool called [`rustc-josh-sync`][josh-sync] for performing Josh subtree updates.
|
||||
Currently, we are migrating Josh repositories to it. So far, it is used in:
|
||||
The commands below can be used for all our Josh subtrees, although note that `miri`
|
||||
requires you to perform some [additional steps](https://github.com/rust-lang/miri/blob/master/CONTRIBUTING.md#advanced-topic-syncing-with-the-rustc-repo) during pulls.
|
||||
|
||||
- compiler-builtins
|
||||
- rustc-dev-guide
|
||||
- stdarch
|
||||
|
||||
To install the tool:
|
||||
You can install the tool using the following command:
|
||||
```
|
||||
cargo install --locked --git https://github.com/rust-lang/josh-sync
|
||||
```
|
||||
@@ -80,6 +77,9 @@ switch to its repository checkout directory in your terminal).
|
||||
|
||||
#### Performing push
|
||||
|
||||
> NOTE:
|
||||
> Before you proceed, look at some guidance related to Git [on josh-sync README].
|
||||
|
||||
1) Run the push command to create a branch named `<branch-name>` in a `rustc` fork under the `<gh-username>` account
|
||||
```
|
||||
rustc-josh-sync push <branch-name> <gh-username>
|
||||
@@ -173,3 +173,4 @@ the week leading up to the beta cut.
|
||||
[Toolstate chapter]: https://forge.rust-lang.org/infra/toolstate.html
|
||||
[josh]: https://josh-project.github.io/josh/intro.html
|
||||
[josh-sync]: https://github.com/rust-lang/josh-sync
|
||||
[on josh-sync README]: https://github.com/rust-lang/josh-sync#git-peculiarities
|
||||
|
||||
@@ -165,8 +165,8 @@ pub fn files_modified(ci_info: &CiInfo, pred: impl Fn(&str) -> bool) -> bool {
|
||||
pub mod deps;
|
||||
pub mod edition;
|
||||
pub mod error_codes;
|
||||
pub mod ext_tool_checks;
|
||||
pub mod extdeps;
|
||||
pub mod extra_checks;
|
||||
pub mod features;
|
||||
pub mod filenames;
|
||||
pub mod fluent_alphabetical;
|
||||
|
||||
@@ -177,7 +177,7 @@ macro_rules! check {
|
||||
check!(unstable_book, &src_path, collected);
|
||||
|
||||
check!(
|
||||
ext_tool_checks,
|
||||
extra_checks,
|
||||
&root_path,
|
||||
&output_directory,
|
||||
&ci_info,
|
||||
|
||||
+4
-2
@@ -8,12 +8,14 @@ fn num_to_digit(_1: char) -> u32 {
|
||||
let _2: std::option::Option<u32>;
|
||||
scope 2 (inlined Option::<u32>::is_some) {
|
||||
let mut _3: isize;
|
||||
scope 3 {
|
||||
}
|
||||
}
|
||||
}
|
||||
scope 3 (inlined #[track_caller] Option::<u32>::unwrap) {
|
||||
scope 4 (inlined #[track_caller] Option::<u32>::unwrap) {
|
||||
let mut _5: isize;
|
||||
let mut _6: !;
|
||||
scope 4 {
|
||||
scope 5 {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -8,12 +8,14 @@ fn num_to_digit(_1: char) -> u32 {
|
||||
let _2: std::option::Option<u32>;
|
||||
scope 2 (inlined Option::<u32>::is_some) {
|
||||
let mut _3: isize;
|
||||
scope 3 {
|
||||
}
|
||||
}
|
||||
}
|
||||
scope 3 (inlined #[track_caller] Option::<u32>::unwrap) {
|
||||
scope 4 (inlined #[track_caller] Option::<u32>::unwrap) {
|
||||
let mut _5: isize;
|
||||
let mut _6: !;
|
||||
scope 4 {
|
||||
scope 5 {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -8,12 +8,14 @@ fn num_to_digit(_1: char) -> u32 {
|
||||
let _2: std::option::Option<u32>;
|
||||
scope 2 (inlined Option::<u32>::is_some) {
|
||||
let mut _3: isize;
|
||||
scope 3 {
|
||||
}
|
||||
}
|
||||
}
|
||||
scope 3 (inlined #[track_caller] Option::<u32>::unwrap) {
|
||||
scope 4 (inlined #[track_caller] Option::<u32>::unwrap) {
|
||||
let mut _5: isize;
|
||||
let mut _6: !;
|
||||
scope 4 {
|
||||
scope 5 {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -8,12 +8,14 @@ fn num_to_digit(_1: char) -> u32 {
|
||||
let _2: std::option::Option<u32>;
|
||||
scope 2 (inlined Option::<u32>::is_some) {
|
||||
let mut _3: isize;
|
||||
scope 3 {
|
||||
}
|
||||
}
|
||||
}
|
||||
scope 3 (inlined #[track_caller] Option::<u32>::unwrap) {
|
||||
scope 4 (inlined #[track_caller] Option::<u32>::unwrap) {
|
||||
let mut _5: isize;
|
||||
let mut _6: !;
|
||||
scope 4 {
|
||||
scope 5 {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
let mut _2: bool;
|
||||
let mut _3: isize;
|
||||
+ let mut _4: isize;
|
||||
scope 1 {
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2);
|
||||
|
||||
@@ -25,9 +25,11 @@ fn step_forward(_1: u16, _2: usize) -> u16 {
|
||||
}
|
||||
scope 8 (inlined Option::<u16>::is_none) {
|
||||
scope 9 (inlined Option::<u16>::is_some) {
|
||||
scope 10 {
|
||||
}
|
||||
}
|
||||
}
|
||||
scope 10 (inlined core::num::<impl u16>::wrapping_add) {
|
||||
scope 11 (inlined core::num::<impl u16>::wrapping_add) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -25,9 +25,11 @@ fn step_forward(_1: u16, _2: usize) -> u16 {
|
||||
}
|
||||
scope 8 (inlined Option::<u16>::is_none) {
|
||||
scope 9 (inlined Option::<u16>::is_some) {
|
||||
scope 10 {
|
||||
}
|
||||
}
|
||||
}
|
||||
scope 10 (inlined core::num::<impl u16>::wrapping_add) {
|
||||
scope 11 (inlined core::num::<impl u16>::wrapping_add) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ fn issue_77355_opt(_1: Foo) -> u64 {
|
||||
debug num => _1;
|
||||
let mut _0: u64;
|
||||
let mut _2: isize;
|
||||
scope 1 {
|
||||
}
|
||||
|
||||
bb0: {
|
||||
_2 = discriminant(_1);
|
||||
|
||||
@@ -1233,6 +1233,10 @@ Exercises sanitizer support. See [Sanitizer | The rustc book](https://doc.rust-l
|
||||
|
||||
Tests with erroneous ways of using `self`, such as using `this.x` syntax as seen in other languages, having it not be the first argument, or using it in a non-associated function (no `impl` or `trait`). It also contains correct uses of `self` which have previously been observed to cause ICEs.
|
||||
|
||||
## `tests/ui/self-profile/`: self-profiling
|
||||
|
||||
Tests related to the self-profiler (`-Zself-profile`) functionality of rustc.
|
||||
|
||||
## `tests/ui/sepcomp/`: Separate Compilation
|
||||
|
||||
In this directory, multiple crates are compiled, but some of them have `inline` functions, meaning they must be inlined into a different crate despite having been compiled separately.
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// Checks that when we use `-Zself-profile-events=args`, it is possible to pretty print paths
|
||||
// using `trimmed_def_paths` even without producing diagnostics.
|
||||
//
|
||||
// Issue: <https://github.com/rust-lang/rust/issues/144457>.
|
||||
|
||||
//@ compile-flags: -Zself-profile={{build-base}} -Zself-profile-events=args
|
||||
//@ build-pass
|
||||
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::atomic::Ordering::Relaxed;
|
||||
|
||||
fn main() {
|
||||
AtomicUsize::new(0).load(Relaxed);
|
||||
}
|
||||
@@ -56,4 +56,11 @@ fn test_option_in_unit_return() {
|
||||
//~| HELP consider using `Option::expect` to unwrap the `Foo` value, panicking if the value is an `Option::None`
|
||||
}
|
||||
|
||||
fn test_option_private_method() {
|
||||
let res: Option<_> = Some(vec![1, 2, 3]);
|
||||
res.expect("REASON").len();
|
||||
//~^ ERROR method `len` is private
|
||||
//~| HELP consider using `Option::expect` to unwrap the `Vec<{integer}>` value, panicking if the value is an `Option::None`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -56,4 +56,11 @@ fn test_option_in_unit_return() {
|
||||
//~| HELP consider using `Option::expect` to unwrap the `Foo` value, panicking if the value is an `Option::None`
|
||||
}
|
||||
|
||||
fn test_option_private_method() {
|
||||
let res: Option<_> = Some(vec![1, 2, 3]);
|
||||
res.len();
|
||||
//~^ ERROR method `len` is private
|
||||
//~| HELP consider using `Option::expect` to unwrap the `Vec<{integer}>` value, panicking if the value is an `Option::None`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -94,6 +94,23 @@ help: consider using `Option::expect` to unwrap the `Foo` value, panicking if th
|
||||
LL | res.expect("REASON").get();
|
||||
| +++++++++++++++++
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error[E0624]: method `len` is private
|
||||
--> $DIR/enum-method-probe.rs:61:9
|
||||
|
|
||||
LL | res.len();
|
||||
| ^^^ private method
|
||||
--> $SRC_DIR/core/src/option.rs:LL:COL
|
||||
|
|
||||
= note: private method defined here
|
||||
|
|
||||
note: the method `len` exists on the type `Vec<{integer}>`
|
||||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
||||
help: consider using `Option::expect` to unwrap the `Vec<{integer}>` value, panicking if the value is an `Option::None`
|
||||
|
|
||||
LL | res.expect("REASON").len();
|
||||
| +++++++++++++++++
|
||||
|
||||
For more information about this error, try `rustc --explain E0599`.
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0599, E0624.
|
||||
For more information about an error, try `rustc --explain E0599`.
|
||||
|
||||
+2
-1
@@ -28,6 +28,7 @@ allow-unauthenticated = [
|
||||
"llvm-*",
|
||||
"needs-fcp",
|
||||
"relnotes",
|
||||
"release-blog-post",
|
||||
"requires-*",
|
||||
"regression-*",
|
||||
"rla-*",
|
||||
@@ -1096,7 +1097,7 @@ cc = ["@jieyouxu"]
|
||||
message = "The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging."
|
||||
cc = ["@davidtwco", "@wesleywiser"]
|
||||
|
||||
[mentions."src/tools/tidy/src/ext_tool_checks.rs"]
|
||||
[mentions."src/tools/tidy/src/extra_checks"]
|
||||
message = "`tidy` extra checks were modified."
|
||||
cc = ["@lolbinarycat"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user