Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
452a7ca
make `RustaceansAreAwesome` satisfy trait bounds
dianne Sep 23, 2026
5695ab8
std: split stack overflow module (duplicate)
joboet Sep 23, 2026
86d18b4
std: split stack overflow module (delete)
joboet Sep 23, 2026
e449348
std: split stack overflow module (format)
joboet Sep 23, 2026
6387f4b
std: split stack overflow module
joboet Sep 23, 2026
188011a
test(imports): add baseline regression for hidden extern crate sugges…
raushan728 Jul 9, 2026
2e4b8e5
fix(metadata): demote unnameable `extern crate` items to `ExternCrate…
raushan728 Jul 9, 2026
26b5f90
Move `alloc::rc` into `alloc::rcs`
EFanZh Sep 28, 2026
f74f6ea
Rename `library/alloc/src/sync.rs` to `library/alloc/src/rcs/arc.rs` …
EFanZh Sep 28, 2026
cba3237
Re-export `alloc::rcs::arc::*` in `alloc::sync`
EFanZh Sep 28, 2026
2e58a77
Fix intra doc link resolution when a doc comment is composed of both …
GuillaumeGomez Sep 16, 2026
ceee44b
Force the correct type variable to never for method resolution on an …
JonathanBrouwer Sep 28, 2026
f3b6502
Run the `method-on-never` type on the next trait solver
JonathanBrouwer Sep 28, 2026
b6d0fb1
select: prefer impl candidates over where clauses
dianne Sep 11, 2026
67cb4ce
Add .seek_read_buf_exact() to std::os::windows::fs::FileExt
json420 Sep 28, 2026
5931727
add `Div` and `Mul` for `Complex<{float}>`
folkertdev Aug 28, 2026
dce0308
Rollup merge of #158997 - raushan728:issues/153459, r=petrochenkov
JonathanBrouwer Sep 29, 2026
31ee28f
Rollup merge of #162655 - dianne:drop-paramenv-candidates, r=lcnr
JonathanBrouwer Sep 29, 2026
f656696
Rollup merge of #162832 - folkertdev:complex-mul-div, r=tgross35
JonathanBrouwer Sep 29, 2026
3fcc6d9
Rollup merge of #162862 - GuillaumeGomez:intra-doc-link-resolution, r…
JonathanBrouwer Sep 29, 2026
5208401
Rollup merge of #163200 - dianne:dyn-satisfies-bounds, r=oli-obk
JonathanBrouwer Sep 29, 2026
d583cc1
Rollup merge of #163210 - joboet:split_stack_overflow, r=ChrisDenton
JonathanBrouwer Sep 29, 2026
a8a6a84
Rollup merge of #163331 - EFanZh:move-arc-and-rc-into-rcs, r=tgross35
JonathanBrouwer Sep 29, 2026
5d02c7f
Rollup merge of #163183 - json420:seek_read_buf_exact, r=clarfonthey
JonathanBrouwer Sep 29, 2026
38506f8
Rollup merge of #163450 - JonathanBrouwer:fix-never, r=lcnr
JonathanBrouwer Sep 29, 2026
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 20d296e9a8b837e586fcc8fc648d4ab9687a2a47 Mon Sep 17 00:00:00 2001
From: Folkert de Vries <folkert@folkertdev.nl>
Date: Mon, 28 Sep 2026 19:14:22 +0200
Subject: [PATCH] sysroot_tests: Disable complex type tests

---
coretests/tests/num/complex.rs | 2 ++
1 file changed, 2 insertions(+)

diff --git a/coretests/tests/num/complex.rs b/coretests/tests/num/complex.rs
index d73d04b1afc..289c0baec17 100644
--- a/coretests/tests/num/complex.rs
+++ b/coretests/tests/num/complex.rs
@@ -75,6 +75,7 @@ fn complex_negation() {
}

#[test]
+#[cfg_attr(target_os = "windows", ignore = "hits an ABI issue with cranelift on windows")]
fn complex_multiplication() {
#[cfg(target_has_reliable_f16)]
assert_eq!(Complex::new(1.0f16, 2.0) * Complex::new(3.0, 4.0), Complex::new(-5.0, 10.0));
@@ -105,6 +106,7 @@ fn complex_multiplication() {
}

#[test]
+#[cfg_attr(target_os = "windows", ignore = "hits an ABI issue with cranelift on windows")]
fn complex_div() {
#[cfg(target_has_reliable_f16)]
assert_eq!(Complex::new(2.0f16, 11.0) / Complex::new(2.0, 1.0), Complex::new(3.0, 4.0));
--
2.43.0

3 changes: 1 addition & 2 deletions compiler/rustc_hir_typeck/src/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
span,
MethodCallOnDivergingInferenceVariable,
);
let root_ty = Ty::new_var(self.tcx, ty_id);
self.demand_eqtype(span, root_ty, self.tcx.types.never);
self.demand_eqtype(span, ty, self.tcx.types.never);
} else {
let guar = match *ty.kind() {
_ if let Some(guar) = self.tainted_by_errors() => guar,
Expand Down
18 changes: 14 additions & 4 deletions compiler/rustc_metadata/src/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use rustc_data_structures::sync::{self, FreezeReadGuard, FreezeWriteGuard};
use rustc_data_structures::unord::UnordMap;
use rustc_expand::base::SyntaxExtension;
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE, LocalDefId, StableCrateId};
use rustc_hir::definitions::Definitions;
use rustc_hir::definitions::{DefPathData, Definitions};
use rustc_index::IndexVec;
use rustc_lint_defs as lint;
use rustc_lint_defs::builtin::UNUSED_CRATE_DEPENDENCIES;
Expand Down Expand Up @@ -1358,14 +1358,24 @@ impl CStore {
let cnum =
self.resolve_crate(tcx, name, item.span, dep_kind, CrateOrigin::Extern)?;

let path_len = definitions.def_path(def_id).data.len();
let def_path = definitions.def_path(def_id);
// An extern crate is only globally nameable if every segment in its path
// is in the type namespace (i.e., it is purely nested inside modules).
// If any segment is in the value namespace (e.g. inside a fn or const),
// it is unnameable from outside that block.
let is_unnameable =
def_path.data.iter().any(|d| !matches!(d.data, DefPathData::TypeNs(_)));
self.update_extern_crate(
cnum,
name,
ExternCrate {
src: ExternCrateSource::Extern(def_id.to_def_id()),
src: if is_unnameable {
ExternCrateSource::Path
} else {
ExternCrateSource::Extern(def_id.to_def_id())
},
span: item.span,
path_len,
path_len: if is_unnameable { usize::MAX } else { def_path.data.len() },
dependency_of: LOCAL_CRATE,
},
);
Expand Down
34 changes: 27 additions & 7 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use std::debug_assert_matches;
use std::mem::{replace, swap, take};
use std::ops::{ControlFlow, Range};

use rustc_ast::attr::AttributeExt;
use rustc_ast::visit::{
AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor, try_visit, visit_opt, walk_list,
};
Expand Down Expand Up @@ -2860,10 +2861,22 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
}

fn resolve_item(&mut self, item: &'ast Item) {
let mod_inner_docs =
matches!(item.kind, ItemKind::Mod(..)) && rustdoc::inner_docs(&item.attrs);
if !mod_inner_docs && !matches!(item.kind, ItemKind::Impl(..) | ItemKind::Use(..)) {
self.resolve_doc_links(&item.attrs, MaybeExported::Ok(item.id));
match item.kind {
ItemKind::Mod(..) => {
// We only handle outer doc comments for modules here.
let attrs = if let Some(pos) = item.attrs.iter().position(|a| {
a.doc_resolution_scope().is_some_and(|style| style == AttrStyle::Inner)
}) {
&item.attrs[..pos]
} else {
&item.attrs
};
self.resolve_doc_links(attrs, MaybeExported::Ok(item.id));
}
ItemKind::Impl(..) | ItemKind::Use(..) => {}
_ => {
self.resolve_doc_links(&item.attrs, MaybeExported::Ok(item.id));
}
}

debug!("(resolving item) resolving {:?} ({:?})", item.kind.ident(), item.kind);
Expand Down Expand Up @@ -2957,9 +2970,16 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
let orig_module = replace(&mut self.parent_scope.module, module);
self.with_rib(ValueNS, RibKind::Module(module.expect_local()), |this| {
this.with_rib(TypeNS, RibKind::Module(module.expect_local()), |this| {
if mod_inner_docs {
this.resolve_doc_links(&item.attrs, MaybeExported::Ok(item.id));
}
// Outer doc comments were already handled above, now we handle
// inner doc comments.
let attrs = if let Some(pos) = item.attrs.iter().position(|a| {
a.doc_resolution_scope().is_some_and(|style| style == AttrStyle::Inner)
}) {
&item.attrs[pos..]
} else {
&[]
};
this.resolve_doc_links(attrs, MaybeExported::Ok(item.id));
let old_macro_rules = this.parent_scope.macro_rules;
visit::walk_item(this, item);
// Maintain macro_rules scopes in the same way as during early resolution
Expand Down
53 changes: 32 additions & 21 deletions compiler/rustc_resolve/src/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use pulldown_cmark::{
};
use rustc_ast as ast;
use rustc_ast::attr::AttributeExt;
use rustc_ast::join_path_syms;
use rustc_ast::token::DocFragmentKind;
use rustc_ast::util::comments::beautify_doc_string;
use rustc_ast::{AttrStyle, join_path_syms};
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::unord::UnordSet;
use rustc_middle::ty::TyCtxt;
Expand Down Expand Up @@ -48,6 +48,7 @@ pub struct DocFragment {
/// Because we tamper with the spans context, this information cannot be correctly retrieved
/// later on. So instead, we compute it and store it here.
pub from_expansion: bool,
pub style: AttrStyle,
}

#[derive(Clone, Copy, Debug)]
Expand Down Expand Up @@ -215,8 +216,15 @@ pub fn attrs_to_doc_fragments<'a, A: AttributeExt + Clone + 'a>(
(value_span.with_ctxt(attr_span.ctxt()), value_span.from_expansion())
}
};
let fragment =
DocFragment { span, doc, kind: fragment_kind, item_id, indent: 0, from_expansion };
let fragment = DocFragment {
span,
doc,
kind: fragment_kind,
item_id,
indent: 0,
from_expansion,
style: attr.doc_resolution_scope().unwrap(),
};
doc_fragments.push(fragment);
} else if !doc_only {
other_attrs.push(attr.clone());
Expand All @@ -231,18 +239,31 @@ pub fn attrs_to_doc_fragments<'a, A: AttributeExt + Clone + 'a>(
(doc_fragments, other_attrs)
}

/// Represents a doc comment, split in two parts, outer and inner attributes. It's needed for
/// the intra-doc link resolution context.
#[derive(Default)]
pub struct DocStrings {
pub outer: String,
pub inner: String,
}

/// Return the doc-comments on this item, grouped by the module they came from.
/// The module can be different if this is a re-export with added documentation.
///
/// The last newline is not trimmed so the produced strings are reusable between
/// early and late doc link resolution regardless of their position.
pub fn prepare_to_doc_link_resolution(
doc_fragments: &[DocFragment],
) -> FxIndexMap<Option<DefId>, String> {
let mut res = FxIndexMap::default();
) -> FxIndexMap<Option<DefId>, DocStrings> {
let mut res: FxIndexMap<Option<DefId>, DocStrings> = FxIndexMap::default();
for fragment in doc_fragments {
let out_str = res.entry(fragment.item_id).or_default();
add_doc_fragment(out_str, fragment);
let out_strs = res.entry(fragment.item_id).or_default();
let out = if fragment.style == AttrStyle::Inner {
&mut out_strs.inner
} else {
&mut out_strs.outer
};
add_doc_fragment(out, fragment);
}
res
}
Expand Down Expand Up @@ -351,19 +372,6 @@ pub fn strip_generics_from_path(path_str: &str) -> Result<Box<str>, MalformedGen
}
}

/// Returns whether the first doc-comment is an inner attribute.
///
/// If there are no doc-comments, return true.
/// FIXME(#78591): Support both inner and outer attributes on the same item.
pub fn inner_docs(attrs: &[impl AttributeExt]) -> bool {
for attr in attrs {
if let Some(attr_style) = attr.doc_resolution_scope() {
return attr_style == ast::AttrStyle::Inner;
}
}
true
}

/// Has `#[rustc_doc_primitive]` or `#[doc(keyword)]` or `#[doc(attribute)]`.
pub fn has_primitive_or_keyword_or_attribute_docs(attrs: &[impl AttributeExt]) -> bool {
for attr in attrs {
Expand Down Expand Up @@ -413,7 +421,10 @@ pub(crate) fn attrs_to_preprocessed_links(attrs: &[ast::Attribute]) -> Vec<Box<s
let (doc_fragments, other_attrs) =
attrs_to_doc_fragments(attrs.iter().map(|attr| (attr, None)), false);
let doc = prepare_to_doc_link_resolution(&doc_fragments).into_values().next();
let mut links = doc.as_deref().map(parse_links).unwrap_or_default();
let mut links = doc
.as_ref()
.map(|doc| parse_links(&format!("{}{}", doc.outer, doc.inner)))
.unwrap_or_default();

for attr in other_attrs {
if let Some(note) = attr.deprecation_note() {
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_resolve/src/rustdoc/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::path::PathBuf;

use rustc_ast::AttrStyle;
use rustc_span::source_map::{FilePathMapping, SourceMap};
use rustc_span::symbol::sym;
use rustc_span::{BytePos, DUMMY_SP, FileName, Span};
Expand All @@ -25,6 +26,7 @@ fn single_backtick() {
doc: sym::empty, // unused placeholder
indent: 0,
from_expansion: false,
style: AttrStyle::Outer,
}],
)
.unwrap();
Expand All @@ -48,6 +50,7 @@ fn utf8() {
doc: sym::empty, // unused placeholder
indent: 0,
from_expansion: false,
style: AttrStyle::Outer,
}],
)
.unwrap();
Expand Down
15 changes: 12 additions & 3 deletions compiler/rustc_trait_selection/src/solve/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::ops::ControlFlow;

