Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
465e373
add regression test
lcnr Sep 23, 2025
4acea46
simplify setup_constraining_predicates, and note it is potentially cubic
hkBst Sep 24, 2025
1a16755
flatten conditional block
hkBst Sep 29, 2025
505a208
Split off a separate name/value parser for debuginfo test commands
Zalathar Sep 29, 2025
ffaf607
Remove `parse_negative_name_directive`
Zalathar Sep 30, 2025
e491056
Pass around `DirectiveLine` instead of bare strings
Zalathar Sep 29, 2025
5139fac
add tests
lcnr Sep 30, 2025
5f54d8b
Remove usage of `compiletest-use-stage0-libtest` from CI
Kobzol Sep 30, 2025
6edf05b
Add `#[bench]` for librustdoc's syntax highlighter
yotamofek Sep 29, 2025
2d03ab1
Replace `rustc_span::Span` with a stripped down version for librustdo…
yotamofek Sep 30, 2025
bdebd47
remove outdated context (inner) infctx
jdonszelmann Sep 30, 2025
ddbaca5
fix void and empty struct ret
ZuseZ4 Sep 30, 2025
28ffbab
add empty struct ret testcase
ZuseZ4 Sep 30, 2025
de189fa
updating tests to not break from new typetree metadata
ZuseZ4 Sep 28, 2025
ec893d1
tests: remove `no-remap-src-base`
jieyouxu Oct 1, 2025
3186902
Remove mention of `compiletest-use-stage0-libtest` from the bootstrap…
Kobzol Oct 1, 2025
b1c212f
Fix broken STD build for ESP-IDF
ivmarkov Oct 1, 2025
e6429c7
Don't create a top-level `true` directory when running UI tests
Zalathar Oct 1, 2025
5b6978a
Rollup merge of #146918 - lcnr:add-regression-test, r=jdonszelmann
Zalathar Oct 1, 2025
f8ae00a
Rollup merge of #146980 - hkBst:hir-analysis-1, r=jdonszelmann
Zalathar Oct 1, 2025
3102f00
Rollup merge of #147170 - Zalathar:directive, r=jieyouxu
Zalathar Oct 1, 2025
870657c
Rollup merge of #147180 - lcnr:forced_ambiguity-error, r=jdonszelmann
Zalathar Oct 1, 2025
ca8ed7e
Rollup merge of #147188 - Kobzol:remove-compiletest-stage-1, r=Zalath…
Zalathar Oct 1, 2025
62b72bd
Rollup merge of #147189 - yotamofek:pr/rustdoc/highlight-optimization…
Zalathar Oct 1, 2025
d4a0f21
Rollup merge of #147199 - jdonszelmann:outdated-comment-infctx, r=lcnr
Zalathar Oct 1, 2025
7b0236f
Rollup merge of #147200 - ZuseZ4:fix-autodiff-emptry-ret, r=Zalathar
Zalathar Oct 1, 2025
f50c76f
Rollup merge of #147209 - jieyouxu:remove-no-remap-src-base, r=Zalathar
Zalathar Oct 1, 2025
06e059d
Rollup merge of #147213 - ivmarkov:fix-hostname-espidf, r=joboet
Zalathar Oct 1, 2025
de20efd
Rollup merge of #147217 - Zalathar:true, r=petrochenkov
Zalathar Oct 1, 2025
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
3 changes: 0 additions & 3 deletions bootstrap.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,6 @@
# when the stage 0 compiler is actually built from in-tree sources.
#build.compiletest-allow-stage0 = false

# Whether to use the precompiled stage0 libtest with compiletest.
#build.compiletest-use-stage0-libtest = true

