Skip to content

Rollup of 9 pull requests #138853

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

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
28bd22c
rustdoc: Gate unstable `doc(cfg())` predicates
clubby789 Mar 9, 2025
85b1116
rustdoc: Add FIXME test for `doc_cfg` interaction with `check_cfg`
clubby789 Mar 10, 2025
aa2c24b
uefi: Add OwnedEvent abstraction
Ayush1325 Mar 8, 2025
bcac931
Update test for SGX now implementing read_buf
thaliaarchi Mar 18, 2025
526a689
std: fs: uefi: Implement canonicalize
Ayush1325 Mar 18, 2025
456eedc
std: fs: uefi: Make lstat call stat
Ayush1325 Mar 18, 2025
80229a2
std: fs: uefi: Implement OpenOptions
Ayush1325 Mar 18, 2025
ec487bf
Test that `supported-crate-types` is `-Zunstable-options`-gated
jieyouxu Mar 18, 2025
83d3197
Add smoke test for `supported-crate-types` print request
jieyouxu Mar 18, 2025
e8cf087
Implement `supported-crate-types` print request
jieyouxu Mar 18, 2025
aafcdda
Document `supported-crate-types` print request in unstable book
jieyouxu Mar 18, 2025
675bfeb
Rebless tests with changed help due to new print request option
jieyouxu Mar 18, 2025
405d1c4
Adjust `rustc-print-info-issue-138612.rs`
jieyouxu Mar 21, 2025
b523301
Add test to ensure no index out of bounds panic (#135474)
reddevilmidzy Mar 14, 2025
c25e4bf
resolve: Avoid some unstable iteration 3
petrochenkov Mar 22, 2025
fa0c951
doc: rename reference #create-a-configtoml to #create-a-bootstraptoml
chiichen Mar 23, 2025
5950c86
Slim `rustc_parse_format` dependencies down
Veykril Mar 17, 2025
0b0773d
Rollup merge of #138236 - Ayush1325:uefi-event, r=petrochenkov
jieyouxu Mar 23, 2025
0631764
Rollup merge of #138293 - clubby789:doc-cfg-gate, r=GuillaumeGomez
jieyouxu Mar 23, 2025
21d89ff
Rollup merge of #138509 - reddevilmidzy:add-test, r=compiler-errors
jieyouxu Mar 23, 2025
16447db
Rollup merge of #138602 - Veykril:push-purxoytpktpu, r=SparrowLii
jieyouxu Mar 23, 2025
34892c1
Rollup merge of #138631 - thaliaarchi:sgx-read-buf-test, r=workingjub…
jieyouxu Mar 23, 2025
51e1840
Rollup merge of #138641 - jieyouxu:print-supported-crate-types, r=Urgau
jieyouxu Mar 23, 2025
22f8caa
Rollup merge of #138662 - Ayush1325:uefi-fs-1, r=nicholasbishop,petro…
jieyouxu Mar 23, 2025
7b54a2f
Rollup merge of #138837 - petrochenkov:resinstab2, r=jieyouxu
jieyouxu Mar 23, 2025
5c17679
Rollup merge of #138849 - chiichen:dev/master/doc-correct-configtoml,…
jieyouxu Mar 23, 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
4 changes: 2 additions & 2 deletions bootstrap.example.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Sample TOML configuration file for building Rust.
#
# To configure bootstrap, run `./configure` or `./x.py setup`.
# See https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html#create-a-configtoml for more information.
# See https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html#create-a-bootstraptoml for more information.
#
# All options are commented out by default in this file, and they're commented
# out with their default values. The build system by default looks for
Expand Down Expand Up @@ -446,7 +446,7 @@
# a specific version.
#ccache = false

# List of paths to exclude from the build and test processes.
# List of paths to exclude from the build and test processes.
# For example, exclude = ["tests/ui", "src/tools/tidy"].
#exclude = []

Expand Down
14 changes: 12 additions & 2 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// tidy-alphabetical-end

use std::cmp::max;
use std::collections::BTreeMap;
use std::collections::{BTreeMap, BTreeSet};
use std::ffi::OsString;
use std::fmt::Write as _;
use std::fs::{self, File};
Expand Down Expand Up @@ -61,7 +61,7 @@ use rustc_session::config::{
};
use rustc_session::getopts::{self, Matches};
use rustc_session::lint::{Lint, LintId};
use rustc_session::output::collect_crate_types;
use rustc_session::output::{CRATE_TYPES, collect_crate_types, invalid_output_for_target};
use rustc_session::{EarlyDiagCtxt, Session, config, filesearch};
use rustc_span::FileName;
use rustc_target::json::ToJson;
Expand Down Expand Up @@ -790,6 +790,16 @@ fn print_crate_info(
sess.dcx().fatal("only Apple targets currently support deployment version info")
}
}
SupportedCrateTypes => {
let supported_crate_types = CRATE_TYPES
.iter()
.filter(|(_, crate_type)| !invalid_output_for_target(&sess, *crate_type))
.map(|(crate_type_sym, _)| *crate_type_sym)
.collect::<BTreeSet<_>>();
for supported_crate_type in supported_crate_types {
println_info!("{}", supported_crate_type.as_str());
}
}
}

