mirror of
https://github.com/rust-lang/rust.git
synced 2026-02-15 01:14:05 +00:00
Rollup merge of #59462 - taiki-e:no-core, r=petrochenkov
Fix error in Rust 2018 + no_core environment Minimized reproduction: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=5b9f6c3026ec9d856699fa6dbd4361f0 This is a fix for the error that occurred in #58702. r? @Centril
This commit is contained in:
commit
647d09fced
@ -1697,7 +1697,12 @@ impl<'a> hir::lowering::Resolver for Resolver<'a> {
|
||||
components: &[&str],
|
||||
is_value: bool
|
||||
) -> hir::Path {
|
||||
let segments = iter::once(keywords::PathRoot.ident())
|
||||
let root = if crate_root.is_some() {
|
||||
keywords::PathRoot
|
||||
} else {
|
||||
keywords::Crate
|
||||
};
|
||||
let segments = iter::once(root.ident())
|
||||
.chain(
|
||||
crate_root.into_iter()
|
||||
.chain(components.iter().cloned())
|
||||
|
||||
18
src/test/run-pass/no-core-2.rs
Normal file
18
src/test/run-pass/no-core-2.rs
Normal file
@ -0,0 +1,18 @@
|
||||
#![allow(dead_code, unused_imports)]
|
||||
#![feature(no_core)]
|
||||
#![no_core]
|
||||
// edition:2018
|
||||
|
||||
extern crate std;
|
||||
extern crate core;
|
||||
use core::{prelude::v1::*, *};
|
||||
|
||||
fn foo() {
|
||||
for _ in &[()] {}
|
||||
}
|
||||
|
||||
fn bar() -> Option<()> {
|
||||
None?
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
Loading…
x
Reference in New Issue
Block a user