use rustc_infer::infer::InferCtxt;
use rustc_infer::traits::solve::inspect::ProbeKind;
use rustc_infer::traits::solve::{CandidateSource, Certainty, Goal};
use rustc_infer::traits::solve::{CandidateSource, Certainty, Goal, ParamEnvSource};
use rustc_infer::traits::{
BuiltinImplSource, ImplSource, ImplSourceUserDefinedData, Obligation, ObligationCause,
PolyTraitObligation, Selection, SelectionError, SelectionResult,
Expand Down Expand Up @@ -92,8 +92,8 @@ fn candidate_should_be_dropped_in_favor_of<'tcx>(
victim: &inspect::InspectCandidate<'_, 'tcx>,
other: &inspect::InspectCandidate<'_, 'tcx>,
) -> bool {
// Don't winnow until `Certainty::Yes` -- we don't need to winnow until
// codegen, and only on the good path.
// Don't winnow until `Certainty::Yes` -- we don't need to winnow until constant evaluation or
// codegen.
if matches!(other.result().unwrap(), Certainty::Maybe(_)) {
return false;
}
Expand Down Expand Up @@ -136,6 +136,15 @@ fn candidate_should_be_dropped_in_favor_of<'tcx>(
victim.goal().infcx().tcx.specializes((other_def_id, victim_def_id))
}