req.out.overwrite(&crate_info, sess);
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_parse_format/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ edition = "2024"
rustc_lexer = { path = "../rustc_lexer" }
# tidy-alphabetical-end

[target.'cfg(target_pointer_width = "64")'.dependencies]
[target.'cfg(target_pointer_width = "64")'.dev-dependencies]
# tidy-alphabetical-start
rustc_index = { path = "../rustc_index", default-features = false }
# tidy-alphabetical-end
2 changes: 1 addition & 1 deletion compiler/rustc_parse_format/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ fn unescape_string(string: &str) -> Option<String> {
}

// Assert a reasonable size for `Piece`
#[cfg(target_pointer_width = "64")]
#[cfg(all(test, target_pointer_width = "64"))]
rustc_index::static_assert_size!(Piece<'_>, 16);

#[cfg(test)]
Expand Down
13 changes: 6 additions & 7 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ impl RibKind<'_> {
/// resolving, the name is looked up from inside out.
#[derive(Debug)]
pub(crate) struct Rib<'ra, R = Res> {
pub bindings: FxHashMap<Ident, R>,
pub bindings: FxIndexMap<Ident, R>,
pub patterns_with_skipped_bindings: UnordMap<DefId, Vec<(Span, Result<(), ErrorGuaranteed>)>>,
pub kind: RibKind<'ra>,
}
Expand Down Expand Up @@ -1642,8 +1642,8 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {

// Allow all following defaults to refer to this type parameter.
let i = &Ident::with_dummy_span(param.ident.name);
forward_ty_ban_rib.bindings.remove(i);
forward_ty_ban_rib_const_param_ty.bindings.remove(i);
forward_ty_ban_rib.bindings.swap_remove(i);
forward_ty_ban_rib_const_param_ty.bindings.swap_remove(i);
}
GenericParamKind::Const { ref ty, kw_span: _, ref default } => {
// Const parameters can't have param bounds.
Expand Down Expand Up @@ -1678,8 +1678,8 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {

// Allow all following defaults to refer to this const parameter.
let i = &Ident::with_dummy_span(param.ident.name);
forward_const_ban_rib.bindings.remove(i);
forward_const_ban_rib_const_param_ty.bindings.remove(i);
forward_const_ban_rib.bindings.swap_remove(i);
forward_const_ban_rib_const_param_ty.bindings.swap_remove(i);
}
}
}
Expand Down Expand Up @@ -2888,7 +2888,6 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
break;
}

#[allow(rustc::potential_query_instability)] // FIXME
seen_bindings
.extend(parent_rib.bindings.keys().map(|ident| (*ident, ident.span)));
}
Expand Down Expand Up @@ -4003,7 +4002,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
}
}

