Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use tracing::debug;

use crate::Namespace::{MacroNS, TypeNS, ValueNS};
use crate::def_collector::DefCollector;
use crate::error_helper::{OnUnknownData, StructCtor};
use crate::diagnostics::impls::{OnUnknownData, StructCtor};
use crate::imports::{ImportData, ImportKind, NameResolution, NameResolutionRef};
use crate::macros::{MacroRulesDecl, MacroRulesScope, MacroRulesScopeRef};
use crate::ref_mut::CmCell;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use rustc_span::{Ident, Span, Spanned, Symbol};
use crate::Res;
use crate::late::{PatternSource, ResolvingRestrictionKind};

pub(crate) mod impls;

#[derive(Diagnostic)]
#[diag("can't use {$is_self ->
[true] `Self`
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ use rustc_span::{Ident, Span, Symbol, kw, sym};
use tracing::debug;

use crate::Namespace::{self, *};
use crate::diagnostics::impls::{OnUnknownData, Suggestion};
use crate::diagnostics::{
self, CannotBeReexportedCratePublic, CannotBeReexportedCratePublicNS,
CannotBeReexportedPrivate, CannotBeReexportedPrivateNS, CannotDetermineImportResolution,
CannotGlobImportAllCrates, ConsiderAddingMacroExport, ConsiderMarkingAsPub,
ConsiderMarkingAsPubCrate,
};
use crate::error_helper::{OnUnknownData, Suggestion};
use crate::ref_mut::{CmCell, CmRefCell};
use crate::{
AmbiguityError, BindingKey, CmResolver, Decl, DeclData, DeclKind, Determinacy, Finalize,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use thin_vec::{ThinVec, thin_vec};
use tracing::debug;

use super::NoConstantGenericsReason;
use crate::error_helper::{ImportSuggestion, LabelSuggestion, TypoSuggestion};
use crate::diagnostics::impls::{ImportSuggestion, LabelSuggestion, TypoSuggestion};
use crate::late::{
AliasPossibility, LateResolutionVisitor, LifetimeBinderKind, LifetimeRes, LifetimeRibKind,
LifetimeUseSet, QSelf, RibKind,
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use std::{fmt, mem};

use diagnostics::{ParamKindInEnumDiscriminant, ParamKindInNonTrivialAnonConst};
use effective_visibilities::EffectiveVisibilitiesVisitor;
use error_helper::{ImportSuggestion, LabelSuggestion, StructCtor, Suggestion};
use hygiene::Macros20NormalizedSyntaxContext;
use imports::{Import, ImportData, ImportKind, NameResolution, PendingDecl};
use late::{
Expand Down Expand Up @@ -77,7 +76,9 @@ use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw, sym};
use smallvec::{SmallVec, smallvec};
use tracing::{debug, instrument};

use crate::error_helper::OnUnknownData;
use crate::diagnostics::impls::{
ImportSuggestion, LabelSuggestion, OnUnknownData, StructCtor, Suggestion,
};
use crate::imports::NameResolutionRef;
use crate::ref_mut::{CmCell, CmRefCell};

Expand All @@ -86,7 +87,6 @@ mod check_unused;
mod def_collector;
mod diagnostics;
mod effective_visibilities;
mod error_helper;
mod ident;
mod imports;
mod late;
Expand Down
41 changes: 22 additions & 19 deletions library/std/src/sys/env/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,19 @@ pub unsafe fn environ() -> *mut *const *const c_char {
unsafe { libc::_NSGetEnviron() as *mut *const *const c_char }
}

// On FreeBSD, environ comes from CRT rather than libc
// On FreeBSD, environ lives in crt1.o, not libc.so, so a shared library
// cannot take a strong link-time reference to it (#153451), and dlsym cannot
// find it in a statically linked executable, which has no dynamic symbol
// table to search (#158939). A weak reference covers both: it binds at link
// time in any executable, and in a shared library the runtime linker
// resolves it against the environ the executable exports.
#[cfg(target_os = "freebsd")]
pub unsafe fn environ() -> *mut *const *const c_char {
use crate::sync::LazyLock;

struct Environ(*mut *const *const c_char);
unsafe impl Send for Environ {}
unsafe impl Sync for Environ {}

static ENVIRON: LazyLock<Environ> = LazyLock::new(|| {
Environ(unsafe {
libc::dlsym(libc::RTLD_DEFAULT, c"environ".as_ptr()) as *mut *const *const c_char
})
});
ENVIRON.0
unsafe extern "C" {
#[linkage = "extern_weak"]
static environ: *mut *const *const c_char;
}
unsafe { environ }
}

// Use the `environ` static which is part of POSIX.
Expand All @@ -75,14 +73,19 @@ pub fn env_read_lock() -> impl Drop {
pub fn env() -> Env {
unsafe {
let _guard = env_read_lock();
let mut environ = *environ();
let mut result = Vec::new();
if !environ.is_null() {
while !(*environ).is_null() {
if let Some(key_value) = parse(CStr::from_ptr(*environ).to_bytes()) {
result.push(key_value);
// A null return means the platform could not locate the symbol;
// treat it like an empty environment.
let environ_ptr = environ();
if !environ_ptr.is_null() {
let mut environ = *environ_ptr;
if !environ.is_null() {
while !(*environ).is_null() {
if let Some(key_value) = parse(CStr::from_ptr(*environ).to_bytes()) {
result.push(key_value);
}
environ = environ.add(1);
}
environ = environ.add(1);
}
}
return Env::new(result);
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/stdio/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl io::Read for Stdin {
Ok(bytes_copied)
} else if buf.len() - bytes_copied < 4 {
// Not enough space to get a UTF-8 byte. We will use the incomplete UTF8.
let mut utf16_buf = [MaybeUninit::new(0); 1];
let mut utf16_buf = [MaybeUninit::new(0); 2];
// Read one u16 character.
let read = read_u16s_fixup_surrogates(handle, &mut utf16_buf, 1, &mut self.surrogate)?;
// Read bytes, using the (now-empty) self.incomplete_utf8 as extra space.
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/mk/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ prepare:
SKIP_COMPILER := --skip=compiler
SKIP_SRC := --skip=src
TEST_SET1 := $(SKIP_COMPILER) $(SKIP_SRC)
TEST_SET2 := --skip=tests --skip=coverage-map --skip=coverage-run --skip=library --skip=tidyselftest
TEST_SET2 := --skip=tests --skip=library --skip=tidyselftest

## MSVC native builders

Expand Down
13 changes: 6 additions & 7 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1975,6 +1975,12 @@ impl Step for Coverage {
for mode in Self::ALL_MODES {
run = run.alias(mode.as_str());
}

// Allow `./x test --skip=tests` to properly skip the coverage tests,
// by not treating the `coverage-map` and `coverage-run` aliases as
// implied command-line arguments.
run = run.default_to_suites_only();

run
}

Expand Down Expand Up @@ -2016,13 +2022,6 @@ impl Step for Coverage {
!run.builder.config.skip.iter().any(|skip| skip == Path::new(mode.as_str()))
});

// FIXME(Zalathar): Make these commands skip all coverage tests, as expected:
// - `./x test --skip=tests`
// - `./x test --skip=tests/coverage`
// - `./x test --skip=coverage`
// Skip handling currently doesn't have a way to know that skipping the coverage
// suite should also skip the `coverage-map` and `coverage-run` aliases.

for mode in modes {
run.builder.ensure(Coverage { compiler, target, mode });
}
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/src/core/builder/cli_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ pub(crate) fn match_paths_to_steps_and_run(
if paths.is_empty() || builder.config.include_default_paths {
for StepExtra { desc, should_run } in &steps {
if (desc.is_default_step_fn)(builder) {
desc.maybe_run(builder, should_run.paths.iter().cloned().collect());
let default_pathsets = should_run.default_pathsets();
desc.maybe_run(builder, default_pathsets);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ expression: test
- Suite(test::tests/crashes)
[Test] test::Coverage
targets: [aarch64-unknown-linux-gnu]
- Set({test::coverage-map})
- Set({test::coverage-run})
- Suite(test::tests/coverage)
[Test] test::MirOpt
targets: [aarch64-unknown-linux-gnu]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ expression: test --skip=coverage
[Test] test::Crashes
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/crashes)
[Test] test::Coverage
targets: [aarch64-unknown-linux-gnu]
- Set({test::coverage-map})
- Set({test::coverage-run})
[Test] test::MirOpt
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/mir-opt)
Expand Down
Loading
Loading