# Default value for the `--extra-checks` flag of tidy.
#
# See `./x test tidy --help` for details.
Expand Down
9 changes: 8 additions & 1 deletion compiler/rustc_codegen_llvm/src/builder/autodiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,5 +378,12 @@ pub(crate) fn generate_enzyme_call<'ll, 'tcx>(

let call = builder.call(enzyme_ty, None, None, ad_fn, &args, None, None);

builder.store_to_place(call, dest.val);
let fn_ret_ty = builder.cx.val_ty(call);
if fn_ret_ty != builder.cx.type_void() && fn_ret_ty != builder.cx.type_struct(&[], false) {
// If we return void or an empty struct, then our caller (due to how we generated it)
// does not expect a return value. As such, we have no pointer (or place) into which
// we could store our value, and would store into an undef, which would cause UB.
// As such, we just ignore the return value in those cases.
builder.store_to_place(call, dest.val);
}
}
53 changes: 25 additions & 28 deletions compiler/rustc_hir_analysis/src/constrained_generic_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,20 @@ pub(crate) fn setup_constraining_predicates<'tcx>(
// which is `O(nt)` where `t` is the depth of type-parameter constraints,
// remembering that `t` should be less than 7 in practice.
//
// FIXME(hkBst): the big-O bound above would be accurate for the number
// of calls to `parameters_for`, which itself is some O(complexity of type).
// That would make this potentially cubic instead of merely quadratic...
// ...unless we cache those `parameters_for` calls.
//
// Basically, I iterate over all projections and swap every
// "ready" projection to the start of the list, such that
// all of the projections before `i` are topologically sorted
// and constrain all the parameters in `input_parameters`.
//
// In the example, `input_parameters` starts by containing `U` - which
// is constrained by the trait-ref - and so on the first pass we
// In the first example, `input_parameters` starts by containing `U`,
// which is constrained by the self type `U`. Then, on the first pass we
// observe that `<U as Iterator>::Item = T` is a "ready" projection that
// constrains `T` and swap it to front. As it is the sole projection,
// constrains `T` and swap it to the front. As it is the sole projection,
// no more swaps can take place afterwards, with the result being
// * <U as Iterator>::Item = T
// * T: Debug
Expand All @@ -193,33 +198,25 @@ pub(crate) fn setup_constraining_predicates<'tcx>(
for j in i..predicates.len() {
// Note that we don't have to care about binders here,
// as the impl trait ref never contains any late-bound regions.
if let ty::ClauseKind::Projection(projection) = predicates[j].0.kind().skip_binder() {
// Special case: watch out for some kind of sneaky attempt
// to project out an associated type defined by this very
// trait.
let unbound_trait_ref = projection.projection_term.trait_ref(tcx);
if Some(unbound_trait_ref) == impl_trait_ref {
continue;
}

// A projection depends on its input types and determines its output
// type. For example, if we have
// `<<T as Bar>::Baz as Iterator>::Output = <U as Iterator>::Output`
// Then the projection only applies if `T` is known, but it still
// does not determine `U`.
let inputs = parameters_for(tcx, projection.projection_term, true);
let relies_only_on_inputs = inputs.iter().all(|p| input_parameters.contains(p));
if !relies_only_on_inputs {
continue;
}
if let ty::ClauseKind::Projection(projection) = predicates[j].0.kind().skip_binder() &&

// Special case: watch out for some kind of sneaky attempt to
// project out an associated type defined by this very trait.
!impl_trait_ref.is_some_and(|t| t == projection.projection_term.trait_ref(tcx)) &&

// A projection depends on its input types and determines its output
// type. For example, if we have
// `<<T as Bar>::Baz as Iterator>::Output = <U as Iterator>::Output`
// then the projection only applies if `T` is known, but it still
// does not determine `U`.
parameters_for(tcx, projection.projection_term, true).iter().all(|p| input_parameters.contains(p))
{
input_parameters.extend(parameters_for(tcx, projection.term, false));
} else {
continue;

predicates.swap(i, j);
i += 1;
changed = true;
}
// fancy control flow to bypass borrow checker
predicates.swap(i, j);
i += 1;
changed = true;
}
debug!(
"setup_constraining_predicates: predicates={:?} \
Expand Down
17 changes: 0 additions & 17 deletions compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,6 @@ pub struct InferCtxtInner<'tcx> {
/// `$0: 'static`. This will get checked later by regionck. (We
/// can't generally check these things right away because we have
/// to wait until types are resolved.)
///
/// These are stored in a map keyed to the id of the innermost
/// enclosing fn body / static initializer expression. This is
/// because the location where the obligation was incurred can be
/// relevant with respect to which sublifetime assumptions are in
/// place. The reason that we store under the fn-id, and not
/// something more fine-grained, is so that it is easier for
/// regionck to be sure that it has found *all* the region
/// obligations (otherwise, it's easy to fail to walk to a
/// particular node-id).
///
/// Before running `resolve_regions_and_report_errors`, the creator
/// of the inference context is expected to invoke
/// [`InferCtxt::process_registered_region_obligations`]
/// for each body-id in this map, which will process the
/// obligations within. This is expected to be done 'late enough'
/// that all type inference variables have been bound and so forth.
region_obligations: Vec<TypeOutlivesConstraint<'tcx>>,

/// The outlives bounds that we assume must hold about placeholders that
Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,10 @@ where
// fails to reach a fixpoint but ends up getting an error after
// running for some additional step.
//
// cc trait-system-refactor-initiative#105
// FIXME(@lcnr): While I believe an error here to be possible, we
// currently don't have any test which actually triggers it. @lqd
// created a minimization for an ICE in typenum, but that one no
// longer fails here. cc trait-system-refactor-initiative#105.
let source = CandidateSource::BuiltinImpl(BuiltinImplSource::Misc);
let certainty = Certainty::Maybe { cause, opaque_types_jank: OpaqueTypesJank::AllGood };
self.probe_trait_candidate(source)
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_trait_selection/src/regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ impl<'tcx> InferCtxt<'tcx> {
///
/// Prefer this method over `resolve_regions_with_normalize`, unless you are
/// doing something specific for normalization.
///
/// This function assumes that all infer variables are already constrained.
fn resolve_regions(
&self,
body_id: LocalDefId,
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/net/hostname/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cfg_select! {
target_family = "unix" => {
all(target_family = "unix", not(target_os = "espidf")) => {
mod unix;
pub use unix::hostname;
}
Expand Down
2 changes: 0 additions & 2 deletions src/bootstrap/defaults/bootstrap.dist.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ test-stage = 2
doc-stage = 2
# When compiling from source, you usually want all tools.
extended = true
# Use libtest built from the source tree instead of the precompiled one from stage 0.
compiletest-use-stage0-libtest = false

# Most users installing from source want to build all parts of the project from source.
[llvm]
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ impl<'a> Builder<'a> {
test::RunMakeCargo,
),
Kind::Miri => describe!(test::Crate),
Kind::Bench => describe!(test::Crate, test::CrateLibrustc),
Kind::Bench => describe!(test::Crate, test::CrateLibrustc, test::CrateRustdoc),
Kind::Doc => describe!(
doc::UnstableBook,
doc::UnstableBookGen,
Expand Down
2 changes: 1 addition & 1 deletion src/ci/citool/tests/test-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ runners:
<<: *base-job
envs:
env-x86_64-apple-tests: &env-x86_64-apple-tests
SCRIPT: ./x.py check compiletest --set build.compiletest-use-stage0-libtest=true && ./x.py --stage 2 test --skip tests/ui --skip tests/rustdoc -- --exact
SCRIPT: ./x.py check compiletest && ./x.py --stage 2 test --skip tests/ui --skip tests/rustdoc -- --exact
RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
# Ensure that host tooling is tested on our minimum supported macOS version.
Expand Down
1 change: 0 additions & 1 deletion src/ci/docker/host-x86_64/pr-check-1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ ENV SCRIPT \
python3 ../x.py check bootstrap && \
/scripts/check-default-config-profiles.sh && \
python3 ../x.py build src/tools/build-manifest && \
python3 ../x.py check compiletest --set build.compiletest-use-stage0-libtest=true && \
python3 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu && \
python3 ../x.py check --set build.optimized-compiler-builtins=false core alloc std --target=aarch64-unknown-linux-gnu,i686-pc-windows-msvc,i686-unknown-linux-gnu,x86_64-apple-darwin,x86_64-pc-windows-gnu,x86_64-pc-windows-msvc && \
/scripts/validate-toolstate.sh && \
Expand Down
1 change: 0 additions & 1 deletion src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,4 @@ ENV HOST_TARGET x86_64-unknown-linux-gnu
COPY scripts/shared.sh /scripts/

ENV SCRIPT /tmp/checktools.sh ../x.py && \
python3 ../x.py check compiletest --set build.compiletest-use-stage0-libtest=true && \
python3 ../x.py test tests/rustdoc-gui --stage 2 --test-args "'--jobs 1'"
3 changes: 2 additions & 1 deletion src/librustdoc/html/highlight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ use std::iter;

use rustc_data_structures::fx::FxIndexMap;
use rustc_lexer::{Cursor, FrontmatterAllowed, LiteralKind, TokenKind};
use rustc_span::BytePos;
use rustc_span::edition::Edition;
use rustc_span::symbol::Symbol;
use rustc_span::{BytePos, DUMMY_SP, Span};

use super::format;
use crate::clean::PrimitiveType;
use crate::display::Joined as _;
use crate::html::escape::EscapeBodyText;
use crate::html::macro_expansion::ExpandedCode;
use crate::html::render::span_map::{DUMMY_SP, Span};
use crate::html::render::{Context, LinkFromSrc};

/// This type is needed in case we want to render links on items to allow to go to their definition.
Expand Down
14 changes: 14 additions & 0 deletions src/librustdoc/html/highlight/tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use expect_test::expect_file;
use rustc_data_structures::fx::FxIndexMap;
use rustc_span::create_default_session_globals_then;
use test::Bencher;

use super::{DecorationInfo, write_code};

Expand Down Expand Up @@ -81,3 +82,16 @@ let a = 4;";
expect_file!["fixtures/decorations.html"].assert_eq(&html);
});
}

#[bench]
fn bench_html_highlighting(b: &mut Bencher) {
let src = include_str!("../../../../compiler/rustc_ast/src/visit.rs");

create_default_session_globals_then(|| {
b.iter(|| {
let mut out = String::new();
write_code(&mut out, src, None, None, None);
out
});
});
}
3 changes: 2 additions & 1 deletion src/librustdoc/html/render/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use crate::formats::item_type::ItemType;
use crate::html::escape::Escape;
use crate::html::macro_expansion::ExpandedCode;
use crate::html::markdown::{self, ErrorCodes, IdMap, plain_text_summary};
use crate::html::render::span_map::Span;
use crate::html::render::write_shared::write_shared;
use crate::html::url_parts_builder::UrlPartsBuilder;
use crate::html::{layout, sources, static_files};
Expand Down Expand Up @@ -139,7 +140,7 @@ pub(crate) struct SharedContext<'tcx> {

/// Correspondence map used to link types used in the source code pages to allow to click on
/// links to jump to the type's definition.
pub(crate) span_correspondence_map: FxHashMap<rustc_span::Span, LinkFromSrc>,
pub(crate) span_correspondence_map: FxHashMap<Span, LinkFromSrc>,
pub(crate) expanded_codes: FxHashMap<BytePos, Vec<ExpandedCode>>,
/// The [`Cache`] used during rendering.
pub(crate) cache: Cache,
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ mod ordered_json;
mod print_item;
pub(crate) mod sidebar;
mod sorted_template;
mod span_map;
pub(crate) mod span_map;
mod type_layout;
mod write_shared;

Expand Down
Loading
Loading