fn innermost_rib_bindings(&mut self, ns: Namespace) -> &mut FxHashMap<Ident, Res> {
fn innermost_rib_bindings(&mut self, ns: Namespace) -> &mut FxIndexMap<Ident, Res> {
&mut self.ribs[ns].last_mut().unwrap().bindings
}

Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
if let Some(rib) = &self.last_block_rib
&& let RibKind::Normal = rib.kind
{
#[allow(rustc::potential_query_instability)] // FIXME
for (ident, &res) in &rib.bindings {
if let Res::Local(_) = res
&& path.len() == 1
Expand Down Expand Up @@ -1019,7 +1018,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
if let Some(err_code) = err.code {
if err_code == E0425 {
for label_rib in &self.label_ribs {
#[allow(rustc::potential_query_instability)] // FIXME
for (label_ident, node_id) in &label_rib.bindings {
let ident = path.last().unwrap().ident;
if format!("'{ident}") == label_ident.to_string() {
Expand Down Expand Up @@ -2265,7 +2263,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
};

// Locals and type parameters
#[allow(rustc::potential_query_instability)] // FIXME
for (ident, &res) in &rib.bindings {
if filter_fn(res) && ident.span.ctxt() == rib_ctxt {
names.push(TypoSuggestion::typo_from_ident(*ident, res));
Expand Down Expand Up @@ -2793,7 +2790,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
let within_scope = self.is_label_valid_from_rib(rib_index);

let rib = &self.label_ribs[rib_index];
#[allow(rustc::potential_query_instability)] // FIXME
let names = rib
.bindings
.iter()
Expand All @@ -2805,7 +2801,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
// Upon finding a similar name, get the ident that it was from - the span
// contained within helps make a useful diagnostic. In addition, determine
// whether this candidate is within scope.
#[allow(rustc::potential_query_instability)] // FIXME
let (ident, _) = rib.bindings.iter().find(|(ident, _)| ident.name == symbol).unwrap();
(*ident, within_scope)
})
Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub const PRINT_KINDS: &[(&str, PrintKind)] = &[
("relocation-models", PrintKind::RelocationModels),
("split-debuginfo", PrintKind::SplitDebuginfo),
("stack-protector-strategies", PrintKind::StackProtectorStrategies),
("supported-crate-types", PrintKind::SupportedCrateTypes),
("sysroot", PrintKind::Sysroot),
("target-cpus", PrintKind::TargetCPUs),
("target-features", PrintKind::TargetFeatures),
Expand Down Expand Up @@ -888,6 +889,7 @@ pub enum PrintKind {
RelocationModels,
SplitDebuginfo,
StackProtectorStrategies,
SupportedCrateTypes,
Sysroot,
TargetCPUs,
TargetFeatures,
Expand Down Expand Up @@ -2063,7 +2065,10 @@ fn check_print_request_stability(
(print_name, print_kind): (&str, PrintKind),
) {
match print_kind {
PrintKind::AllTargetSpecsJson | PrintKind::CheckCfg | PrintKind::TargetSpecJson
PrintKind::AllTargetSpecsJson
| PrintKind::CheckCfg
| PrintKind::SupportedCrateTypes
| PrintKind::TargetSpecJson
if !unstable_opts.unstable_options =>
{
early_dcx.early_fatal(format!(
Expand Down
8 changes: 2 additions & 6 deletions library/std/src/net/tcp/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,8 @@ fn read_buf() {
let mut buf = BorrowedBuf::from(buf.as_mut_slice());
t!(s.read_buf(buf.unfilled()));
assert_eq!(buf.filled(), &[1, 2, 3, 4]);

// FIXME: sgx uses default_read_buf that initializes the buffer.
if cfg!(not(target_env = "sgx")) {
// TcpStream::read_buf should omit buffer initialization.
assert_eq!(buf.init_len(), 4);
}
// TcpStream::read_buf should omit buffer initialization.
assert_eq!(buf.init_len(), 4);

t.join().ok().expect("thread panicked");
})
Expand Down
73 changes: 61 additions & 12 deletions library/std/src/sys/fs/uefi.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use r_efi::protocols::file;

use crate::ffi::OsString;
use crate::fmt;
use crate::hash::Hash;
Expand All @@ -22,7 +24,12 @@ pub struct ReadDir(!);
pub struct DirEntry(!);

#[derive(Clone, Debug)]
pub struct OpenOptions {}
pub struct OpenOptions {
mode: u64,
append: bool,
truncate: bool,
create_new: bool,
}

#[derive(Copy, Clone, Debug, Default)]
pub struct FileTimes {}
Expand Down Expand Up @@ -141,15 +148,57 @@ impl DirEntry {

impl OpenOptions {
pub fn new() -> OpenOptions {
OpenOptions {}
OpenOptions { mode: 0, append: false, create_new: false, truncate: false }
}

pub fn read(&mut self, read: bool) {
if read {
self.mode |= file::MODE_READ;
} else {
self.mode &= !file::MODE_READ;
}
}

pub fn write(&mut self, write: bool) {
if write {
// Valid Combinations: Read, Read/Write, Read/Write/Create
self.read(true);
self.mode |= file::MODE_WRITE;
} else {
self.mode &= !file::MODE_WRITE;
}
}

pub fn append(&mut self, append: bool) {
// Docs state that `.write(true).append(true)` has the same effect as `.append(true)`
if append {
self.write(true);
}
self.append = append;
}

pub fn read(&mut self, _read: bool) {}
pub fn write(&mut self, _write: bool) {}
pub fn append(&mut self, _append: bool) {}
pub fn truncate(&mut self, _truncate: bool) {}
pub fn create(&mut self, _create: bool) {}
pub fn create_new(&mut self, _create_new: bool) {}
pub fn truncate(&mut self, truncate: bool) {
self.truncate = truncate;
}

pub fn create(&mut self, create: bool) {
if create {
self.mode |= file::MODE_CREATE;
} else {
self.mode &= !file::MODE_CREATE;
}
}

pub fn create_new(&mut self, create_new: bool) {
self.create_new = create_new;
}

const fn is_mode_valid(&self) -> bool {
// Valid Combinations: Read, Read/Write, Read/Write/Create
self.mode == file::MODE_READ
|| self.mode == (file::MODE_READ | file::MODE_WRITE)
|| self.mode == (file::MODE_READ | file::MODE_WRITE | file::MODE_CREATE)
}
}

impl File {
Expand Down Expand Up @@ -311,12 +360,12 @@ pub fn stat(_p: &Path) -> io::Result<FileAttr> {
unsupported()
}

pub fn lstat(_p: &Path) -> io::Result<FileAttr> {
unsupported()
pub fn lstat(p: &Path) -> io::Result<FileAttr> {
stat(p)
}

pub fn canonicalize(_p: &Path) -> io::Result<PathBuf> {
unsupported()
pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
crate::path::absolute(p)
}

pub fn copy(_from: &Path, _to: &Path) -> io::Result<u64> {
Expand Down
Loading
Loading