// Prefer impl candidates over global where clause candidates. Unless `generic_const_args`
// is enabled, we currently don't use an empty environment when resolving and evaluating
// constants to lower them to patterns. If we don't drop where clause candidates here, we
// can fail to select impl candidates (#162331).
(
CandidateSource::ParamEnv(ParamEnvSource::Global),
CandidateSource::Impl(_) | CandidateSource::BuiltinImpl(_),
) => true,

_ => false,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,15 @@ fn receiver_is_dispatchable<'tcx>(
let trait_predicate = ty::TraitRef::new_from_args(tcx, trait_def_id, args);
clauses.push(trait_predicate.upcast(tcx));

// U satisfies `Trait`'s where-bounds.
clauses.extend(
tcx.clauses_of(trait_def_id)
.instantiate(tcx, args)
.clauses
.into_iter()
.map(Unnormalized::skip_norm_wip),
);

let meta_sized_predicate = {
let meta_sized_did = tcx.require_lang_item(LangItem::MetaSized, DUMMY_SP);
ty::TraitRef::new(tcx, meta_sized_did, [unsized_self_ty])
Expand Down
15 changes: 13 additions & 2 deletions library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,25 @@
// from other crates, but since this can only appear for lang items, it doesn't seem worth fixing.
#![feature(intra_doc_pointers)]

#[cfg(not(no_rc))]
#[stable(feature = "rust1", since = "1.0.0")]
pub use rcs::rc;

// Module with internal macros used by other modules (needs to be included before other modules).
#[macro_use]
mod macros;

mod raw_vec;

/// Implementations of reference-counted pointers.
#[cfg(not(no_rc))]
mod rcs {
pub mod rc;

#[cfg(all(not(no_sync), target_has_atomic = "ptr"))]
pub(crate) mod arc;
}

// Heaps provided for low-level allocation strategies
pub mod alloc;

Expand All @@ -255,8 +268,6 @@ pub mod intrinsics;
#[unstable(feature = "alloc_io", issue = "154046")]
pub mod io;
pub mod panicking;
#[cfg(not(no_rc))]
pub mod rc;
pub mod slice;
pub mod str;
pub mod string;
Expand Down
Loading
Loading